Skip to content

Instantly share code, notes, and snippets.

@faidamine
Created September 4, 2017 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faidamine/6a7df9fd0bd50543d09e8e531b360555 to your computer and use it in GitHub Desktop.
Save faidamine/6a7df9fd0bd50543d09e8e531b360555 to your computer and use it in GitHub Desktop.
#usr/bin/python
#Faid Mohammed Amine
#Fb : piratuer
import commands
import string
## [Reverse] Tokyo Westerns CTF 3rd 2017 - Rev Rev Rev
bl = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!()"
def get_nums(dic):
for key in bl:
res = commands.getstatusoutput('echo "'+str(key)+'" | ltrace -o res -e strcmp ./revrev')
text=open('res')
ltr=str(text.read().split('"')[1]).replace("\\","")
dic[ltr] = key
return dic
def get_lettre(dic):
for key in bl:
res = commands.getstatusoutput('echo "'+str(key)+'" | ltrace -o res -e strcmp ./revrev')
text=open('res')
ltr=str(text.read().split('"')[1]).replace("\\","")
dic[key] = ltr
return dic
flag = ""
dico = {}
dico2 = {}
get_nums(dico)
get_lettre(dico2)
encrypted = "A ( 331 e 241 361 341 311 031 t 223 023 241 t 271 I 271 211 335 a 1 i 241 361 q ! 235 325 = 025 325".split(" ")
for a in encrypted:
if a in dico:
flag += str(dico[a])
else:
flag += str(dico2[a])
print(flag)
#TWCTF{qpzisyDnbmboz76oglxpzYdk}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment