Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby -w
- #list of potentional passwords
- passphraseList = ['possibility1','possibility2','possibility3']
- $allPhrases=''
- $countList=0
- passphraseList.each do |passphrase|
- def display(phrase)
- if phrase.length != 1
- $allPhrases<<phrase
- $allPhrases<<'
- '
- end
- $countList += 1
- end
- def scramble(passphrase)
- characters = " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
- list = []
- # transpose adjacent chars
- (passphrase.length - 1).times do |i|
- testphrase = passphrase.dup
- testphrase[i] = passphrase[i+1]
- testphrase[i+1] = passphrase[i]
- list << testphrase
- end
- # delete one char
- passphrase.length.times do |i|
- testphrase = passphrase.dup
- testphrase = testphrase[0,i] + testphrase[(i+1)..-1]
- list << testphrase
- end
- # substitutute one char
- passphrase.length.times do |i|
- characters.chars.each do |c|
- testphrase = passphrase.dup
- testphrase[i] = c
- list << testphrase
- end
- end
- # insert one char
- (passphrase.length + 1).times do |i|
- characters.chars.each do |c|
- testphrase = passphrase.dup
- testphrase.insert(i, c)
- list << testphrase
- end
- end
- return list.uniq
- end
- list1 = scramble(passphrase)
- list1.each { |i| display i }
- print 'total count'
- print $countList
- fo = open("wordlist.txt","w")
- fo.write( $allPhrases )
- fo.close()
- end
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement