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

Function action

lib/controller/action.py:23–247  ·  view source on GitHub ↗

This function exploit the SQL injection on the affected URL parameter and extract requested data from the back-end database management system or operating system if possible

()

Source from the content-addressed store, hash-verified

21from lib.utils.brute import tableExists
22
23def action():
24 """
25 This function exploit the SQL injection on the affected
26 URL parameter and extract requested data from the
27 back-end database management system or operating system
28 if possible
29 """
30
31 # First of all we have to identify the back-end database management
32 # system to be able to go ahead with the injection
33 setHandler()
34
35 if not Backend.getDbms() or not conf.dbmsHandler:
36 htmlParsed = Format.getErrorParsedDBMSes()
37
38 errMsg = "sqlmap was not able to fingerprint the "
39 errMsg += "back-end database management system"
40
41 if htmlParsed:
42 errMsg += ", but from the HTML error page it was "
43 errMsg += "possible to determinate that the "
44 errMsg += "back-end DBMS is %s" % htmlParsed
45
46 if htmlParsed and htmlParsed.lower() in SUPPORTED_DBMS:
47 errMsg += ". Do not specify the back-end DBMS manually, "
48 errMsg += "sqlmap will fingerprint the DBMS for you"
49 elif kb.nullConnection:
50 errMsg += ". You can try to rerun without using optimization "
51 errMsg += "switch '%s'" % ("-o" if conf.optimize else "--null-connection")
52
53 raise SqlmapUnsupportedDBMSException(errMsg)
54
55 conf.dumper.singleString(conf.dbmsHandler.getFingerprint())
56
57 kb.fingerprinted = True
58
59 # Enumeration options
60 if conf.getBanner:
61 conf.dumper.banner(conf.dbmsHandler.getBanner())
62
63 if conf.getCurrentUser:
64 conf.dumper.currentUser(conf.dbmsHandler.getCurrentUser())
65
66 if conf.getCurrentDb:
67 conf.dumper.currentDb(conf.dbmsHandler.getCurrentDb())
68
69 if conf.getHostname:
70 conf.dumper.hostname(conf.dbmsHandler.getHostname())
71
72 if conf.isDba:
73 conf.dumper.dba(conf.dbmsHandler.isDba())
74
75 if conf.getUsers:
76 conf.dumper.users(conf.dbmsHandler.getUsers())
77
78 if conf.getStatements:
79 conf.dumper.statements(conf.dbmsHandler.getStatements())
80

Callers 1

startFunction · 0.90

Calls 15

setHandlerFunction · 0.90
tableExistsFunction · 0.90
columnExistsFunction · 0.90
fileExistsFunction · 0.90
singleStringMethod · 0.80
bannerMethod · 0.80
currentUserMethod · 0.80
currentDbMethod · 0.80
hostnameMethod · 0.80
dbaMethod · 0.80
usersMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…