Example #1
0
def main():
    parser = argparse.ArgumentParser(
        prog='pyscanmap',
        description=
        'PyScanMap makes it easy to scan your network hosts and their open ports',
        epilog='By Luiz Rosa & Renan Tashiro')
    parser.add_argument('-v',
                        '--version',
                        action='version',
                        version='%(prog)s ' + VERSION)
    parser.add_argument('-n',
                        '--network',
                        help='IPv4 address for the network',
                        required=True)
    parser.add_argument(
        '-m',
        '--mask',
        help='Mask for the IPv4 address, expressed as an IPv4 address',
        required=True)
    args = parser.parse_args(sys.argv[1:])
    validate_arguments(args.network, args.mask)

    network_scanner = NetworkScanner(args.network, args.mask)
    try:
        network_scanner.scan()
    except KeyboardInterrupt:
        sys.exit(0)
Example #2
0
def main():
    args = parseArguments()
    ip = checkArgs(args)
    net = NetworkScanner(ip)
    w = Writer()
    while (True):
        clients = net.scan()
        devices = parseDevices(clients)
        csv_devices = w.getDevicesFromCSV()
        list_to_print = compareDevices(devices, csv_devices, net.getRouterIP())
        printDevices(list_to_print)
        w.writeToCSV(devices)
        time.sleep(60 * args.time)
Example #3
0
def main():
    args = analisaArgs()
    ip = checaIPnosArgumentos(args)
    net = NetworkScanner(ip)
    w = Writer()
    while(True):
        clients = net.scan()
        devices = analisaDispositivos(clients)
        csv_devices = w.dispositivosDoCSV()
        list_to_print = comparaDispositivos(
            devices, csv_devices, net.getRouterIP())
        mostraDispositivos(list_to_print)
        w.escreveCSV(devices)
        time.sleep(args.time)
Example #4
0
def scan_my_network(my_ip):
    network_scanner = NetworkScanner()
    full_wlan_ip_range = network_scanner.get_wlan_ip_from_ip(my_ip)
    print(f'[+] We will send ARP request to wlan ip :{full_wlan_ip_range}')
    answers = network_scanner.scan(full_wlan_ip_range)  # We don't want router
    spoof_ip = answers[0][1].psrc
    answers = answers[2:]
    print('Here we go, list of avaible machines')
    network_scanner.print_result(answers)
    return answers, spoof_ip
Example #5
0
class Spoofer():
    network_scanner = NetworkScanner()

    def _restore(self, destination_ip, source_ip):
        destination_mac = self.network_scanner.get_mac_from_ip(destination_ip)
        source_mac = self.network_scanner.get_mac_from_ip(source_ip)
        send(ARP(op=2,
                 pdst=destination_ip,
                 hwdst=destination_mac,
                 psrc=source_ip,
                 hwsrc=source_mac),
             verbose=False)
        send(ARP(op=2,
                 pdst=source_ip,
                 hwdst=source_mac,
                 psrc=destination_ip,
                 hwsrc=destination_mac),
             verbose=False)

    def _spoof(self, target_ip, spoof_ip):
        target_mac = self.network_scanner.get_mac_from_ip(target_ip)
        # op settings change request ARP to response ARP
        packet = ARP(op=2, pdst=target_ip, hwdst=target_mac, psrc=spoof_ip)
        send(packet, verbose=False)

    def spoof(self, targets_ip, spoof_ip):
        packets_count = 0
        print(targets_ip)
        while True:
            try:
                for target_ip in targets_ip:
                    self._spoof(target_ip, spoof_ip)
                    self._spoof(spoof_ip, target_ip)
                    packets_count += 2
                print('\r[+] Sent packets ' + str(packets_count), end="")
                sleep(2)
            except:
                print('\r[---] Stopping spoofing')
                for target_ip in targets_ip:
                    self._restore(target_ip, spoof_ip)
                print(f'\r[INFO] Sent {packets_count} packets')
                break
Example #6
0
class Application():
    argumentsParser = ArgumentsParser()
    emailSender = EmailSender()
    network_scanner = NetworkScanner()
    arguments = None


    def initialize(self):
        self.arguments = self.argumentsParser.get_arguments()
        self.start_scanning(self.arguments.interval or 5)

    def start_scanning(self, interval: int):
        output = self.network_scanner.get_network_devices_output()
        print(output)

        if self.arguments.testing == True or self.arguments.email != None and self.arguments.pw != None:
            self.emailSender.send_email(self.arguments.testing, self.arguments.email, self.arguments.pw, output)

        if self.arguments.watch:
            for x in range(1, interval):
                b = f"  Next scan in: {interval - x} seconds"  + "." * x
                print (b, end="\r")
                time.sleep(1)
            self.start_scanning(interval)
Example #7
0
 def run(self):
     NetworkScanner().ping_sweep_async(callback=self.on_host_online)
     wx.PostEvent(self._notify_window,
                  ResultEvent(EVT_RESULT_NET_SCAN_ID, "DONE"))
Example #8
0
 def run(self):
     NetworkScanner().scan_ports_async(self._host,
                                       callback=self.on_port_open)
     wx.PostEvent(self._notify_window,
                  ResultEvent(EVT_RESULT_PORT_SCAN_ID, "DONE"))
Example #9
0
 def broadcast(self, msg):
     print("BROADCASTING")
     NetworkScanner(msg).start()