예제 #1
0
def main():
    # configure logging
    loglevel = getattr(logging, LOGLEVEL.upper())
    logging.basicConfig(format='%(levelname)s %(message)s', level=loglevel)
    logging.addLevelName(logging.INFO, '[-]')
    logging.addLevelName(logging.WARN, '[*]')
    logging.addLevelName(logging.ERROR, '[!]')
    # configure debug logging for requests
    if loglevel == logging.DEBUG:
        # debug HTTP requests
        import http.client as http_client
        http_client.HTTPConnection.debuglevel = 1
        # initialize logging, otherwise you'll not see debug output
        requests_log = logging.getLogger("requests.packages.urllib3")
        requests_log.setLevel(loglevel)
        requests_log.propagate = True
    i = Injector()
    try:
        i.set_attack(ATTACKS, ATTACK, PAYLOADS)
        i.condition = condition
        i.success = success
        i.exploit(URL, PARAMS, DATA, HEADERS)
    except InjectorException as e:
        logging.error(e)
    except KeyboardInterrupt:
        pass