Created
September 4, 2017 10:05
-
-
Save faidamine/808249b33a277abb942b2ce3762d8220 to your computer and use it in GitHub Desktop.
This file contains 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
#usr/bin/python | |
#Faid Mohammed Amine | |
#Fb : piratuer | |
from pwn import * | |
### [PPC] Tokyo Westerns CTF 3rd 2017 - Palindromes Pairs - Coding Phase | |
def palindrome(num): | |
return num == num[::-1] | |
s = remote("ppc1.chal.ctf.westerns.tokyo", 8765) | |
print s.recvuntil("--\n") | |
stg = 0 | |
while True: | |
stg += 1 | |
print s.recvuntil("/50\n") | |
number = s.recvuntil("\n") | |
print number | |
data= s.recvuntil("\n") | |
print data | |
lt=[] | |
lt=data.split(" ") | |
lt[len(lt)-1]=lt[len(lt)-1].replace("\n","") | |
cnt=0 | |
for i in lt: | |
for j in lt: | |
if palindrome(i+j): | |
cnt+=1 | |
print "[+] count : " + str(cnt) | |
s.sendline(str(cnt)) | |
print s.recvuntil("!") | |
if stg ==50: | |
break | |
print s.recv(1024) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment