File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1800,9 +1800,11 @@ def getFileType(filePath):
18001800 """
18011801
18021802 try :
1803- desc = getUnicode ( magic .from_file (filePath ) or "" )
1803+ desc = magic .from_file (filePath ) or magic . MAGIC_UNKNOWN_FILETYPE
18041804 except :
18051805 desc = magic .MAGIC_UNKNOWN_FILETYPE
1806+ finally :
1807+ desc = getText (desc )
18061808
18071809 if desc == magic .MAGIC_UNKNOWN_FILETYPE :
18081810 content = openFile (filePath , "rb" , encoding = None ).read ()
Original file line number Diff line number Diff line change 1818from lib .core .common import dataToDumpFile
1919from lib .core .common import dataToStdout
2020from lib .core .common import getSafeExString
21+ from lib .core .common import getText
2122from lib .core .common import isListLike
2223from lib .core .common import isMultiThreadMode
2324from lib .core .common import normalizeUnicode
@@ -613,8 +614,8 @@ def dbTableValues(self, tableValues):
613614
614615 if len (value ) > MIN_BINARY_DISK_DUMP_SIZE and r'\x' in value :
615616 try :
616- mimetype = magic .from_buffer (value , mime = True )
617- if any (mimetype .startswith (_ ) for _ in (b "application" , b "image" )):
617+ mimetype = getText ( magic .from_buffer (value , mime = True ) )
618+ if any (mimetype .startswith (_ ) for _ in ("application" , "image" )):
618619 if not os .path .isdir (dumpDbPath ):
619620 os .makedirs (dumpDbPath )
620621
Original file line number Diff line number Diff line change 1818from thirdparty import six
1919
2020# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21- VERSION = "1.3.5.58 "
21+ VERSION = "1.3.5.59 "
2222TYPE = "dev" if VERSION .count ('.' ) > 2 and VERSION .split ('.' )[- 1 ] != '0' else "stable"
2323TYPE_COLORS = {"dev" : 33 , "stable" : 90 , "pip" : 34 }
2424VERSION_STRING = "sqlmap/%s#%s" % ('.' .join (VERSION .split ('.' )[:- 1 ]) if VERSION .count ('.' ) > 2 and VERSION .split ('.' )[- 1 ] == '0' else VERSION , TYPE )
Original file line number Diff line number Diff line change @@ -223,4 +223,4 @@ def magic_load(cookie, filename):
223223MAGIC_NO_CHECK_TROFF = 0x040000 # Don't check ascii/troff
224224MAGIC_NO_CHECK_FORTRAN = 0x080000 # Don't check ascii/fortran
225225MAGIC_NO_CHECK_TOKENS = 0x100000 # Don't check ascii/tokens
226- MAGIC_UNKNOWN_FILETYPE = "unknown"
226+ MAGIC_UNKNOWN_FILETYPE = b "unknown"
You can’t perform that action at this time.
0 commit comments