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

Commitd97902b

Browse files
committed
add finding past wifi connections on windows tutorial
1 parentcb538e4 commitd97902b

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
6161
-[How to Create A Fork Bomb in Python](https://thepythoncode.com/article/make-a-fork-bomb-in-python). ([code](ethical-hacking/fork-bomb))
6262
-[How to Implement 2FA in Python](https://thepythoncode.com/article/implement-2fa-in-python). ([code](ethical-hacking/implement-2fa))
6363
-[How to Build a Username Search Tool in Python](https://thepythoncode.com/code/social-media-username-finder-in-python). ([code](ethical-hacking/username-finder))
64+
-[How to Find Past Wi-Fi Connections on Windows in Python](https://thepythoncode.com/article/find-past-wifi-connections-on-windows-in-python). ([code](ethical-hacking/find-past-wifi-connections-on-windows))
6465

6566
-###[Machine Learning](https://www.thepythoncode.com/topic/machine-learning)
6667
-###[Natural Language Processing](https://www.thepythoncode.com/topic/nlp)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#[How to Find Past Wi-Fi Connections on Windows in Python](https://thepythoncode.com/article/find-past-wifi-connections-on-windows-in-python)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
importwinreg# Import registry module.
2+
3+
defval2addr(val):# Convert value to address format.
4+
addr=''# Initialize address.
5+
try:
6+
forchinval:# Loop through value characters.
7+
addr+='%02x '%ch# Convert each character to hexadecimal.
8+
addr=addr.strip(' ').replace(' ',':')[0:17]# Format address.
9+
except:
10+
return"N/A"# Return N/A if error occurs.
11+
returnaddr# Return formatted address.
12+
13+
14+
defprintNets():# Print network information.
15+
net=r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged"# Registry key for network info.
16+
key=winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,net)# Open registry key.
17+
print('\n[*] Networks You have Joined:')# Print header.
18+
foriinrange(100):# Loop through possible network keys.
19+
try:
20+
guid=winreg.EnumKey(key,i)# Get network key.
21+
netKey=winreg.OpenKey(key,guid)# Open network key.
22+
try:
23+
n,addr,t=winreg.EnumValue(netKey,5)# Get MAC address.
24+
n,name,t=winreg.EnumValue(netKey,4)# Get network name.
25+
ifaddr:
26+
macAddr=val2addr(addr)# Convert MAC address.
27+
else:
28+
macAddr='N/A'
29+
netName=str(name)# Convert network name to string.
30+
print(f'[+]{netName} ---->{macAddr}')# Print network info.
31+
exceptWindowsError:# Handle errors.
32+
pass# Continue loop.
33+
winreg.CloseKey(netKey)# Close network key.
34+
exceptWindowsError:# Handle errors.
35+
break# Exit loop.
36+
winreg.CloseKey(key)# Close registry key.
37+
38+
39+
printNets()# Call printNets function.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp