@@ -48,41 +48,21 @@ def __init__(self):
48
48
49
49
50
50
def __unbase64String (self , base64Str ):
51
- unbase64Str = ""
52
-
53
- if isinstance (base64Str , (list , tuple , set )):
54
- for chunk in base64Str :
55
- if isinstance (chunk , (list , tuple , set )):
56
- chunk = chunk [0 ]
57
-
58
- unbase64Str += "%s\n " % chunk .decode ("base64" )
59
- else :
60
- unbase64Str = "%s\n " % base64Str .decode ("base64" )
51
+ unbase64Str = "%s\n " % base64Str .decode ("base64" )
61
52
62
53
return unbase64Str
63
54
64
55
65
56
def __unhexString (self , hexStr ):
66
- unhexStr = ""
67
-
68
- if ( len (hexStr ) % 2 ) != 0 :
57
+ if len (hexStr ) % 2 != 0 :
69
58
errMsg = "for some reasons sqlmap retrieved an odd-length "
70
59
errMsg += "hexadecimal string which it is not able to convert "
71
60
errMsg += "to raw string"
72
61
logger .error (errMsg )
73
62
74
63
return hexStr
75
64
76
- if isinstance (hexStr , (list , tuple , set )):
77
- for chunk in hexStr :
78
- if isinstance (chunk , (list , tuple , set )):
79
- chunk = chunk [0 ]
80
-
81
- unhexStr += binascii .unhexlify (chunk )
82
- else :
83
- unhexStr = binascii .unhexlify (hexStr )
84
-
85
- return unhexStr
65
+ return binascii .unhexlify (hexStr )
86
66
87
67
88
68
def __binDataToScr (self , binaryData , chunkName ):
@@ -301,10 +281,20 @@ def readFile(self, rFile):
301
281
302
282
fileContent = self .stackedReadFile (rFile )
303
283
304
- if fileContent == None :
284
+ if fileContent in ( None , "" ) :
305
285
self .cleanup (onlyFileTbl = True )
306
286
307
287
return
288
+ elif isinstance (fileContent , (list , tuple , set )):
289
+ newFileContent = ""
290
+
291
+ for chunk in fileContent :
292
+ if isinstance (chunk , (list , tuple , set )):
293
+ chunk = chunk [0 ]
294
+
295
+ newFileContent += chunk
296
+
297
+ fileContent = newFileContent
308
298
309
299
if kb .dbms in ( "MySQL" , "Microsoft SQL Server" ):
310
300
fileContent = self .__unhexString (fileContent )
0 commit comments