Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9da3811

Browse files
authored
Create lanscan_arp.py
1 parentad93ebb commit9da3811

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

‎lanscan_arp.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Import scapy
2+
importscapy.allasscapy
3+
# We need to create regular expressions to ensure that the input is correctly formatted.
4+
importre
5+
6+
# Basic user interface header
7+
print(r"""______ _ _ ______ _ _
8+
| _ \ (_) | | | ___ \ | | | |
9+
| | | |__ ___ ___ __| | | |_/ / ___ _ __ ___ | |__ __ _| |
10+
| | | / _` \ \ / / |/ _` | | ___ \/ _ \| '_ ` _ \| '_ \ / _` | |
11+
| |/ / (_| |\ V /| | (_| | | |_/ / (_) | | | | | | |_) | (_| | |
12+
|___/ \__,_| \_/ |_|\__,_| \____/ \___/|_| |_| |_|_.__/ \__,_|_|""")
13+
print("\n****************************************************************")
14+
print("\n* Copyright of David Bombal, 2021 *")
15+
print("\n* https://www.davidbombal.com *")
16+
print("\n* https://www.youtube.com/davidbombal *")
17+
print("\n****************************************************************")
18+
19+
# Regular Expression Pattern to recognise IPv4 addresses.
20+
ip_add_range_pattern=re.compile("^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]*$")
21+
22+
# Get the address range to ARP
23+
whileTrue:
24+
ip_add_range_entered=input("\nPlease enter the ip address and range that you want to send the ARP request to (ex 192.168.1.0/24): ")
25+
ifip_add_range_pattern.search(ip_add_range_entered):
26+
print(f"{ip_add_range_entered} is a valid ip address range")
27+
break
28+
29+
30+
# Try ARPing the ip address range supplied by the user.
31+
# The arping() method in scapy creates a pakcet with an ARP message
32+
# and sends it to the broadcast mac address ff:ff:ff:ff:ff:ff.
33+
# If a valid ip address range was supplied the program will return
34+
# the list of all results.
35+
arp_result=scapy.arping(ip_add_range_entered)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp