Ejemplo n.º 1
0
def _set_connect_back():
    ips = get_local_ip(all=True)
    if ips:
        kb.data.local_ips = ips
    if conf.mode == "shell" and conf.connect_back_host is None:
        data_to_stdout(
            "[i] pocsusite is running in shell mode, you need to set connect back host:\n"
        )
        message = '----- Local IP Address -----\n'
        for i, ip in enumerate(kb.data.local_ips):
            message += "{0}    {1}\n".format(i, ip)
        data_to_stdout(message)
        while True:
            choose = None
            choose = input('Choose>: ').strip()
            if not choose:
                continue
            try:
                if choose.isdigit():
                    choose = int(choose)
                    conf.connect_back_host = kb.data.local_ips[choose]
                    data_to_stdout("you choose {0}\n".format(
                        conf.connect_back_host))
                    break
            except Exception:
                data_to_stdout("wrong number, choose again\n")
Ejemplo n.º 2
0
def _set_connect_back():
    if conf.mode == "shell" and conf.connect_back_host is None:
        wan_ipv4 = get_host_ip()
        kb.data.local_ips = get_local_ip(all=True)
        data_to_stdout(
            "[i] pocsusite is running in shell mode, you need to set connect back host:\n"
        )
        message = '----- Local IP Address -----\n'
        for i, ip in enumerate(kb.data.local_ips):
            v = ip
            if conf.ppt:
                v = desensitization(v)
            if ip == wan_ipv4:
                v = colored(f'{v}    *wan*', 'green')
            message += "{0}    {1}\n".format(i, v)
        data_to_stdout(message)
        while True:
            choose = None
            choose = input('Choose>: ').strip()
            if not choose:
                continue
            try:
                if choose.isdigit():
                    choose = int(choose)
                    conf.connect_back_host = kb.data.local_ips[choose]
                    data_to_stdout("you choose {0}\n".format(
                        desensitization(conf.connect_back_host) if conf.
                        ppt else conf.connect_back_host))
                    break
            except Exception:
                data_to_stdout("wrong number, choose again\n")
Ejemplo n.º 3
0
 def _show_ip(self, *args, **kwargs):
     ips = get_local_ip(all=True)
     tb = prettytable.PrettyTable(["Index", "IP"])
     index = 0
     for item in ips:
         tb.add_row([str(index), item])
         index += 1
     data_to_stdout("\n" + tb.get_string() + "\n")
Ejemplo n.º 4
0
 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"
     )
     if WINDOWS:
         iface = []
         import ctypes
         if ctypes.windll.shell32.IsUserAnAdmin():
             self.is_admin = True
         ips = get_local_ip(all=True)
         message = '----- Local IP Address -----\n'
         name = []
         interface_ips = []
         for iface_name in sorted(IFACES):
             if list(set(IFACES[iface_name].data['ips'])):
                 if list(set(IFACES[iface_name].data['ips']))[0] in ips:
                     name.append(IFACES[iface_name].data['name'])
                     interface_ips.append(
                         list(set(IFACES[iface_name].data['ips']))[0])
                     iface.append(IFACES[iface_name].data['description'])
         for i, ip in enumerate(interface_ips):
             message += "{0}   {1}    {2}\n".format(i, name[i], ip)
     else:
         if os.getuid() == 0:
             self.is_admin = True
         from pocsuite3.thirdparty.scapy.core import get_if_list, get_if_lists
         iface, ips = get_if_lists()
         message = '----- Local IP Address -----\n'
         for i, ip in enumerate(ips):
             message += "{0}   {1}    {2}\n".format(i, iface[i], ip)
     data_to_stdout(message)
     choose = input('Choose>: ').strip()
     self.interface = iface[int(choose)]
     self.use_pcap = conf.use_pcap
     self.stop_sniffer = Event()
     self.pcap = None