Main function of sqlmap when running from command line.
()
| 139 | globals()[_] = getattr(sys.modules["lib.core.exception"], _) |
| 140 | |
| 141 | def 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)): |
no test coverage detected
searching dependent graphs…