Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import socket
- #tyinternet
- def caesar(message, key):
- translated = ''
- for symbol in message:
- if symbol.isalpha():
- num = ord(symbol)
- num += key
- if symbol.isupper():
- if num > ord('Z'):
- num -= 26
- elif num < ord('A'):
- num += 26
- elif symbol.islower():
- if num > ord('z'):
- num -= 26
- elif num < ord('a'):
- num += 26
- translated += chr(num)
- else:
- translated += symbol
- return translated
- dict = open('en_US.dictionary','r').read().split('\n')
- dict = dict[0::4] # n33d4sp33d
- socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- socket.connect(("web."+"l"+"a"+"s"+"a"+"c"+"t"+"f"+".com", 4056))
- while True:
- msg = socket.recv(1024).strip()
- if ("l"+"a"+"s"+"a"+"c"+"t"+"f") in msg:
- print msg
- break
- maxcount = 0
- ans = ''
- for sh in range(0,26):
- count = 0
- dec = caesar(msg,sh)
- for word in dict:
- if word in dec:
- count = count + 1
- if count >= maxcount:
- maxcount = count
- ans = str(dec)
- socket.send(ans+'\n')
- socket.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement