diff --git a/python-ofensivo/14_escaner_red_ICMP/network_scaner.py b/python-ofensivo/14_escaneres_red/01_network_scanner_icmp.py similarity index 100% rename from python-ofensivo/14_escaner_red_ICMP/network_scaner.py rename to python-ofensivo/14_escaneres_red/01_network_scanner_icmp.py diff --git a/python-ofensivo/14_escaneres_red/02_network_scanner_arp.py b/python-ofensivo/14_escaneres_red/02_network_scanner_arp.py new file mode 100644 index 0000000..44c6f3f --- /dev/null +++ b/python-ofensivo/14_escaneres_red/02_network_scanner_arp.py @@ -0,0 +1,43 @@ +# /usr/bin/env python3 +""" +Escaner de red ARP +""" + +import scapy.all as scapy +import argparse + + +def get_arguments(): + + parser = argparse.ArgumentParser(description='Escaner de red ARP') + parser.add_argument( + '-t', '--target', + required=True, dest='target', + help='Host / IP range. ex: 192.168.1.1 or 192.168.1.0/24' + ) + args = parser.parse_args() + + return args.target + + +def scan(ip): + + arp_packet = scapy.ARP(pdst=ip) + broadcast_packet = scapy.Ether(dst='ff:ff:ff:ff:ff:ff') + arp_packet = broadcast_packet/arp_packet # / es un operador de composición + + answered, unanswered = scapy.srp(arp_packet, timeout=1, verbose=False) + + response = answered.summary() + + if response: + print(response) + +def main(): + + target = get_arguments() + scan(target) + + +if __name__ == '__main__': + main() diff --git a/python-ofensivo/README.md b/python-ofensivo/README.md index bec9c04..765faa6 100644 --- a/python-ofensivo/README.md +++ b/python-ofensivo/README.md @@ -27,4 +27,4 @@ Quizá encuentres aquí cosas que no están en el vídeo, o viceversa, son apunt | 11. [Chat cifrado con E2E](./11_chat_cifrado_E2E/) | | 12. [Escaner de puertos](./12_escaner_puertos/) | | 13. [Cambiador de MAC](./13_cambiar_mac_address/) | -| 14. [Escaner de red ICMP](./14_escaner_red_ICMP/) | +| 14. [Escaner de red](./14_escaneres_red/) |