示例#1
0
def main():
    if len(sys.argv) == 2:
        parser = PARSER(sys.argv[1])
        if parser.parse_check():
            code = INTERPRETER(sys.argv[1])
            code.execute()
        else:
            print("Verifique la gramatica")
    elif len(sys.argv) > 2:
        print("Varios argumentos detectados, especifque solo un archivo")
        sys.exit()
    else:
        print("Especifique el archivo")
        sys.exit()
示例#2
0
def parse_cmd(cmd):
    """ Takes the full command definition string and parses to a tuple of the
	command name, input arguments, and return type
	"""

    print "Matching %s" % cmd
    #m = cmd_pattern.match(cmd)
    try:
        parsed = PARSER.parse(cmd)
    except PARSER.ParseException:
        print("Error in parsing")
        return None

    print("Parsed %s" % parsed)

    name = parsed[0]
    outparams = parsed[1]
    inparams = parsed[2]

    returns = []
    for p in outparams:
        param = mk_param(p)
        if param:
            returns.append(param)

    params = []
    for p in filter(bool, inparams):
        param = mk_param(p)
        if param:
            params.append(param)

    return (name, params, returns)
示例#3
0
def parse_cmd(cmd):
	""" Takes the full command definition string and parses to a tuple of the
	command name, input arguments, and return type
	"""

	print "Matching %s" % cmd
	#m = cmd_pattern.match(cmd)
	try:
		parsed = PARSER.parse(cmd)
	except PARSER.ParseException:
		print("Error in parsing")
		return None

	print("Parsed %s" % parsed)

	name = parsed[0]
	outparams = parsed[1]
	inparams = parsed[2]

	returns = []
	for p in outparams:
		param = mk_param(p)
		if param:
			returns.append(param)

	params = []
	for p in filter(bool, inparams):
		param = mk_param(p)
		if param:
			params.append(param)

	return (name, params, returns)
示例#4
0
def main():
	parser = argparse.ArgumentParser(add_help=False)

	parser.add_argument('-h', '--help', dest="help", default=False, action="store_true")
	parser.add_argument('-t', '--target', dest="target", default="", type=str)
	parser.add_argument('-r', '--regex', dest="regex", default="", type=str)
	parser.add_argument('-f', '--regex-json', dest="regfile", default="", type=str)
	parser.add_argument('-d', '--depth', dest="depth", default=0, type=int)
	parser.add_argument('-v', '--verbose', dest="verbose", default=False, action="store_true")

	opts = parser.parse_args()
	parser = PARSER(opts)

	locohunt = LOCOHUNT(parser)
	locohunt.engage()
示例#5
0
def main():
	parser = optparse.OptionParser( add_help_option=False )

	parser.add_option('-h', '--help', dest='help', action='store_true', default=False)
	parser.add_option('-d', '--domain', dest="domain", type="string", default="")
	parser.add_option('-w', '--wordlists', dest="wordlists", type="string", default="")
	parser.add_option('-t', '--threads', dest="threads", type="int", default=20)
	parser.add_option('-o', '--output', dest="output", type="string", default="")
	parser.add_option('-c', '--csv', dest="csv", type="string", default="")
	parser.add_option('-p', '--ports', dest="ports", type="string", default=roll.PORTS)
	parser.add_option('-s', '--search', dest="online", action="store_true", default=False)
	parser.add_option('-l', '--low-mode', dest="lmode", action="store_true", default=False)
	parser.add_option('-e', '--error-output', dest="eoutput", type="string", default="")
	parser.add_option(''  , '--screenshots' , dest="sshots" , type="string", default="")
	parser.add_option(''  , '--filter', dest="filter", action="store_true", default=False)
	parser.add_option(''  , '--subs', dest="subs", type="string", default="")
	parser.add_option(''  , '--scan-ports', dest="scan", action="store_true", default=False)
	parser.add_option(''  , '--skip-dns'  , dest="sdns", action="store_true", default=False)
	parser.add_option(''  , '--exclude-ips', dest="eeips", type=str, default="")

	(options, args) = parser.parse_args()

	pull.logo()

	if options.help:
		pull.help(); sys.exit(0)
	else:
		parser  = PARSER( options, args )
		pull.gthen( "CREATED ENVIRONMENT. EVERYTHING IN PLACE", pull.BOLD, pull.DARKCYAN )
		if not parser.skipdns:
			pull.gthen( "DNS Records ->", pull.BOLD, pull.DARKCYAN )
			pull.linebreak( 1 )
			dnssec  = NAMESERVER( parser.domain, parser.eeips )
			dnssec.push()
			dnsrec  = dnssec.get()
			pull.linebreak( 1 )
		else:
			dnssec  = NMHANDLER( parser.domain, parser.eeips )
	
		pull.gthen( "False Positive Detection ->", pull.BOLD, pull.DARKCYAN )
		pull.linebreak( 1 )
		dip     = dnssec.def_ip()
		dcn     = dnssec.def_cn()
		dnssec.def_ps()
		pull.linebreak( 1 )

		if parser.online:
			pull.gthen( "Looking for Subdomains Online ->", pull.BOLD, pull.DARKCYAN )
			pull.linebreak()
			oenum = ONLINE( parser.domain )
			oenum.enumerate()
			oenum.pause()
			osubs = oenum.acquire()
			pull.linebreak()
		else:
			osubs = list()

		pull.gthen( "Starting Brute Engine. Validating sub-domains ->", pull.BOLD, pull.DARKCYAN )
		pull.linebreak()
		eenge = ENGINE( parser.domain, parser.checklist, dip, parser.eeips, dcn, osubs, parser.threads, parser.eoutput )
		eenge.fmheaders()
		eenge.engage()
		pull.linebreak()
		pull.gthen( "Starting Brute Gun. Looking For Specifics ->", pull.BOLD, pull.DARKCYAN )
		pull.linebreak()
		pull.psheadb( pull.DARKCYAN, cdh=roll.FCODE, sbh=roll.FSUBDOM, pth=roll.FPORTS, cnh=roll.FCNAME )
		eenge.engross( parser.scan, parser.ports )
		pull.linebreak( 1 )

		fpush = WRITER(parser.domain, parser.output, parser.csv, parser.subs, eenge.get(), dip, parser.eeips, dcn)

		if parser.filter:
			pull.gthen( "Filtering Items for You. Suitable for larger assets -><-", pull.BOLD, pull.DARKCYAN )
			fpush.engage()
			pull.lthen( "Items Filtered. Output Finalized! ", pull.BOLD, pull.GREEN )
			pull.linebreak()

			if parser.output or parser.csv:
				pull.gthen( "Writing Your Desired Output ->", pull.BOLD, pull.DARKCYAN )
				pull.linebreak()
				fpush.flwritetxt()
				fpush.flwritecsv()
		else:
			if parser.output or parser.csv:
				pull.gthen( "Writing Your Desired Output ->", pull.BOLD, pull.DARKCYAN )
				pull.linebreak()
				fpush.nmwritetxt()
				fpush.nmwritecsv()

		if parser.sshots:
			pull.gthen( "Writing the URLs to be Screenshotted ->", pull.BOLD, pull.DARKCYAN	)
			pull.linebreak()
			fpush.screenshot(parser.sshots)

		if parser.subs:
			fpush.writesubs()

		pull.lthen( "DONE!", pull.BOLD, pull.RED )
示例#6
0
#!/usr/bin/env python
# license removed for brevity
import os
import sys
current_folder = os.path.dirname(os.path.realpath(__file__))
sys.path.append(current_folder)

import numpy as np
from parser import PARSER

parser = PARSER()
'''
monitor.init()
msg = monitor.airdump(save_file_name="aaaa", is_beacons=True, is_manufacturer=True, is_uptime=True)
print(msg)
'''

ap_list, client_list = parser.airdump_reader(
    os.path.join(current_folder, "aaaa-01.csv"))

pos = parser.airdump_parser(ap_list,
                            client_list,
                            refresh_time=100,
                            elast_time=99999999,
                            save_file_name="aaaa",
                            is_show=False)
