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

Function main

sqlmapapi.py:82–114  ·  view source on GitHub ↗

REST-JSON API main function

()

Source from the content-addressed store, hash-verified

80 return getUnicode(os.path.dirname(os.path.realpath(__file__)), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)
81
82def main():
83 """
84 REST-JSON API main function
85 """
86
87 dirtyPatches()
88 resolveCrossReferences()
89
90 # Set default logging level to debug
91 logger.setLevel(logging.DEBUG)
92
93 # Initialize paths
94 setPaths(modulePath())
95
96 # Parse command line options
97 apiparser = ArgumentParser()
98 apiparser.add_argument("-s", "--server", help="Run as a REST-JSON API server", action="store_true")
99 apiparser.add_argument("-c", "--client", help="Run as a REST-JSON API client", action="store_true")
100 apiparser.add_argument("-H", "--host", help="Host of the REST-JSON API server (default \"%s\")" % RESTAPI_DEFAULT_ADDRESS, default=RESTAPI_DEFAULT_ADDRESS)
101 apiparser.add_argument("-p", "--port", help="Port of the REST-JSON API server (default %d)" % RESTAPI_DEFAULT_PORT, default=RESTAPI_DEFAULT_PORT, type=int)
102 apiparser.add_argument("--adapter", help="Server (bottle) adapter to use (default \"%s\")" % RESTAPI_DEFAULT_ADAPTER, default=RESTAPI_DEFAULT_ADAPTER)
103 apiparser.add_argument("--database", help="Set IPC database filepath (optional)")
104 apiparser.add_argument("--username", help="Basic authentication username (optional)")
105 apiparser.add_argument("--password", help="Basic authentication password (optional)")
106 (args, _) = apiparser.parse_known_args() if hasattr(apiparser, "parse_known_args") else apiparser.parse_args()
107
108 # Start the client or the server
109 if args.server:
110 server(args.host, args.port, adapter=args.adapter, username=args.username, password=args.password, database=args.database)
111 elif args.client:
112 client(args.host, args.port, username=args.username, password=args.password)
113 else:
114 apiparser.print_help()
115
116if __name__ == "__main__":
117 main()

Callers 1

sqlmapapi.pyFile · 0.70

Calls 6

dirtyPatchesFunction · 0.90
resolveCrossReferencesFunction · 0.90
setPathsFunction · 0.90
modulePathFunction · 0.90
serverFunction · 0.90
clientFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…