Esempio n. 1
0
def main():
	import argparse

	parser = argparse.ArgumentParser(description='Transparent TCP tunnel for SOCKS unaware clients.')
	parser.add_argument('proxy_connection_string', help='connection string decribing the socks5 proxy server connection properties')
	parser.add_argument('dst_ip', help='IP address of the desination server')
	parser.add_argument('dst_port', type = int, help='port number of the desination service')
	parser.add_argument('-l', '--listen-ip', default = '127.0.0.1',  help='Listener IP address to bind to')
	parser.add_argument('-p', '--listen-port', type = int, default = 11111, help='Listener port number to bind to')
	parser.add_argument('-t', '--timeout', type = int, default = None, help='Endpoint timeout')
	parser.add_argument('-v', '--verbose', action='count', default=0)

	args = parser.parse_args()

	if args.verbose >=1:
		logger.setLevel(logging.DEBUG)
		

	elif args.verbose > 2:
		logger.setLevel(1)

	comms = SocksLitenerComms(args.listen_ip, args.listen_port)

	url = SocksClientURL.from_url(args.proxy_connection_string)
	url.endpoint_ip = args.dst_ip
	url.endpoint_port = args.dst_port
	url.endpoint_timeout = args.timeout

	target = url.get_target()
	credentials = url.get_creds()

	if args.verbose >=1:
		print(str(target))

	print(__banner__)
	layout = """Connection layout
	
	CLIENT --->|
	CLIENT --->|(LISTENER) %s:%s  |--->| (%s) %s:%s |--->| (FINAL DST) %s:%s
	CLIENT --->|
	
	""" % (args.listen_ip, args.listen_port, target.version.name.upper() ,target.server_ip, target.server_port, args.dst_ip, args.dst_port)

	print(layout)

	client = SOCKSClient(comms, target, credentials)

	print('Waiting for incoming connections')
	asyncio.run(client.run())
Esempio n. 2
0
def main():

    import argparse

    parser = argparse.ArgumentParser(
        description='SOCKS5 proxy auth bruteforcer')
    parser.add_argument(
        'proxy_connection_string',
        help=
        'connection string decribing the socks5 proxy server connection properties'
    )
    parser.add_argument(
        '-u',
        '--users',
        action='append',
        help='User or users file with one user per line. can be stacked')
    parser.add_argument(
        '-p',
        '--passwords',
        action='append',
        help=
        'Password or password file with one password per line. can be stacked')
    parser.add_argument('-t',
                        '--timeout',
                        type=int,
                        default=None,
                        help='Brute retries sleep time')
    parser.add_argument('-w',
                        '--worker-count',
                        type=int,
                        default=1,
                        help='Parallelism')
    parser.add_argument('-v',
                        '--verbose',
                        action='count',
                        default=0,
                        help='Verbosity')
    parser.add_argument('-s',
                        '--silent',
                        action='store_true',
                        help='dont print banner')
    parser.add_argument('-o', '--out-file', help='output file')
    parser.add_argument('--positive',
                        action='store_true',
                        help='only show sucsessful results')

    args = parser.parse_args()

    if args.silent is False:
        print(__banner__)

    logger.setLevel(100)
    if args.verbose >= 1:
        logger.setLevel(logging.DEBUG)

    elif args.verbose > 2:
        logger.setLevel(1)

    url = SocksClientURL.from_url(args.proxy_connection_string)
    brute = SOCKSBrute(url)
    brute.timeout = args.timeout
    brute.worker_cnt = args.worker_count
    brute.output_file = args.out_file
    brute.only_positive = args.positive

    if args.users is None or args.passwords is None:
        print('Users "-u" and Passwords "-p" must be set! Exiting')
        return

    notfile = []
    for target in args.users:
        try:
            f = open(target, 'r')
            f.close()
            brute.user_gens.append(FileStringGen(target))
        except:
            notfile.append(target)

    if len(notfile) > 0:
        brute.user_gens.append(ListStringGen(notfile))

    if len(brute.user_gens) == 0:
        print('[-] No suitable users were found!')
        return

    notfile = []
    for target in args.passwords:
        try:
            f = open(target, 'r')
            f.close()
            brute.password_gens.append(FileStringGen(target))
        except:
            notfile.append(target)

    if len(notfile) > 0:
        brute.password_gens.append(ListStringGen(notfile))

    if len(brute.password_gens) == 0:
        print('[-] No suitable passwords were found!')
        return

    _, err = asyncio.run(brute.run())
    if err is not None:
        print('Failed to perform bruting! Reason: %s' % err)
        return

    if args.silent is False:
        print('Done!')
Esempio n. 3
0
def main():

    import argparse

    parser = argparse.ArgumentParser(
        description='SOCKS/HTTP proxy port scanner')
    parser.add_argument(
        'proxy_connection_string',
        help=
        'connection string decribing the socks5 proxy server connection properties'
    )
    parser.add_argument(
        '-p',
        '--ports',
        action='append',
        help=
        'port to scan / port range to scan / port range file. can be stacked')
    parser.add_argument('-t',
                        '--timeout',
                        type=int,
                        default=None,
                        help='Scan retries sleep time')
    parser.add_argument('-r',
                        '--retries',
                        type=int,
                        default=0,
                        help='Retries for testing the port')
    parser.add_argument('-w',
                        '--worker-count',
                        type=int,
                        default=1,
                        help='Parallelism')
    parser.add_argument('-v', '--verbose', action='count', default=0)
    parser.add_argument('targets',
                        nargs='+',
                        help='IP address / IP range (CDIR) / targets file')

    args = parser.parse_args()

    logger.setLevel(100)
    if args.verbose >= 1:
        logger.setLevel(logging.DEBUG)

    elif args.verbose > 2:
        logger.setLevel(1)

    url = SocksClientURL.from_url(args.proxy_connection_string)
    scanner = SOCKSPortscan(url)
    scanner.max_retries = args.retries
    scanner.retries_timeout = args.timeout
    scanner.worker_cnt = args.worker_count

    notfile = []
    for target in args.targets:
        try:
            f = open(target, 'r')
            f.close()
            scanner.target_gens.append(FileTargetIPGen(target))
        except:
            notfile.append(target)

    if len(notfile) > 0:
        scanner.target_gens.append(ListTargetIPGen(notfile))

    if len(scanner.target_gens) == 0:
        print('[-] No suitable targets were found!')
        return

    notfile = []
    for target in args.ports:
        try:
            f = open(target, 'r')
            f.close()
            scanner.port_gens.append(FileTargetPortGen(target))
        except:
            notfile.append(target)

    if len(notfile) > 0:
        scanner.port_gens.append(ListTargetPortGen(notfile))

    if len(scanner.port_gens) == 0:
        print('[-] No suitable ports were found!')
        return

    asyncio.run(scanner.run())