'''
for i in range(10):
    pos = monitor.airdump_parser(ap_list, client_list, pos)
'''
print(pos)
示例#7
0
#!/usr/bin/env python
# license removed for brevity
import os
import sys
current_folder = os.path.dirname(os.path.realpath(__file__))
sys.path.append(current_folder)

import time
import numpy as np
from monitor import MONITOR
from parser import PARSER

parser = PARSER()

ap_list, client_list = parser.airdump_reader(os.path.join(current_folder, "aaaa-01.csv"))

pos_ap, pos_client = parser.airdump_parser(ap_list, client_list, refresh_time=0.1)
while True:
    ap_list, client_list = parser.airdump_reader(os.path.join(current_folder, "aaaa-01.csv"))
    a = time.time()
    pos_ap, pos_client = parser.airdump_parser(ap_list, client_list, refresh_time=0.1, save_file_name="aaaa", is_show=True)
    b = time.time()
    print("deley : {} secs".format(b-a))

示例#8
0
class ATTACKER:
    version_ = "1.0"
    console = Console_Formatter(__name__)
    sys_util = SYS_UTILS()
    data_reader = DATA_READER()
    wifi_detector = None
    parser = PARSER()
    reference_file = None

    ap_info_list = None
    client_info_list = None

    flag_wifi_is_init = False

    def __init__(self):
        pass

    def __del__(self):
        pass

    def init(self, interface=None, reference_file=None):
        print(self.console.INFO("Initializing ..."))
        self.wifi_detector = WIFI_HD_DETECTOR()
        self.flag_wifi_is_init = self.wifi_detector.is_init()
        if interface == None:
            if self.flag_wifi_is_init:
                self.wifi_detector.run(is_silent=True)

        if reference_file != None:
            self.airdumpreader(reference_file)

        return self.flag_wifi_is_init

    def airdumpreader(self, file_name):
        self.ap_info_list, self.client_info_list = self.parser.airdump_reader(
            os.path.join(current_folder, file_name))
        return self.ap_info_list, self.client_info_list

    def airattack(self,
                  interface=None,
                  ap_mac=None,
                  ap_essid=None,
                  client_mac=None,
                  src_mac=None,
                  deauth_count=0):
        '''
        ap_mac : 
        ap_essid : 
        client_mac :
        src_mac :
        deauth_count count : 
        '''
        print(self.console.INFO("Air attacking ..."))
        args = []
        cmd = ["aireplay-ng"]
        if ap_mac != None:
            args = np.append(args, "-a")
            args = np.append(args, ap_mac)
        if ap_essid != None:
            args = np.append(args, "-e")
            args = np.append(args, ap_essid)
        if src_mac != None:
            args = np.append(args, "-h")
            args = np.append(args, src_mac)
        if client_mac != None:
            args = np.append(args, "-c")
            args = np.append(args, client_mac)
        if deauth_count != None:
            args = np.append(args, "--deauth")
            args = np.append(args, deauth_count)

        args = np.append(args, "--ignore-negative-one")

        if interface == None:
            if self.flag_wifi_is_init:
                for i in range(len(self.wifi_detector.interface)):
                    if len(self.wifi_detector.interface[i]) > 3:
                        if self.wifi_detector.interface[i][
                                0:3] == "mon" or self.wifi_detector.interface[
                                    i][-3:] == "mon":
                            print(
                                self.console.INFO(
                                    "Air attacking interface : {}".format(
                                        self.wifi_detector.interface[i])))
                            cmd = np.append(cmd, args)
                            cmd = np.append(cmd,
                                            self.wifi_detector.interface[i])
                            stdout = self.sys_util.sys_check_output(cmd)
                            #stdout, stderr = self.sys_util(cmd)
                            line_new = self.sys_util.msg_line_split(stdout)
                            return line_new
            else:
                return None
        else:
            print(
                self.console.INFO(
                    "Air attacking interface : {}".format(interface)))
            cmd = np.append(cmd, args)
            cmd = np.append(cmd, interface)
            stdout, stderr = self.sys_util(cmd)
            line_new = self.sys_util.msg_line_split(stdout)
            return line_new