def run(self, plugin_Params, global_params): """Get the help message for this plugin.""" TARGET = global_params.target DST_MAC = global_params.mac_dst OUT_IFACE = global_params.iface_out SEND_FUNCTION = global_params.send_function PORTS = split_ports(plugin_Params.ports_idle_scan) SLEEP_TIME = plugin_Params.sleep / 1000.0 # Añadido nuevo IDLEHOST = plugin_Params.idle_host IDLEHOST_MAC = plugin_Params.mac_idle_host ATTACKER = global_params.ip_src global PORTS_LIST, INCREASE_ASSIGNMENT_IPID #, PORTS_CLOSED, PORTS_FILTERED PORTS_LIST.extend(PORTS) PORTS_LIST.reverse() PARTIAL_HEADER_IDLEHOST_TO_TARGET = Ether(src=IDLEHOST_MAC,dst=DST_MAC) #Cabecera MAC PARTIAL_HEADER_TARGET_TO_IDLEHOST = Ether(src=DST_MAC,dst=IDLEHOST_MAC) #Cabecera MAC PARTIAL_HEADER_ATTACKER_TO_IDLEHOST = Ether(dst=IDLEHOST_MAC) #Cabecera MAC try: # Passed idle host as parameter? if not IDLEHOST: IODebug.displayInfo("%s: error: too few arguments\n" % __prog__) exit(1) # Check if destination are reachable IODebug.displayDebugInfo("DEBUG 1: Checking if destination are reachable") # Get remote MAC if not IDLEHOST_MAC: try: IDLEHOST_MAC = get_remote_addr(IDLEHOST, ATTACKER, OUT_IFACE) SEND_FUNCTION = sendp print "level = 2" except RuntimeError: # Check if address is accesible without net level 2 test = sr1(IPv6(dst=IDLEHOST)/ICMPv6EchoRequest(), iface = OUT_IFACE, timeout=4, verbose = 0) print "level = 3" SEND_FUNCTION = send if not test: raise RuntimeError("Idle host is not reachable") except IOError,e: IODebug.displayInfo("\nError: %s\n" % str(e)) sys.exit(1)
def run(self, plugin_Params, global_params): """Get the help message for this plugin.""" #---------------------------------------------------------------------- # Packet layers TARGET = global_params.target DST_MAC = global_params.mac_dst OUT_IFACE = global_params.iface_out SEND_FUNCTION = global_params.send_function PORTS = split_ports(plugin_Params.ports_scan) SLEEP_TIME = plugin_Params.sleep / 1000.0 eth_header = Ether(dst=DST_MAC) ip_header = IPv6(dst=TARGET) # Add headers ip_payload = make_payload(num_headers=global_params.headers_num, ext_type=global_params.payload_type) # Make the payload if ip_payload: PARTIAL_HEADER = eth_header / ip_header / ip_payload else: PARTIAL_HEADER = eth_header / ip_header # # Shared data # {'state': []} # # Example: # { # 'open' : [80,8080], # 'closed' : [139,445] # } # global PORTS_OPEN, PORTS_CLOSED, PORTS_FILTERED # Init all ports as closed PORTS_CLOSED.extend(PORTS) # Process topera = ToperaPortScanner(TARGET, partial_header=PARTIAL_HEADER, send_function=SEND_FUNCTION, dest_ports=PORTS, sleep_time=SLEEP_TIME, output_iface=OUT_IFACE, debuging=global_params.verbosity) try: IODebug.displayInfo("Scanning %s [%s ports]" % (TARGET, str(len(PORTS)))) m_start_init = clock() m_timeout = len(PORTS) * 2 m_timeout_counter = 0 # Start topera.start() # Launch all syn packets topera.send_syn() topera.join() IODebug.displayInfo("Not shown: %s closed ports" % str(len(PORTS_CLOSED))) # Display results IODebug.displayInfo("%s scan report for %s" % ("Topera", TARGET)) IODebug.displayInfo("PORT\t\tSTATE") # Order results for po in PORTS_OPEN: IODebug.displayInfo("%s/tcp\t\topen" % (str(po))) IODebug.displayInfo( "\nTopera done: 1 IP address (1 host up) scanned in %s seconds" % (str(clock() - m_start_init))) except KeyboardInterrupt: print "\n[*] Stoping, please be patient..." topera.terminate() print ""
def run(self, plugin_Params, global_params): """Get the help message for this plugin.""" #---------------------------------------------------------------------- # Packet layers TARGET = global_params.target DST_MAC = global_params.mac_dst OUT_IFACE = global_params.iface_out SEND_FUNCTION = global_params.send_function PORTS = split_ports(plugin_Params.ports_scan) SLEEP_TIME = plugin_Params.sleep / 1000.0 eth_header = Ether(dst=DST_MAC) ip_header = IPv6(dst=TARGET) # Add headers ip_payload = make_payload(num_headers=global_params.headers_num, ext_type=global_params.payload_type) # Make the payload if ip_payload: PARTIAL_HEADER = eth_header/ip_header/ip_payload else: PARTIAL_HEADER = eth_header/ip_header # # Shared data # {'state': []} # # Example: # { # 'open' : [80,8080], # 'closed' : [139,445] # } # global PORTS_OPEN, PORTS_CLOSED, PORTS_FILTERED # Init all ports as closed PORTS_CLOSED.extend(PORTS) # Process topera = ToperaPortScanner(TARGET, partial_header = PARTIAL_HEADER, send_function = SEND_FUNCTION, dest_ports = PORTS, sleep_time = SLEEP_TIME, output_iface = OUT_IFACE, debuging = global_params.verbosity) try: IODebug.displayInfo("Scanning %s [%s ports]" % (TARGET, str(len(PORTS)))) m_start_init = clock() m_timeout = len(PORTS) * 2 m_timeout_counter = 0 # Start topera.start() # Launch all syn packets topera.send_syn() topera.join() IODebug.displayInfo("Not shown: %s closed ports" % str(len(PORTS_CLOSED))) # Display results IODebug.displayInfo("%s scan report for %s" % ("Topera", TARGET)) IODebug.displayInfo("PORT\t\tSTATE") # Order results for po in PORTS_OPEN: IODebug.displayInfo("%s/tcp\t\topen" % (str(po))) IODebug.displayInfo("\nTopera done: 1 IP address (1 host up) scanned in %s seconds" % (str(clock() - m_start_init))) except KeyboardInterrupt: print "\n[*] Stoping, please be patient..." topera.terminate() print ""