-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68cbe2a
commit 8ef3746
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from scapy.all import ARP, Ether, srp | ||
|
||
def arp_scan(ip): | ||
arp_request = ARP(pdst=ip) | ||
broadcast = Ether(dst="ff:ff:ff:ff:ff:ff") | ||
arp_request_broadcast = broadcast / arp_request | ||
answered_list = srp(arp_request_broadcast, timeout=1, verbose=False)[0] | ||
|
||
clients_list = [] | ||
for element in answered_list: | ||
client_dict = {"ip": element[1].psrc, "mac": element[1].hwsrc} | ||
clients_list.append(client_dict) | ||
return clients_list | ||
|
||
def print_result(result_list): | ||
print("IP Address\t\tMAC Address") | ||
print("----------------------------------------------------") | ||
for client in result_list: | ||
print(client["ip"] + "\t\t" + client["mac"]) | ||
|
||
ip_range = "192.168.1.1/24" # İp aralığınızı buraya girin (örneğin, 192.168.1.1/24) | ||
|
||
scan_result = arp_scan(ip_range) | ||
print_result(scan_result) |