Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the dump file name #5443

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/core/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from lib.utils.safe2bin import safechardecode
from thirdparty import six
from thirdparty.magic import magic
from plugins.generic.entries import G_column_name_list

class Dump(object):
"""
Expand Down Expand Up @@ -449,7 +450,7 @@ def dbTableValues(self, tableValues):

dumpDbPath = tempDir

dumpFileName = conf.dumpFile or os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower())))
dumpFileName = conf.dumpFile or os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s-%s.%s" % (unsafeSQLIdentificatorNaming(table),G_column_name_list[0],conf.dumpFormat.lower())))
if not checkFile(dumpFileName, False):
try:
openFile(dumpFileName, "w+b").close()
Expand All @@ -470,7 +471,7 @@ def dbTableValues(self, tableValues):
if not appendToFile:
count = 1
while True:
candidate = "%s.%d" % (dumpFileName, count)
candidate = "%s-%02d.csv" % (dumpFileName.split('.csv')[0], count)
if not checkFile(candidate, False):
try:
shutil.copyfile(dumpFileName, candidate)
Expand Down
2 changes: 2 additions & 0 deletions plugins/generic/entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
from thirdparty import six
from thirdparty.six.moves import zip as _zip

G_column_name_list=['']
class Entries(object):
"""
This class defines entries' enumeration functionalities for plugins.
Expand Down Expand Up @@ -167,6 +168,7 @@ def dumpTable(self, foundData=None):
infoMsg = "fetching entries"
if conf.col:
infoMsg += " of column(s) '%s'" % colNames
G_column_name_list[0] = colString
infoMsg += " for table '%s'" % unsafeSQLIdentificatorNaming(tbl)
if METADB_SUFFIX not in conf.db:
infoMsg += " in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
Expand Down