http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=8582 [º¹»ç]
from scapy.all import ARP, Ether, srp, get_if_list
def scan_network(interface, ip_range):
print(f"Scanning network on interface {interface} for IP range {ip_range}")
arp = ARP(pdst=ip_range)
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
packet = ether/arp
# ÆÐŶ Àü¼Û ¹× ÀÀ´ä ¼ö½Å
result = srp(packet, iface=interface, timeout=3, verbose=False)[0]
devices = []
for sent, received in result:
devices.append({'ip': received.psrc, 'mac': received.hwsrc})
print("IP Address\t\tMAC Address")
print("-----------------------------------------")
for device in devices:
print(f"{device['ip']}\t\t{device['mac']}")
if __name__ == "__main__":
interfaces = get_if_list()
print("Available interfaces:")
for i, iface in enumerate(interfaces):
print(f"{i}: {iface}")
# ¿Ã¹Ù¸¥ ³×Æ®¿öÅ© ÀÎÅÍÆäÀ̽º À̸§ ¼±ÅÃ
# ¿¹¸¦ µé¾î, 'Ethernet' ¶Ç´Â 'Wi-Fi'
interface = 'Ethernet' # ½ÇÁ¦ ³×Æ®¿öÅ© ÀÎÅÍÆäÀ̽º À̸§À¸·Î º¯°æ
ip_range = "192.168.56.1/24"
netdiscover¶õ ÀÚ½ÅÀÌ ¼ÓÇÑ ³×Æ®¿öÅ©ÀÇ ¿¬°áµÇ¾î ÀÖ´Â
½Ã½ºÅÛÀ» ½ºÄµÇÏ°í Ãâ·ÂÇÏ´Â ÇØÅ· ÇÁ·Î±×·¥ÀÌ´Ù.
ÇÏÁö¸¸ ±âÁ¸ÀÇ Ä®¸® ¸®´ª½ºÀÇ netdiscover¸¦ »ç¿ëÇÏ´Â°Ô ´õ Æí¸®ÇÑ °Í °°´Ù.
°øºÎ»ï¾Æ ÀÛ¼ºÇÑ °ÍÀε¥ ¾÷·Îµå¸¦ Çß´Ù. |
Hit : 284 Date : 2024/08/13 05:20
|