|
8 | 8 | import os |
9 | 9 |
|
10 | 10 | from lib.core.common import Backend |
| 11 | +from lib.core.common import checkFile |
11 | 12 | from lib.core.common import decloakToTemp |
12 | 13 | from lib.core.common import randomStr |
13 | 14 | from lib.core.data import kb |
14 | 15 | from lib.core.data import logger |
15 | 16 | from lib.core.data import paths |
16 | 17 | from lib.core.enums import OS |
| 18 | +from lib.core.exception import SqlmapSystemException |
17 | 19 | from lib.core.exception import SqlmapUnsupportedFeatureException |
18 | 20 | from lib.request import inject |
19 | 21 | from plugins.generic.takeover import Takeover as GenericTakeover |
@@ -60,14 +62,20 @@ def udfSetLocalPaths(self): |
60 | 62 | errMsg = "unsupported feature on versions of PostgreSQL before 8.2" |
61 | 63 | raise SqlmapUnsupportedFeatureException(errMsg) |
62 | 64 |
|
63 | | - if Backend.isOs(OS.WINDOWS): |
64 | | - _ = os.path.join(self.udfLocalFile, "postgresql", "windows", "%d" % Backend.getArch(), majorVer, "lib_postgresqludf_sys.dll_") |
65 | | - self.udfLocalFile = decloakToTemp(_) |
66 | | - self.udfSharedLibExt = "dll" |
67 | | - else: |
68 | | - _ = os.path.join(self.udfLocalFile, "postgresql", "linux", "%d" % Backend.getArch(), majorVer, "lib_postgresqludf_sys.so_") |
69 | | - self.udfLocalFile = decloakToTemp(_) |
70 | | - self.udfSharedLibExt = "so" |
| 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) |
71 | 79 |
|
72 | 80 | def udfCreateFromSharedLib(self, udf, inpRet): |
73 | 81 | if udf in self.udfToCreate: |
|
0 commit comments