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

Function cmdLineParser

lib/parse/cmdline.py:97–1144  ·  view source on GitHub ↗

This function parses the command line parameters and arguments

(argv=None)

Source from the content-addressed store, hash-verified

95from thirdparty.six.moves import input as _input
96
97def cmdLineParser(argv=None):
98 """
99 This function parses the command line parameters and arguments
100 """
101
102 if not argv:
103 argv = sys.argv
104
105 checkSystemEncoding()
106
107 # Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING")
108 _ = getUnicode(os.path.basename(argv[0]), encoding=sys.stdin.encoding)
109
110 usage = "%s%s [options]" % ("%s " % os.path.basename(sys.executable) if not IS_WIN else "", "\"%s\"" % _ if " " in _ else _)
111 parser = ArgumentParser(usage=usage)
112
113 try:
114 parser.add_argument("--hh", dest="advancedHelp", action="store_true",
115 help="Show advanced help message and exit")
116
117 parser.add_argument("--version", dest="showVersion", action="store_true",
118 help="Show program's version number and exit")
119
120 parser.add_argument("-v", dest="verbose", type=int,
121 help="Verbosity level: 0-6 (default %d)" % defaults.verbose)
122
123 # Target options
124 target = parser.add_argument_group("Target", "At least one of these options has to be provided to define the target(s)")
125
126 target.add_argument("-u", "--url", dest="url",
127 help="Target URL (e.g. \"http://www.site.com/vuln.php?id=1\")")
128
129 target.add_argument("-d", dest="direct",
130 help="Connection string for direct database connection")
131
132 target.add_argument("-l", dest="logFile",
133 help="Parse target(s) from Burp or WebScarab proxy log file")
134
135 target.add_argument("-m", dest="bulkFile",
136 help="Scan multiple targets given in a textual file ")
137
138 target.add_argument("-r", dest="requestFile",
139 help="Load HTTP request from a file")
140
141 target.add_argument("-g", dest="googleDork",
142 help="Process Google dork results as target URLs")
143
144 target.add_argument("-c", dest="configFile",
145 help="Load options from a configuration INI file")
146
147 # Request options
148 request = parser.add_argument_group("Request", "These options can be used to specify how to connect to the target URL")
149
150 request.add_argument("-A", "--user-agent", dest="agent",
151 help="HTTP User-Agent header value")
152
153 request.add_argument("-H", "--header", dest="header",
154 help="Extra header (e.g. \"X-Forwarded-For: 127.0.0.1\")")

Callers 2

mainFunction · 0.90
clientFunction · 0.90

Calls 15

checkSystemEncodingFunction · 0.90
getUnicodeFunction · 0.90
checkOldOptionsFunction · 0.90
runGuiFunction · 0.90
runTuiFunction · 0.90
_createHomeDirectoriesFunction · 0.90
autoCompletionFunction · 0.90
clearHistoryFunction · 0.90
dataToStdoutFunction · 0.90
saveHistoryFunction · 0.90
loadHistoryFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…