def send_random_traffic(dst): dst_mac = None dst_ip = None iface = [i for i in get_if_list() if 'eth0' in i][0] src_mac = [get_if_hwaddr(i) for i in get_if_list() if 'eth0' in i] if len(src_mac) < 1: print("No interface for output") sys.exit(1) src_mac = src_mac[0] src_ip = None if src_mac == "00:00:00:00:01:01": src_ip = "10.0.1.1" elif src_mac == "00:00:00:00:02:02": src_ip = "10.0.2.2" elif src_mac == "00:00:00:00:03:03": src_ip = "10.0.3.3" elif src_mac == "00:00:00:00:04:04": src_ip = "10.0.4.4" else: print("Invalid source host") sys.exit(1) if dst == 'h1': dst_mac = "00:00:00:00:01:01" dst_ip = "10.0.1.1" elif dst == 'h2': dst_mac = "00:00:00:00:02:02" dst_ip = "10.0.2.2" elif dst == 'h3': dst_mac = "00:00:00:00:03:03" dst_ip = "10.0.3.3" elif dst == 'h4': dst_mac = "00:00:00:00:04:04" dst_ip = "10.0.4.4" else: print("Invalid host to send to") sys.exit(1) total_pkts = 0 random_ports = random.sample(xrange(1024, 65535), 11) t1 = time.time() for port in random_ports: num_packets = random.randint(50, 250) # num_packets = 1 for i in range(num_packets): data = randomword(100) # data = randomword(1) p = Ether(dst=dst_mac, src=src_mac) / IP(dst=dst_ip, src=src_ip) p = p / UDP(dport=port) / Raw(load=data) # p = p/TCP(dport=port)/Raw(load=data) # print p.show() sendp(p, iface=iface, verbose=False) total_pkts += 1 t2 = time.time() print "Sent %s packets in total" % total_pkts print "Packets per second: %f" % (total_pkts / (t2 - t1))
def get_if(): ifs=get_if_list() iface=None for i in get_if_list(): if "eth0" in i: iface=i break; if not iface: exit(1) return iface
def get_if(): ifs = get_if_list() iface = None for i in get_if_list(): if "p4p2" in i: iface = i break if not iface: print "Cannot find p4p2 interface" exit(1) return iface
def get_if(): ifs = get_if_list() iface = None for i in get_if_list(): if 'eth0' in i: iface = i break if not iface: print('No eth0 interface') exit(1) return iface
def get_if(): ifs = get_if_list() iface = None # "h1-eth0" for i in get_if_list(): if "enx00051bc0004e" in i: iface = i break if not iface: print "Cannot find eth0 interface" exit(1) return iface
def get_if(): ifs = get_if_list() iface = None # "h1-eth0" for i in get_if_list(): if "eth0" in i: iface = i break if not iface: print("Cannot find eth0 interface", flush=True) exit(1) return iface
def get_if(): ifs=get_if_list() iface=None for i in get_if_list(): if "eth0" in i: iface=i break; if not iface: print "Cannot find eth0 interface" exit(1) return iface
def get_if(): ifs = get_if_list() iface = None # "h1-eth0" for i in get_if_list(): if "enp0s8" in i: iface = i break if not iface: print "Cannot find interface eth1" exit(1) return iface
def get_if(): ifs = get_if_list() iface = None for i in get_if_list(): if iface in i: iface = i break if not iface: print("Cannot find %s interface" % (iface)) exit(1) return iface
def get_if(): ifs = get_if_list() iface = "eth0" for i in get_if_list(): print(i) if "eth0" in i: iface = i break if not iface: print("Cannot find eth0 interface") exit(1) return iface
def get_if(sw): ifs = get_if_list() target = 'ctlr-' + sw iface = None for i in get_if_list(): if target in i: iface = i break if not iface: print "Cannot find target interface " + target exit(1) return iface
def get_if(self): self.ifs = get_if_list() iface = None # "h1-eth0" for i in get_if_list(): if "eth0" in i: iface = i break if not iface: print "Cannot find eth0 interface" exit(1) self.ifs.remove('lo') self.ifs.remove('eth0') print(self.ifs) return iface
def __init__(self, filter): super().__init__() self.filter = "host %s" % filter self.daemon = True self.socket = None self.use_pcap = True self.is_admin = False logger.info( 'Local network adapter information, choose a network you want to ' 'capture.') message = '----- Local IP Address -----\n' ifaces = [] if WINDOWS: import ctypes from scapy.all import IFACES if ctypes.windll.shell32.IsUserAnAdmin(): self.is_admin = True for i, iface in enumerate(sorted(IFACES)): dev = IFACES[iface] ifaces.append(dev.description) message += "{0} {1} {2}\n".format(i, dev.description, dev.ip) else: if os.getuid() == 0: self.is_admin = True ifaces = get_if_list() for i, iface in enumerate(ifaces): ip = get_if_addr(iface) message += "{0} {1} {2}\n".format(i, iface, ip) data_to_stdout(message) choose = input('Choose>: ').strip() self.interface = ifaces[int(choose)] self.use_pcap = True self.stop_sniffer = Event() self.pcap = None
def __parseCmdLine(self, cfg=None): ''' Parse whatever argparse has got. ''' errcode = 0 errmsg = '' if cfg == None: errcode = 1 errmsg = "[-] Unable to parse command line args." return (errcode, errmsg) # validate cmd line args if cfg.iface in get_if_list(): self.__iface = cfg.iface self.__ifaceOldMac = get_if_hwaddr(self.__iface) if cfg.mac is None: self.__ifaceMac = get_if_hwaddr(self.__iface) else: self.__ifaceMac = cfg.mac else: errcode = 2 errmsg = "[-] No such interface: " + cfg.iface return (errcode, errmsg) if cfg.threads > 0: self.__threads = cfg.threads else: errcode = 3 errmsg = "[-] A positive number of threads must be given." self.__vlanIds = self.__parseVlanIdString(cfg.vlanIds) if self.__vlanIds == []: errcode = 10 errmsg = "[-] vlan range string is invalid." return (errcode, errmsg) return (errcode, errmsg)
def __parseCmdLine(self, cfg = None): ''' Parse whatever argparse has got. ''' errcode = 0 errmsg = '' if cfg == None: errcode = 1 errmsg = "[-] Unable to parse command line args." return (errcode, errmsg) # validate cmd line args if cfg.iface in get_if_list(): self.__iface = cfg.iface self.__ifaceOldMac = get_if_hwaddr(self.__iface) if cfg.mac is None: self.__ifaceMac = get_if_hwaddr(self.__iface) else: self.__ifaceMac = cfg.mac else: errcode = 2 errmsg = "[-] No such interface: " + cfg.iface return (errcode, errmsg) if cfg.threads > 0: self.__threads = cfg.threads else: errcode = 3 errmsg = "[-] A positive number of threads must be given." self.__vlanIds = self.__parseVlanIdString(cfg.vlanIds) if self.__vlanIds == []: errcode = 10 errmsg = "[-] vlan range string is invalid." return (errcode, errmsg) return (errcode, errmsg)
def send_random_traffic(src_switch, src_host, dst_switch, dst_host, timeout, loop): NTP_MONLIST_REQUEST = "\x17\x00\x03\x2a" + "\x00" * 8 src_mac = '00:00:00:00:0' + src_switch + ':0' + src_host src_ip = '10.0.' + src_switch + '.' + src_host dst_mac = '00:00:00:00:0' + dst_switch + ':0' + dst_host dst_ip = '10.0.' + dst_switch + '.' + dst_host # Get name of eth0 interface iface_eth0 = '' for i in get_if_list(): if 'eth0' in i or 's0' in i: iface_eth0 = i hosts = [str(i) for i in range(1, 10)] print hosts # send requests while True: for i in hosts: src_host = i src_mac = '00:00:00:00:0' + src_switch + ':0' + src_host src_ip = '10.0.' + src_switch + '.' + src_host p = Ether(dst=dst_mac, src=src_mac) / IP(dst=dst_ip, src=src_ip) p = p / UDP(dport=123, sport=123) / Raw(NTP_MONLIST_REQUEST) sendp(p, iface=iface_eth0, loop=loop, verbose=0)
def get_local_ip(all=True): """Fetches all the local network address """ ips = OrderedSet() wan_ipv4 = get_host_ip() ips.add(wan_ipv4) if not all: return list(ips) wan_ipv6 = get_host_ipv6() if wan_ipv6: ips.add(wan_ipv6) # fix https://github.com/BVLC/caffe/issues/861 os.environ["MPLBACKEND"] = "Agg" # fix https://github.com/secdev/scapy/issues/3216 logging.getLogger("scapy").setLevel(logging.ERROR) from scapy.all import WINDOWS, get_if_list, get_if_addr if WINDOWS: from scapy.all import IFACES for iface in sorted(IFACES): dev = IFACES[iface] ips.add(dev.ip) else: for iface in get_if_list(): ipv4 = get_if_addr(iface) if ipv4 != '0.0.0.0': ips.add(ipv4) return list(ips)
def test_usb_tethering_over_wifi(self): """Tests USB tethering over wifi. Steps: 1. Connects to a wifi network 2. Enables USB tethering 3. Verifies wifi is preferred upstream over data connection """ wutils.start_wifi_connection_scan_and_ensure_network_found( self.dut, self.wifi_network[SSID]) wutils.wifi_connect(self.dut, self.wifi_network) wifi_network = self.dut.droid.connectivityGetActiveNetwork() self.log.info("wifi network %s" % wifi_network) iflist_before = get_if_list() nutils.start_usb_tethering(self.dut) self.USB_TETHERED = True self.iface = nutils.wait_for_new_iface(iflist_before) self.real_hwaddr = get_if_raw_hwaddr(self.iface) output = self.dut.adb.shell(DUMSYS_CMD) for line in output.split("\n"): if UPSTREAM_WANTED_STRING in line: asserts.assert_true("true" in line, "Upstream interface is not active") self.log.info("Upstream interface is active") if CURRENT_UPSTREAM_STRING in line: asserts.assert_true("wlan" in line, "WiFi is not the upstream " "interface") self.log.info("WiFi is the upstream interface")
def __parse_args(): parser = argparse.ArgumentParser(description="Send few TCP packets") parser.add_argument("-i", metavar="INTERFACE", dest="interface", action="store", type=str, required=True, help="interface to send TCP packets") parser.add_argument("-d", metavar="DST-IP", dest="dip", type=str, required=True, help="destination IP address") parser.add_argument("-p", metavar="DST-PORT", dest="dport", type=int, required=True, help="destination TCP port") parser.add_argument("-n", metavar="NPACKETS", dest="npackets", type=int, default=4, help="number of TCP packets to send") parser.add_argument("-g", metavar="INTERVAL", dest="interval", type=int, default=0, help="seconds to wait between packets") parser.add_argument("-l", metavar="SIZE", dest="size", type=int, default=64, help="size of TCP payload in bytes") parser.add_argument("-w", dest="wait", action="store_true", help="wait for user input between packets") parser.add_argument("-a", dest="synack", action="store_true", help="use 3-way TCP handshake") parser.add_argument("-b", metavar="PKT-TYPE", dest="bad_csum", type=str, help="force bad checksum for IPv4 and/or TCP packets") args = parser.parse_args() if args.interface not in get_if_list(): err = "Interface '" + args.interface + "' not found." raise parser.error(err) if args.bad_csum is not None and args.bad_csum not in PKT_TYPES: err = "Invalid PKT-TYPE for '-b'. Use one of '%s'." % \ ", ".join(PKT_TYPES) raise parser.error(err) return args
def get_if(): interfaces = get_if_list() for i in interfaces: if "eth0" in i: return i print("Cannot find eth0 interface") sys.exit(1)
def main(interface: str, address, ports, range, transport): """ pnmap - A simple network mapper/port scanner for Linux """ whoami = subprocess.check_output(["whoami"]).decode("utf-8") match = re.search(r"root", whoami) if not match: click.secho(f"pnmap must be run/installed as root (Scapy requirement)", fg="red") sys.exit(1) ports = range if range else list(ports) if ports else [22, 80, 443] valid_interfaces: list = get_if_list() valid_interfaces.remove("lo") if not interface and len(valid_interfaces) == 1: interface = valid_interfaces[0] else: while interface not in valid_interfaces: interface = click.prompt( click.style( f"Interface not found/ambiguous. Choose from {valid_interfaces}", fg="red")) # default to local subnet localnet = determine_subnet(interface) if not address: address = str(localnet) cli = CLI(interface, address, ports, localnet) cli.nmap(transport)
def selectInterface(): if os.name=='nt': counter = 0 arrInterfaces = get_windows_if_list() for arrInt in arrInterfaces: sIPv4 = '' for sIP in arrInt['ips']: if len(sIP.split('.')) == 4: sIPv4 = sIP print('['+str(counter)+'] ' + sIPv4 + ': ' + arrInt['name'] + ' (' + arrInt['description'] + ')') arrInterfaces[counter] = arrInterfaces[counter]['name'] counter += 1 else: counter = 0 arrInterfaces = get_if_list() for sInt in arrInterfaces: if not sInt == 'lo': print('[' + str(counter) + ']: ' + sInt) counter += 1 else: arrInterfaces.remove(sInt) if(len(arrInterfaces)==1): return arrInterfaces[0] print('[Q] Quit') sAnsw = input('Select interface [0]: ') if sAnsw.lower()[0] == 'q': exit() if sAnsw == '' or not sAnsw.isdigit(): sAnsw = '0' return arrInterfaces[int(sAnsw)]
def send_packet(pkt_ip, cnt=1, ipVer=8, iface=None): """send packet through eth0 or 1st available interfaces""" if iface is None: ifs = get_if_list() for i in ifs: if "eth0" in i: iface = i break if not iface: # tmp test iface = 'lo' if ipVer == 8: pkt = Ether(src=get_if_hwaddr(iface), dst='ff:ff:ff:ff:ff:ff', type=0x888) elif ipVer == 6: pkt = Ether(src=get_if_hwaddr(iface), dst='ff:ff:ff:ff:ff:ff', type=0x86DD) else: print("IP version {} is not supported. Abort Early".format(inVer)) exit(1) pkt = pkt / pkt_ip pkt.show() hexdump(pkt) t0 = time.time() sendp(pkt, iface=iface, count=cnt, inter=0.001, verbose=True) t_span = time.time() - t0 print("send {} IPv{} packts use {} sec".format(cnt, ipVer, t_span)) return iface
def get_local_ip(all=True): """Fetches all the local network address """ ips = OrderedSet() wan_ipv4 = get_host_ip() ips.add(wan_ipv4) if not all: return list(ips) wan_ipv6 = get_host_ipv6() if wan_ipv6: ips.add(wan_ipv6) if WINDOWS: from scapy.all import IFACES for iface in sorted(IFACES): dev = IFACES[iface] ips.add(dev.ip) else: for iface in get_if_list(): ipv4 = get_if_addr(iface) if ipv4 != '0.0.0.0': ips.add(ipv4) return list(ips)
def test_check_incoherences_interface(self): self.configuration['advanced']['interface'] = 'funky' self.assertRaises(errors.ConfigFileIncoherent, self.conf.check_incoherences, self.configuration) self.configuration['advanced']['interface'] = random.choice( get_if_list()) self.conf.check_incoherences(self.configuration)
def get_ifaces() -> List[Dict]: """Get network interface list.""" if sys.platform == "win32": from scapy.all import get_windows_if_list return get_windows_if_list() from scapy.all import get_if_list return get_if_list()
def get_router(): global router_ip ip_cmd = Popen(["ip", "route"], stdout=PIPE) ip_data = ip_cmd.communicate()[0].split("\n")[0].split() router_ip = ip_data[2] my_macs = [get_if_hwaddr(i) for i in get_if_list()] for mac in my_macs: if (mac != "00:00:00:00:00:00"): return mac, router_ip
def check_incoherences(self, configuration): incoherent = [] if configuration['advanced']['interface'] != 'auto': from scapy.all import get_if_list if configuration['advanced']['interface'] not in get_if_list(): incoherent.append('advanced:interface') self.log_incoherences(incoherent)
def main(): iface_eth0 = '' for i in get_if_list(): if 'eth0' in i or 's0' in i: iface_eth0 = i if not iface_eth0: print 'could not find iface_eth0' exit(1) sniff(iface=iface_eth0, prn=lambda x: handle_pkt(x, iface_eth0))
def main(): print __doc__ if len(sys.argv) <= 3: print "USAGE: <mode> <host> <port> [starttls] [num_worker] [interface]" print " mode ... client | sniff" print " starttls ... starttls keyword e.g. 'starttls\\n' or 'ssl\\n'" print "available interfaces" for i in get_if_list(): print " * %s" % i exit(1) mode = sys.argv[1] starttls = sys.argv[4] if len(sys.argv) > 4 else None host = sys.argv[2] port = int(sys.argv[3]) num_workers = 10 if not len(sys.argv) > 5 else int(sys.argv[5]) iface = "eth0" if not len(sys.argv) > 6 else sys.argv[6] scanner = TLSScanner(workers=num_workers) if mode == "sniff": print "[*] [passive] Scanning in 'sniff' mode for %s on %s..." % (repr( (host, port)), iface) scanner.sniff((host, port), iface=iface) else: print "[*] [active] Scanning with %s parallel threads..." % num_workers t_start = time.time() scanner.scan((host, port), starttls=starttls) print "\n" print "[*] Capabilities (Debug)" print scanner.capabilities print "[*] supported ciphers: %s/%s" % (len( scanner.capabilities.info.server.ciphers), len(TLS_CIPHER_SUITES) + len(SSLv2_CIPHER_SUITES)) print " * " + "\n * ".join( ("%s (0x%0.4x)" % (TLS_CIPHER_SUITES.get( c, "SSLv2_%s" % SSLv2_CIPHER_SUITES.get(c, c)), c) for c in scanner.capabilities.info.server.ciphers)) print "" print "[*] supported protocol versions: %s/%s" % (len( scanner.capabilities.info.server.versions), len(TLS_VERSIONS)) print " * " + "\n * ".join( ("%s (0x%0.4x)" % (TLS_VERSIONS.get(c, c), c) for c in scanner.capabilities.info.server.versions)) print "" print "[*] supported compressions methods: %s/%s" % ( len(scanner.capabilities.info.server.compressions), len(TLS_COMPRESSION_METHODS)) print " * " + "\n * ".join( ("%s (0x%0.4x)" % (TLS_COMPRESSION_METHODS.get(c, c), c) for c in scanner.capabilities.info.server.compressions)) print "" events = scanner.capabilities.get_events() print "[*] Events: %s" % len(events) print "* EVENT - " + "\n* EVENT - ".join(e[0] for e in events) t_diff = time.time() - t_start print "" print "Scan took: %ss" % t_diff
def get_iface(): iface = None for i in get_if_list(): # returns a list of connected hardware interfaces if "eth0" in i: iface = i break if not iface: print "Cannot find eth0 interface" exit(1) return iface
def getAddresses(): from scapy.all import get_if_addr, get_if_list from ipaddr import IPAddress addresses = set() for i in get_if_list(): try: addresses.add(get_if_addr(i)) except: pass if '0.0.0.0' in addresses: addresses.remove('0.0.0.0') return [IPAddress(addr) for addr in addresses]
def main(): print (__doc__) if len(sys.argv) <= 3: print ("USAGE: <mode> <host> <port> [starttls] [num_worker] [interface]") print (" mode ... client | sniff") print (" starttls ... starttls keyword e.g. 'starttls\\n' or 'ssl\\n'") print ("available interfaces") for i in get_if_list(): print (" * %s" % i) exit(1) mode = sys.argv[1] starttls = sys.argv[4] if len(sys.argv) > 4 else None host = sys.argv[2] port = int(sys.argv[3]) num_workers = 10 if not len(sys.argv) > 5 else int(sys.argv[5]) iface = "eth0" if not len(sys.argv) > 6 else sys.argv[6] scanner = TLSScanner(workers=num_workers) if mode == "sniff": print ("[*] [passive] Scanning in 'sniff' mode for %s on %s..." % (repr((host, port)), iface)) scanner.sniff((host, port), iface=iface) else: print ("[*] [active] Scanning with %s parallel threads..." % num_workers) t_start = time.time() scanner.scan((host, port), starttls=starttls) print ("\n") print ("[*] Capabilities (Debug)") print (scanner.capabilities) print ("[*] supported ciphers: %s/%s" % ( len(scanner.capabilities.info.server.ciphers), len(TLS_CIPHER_SUITES) + len(SSLv2_CIPHER_SUITES))) print (" * " + "\n * ".join( ("%s (0x%0.4x)" % (TLS_CIPHER_SUITES.get(c, "SSLv2_%s" % SSLv2_CIPHER_SUITES.get(c, c)), c) for c in scanner.capabilities.info.server.ciphers))) print ("") print ( "[*] supported protocol versions: %s/%s" % (len( scanner.capabilities.info.server.versions), len(TLS_VERSIONS))) print (" * " + "\n * ".join( ("%s (0x%0.4x)" % (TLS_VERSIONS.get(c, c), c) for c in scanner.capabilities.info.server.versions))) print ("") print ("[*] supported compressions methods: %s/%s" % ( len(scanner.capabilities.info.server.compressions), len(TLS_COMPRESSION_METHODS))) print (" * " + "\n * ".join(("%s (0x%0.4x)" % (TLS_COMPRESSION_METHODS.get(c, c), c) for c in scanner.capabilities.info.server.compressions))) print ("") events = scanner.capabilities.get_events() print ("[*] Events: %s" % len(events)) print ("* EVENT - " + "\n* EVENT - ".join(e[0] for e in events)) t_diff = time.time() - t_start print ("") print ("Scan took: %ss" % t_diff)
def send_random_traffic(dst): dst_mac = None dst_ip = None src_mac = [get_if_hwaddr(i) for i in get_if_list() if i == 'eth0'] if len(src_mac) < 1: print ("No interface for output") sys.exit(1) src_mac = src_mac[0] src_ip = None if src_mac =="00:00:00:00:00:01": src_ip = "10.0.0.1" elif src_mac =="00:00:00:00:00:02": src_ip = "10.0.0.2" elif src_mac =="00:00:00:00:00:03": src_ip = "10.0.0.3" else: print ("Invalid source host") sys.exit(1) if dst == 'h1': dst_mac = "00:00:00:00:00:01" dst_ip = "10.0.0.1" elif dst == 'h2': dst_mac = "00:00:00:00:00:02" dst_ip = "10.0.0.2" elif dst == 'h3': dst_mac = "00:00:00:00:00:03" dst_ip = "10.0.0.3" else: print ("Invalid host to send to") sys.exit(1) total_pkts = 0 random_ports = random.sample(xrange(1024, 65535), 10) for port in random_ports: num_packets = random.randint(50, 250) for i in range(num_packets): data = randomword(100) p = Ether(dst=dst_mac,src=src_mac)/IP(dst=dst_ip,src=src_ip) p = p/TCP(dport=port)/Raw(load=data) print p.show() sendp(p, iface = "eth0") total_pkts += 1 print "Sent %s packets in total" % total_pkts
def injmon(iface=None): if iface is None: for i in get_if_list(): injmon(i) else: try: driver, description = auto_driver(iface) except: # print('Could not find driver for %s' % iface) return if iface.find('mon') != -1: print('%s is already in mon mode' % iface) return ctx = Context(iface) print('Enabling injmon on %s %s' % (iface, driver)) try: ctx.open_injmon() except: print("Failed to set injmon for %s!" % iface)
def main(): """ :return: void """ # handle args parser = argparse.ArgumentParser() parser.add_argument('-src', help="Source IP") parser.add_argument('-dst', help="Destination IP") parser.add_argument('-msg', help="HTTP message") args = parser.parse_args() fake_src_ip = args.src dst_ip = args.dst http_get_msg = "GET / HTTP/1.1\r\n" + args.msg + "\r\n\r\n" # get my mac address my_mac = '00:00:00:00:00:00' my_macs = [get_if_hwaddr(i) for i in get_if_list()] for macs in my_macs: if macs != '00:00:00:00:00:00': my_mac = macs # Arp posion arp_psn = Ether() / ARP(op="who-has", hwsrc=my_mac, pdst=dst_ip, psrc=fake_src_ip) sendp(arp_psn) # Hand Shake ip_layer = IP(src=fake_src_ip, dst=dst_ip) tcp_layer = TCP(dport=PORT, seq=100, flags='S') syn_pkg = ip_layer / tcp_layer syn_ack_pkg = sr1(syn_pkg) if syn_ack_pkg != 0: ip_layer = IP(src=fake_src_ip, dst=dst_ip) tcp_layer = TCP(dport=PORT, seq=syn_ack_pkg[TCP].ack, ack=(syn_ack_pkg[TCP].seq + 1), flags='A') ack_pkg = ip_layer / tcp_layer send(ack_pkg) ack_pkg /= http_get_msg send(ack_pkg)
def runAsWizard(self): try: print print "Interface list" print "--------------" print for miface in get_if_list(): print miface print res = raw_input("Interface [" + get_working_if() + "]: ") if res != "": iface = res res = raw_input("Timeout [" + str(self.timeout) + "]: ") if res != "": self.timeout = int(res) except: pass
def test_check_incoherences_interface(self): self.configuration['advanced']['interface'] = 'funky' self.assertRaises(errors.ConfigFileIncoherent, self.conf.check_incoherences, self.configuration) self.configuration['advanced']['interface'] = random.choice(get_if_list()) self.conf.check_incoherences(self.configuration)
def get_interfaces(self): return scapy.get_if_list()
def getIfaceList(self): return scapy.get_if_list()
def get_ifaces(): from scapy.all import get_if_list return get_if_list()