#!/usr/bin/env python"""Copyright (c) 2006-2022 sqlmap developers (https://sqlmap.org/)See the file 'LICENSE' for copying permission"""import syssys.dont_write_bytecode = True__import__("lib.utils.versioncheck") # this has to be the first non-standard importimport loggingimport optparseimport osimport warningswarnings.filterwarnings(action="ignore", category=UserWarning)warnings.filterwarnings(action="ignore", category=DeprecationWarning)from lib.core.common import getUnicodefrom lib.core.common import setPathsfrom lib.core.data import loggerfrom lib.core.patch import dirtyPatchesfrom lib.core.patch import resolveCrossReferencesfrom lib.core.settings import RESTAPI_DEFAULT_ADAPTERfrom lib.core.settings import RESTAPI_DEFAULT_ADDRESSfrom lib.core.settings import RESTAPI_DEFAULT_PORTfrom lib.core.settings import UNICODE_ENCODINGfrom lib.utils.api import clientfrom lib.utils.api import servertry:from sqlmap import modulePathexcept ImportError:def modulePath():return getUnicode(os.path.dirname(os.path.realpath(__file__)), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)def main():"""REST-JSON API main function"""dirtyPatches()resolveCrossReferences()# Set default logging level to debuglogger.setLevel(logging.DEBUG)# Initialize pathssetPaths(modulePath())# Parse command line optionsapiparser = optparse.OptionParser()apiparser.add_option("-s", "--server", help="Run as a REST-JSON API server", action="store_true")apiparser.add_option("-c", "--client", help="Run as a REST-JSON API client", action="store_true")apiparser.add_option("-H", "--host", help="Host of the REST-JSON API server (default \"%s\")" % RESTAPI_DEFAULT_ADDRESS, default=RESTAPI_DEFAULT_ADDRESS, action="store")apiparser.add_option("-p", "--port", help="Port of the the REST-JSON API server (default %d)" % RESTAPI_DEFAULT_PORT, default=RESTAPI_DEFAULT_PORT, type="int", action="store")apiparser.add_option("--adapter", help="Server (bottle) adapter to use (default \"%s\")" % RESTAPI_DEFAULT_ADAPTER, default=RESTAPI_DEFAULT_ADAPTER, action="store")apiparser.add_option("--username", help="Basic authentication username (optional)", action="store")apiparser.add_option("--password", help="Basic authentication password (optional)", action="store")(args, _) = apiparser.parse_args()# Start the client or the serverif args.server:server(args.host, args.port, adapter=args.adapter, username=args.username, password=args.password)elif args.client:client(args.host, args.port, username=args.username, password=args.password)else:apiparser.print_help()if __name__ == "__main__":main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。