Created
May 14, 2023 08:19
-
-
Save toxxic407/48c5c9730c0d5f6852f00978755b9d2b to your computer and use it in GitHub Desktop.
script to generate a wordlist with all valid WPS-Pins (7 digits + 1 digit checksum)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding:utf-8 -*- | |
""" | |
* Copyright (c) 2015 Sputkin . | |
* | |
* Tp-link_W_gen is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, version 3. | |
* | |
* Tp-link_W_gen is distributed in the hope that it will be useful, but | |
* WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
* General Public License for more details. | |
* | |
* You should have received a copy of the GNU General Public License | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
""" | |
from itertools import product | |
import sys | |
def checksum(pin): | |
''' | |
Standard WPS checksum algorithm. | |
@pin — A 7 digit pin to calculate the checksum for. | |
Returns the checksum value. | |
''' | |
accum = 0 | |
while pin: | |
accum += (3 * (pin % 10)) | |
pin = int(pin / 10) | |
accum += (pin % 10) | |
pin = int(pin / 10) | |
return ((10 - accum % 10) % 10) | |
def main(): | |
print "" | |
print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" | |
print "! Respect the privacy of others." | |
print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" | |
print "" | |
counter = 0 | |
wordlist = open("wordlist.txt","w") | |
print ("[+] The file will be saved in the current directory !!") | |
print ("[+] create wordlist...") | |
for x in range(10000000): | |
wordlist.write('{:07d}'.format(x)+'{}'.format(checksum(x))+"\n") | |
counter +=1 | |
return counter | |
if __name__ == "__main__": | |
size = main() | |
print("[+] total key generated %s size %d Mb"%(size,(size*9)/1000000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment