Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- def permutate(charset, keyLength=None):
- charset=str(charset)
- if keyLength is None:
- keyLength = len(charset)
- hasil=[]
- for x in range(len(charset)):
- y = charset[x:x+1]
- if keyLength == 1:
- hasil.append(y)
- else:
- hasil_ = charset[:x] + charset[x+1:]
- for z in permutate(hasil_, keyLength-1):
- hasil.append(y + z)
- return hasil
- cipher = '15,42,62,52,111,58,61,35,62,55,111,38,48,42,32,61,111,51,63,46,59,54,110,114,17,59,114,47,32,39,52,43,114,43,42,55,53,111,38,48,46,38,120,59,58,61,61,55,120,56,51,43,111,51,120,34,59,54,32,32,120,40,62,49,59,49,48,111,59,54,111,38,48,42,114,53,46,38,42,38,42,120,45,39,44,111,52,61,46,32,120,33,61,44,99,114,44,39,55,120,46,37,61,60,61,53,42,60,61,60,33,120,59,58,57,59,114,49,60,114,12,28,25,120,39,51,43,111,63,57,33,51,63,42,54,120,59,61,120,61,55,40,46,59,42,111,38,48,42,114,63,35,59,44,44,58,118,111,5,61,104,36,61,111,54,61,59,55,59,59,55,60,111,38,48,46,38,120,59,58,61,111,53,52,38,38,59,39,114,47,46,33,120,44,51,45,60,55,60,111,48,33,111,51,54,111,51,54,32,63,57,35,43,120,44,51,52,35,55,60,111,19,63,42,60,44,111,1,53,38,38,48,97,114,15,42,114,44,61,59,61,43,114,52,32,61,51,38,60,63,111,52,55,61,114,22,42,61,120,32,60,120,59,58,61,111,27,10,12,114,58,58,38,120,39,55,120,56,51,43,111,60,55,111,58,61,35,34,118,97,124,118,46,38,120,46,62,52,97,114,22,32,37,120,59,58,57,59,114,47,42,114,48,46,36,61,111,43,55,58,32,120,46,38,44,42,60,44,38,61,54,99,114,47,42,114,54,42,55,60,111,11,23,26,114,44,32,114,62,38,60,60,111,51,54,43,114,60,42,33,44,61,61,33,111,19,63,42,60,44,111,1,53,38,38,48,111,39,43,38,60,63,111,51,120,60,39,40,42,32,117,0,31,30,8,127,61,35,59,44,42,127,40,46,33,43,56,61,42,43,114,119,111,52,52,46,53,120,56,58,49,44,58,120,38,33,120,42,39,52,42,32,40,61,61,58,35,55,53,122,107,118,111,26,61,61,55,127,60,114,57,111,38,49,63,126,120,59,58,61,111,57,61,54,114,49,60,114,107,111,49,48,46,32,43,97,88'
- cipher_split = [int(i) for i in cipher.split(',')]
- while len(cipher_split)%3!=0:
- cipher_split.append(0)
- cipher1=[cipher_split[i:i+3] for i in range(0,len(cipher_split),3)]
- # charset untuk bruteforce: [a-zA-Z]
- # length untuk key diset kpd 3 sbb klu "Three is a crowd" dan ni celen crypto300
- for i in permutate('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',3):
- temp=''
- for j in cipher1:
- temp+=''.join((chr(ord(i[0])^j[0]),chr(ord(i[1])^j[1]),chr(ord(i[2])^j[2])))
- # cari perkataan " the " dlm decoded string sebelum stop loop bruteforce
- # sbb biasanya dalam bahasa english perkataan " the " mst ada
- if temp[:-2].count(' the ')>1:
- print 'The key: ' + i[0]+i[1]+i[2]
- print 'Message: ' + temp[:-2]
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement