Skip to content

Instantly share code, notes, and snippets.

@fernandozamoraj
Created September 30, 2015 22:48
Show Gist options
  • Save fernandozamoraj/7bb43b727c481bcc12e6 to your computer and use it in GitHub Desktop.
Save fernandozamoraj/7bb43b727c481bcc12e6 to your computer and use it in GitHub Desktop.
import sys
import _winreg
#this checker only works on a windows box... i tested it on my windows 7 64bit box
#this script displays the history of your wifi connections... or better said
#all the wifi connections that you have previously used
def val2addr(val):
addr = ''
for ch in val:
addr += '%02x '% ord(ch)
addr = addr.strip(' ').replace(' ', ':')[0:17]
return addr
def printNets():
net ="Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkList\\" + \
"Signatures\\Unmanaged\\"
try:
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, net, 0,_winreg.KEY_WOW64_64KEY + _winreg.KEY_ALL_ACCESS)
except:
print sys.exc_info()
print key
print '\n[*] Networks You have Joined.'
for i in range(100):
try:
guid = _winreg.EnumKey(key, i)
netKey = _winreg.OpenKey(key, str(guid))
(n, addr, t) = _winreg.EnumValue(netKey, 5)
(n, name, t) = _winreg.EnumValue(netKey, 4)
macAddr = val2addr(addr)
netName = str(name)
print '[+]' + netName + ' ' + macAddr
_winreg.CloseKey(netKey)
except:
e = sys.exc_info()[0]
print sys.exc_info()
break
def main():
printNets()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment