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

Method udfSetRemotePath

plugins/dbms/mysql/takeover.py:36–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

34 GenericTakeover.__init__(self)
35
36 def udfSetRemotePath(self):
37 self.getVersionFromBanner()
38
39 banVer = kb.bannerFp["dbmsVersion"]
40
41 if banVer and LooseVersion(banVer) >= LooseVersion("5.0.67"):
42 if self.__plugindir is None:
43 logger.info("retrieving MySQL plugin directory absolute path")
44 self.__plugindir = unArrayizeValue(inject.getValue("SELECT @@plugin_dir"))
45
46 # On MySQL 5.1 >= 5.1.19 and on any version of MySQL 6.0
47 if self.__plugindir is None and LooseVersion(banVer) >= LooseVersion("5.1.19"):
48 logger.info("retrieving MySQL base directory absolute path")
49
50 # Reference: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_basedir
51 self.__basedir = unArrayizeValue(inject.getValue("SELECT @@basedir"))
52
53 if isWindowsDriveLetterPath(self.__basedir or ""):
54 Backend.setOs(OS.WINDOWS)
55 else:
56 Backend.setOs(OS.LINUX)
57
58 # The DLL must be in C:\Program Files\MySQL\MySQL Server 5.1\lib\plugin
59 if Backend.isOs(OS.WINDOWS):
60 self.__plugindir = "%s/lib/plugin" % self.__basedir
61 else:
62 self.__plugindir = "%s/lib/mysql/plugin" % self.__basedir
63
64 self.__plugindir = ntToPosixSlashes(normalizePath(self.__plugindir)) or '.'
65
66 self.udfRemoteFile = "%s/%s.%s" % (self.__plugindir, self.udfSharedLibName, self.udfSharedLibExt)
67
68 # On MySQL 4.1 < 4.1.25 and on MySQL 4.1 >= 4.1.25 with NO plugin_dir set in my.ini configuration file
69 # On MySQL 5.0 < 5.0.67 and on MySQL 5.0 >= 5.0.67 with NO plugin_dir set in my.ini configuration file
70 else:
71 # logger.debug("retrieving MySQL data directory absolute path")
72
73 # Reference: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_datadir
74 # self.__datadir = inject.getValue("SELECT @@datadir")
75
76 # NOTE: specifying the relative path as './udf.dll'
77 # saves in @@datadir on both MySQL 4.1 and MySQL 5.0
78 self.__datadir = '.'
79 self.__datadir = ntToPosixSlashes(normalizePath(self.__datadir))
80
81 # The DLL can be in either C:\WINDOWS, C:\WINDOWS\system,
82 # C:\WINDOWS\system32, @@basedir\bin or @@datadir
83 self.udfRemoteFile = "%s/%s.%s" % (self.__datadir, self.udfSharedLibName, self.udfSharedLibExt)
84
85 def udfSetLocalPaths(self):
86 self.udfLocalFile = paths.SQLMAP_UDF_PATH

Callers

nothing calls this directly

Calls 9

LooseVersionFunction · 0.90
unArrayizeValueFunction · 0.90
isWindowsDriveLetterPathFunction · 0.90
ntToPosixSlashesFunction · 0.90
normalizePathFunction · 0.90
getVersionFromBannerMethod · 0.80
infoMethod · 0.80
setOsMethod · 0.80
isOsMethod · 0.80

Tested by

no test coverage detected