MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / udfSetLocalPaths

Method udfSetLocalPaths

plugins/dbms/postgresql/takeover.py:46–78  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44 self.udfRemoteFile = "/tmp/%s.%s" % (self.udfSharedLibName, self.udfSharedLibExt)
45
46 def udfSetLocalPaths(self):
47 self.udfLocalFile = paths.SQLMAP_UDF_PATH
48 self.udfSharedLibName = "libs%s" % randomStr(lowercase=True)
49
50 self.getVersionFromBanner()
51
52 banVer = kb.bannerFp["dbmsVersion"]
53
54 if not banVer or not banVer[0].isdigit():
55 errMsg = "unsupported feature on unknown version of PostgreSQL"
56 raise SqlmapUnsupportedFeatureException(errMsg)
57 elif LooseVersion(banVer) >= LooseVersion("10"):
58 majorVer = banVer.split('.')[0]
59 elif LooseVersion(banVer) >= LooseVersion("8.2") and '.' in banVer:
60 majorVer = '.'.join(banVer.split('.')[:2])
61 else:
62 errMsg = "unsupported feature on versions of PostgreSQL before 8.2"
63 raise SqlmapUnsupportedFeatureException(errMsg)
64
65 try:
66 if Backend.isOs(OS.WINDOWS):
67 _ = os.path.join(self.udfLocalFile, "postgresql", "windows", "%d" % Backend.getArch(), majorVer, "lib_postgresqludf_sys.dll_")
68 checkFile(_)
69 self.udfLocalFile = decloakToTemp(_)
70 self.udfSharedLibExt = "dll"
71 else:
72 _ = os.path.join(self.udfLocalFile, "postgresql", "linux", "%d" % Backend.getArch(), majorVer, "lib_postgresqludf_sys.so_")
73 checkFile(_)
74 self.udfLocalFile = decloakToTemp(_)
75 self.udfSharedLibExt = "so"
76 except SqlmapSystemException:
77 errMsg = "unsupported feature on PostgreSQL %s (%s-bit)" % (majorVer, Backend.getArch())
78 raise SqlmapUnsupportedFeatureException(errMsg)
79
80 def udfCreateFromSharedLib(self, udf, inpRet):
81 if udf in self.udfToCreate:

Callers

nothing calls this directly

Calls 8

randomStrFunction · 0.90
LooseVersionFunction · 0.90
checkFileFunction · 0.90
decloakToTempFunction · 0.90
getVersionFromBannerMethod · 0.80
isOsMethod · 0.80
getArchMethod · 0.80

Tested by

no test coverage detected