Created
June 17, 2014 23:31
-
-
Save caioluders/1a4b7cc151f703f5a3c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Chosen-plaintext attack (CPA) | |
http://en.wikipedia.org/wiki/Chosen-plaintext_attack | |
no "K2 - Cryptographic Hash" do KoubackTr | |
by geolado | g3ol4d0 | |
A ideia eh simples . Ele cria uma lista com os caraceteres e manda para codificar , | |
depois retorna o resultado para cada caractere , "quebrando" a codificacao . | |
''' | |
import os , string | |
def cipher(i) : | |
cmd = "echo "+i+" | perl kouba_encode.pl" | |
output = os.popen(cmd).read().split() # roda cada caractere e retorna o resultado | |
return output[len(output)-1] | |
def main() : | |
chars = list(string.ascii_letters+string.digits) # Cria lista com caracters basicos , sem pontuacao etc e tal | |
exposed = {} | |
for i in chars : | |
exp = cipher(i) | |
exposed[i] = exp # dicionario crackeado (: | |
for i in chars : | |
print i + " == " + exposed[i] | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment