Author Topic: 5Gen  (Read 10387 times)

mad_dev

  • Newbie
  • *
  • Posts: 8
    • View Profile
on: December 05, 2013, 11:34:44 PM
Please Note: The size of testing DIR will be 2.5 GB
Code: [Select]
#!/usr/bin/env python

'''Generate Organised Wordlists Based On Crunch (5Gen.py)'''
'''NOTE: The size of testing DIR will be 2.5 GB'''

__author__ = ["A'mmer Almadani:Mad_Dev", "penbang.sysbase.org"]
__email__  = ["mad_dev@linuxmail.org", "mail@sysbase.org"]

import os
import re

# Requires crunch
# Change param for use on other lengths
seq = 'aA0'  #Seq. to generate file names
out = seq+'.txt' #name of file that has all the file names

a = 'a'
A = 'A'
ZERO = '0'


def getFileName(seq, out): #Crunch Command to generate file names

os.system('crunch 5 5 '+seq+' -o '+out)
#Create seq.txt | in this example it will start from aaaaa and end in 00000


def createFiles(out):

op = open(out,'r') #open the file that has the file names(seq.txt)
rd = op.readlines()
op.close()

print 'Creating Files...'
 
for s in rd:
lines = s.splitlines() # To remove \n
#TODO: Could add indicator as to how many files are left
for line in lines:
add = line.replace(a,'z').replace(A,'Z').replace(ZERO,'9') #This is needed to add the other part of the name
files = 'testing/'+line+'-'+add+'.txt'

cr = file(files, 'a')

rep = line.replace(a, '@').replace(A, ',').replace(ZERO, '%') #@ lalpha , uaplha % numeric
os.system('crunch 5 5 -t '+rep+' -o '+files)

print 'Done'


if __name__ == '__main__':

print 'Generating File Names...'
getFileName(seq, out)
createFiles(out)