| 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. | ##!/usr/bin/python ################################################################ # .___ __ _______ .___ # # __| _/____ _______| | __ ____ \ _ \ __| _/____ # # / __ |\__ \\_ __ \ |/ // ___\/ /_\ \ / __ |/ __ \ # # / /_/ | / __ \| | \/ <\ \___\ \_/ \/ /_/ \ ___/ # # \____ |(______/__| |__|_ \\_____>\_____ /\_____|\____\ # # \/ \/ \/ # # ___________ ______ _ __ # # _/ ___\_ __ \_/ __ \ \/ \/ / # # \ \___| | \/\ ___/\ / # # \___ >__| \___ >\/\_/ # # est.2007 \/ \/ forum.darkc0de.com # ################################################################ # uniGen.py - universal pattern based wordlist generator # fill the gaps in your wordlist / generate wordlists for wifi attacks # # darkc0de Crew # www.darkc0de.com # code low1z # # Greetz to # d3hydr8, rsauron, baltazar, inkubus, kopele, p47rick, houby # and the rest of the Darkc0de members # # examples: # # uniGen.py -s MyPassword99 # - generate a wordlist from a single word pattern # # uniGen.py -m plains.txt # - generate a top10 pattern list from a plain password file # - choose one pattern to generate a special wordlist # # uniGen.py -c # - constructor mode # - define pattern by word # - add prefix to pattern # - adjust count of words to be generated # - generate a wordlist with defined parameters # # NO DUPE CHECKS, average dupecount < 1% @ password length > 7 version = '0.2b' ldm = 'jun_10_09' import string, sys, time from random import choice from optparse import OptionParser def extPatConv(cword): text = '' for i in range ( len(cword) ): if cword[i] in string.ascii_lowercase: text = text + 'x' elif cword[i] in string.ascii_uppercase: text = text + 'X' elif cword[i] in string.digits: text = text + 'N' elif cword[i] in string.punctuation: text = text + 'S' else: break return text def PatternPwd(pattern): newpasswd = '' for i in range(len(pattern)): if pattern[i] == 'x': chars = string.ascii_lowercase newpasswd = newpasswd + choice(chars) if pattern[i] == 'X': chars = string.ascii_uppercase newpasswd = newpasswd + choice(chars) if pattern[i] == 'N': chars = string.digits newpasswd = newpasswd + choice(chars) return newpasswd def txt2top(fname): fp = open(fname, "r").readlines() mydic = {} for entry in fp: tmpgen = extPatConv(entry[:-1]) if mydic.has_key(tmpgen): mydic[tmpgen] += 1 else: mydic[tmpgen] = 1 tmplist = [] for pat,cnt in mydic.items(): if cnt not in tmplist: tmplist.append(cnt) tmplist.sort(reverse=True); tmpdic = {} print "\nNo \t: Count : Pattern\n" for x in range(0,20): for pat,cnt in mydic.items(): if cnt == tmplist[x]: tmpdic[pat] = cnt stecnt = 0 for pat,cnt in tmpdic.items(): stecnt += 1 print str(stecnt), "\t:", cnt, " \t", pat patkey = raw_input('Pattern Number: ') patarray = tmpdic[tmpdic.keys()[int(patkey)-1]] for pat,cnt in tmpdic.items(): if cnt == patarray: return pat parser = OptionParser() parser.add_option("-c", dest='construct',action='store_true', default=False, help="Start in Construct Mode") parser.add_option("-s",type='string', dest='single_plain',action='store', help="Single Password for generator") parser.add_option("-m",type='string', dest='plain_list',action='store', help="List of Plains for Top10 generator") parser.add_option("-w",type='string', dest='outfile',action='store', help="output filename for saving") (options, args) = parser.parse_args() print " _ ______" print " __ ______ (_) ____/__ ____" print " / / / / __ \\/ / / __/ _ \/ __ \\ code : low1z" print "/ /_/ / / / / / /_/ / __/ / / / modified :", ldm print "\__,_/_/ /_/_/\____/\___/_/ /_/ version :", version, "\n" if options.single_plain != None: tmppat = extPatConv(options.single_plain) numgen = raw_input("Number of Passwords to generate : ") if options.outfile == None: lclfn = raw_input("Saving as : ") else: lclfn = options.outfile fnp = open(lclfn, "w") if numgen.isdigit(): for x in range(0,int(numgen)): tmppp = PatternPwd(tmppat) fnp.write(tmppp+"\n") fnp.close() if options.plain_list != None: tmppat = extPatConv(txt2top(options.plain_list)) numgen = raw_input("Number of Passwords to generate : ") if options.outfile == None: lclfn = raw_input("Saving as : ") else: lclfn = options.outfile fnp = open(lclfn, "w") if numgen.isdigit(): for x in range(0,int(numgen)): tmppp = PatternPwd(tmppat) fnp.write(tmppp+"\n") fnp.close() if options.construct == True: pwdFin = ''; myPattern = ''; myprefix = '' GenCount = 10000 while pwdFin != 'exit': print "\n+-----------------+" print "| Current Prefix : ", myprefix print "| Current Pattern : ", myprefix+myPattern print "| Generator Count : ", GenCount print "+-----------------+\n" print "[1] Erase Current Pattern & Prefix" print "[2] Enter Plain Password" print "[3] Add Prefix (eg. SP-XXXNNX)" print "[4] Set Generator Count" print "[5] Fixed Length Generator (random)" print "\n[9] Generate" print "[0] EXIT" pwdFin = raw_input("\n( 1|2|3|4|5|9|0 ) : ") if pwdFin == '1': print "clearing prefix & pattern..." myPattern = ''; myprefix = '' if pwdFin == '2': myPattern = extPatConv(raw_input("Password : ")) if pwdFin == '3': myprefix = raw_input("Prefix : ") if pwdFin == '4': GenCount = raw_input("New Generator Count : ") if pwdFin == '5': mylen = raw_input("Lengh : ") if options.outfile == None: lclfn = raw_input("Saving as : ") else: lclfn = options.outfile fnp = open(lclfn, "w") for x in range(0, int(GenCount)): newpasswd = '' for i in range(0, int(mylen)): cchoice = [string.ascii_lowercase, string.ascii_uppercase, string.digits] chars = choice(cchoice) newpasswd = newpasswd + choice(chars) fnp.write(newpasswd+"\n") fnp.close() if pwdFin == '9': if options.outfile == None: lclfn = raw_input("Saving as : ") else: lclfn = options.outfile fnp = open(lclfn, "w") for x in range(0,int(GenCount)): tmppp = PatternPwd(myPattern) fnp.write(myprefix+tmppp+"\n") fnp.close() pwdFin = 'exit' if pwdFin == '0': pwdFin = 'exit' |