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

Commit92e40f6

Browse files
committed
add seeing hidden wifi networks tutorial
1 parentc9e90ba commit92e40f6

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
1717
-[How to Make a SYN Flooding Attack in Python](https://www.thepythoncode.com/article/syn-flooding-attack-using-scapy-in-python). ([code](scapy/syn-flood))
1818
-[How to Inject Code into HTTP Responses in the Network in Python](https://www.thepythoncode.com/article/injecting-code-to-html-in-a-network-scapy-python). ([code](scapy/http-code-injector/))
1919
-[How to Perform IP Address Spoofing in Python](https://thepythoncode.com/article/make-an-ip-spoofer-in-python-using-scapy). ([code](scapy/ip-spoofer))
20+
-[How to See Hidden Wi-Fi Networks in Python](https://thepythoncode.com/article/uncovering-hidden-ssids-with-scapy-in-python). ([code](scapy/uncover-hidden-wifis))
2021
-[Writing a Keylogger in Python from Scratch](https://www.thepythoncode.com/article/write-a-keylogger-python). ([code](ethical-hacking/keylogger))
2122
-[Making a Port Scanner using sockets in Python](https://www.thepythoncode.com/article/make-port-scanner-python). ([code](ethical-hacking/port_scanner))
2223
-[How to Create a Reverse Shell in Python](https://www.thepythoncode.com/article/create-reverse-shell-python). ([code](ethical-hacking/reverse_shell))

‎scapy/uncover-hidden-wifis/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#[How to See Hidden Wi-Fi Networks in Python](https://thepythoncode.com/article/uncovering-hidden-ssids-with-scapy-in-python)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scapy
2+
colorama
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Operating system functions.
2+
importos
3+
# Import all functions from scapy library.
4+
fromscapy.allimport*
5+
# Import Fore from colorama for colored console output, and init for colorama initialization.
6+
fromcoloramaimportFore,init
7+
# Initialize colorama
8+
init()
9+
10+
# Set to store unique SSIDs.
11+
seen_ssids=set()
12+
13+
14+
# Function to set the wireless adapter to monitor mode.
15+
defset_monitor_mode(interface):
16+
# Bring the interface down.
17+
os.system(f'ifconfig{interface} down')
18+
# Set the mode to monitor.
19+
os.system(f'iwconfig{interface} mode monitor')
20+
# Bring the interface back up.
21+
os.system(f'ifconfig{interface} up')
22+
23+
24+
# Function to process Wi-Fi packets.
25+
defprocess_wifi_packet(packet):
26+
# Check if the packet is a Probe Request, Probe Response, or Association Request.
27+
ifpacket.haslayer(Dot11ProbeReq)orpacket.haslayer(Dot11ProbeResp)orpacket.haslayer(Dot11AssoReq):
28+
# Extract SSID and BSSID from the packet.
29+
ssid=packet.info.decode('utf-8',errors='ignore')
30+
bssid=packet.addr3
31+
32+
# Check if the SSID is not empty and not in the set of seen SSIDs, and if the BSSID is not the broadcast/multicast address.
33+
ifssidandssidnotinseen_ssidsandbssid.lower()!='ff:ff:ff:ff:ff:ff':
34+
# Add the SSID to the set.
35+
seen_ssids.add(ssid)
36+
# Print the identified SSID and BSSID in green.
37+
print(f"{Fore.GREEN}[+] SSID:{ssid} ----> BSSID:{bssid}")
38+
39+
40+
# Main function.
41+
defmain():
42+
# Define the wireless interface.
43+
wireless_interface='wlan0'
44+
45+
# Set the wireless adapter to monitor mode.
46+
set_monitor_mode(wireless_interface)
47+
48+
# Print a message indicating that sniffing is starting on the specified interface in magenta.
49+
print(f"{Fore.MAGENTA}[+] Sniffing on interface:{wireless_interface}")
50+
51+
# Start sniffing Wi-Fi packets on the specified interface, calling process_wifi_packet for each packet, and disabling packet storage
52+
sniff(iface=wireless_interface,prn=process_wifi_packet,store=0)
53+
54+
55+
# Check if the script is being run as the main program.
56+
if__name__=="__main__":
57+
# Call the main function.
58+
main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp