Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pybluez = "==0.21"
pyyaml = "==3.11"
argh = "==0.26.1"
colorama = "==0.3.3"
dnet = "==1.12"
docopt = "==0.6.2"
dpkt = "==1.8.6"
impacket = "==0.9.12"
iwlib = "==1.5"
libnl = "==0.2.0"
netaddr = "==0.7.14"
netlink = "==1.0"
pathtools = "==0.1.2"
pcapy = "==0.10.8"
prettytable = "==0.7.2"
pycparser = "==2.10"
pyroute2 = "==0.3.6"
scapy = "==2.3.1"
terminaltables = "==1.1.1"
watchdog = "==0.8.3"
wireless = "==0.3.0"
wireless-radar = "==0.2.1"
wsgiref = "==0.1.2"
colorclass = "==1.2.0"
pbkdf2 = "==1.3"
python-wifi = "==0.6.0"
wifi = "==0.3.4"
python-wifi-master = {editable = true, ref = "2d20c4f0d057833d5b851280ed2133b0b82bf69c", git = "git+https://github.com/pingflood/pythonwifi.git"}
py80211-master = {editable = true, ref = "4f6ef735d96bddc24a0090af8876bb20a84fb3ff", git = "git+https://github.com/arend/py80211"}

[dev-packages]

[requires]
python_version = "3.11"
python_full_version = "3.11.8"
26 changes: 12 additions & 14 deletions belkin-wpspin.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# http://ednolo.alumnos.upv.es/?p=1295

'''
Created on Dec 9, 2012


@author       : [email protected]
@author : [email protected]

Original work : ZhaoChunsheng 04/07/2012


'''


import sys

VERSION = 0
SUBVERSION = 2

def usage():
print "[+] WPSpin %d.%d " % (VERSION, SUBVERSION)
print "[*] Usage : python WPSpin.py 123456"
print("[+] WPSpin %d.%d " % (VERSION, SUBVERSION))
print("[*] Usage : python WPSpin.py 123456")
sys.exit(0)

def wps_pin_checksum(pin):
accum = 0
while(pin):
accum += 3 * (pin % 10)
pin /= 10
pin //= 10 # Change to ensure integer division
accum += pin % 10
pin /= 10
pin //= 10 # Change to ensure integer division
return (10 - accum % 10) % 10

try:
if (len(sys.argv[1]) == 6):
p = int(sys.argv[1] , 16) % 10000000
print "[+] WPS pin is : %07d%d" % (p, wps_pin_checksum(p))
p = int(sys.argv[1], 16) % 10000000
print("[+] WPS pin is : %07d%d" % (p, wps_pin_checksum(p)))
else:
usage()
except Exception:
usage()
except IndexError: # Handles missing sys.argv[1]
usage()
except ValueError: # Handles invalid int conversion
usage()
37 changes: 17 additions & 20 deletions easybox_wps.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
#!/usr/bin/env python
import sys, re

def gen_pin (mac_str, sn):
mac_int = [int(x, 16) for x in mac_str]
sn_int = [0]*5+[int(x) for x in sn[5:]]
def gen_pin(mac_str, sn):
mac_int = [int(mac_str[i:i+2], 16) for i in range(0, len(mac_str), 2)]
sn_int = [0] * 5 + [int(x) for x in sn[5:]]
hpin = [0] * 7

k1 = (sn_int[6] + sn_int[7] + mac_int[10] + mac_int[11]) & 0xF
k2 = (sn_int[8] + sn_int[9] + mac_int[8] + mac_int[9]) & 0xF
hpin[0] = k1 ^ sn_int[9];
hpin[1] = k1 ^ sn_int[8];
hpin[2] = k2 ^ mac_int[9];
hpin[3] = k2 ^ mac_int[10];
hpin[4] = mac_int[10] ^ sn_int[9];
hpin[5] = mac_int[11] ^ sn_int[8];
hpin[6] = k1 ^ sn_int[7];
pin = int('%1X%1X%1X%1X%1X%1X%1X' % (hpin[0], hpin[1], hpin[2], hpin[3], hpin[4], hpin[5], hpin[6]), 16) % 10000000
hpin[0] = k1 ^ sn_int[9]
hpin[1] = k1 ^ sn_int[8]
hpin[2] = k2 ^ mac_int[9]
hpin[3] = k2 ^ mac_int[10]
hpin[4] = mac_int[10] ^ sn_int[9]
hpin[5] = mac_int[11] ^ sn_int[8]
hpin[6] = k1 ^ sn_int[7]
pin = int('%1X%1X%1X%1X%1X%1X%1X' % tuple(hpin), 16) % 10000000

# WPS PIN Checksum - for more information see hostapd/wpa_supplicant source (wps_pin_checksum) or
# http://download.microsoft.com/download/a/f/7/af7777e5-7dcd-4800-8a0a-b18336565f5b/WCN-Netspec.doc
accum = 0
t = pin
while (t):
while t:
accum += 3 * (t % 10)
t /= 10
t //= 10
accum += t % 10
t /= 10
t //= 10
return '%i%i' % (pin, (10 - accum % 10) % 10)

def main():
Expand All @@ -37,10 +35,9 @@ def main():
sys.exit('check MAC format!\n')

sn = 'R----%05i' % int(mac_str[8:12], 16)
print 'derived serial number:', sn
print 'SSID: Arcor|EasyBox|Vodafone-%c%c%c%c%c%c' % (mac_str[6], mac_str[7], mac_str[8], mac_str[9], sn[5], sn[9])
print 'WPS pin:', gen_pin(mac_str, sn)
print('derived serial number:', sn)
print('SSID: Arcor|EasyBox|Vodafone-%c%c%c%c%c%c' % tuple(mac_str[6:12]))
print('WPS pin:', gen_pin(mac_str, sn))

if __name__ == "__main__":
main()