Skip to content

Commit b46851a

Browse files
author
郭睆
committed
Change the dump file name
1 parent 1230e57 commit b46851a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/core/dump.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
from lib.utils.safe2bin import safechardecode
5959
from thirdparty import six
6060
from thirdparty.magic import magic
61+
from plugins.generic.entries import G_column_name_list
6162

6263
class Dump(object):
6364
"""
@@ -449,7 +450,7 @@ def dbTableValues(self, tableValues):
449450

450451
dumpDbPath = tempDir
451452

452-
dumpFileName = conf.dumpFile or os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower())))
453+
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())))
453454
if not checkFile(dumpFileName, False):
454455
try:
455456
openFile(dumpFileName, "w+b").close()
@@ -470,7 +471,7 @@ def dbTableValues(self, tableValues):
470471
if not appendToFile:
471472
count = 1
472473
while True:
473-
candidate = "%s.%d" % (dumpFileName, count)
474+
candidate = "%s-%02d.csv" % (dumpFileName.split('.csv')[0], count)
474475
if not checkFile(candidate, False):
475476
try:
476477
shutil.copyfile(dumpFileName, candidate)

plugins/generic/entries.py

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from thirdparty import six
5353
from thirdparty.six.moves import zip as _zip
5454

55+
G_column_name_list=['']
5556
class Entries(object):
5657
"""
5758
This class defines entries' enumeration functionalities for plugins.
@@ -167,6 +168,7 @@ def dumpTable(self, foundData=None):
167168
infoMsg = "fetching entries"
168169
if conf.col:
169170
infoMsg += " of column(s) '%s'" % colNames
171+
G_column_name_list[0] = colString
170172
infoMsg += " for table '%s'" % unsafeSQLIdentificatorNaming(tbl)
171173
if METADB_SUFFIX not in conf.db:
172174
infoMsg += " in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)

0 commit comments

Comments
 (0)