Skip to content

Instantly share code, notes, and snippets.

@NullArray
Created May 30, 2018 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NullArray/c5d127ec48aea708525936e762904312 to your computer and use it in GitHub Desktop.
Save NullArray/c5d127ec48aea708525936e762904312 to your computer and use it in GitHub Desktop.
Wrapper for `crunch` that filters out results that are only strings of numbers.
#!/usr/bin/env python2.7
#____ ____ __
#\ \ / /____ _____/ |_ ___________
# \ Y // __ \_/ ___\ __\/ _ \_ __ \
# \ /\ ___/\ \___| | ( <_> ) | \/
# \___/ \___ >\___ >__| \____/|__|
# \/ \/
############################################
import subprocess
import re
def cmdline(command):
process = subprocess.Popen(
args=command,
stdout=subprocess.PIPE,
shell=True)
return process.communicate()[0]
print """\nWe're making a list, we're checking it twice.
We're gonna find strings who are naughty or nice!
By the way, if you want to add a limit to the amount of strings generated
just type the amount in the upcoming prompt. If you want no limit, provide
a value of '0' without the quotation marks.
\n"""
amount = raw_input("Input limit: ")
if amount == '0':
limit = ''
else:
limit = ' -c ' + amount
template = "crunch 8 8 ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + limit
print "\nCrunching the numbers, please stand by...\n"
operation = cmdline(template)
result = re.sub(r'\b[0-9]+\b\W*', '', operation)
print "\nWriting results to 'wifi.lst.'\n"
with open("wifi.lst", "ab") as outfile:
for line in result:
outfile.write(line)
print "Done! Find your list in the current working directory."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment