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

Function main

sqlmap.py:141–618  ·  view source on GitHub ↗

Main function of sqlmap when running from command line.

()

Source from the content-addressed store, hash-verified

139 globals()[_] = getattr(sys.modules["lib.core.exception"], _)
140
141def main():
142 """
143 Main function of sqlmap when running from command line.
144 """
145
146 try:
147 dirtyPatches()
148 resolveCrossReferences()
149 checkEnvironment()
150 setPaths(modulePath())
151 banner()
152
153 # Store original command line options for possible later restoration
154 args = cmdLineParser()
155 cmdLineOptions.update(args.__dict__ if hasattr(args, "__dict__") else args)
156 initOptions(cmdLineOptions)
157
158 if checkPipedInput():
159 conf.batch = True
160
161 if conf.get("api"):
162 # heavy imports
163 from lib.utils.api import StdDbOut
164 from lib.utils.api import setRestAPILog
165
166 # Overwrite system standard output and standard error to write
167 # to an IPC database
168 sys.stdout = StdDbOut(conf.taskid, messagetype="stdout")
169 sys.stderr = StdDbOut(conf.taskid, messagetype="stderr")
170
171 setRestAPILog()
172
173 conf.showTime = True
174 dataToStdout("[!] legal disclaimer: %s\n\n" % LEGAL_DISCLAIMER, forceOutput=True)
175 dataToStdout("[*] starting @ %s\n\n" % time.strftime("%X /%Y-%m-%d/"), forceOutput=True)
176
177 init()
178
179 if not conf.updateAll:
180 # Postponed imports (faster start)
181 if conf.smokeTest:
182 from lib.core.testing import smokeTest
183 os._exitcode = 1 - (smokeTest() or 0)
184 elif conf.vulnTest:
185 from lib.core.testing import vulnTest
186 os._exitcode = 1 - (vulnTest() or 0)
187 else:
188 from lib.controller.controller import start
189 if conf.profile:
190 from lib.core.profiling import profile
191 globals()["start"] = start
192 profile()
193 else:
194 try:
195 if conf.crawlDepth and conf.bulkFile:
196 targets = getFileItems(conf.bulkFile)
197
198 for i in xrange(len(targets)):

Callers 1

sqlmap.pyFile · 0.70

Calls 15

dirtyPatchesFunction · 0.90
resolveCrossReferencesFunction · 0.90
setPathsFunction · 0.90
bannerFunction · 0.90
cmdLineParserFunction · 0.90
initOptionsFunction · 0.90
checkPipedInputFunction · 0.90
StdDbOutClass · 0.90
setRestAPILogFunction · 0.90
dataToStdoutFunction · 0.90
initFunction · 0.90
smokeTestFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…