@@ -33,22 +33,23 @@ class UPX:
3333
3434 def __initialize (self , srcFile , dstFile = None ):
3535 if PLATFORM == "mac" :
36- self .__upxPath = "%s/upx/macosx/upx " % paths .SQLMAP_CONTRIB_PATH
36+ self .__upxTemp = decloakToMkstemp ( "%s/upx/macosx/upx_ " % paths .SQLMAP_CONTRIB_PATH )
3737
3838 elif PLATFORM in ( "ce" , "nt" ):
39- self .__upxTempExe = decloakToMkstemp ("%s\upx\windows\upx.exe_" % paths .SQLMAP_CONTRIB_PATH , suffix = ".exe" )
40- self .__upxPath = self .__upxTempExe .name
41- self .__upxTempExe .close () #needed for execution rights
39+ self .__upxTemp = decloakToMkstemp ("%s\upx\windows\upx.exe_" % paths .SQLMAP_CONTRIB_PATH , suffix = ".exe" )
4240
4341 elif PLATFORM == "posix" :
44- self .__upxPath = "%s/upx/linux/upx " % paths .SQLMAP_CONTRIB_PATH
42+ self .__upxTemp = decloakToMkstemp ( "%s/upx/linux/upx_ " % paths .SQLMAP_CONTRIB_PATH )
4543
4644 else :
4745 warnMsg = "unsupported platform for the compression tool "
4846 warnMsg += "(upx), sqlmap will continue anyway"
4947 logger .warn (warnMsg )
5048
51- self .__upxPath = "%s/upx/linux/upx" % paths .SQLMAP_CONTRIB_PATH
49+ self .__upxTemp = decloakToMkstemp ("%s/upx/linux/upx_" % paths .SQLMAP_CONTRIB_PATH )
50+
51+ self .__upxPath = self .__upxTemp .name
52+ self .__upxTemp .close () #needed for execution rights
5253
5354 self .__upxCmd = "%s -9 -qq %s" % (self .__upxPath , srcFile )
5455
@@ -65,8 +66,8 @@ def pack(self, srcFile, dstFile=None):
6566 pollProcess (process )
6667 upxStdout , upxStderr = process .communicate ()
6768
68- if hasattr (self , '__upxTempExe ' ):
69- os .remove (self .__upxTempExe .name )
69+ if hasattr (self , '__upxTemp ' ):
70+ os .remove (self .__upxTemp .name )
7071
7172 msg = "failed to compress the file"
7273
0 commit comments