|
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 : 2592 Date : 2024/08/13 05:20
|