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

Method udfInjectCustom

lib/takeover/udf.py:185–396  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183 return self.udfInjectCore(self.sysUdfs)
184
185 def udfInjectCustom(self):
186 if Backend.getIdentifiedDbms() not in (DBMS.MYSQL, DBMS.PGSQL):
187 errMsg = "UDF injection feature only works on MySQL and PostgreSQL"
188 logger.error(errMsg)
189 return
190
191 if not isStackingAvailable() and not conf.direct:
192 errMsg = "UDF injection feature requires stacked queries SQL injection"
193 logger.error(errMsg)
194 return
195
196 self.checkDbmsOs()
197
198 if not self.isDba():
199 warnMsg = "functionality requested probably does not work because "
200 warnMsg += "the current session user is not a database administrator"
201 logger.warning(warnMsg)
202
203 if not conf.shLib:
204 msg = "what is the local path of the shared library? "
205
206 while True:
207 self.udfLocalFile = readInput(msg, default=None, checkBatch=False)
208
209 if self.udfLocalFile:
210 break
211 else:
212 logger.warning("you need to specify the local path of the shared library")
213 else:
214 self.udfLocalFile = conf.shLib
215
216 if not os.path.exists(self.udfLocalFile):
217 errMsg = "the specified shared library file does not exist"
218 raise SqlmapFilePathException(errMsg)
219
220 if not self.udfLocalFile.endswith(".dll") and not self.udfLocalFile.endswith(".so"):
221 errMsg = "shared library file must end with '.dll' or '.so'"
222 raise SqlmapMissingMandatoryOptionException(errMsg)
223
224 elif self.udfLocalFile.endswith(".so") and Backend.isOs(OS.WINDOWS):
225 errMsg = "you provided a shared object as shared library, but "
226 errMsg += "the database underlying operating system is Windows"
227 raise SqlmapMissingMandatoryOptionException(errMsg)
228
229 elif self.udfLocalFile.endswith(".dll") and Backend.isOs(OS.LINUX):
230 errMsg = "you provided a dynamic-link library as shared library, "
231 errMsg += "but the database underlying operating system is Linux"
232 raise SqlmapMissingMandatoryOptionException(errMsg)
233
234 self.udfSharedLibName = os.path.basename(self.udfLocalFile).split(".")[0]
235 self.udfSharedLibExt = os.path.basename(self.udfLocalFile).split(".")[1]
236
237 msg = "how many user-defined functions do you want to create "
238 msg += "from the shared library? "
239
240 while True:
241 udfCount = readInput(msg, default='1')
242

Callers 1

actionFunction · 0.80

Calls 15

udfInjectCoreMethod · 0.95
udfEvalCmdMethod · 0.95
udfExecCmdMethod · 0.95
isStackingAvailableFunction · 0.90
readInputFunction · 0.90
isDigitFunction · 0.90
dataToStdoutFunction · 0.90
xrangeClass · 0.85
getIdentifiedDbmsMethod · 0.80
isOsMethod · 0.80

Tested by

no test coverage detected