x = setup_consoleLogger() x.write('\nLog level test:') x.critical('[!] Console log: Critical {}'.format(logging.CRITICAL)) x.warning('Console log: Warning {}'.format(logging.WARNING)) x.info('console log: Info {}'.format(logging.INFO)) x.debug('Console log: Debug {}'.format(logging.DEBUG)) x.write('\nTaser adapter test:') x.write('[*] write') x.info('info') x.success('success') x.fail('fail') x.status('status') x.warning('warning') x.debug('debug') x.critical('') x.write('\nTaser file handler test:') y = setup_fileLogger(False) y.info('Log to file test, no filename') y.debug('Log to file test, no filename') z = setup_fileLogger('log_test.txt') z.info('Log to file test, no filename') z.debug('Log to file test, no filename') if os.path.exists('log_test.txt'): x.info('Log file creation successful!') os.remove('log_test.txt') else: x.warning('Failed to create log file.')
args.add_argument('-o', dest='outfile', action='store', help='Filename to write results (optional)') args.add_argument('--port', dest="port", type=int, default=False,help="Define request port") args.add_argument('--page', dest="page", type=str, default='/',help="Define request page") args.add_argument('-H','--header', dest="header", type=str, default=False, help="Extract header(s) from response, i.e: Server,X-Powered-By") proxy = args.add_mutually_exclusive_group(required=False) proxy.add_argument('--proxy', dest='proxy', action='append', default=[], help='Proxy requests (IP:Port)') proxy.add_argument('--proxy-file', dest='proxy', default=False, type=lambda x: file_exists(args, x), help='Load proxies from file for rotation') args.add_argument('--proto', dest="protocol", type=str, default=False,help="Define protocol {http,https}") args.add_argument('--resolve', dest='resolve', action='store_true', help='Resolve all DNS names before enumeration') args.add_argument(dest='target', nargs='+', help='Target') args = args.parse_args() cliLogger = setup_consoleLogger(spacers=[45,30,]) fileLogger = setup_fileLogger(args.outfile, mode='w') cliLogger.info(BANNER) urls = [] tmp_ip = ipparser(args.target[0], resolve=args.resolve, open_ports=True, exit_on_error=False, debug=False) for x in sample(tmp_ip, len(tmp_ip)): proto = [args.protocol] if args.protocol else ['http', 'https'] for p in proto: tmp_x = x[:-1] if x.endswith("/") else x tmp_x = tmp_x+":"+str(args.port) if args.port else tmp_x u = target2url(tmp_x+args.page, protocol=p) urls.append(u) if u not in urls else urls main(args, urls)
args.add_argument('-o', dest='outfile', action='store', help='Output to filename to log results') args.add_argument('--append-output', dest='append', action='store_true', help='Append output file instead of creating new file') args.add_argument(dest='target', nargs='*', help='Target Host(s)/CIDR/nmap xml report') args = args.parse_args() cliLogger = setup_consoleLogger(spacers=[30]) fileLogger = setup_fileLogger(args.outfile, mode='a' if args.append else 'w') cliLogger.info(BANNER) hosts = [] if args.target: for x in args.target: hosts = hosts + ipparser( x.strip(), open_ports=True, exit_on_error=False, debug=False) elif sys.stdin: for x in sys.stdin: x = x.strip() if x: hosts = hosts + ipparser( x, open_ports=True, exit_on_error=False, debug=False) set(hosts)