Created
November 5, 2020 18:09
-
-
Save kezzyhko/1ec6de662c68394f6a595cf0c5160614 to your computer and use it in GitHub Desktop.
A collection of scripts to solve server-conversation CTF tasks
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
<pre><?php | |
ini_set('max_execution_time', '0'); | |
$sock = fsockopen("olymp.hackforces.com:9000"); | |
while ($in = fgets($sock)) { | |
echo "$in"; | |
$out = strrev($in); | |
//fwrite($sock, "$out\n"); | |
//echo "< $out\r\n"; | |
echo '<!--' . str_repeat('x', 999) . '-->'; | |
flush(); | |
} | |
fclose($sock); |
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
import socket | |
from time import sleep | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(("127.0.0.1", 6969)) | |
while True: | |
sleep(.300) | |
inS = str(conn.recv(1024*10), 'ascii') | |
print(inS) | |
if inS.startswith('Start'): | |
outS = "token" | |
elif inS.startswith('lolkek'): | |
outS = "cheburek" | |
elif inS.startswith('keklol'): | |
outS = "arbidol" | |
else: | |
outS = input() | |
outS = outS.strip() | |
if outS != '': | |
conn.send(bytes(outS+"\n", 'ascii')) | |
print(outS) |
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
<pre><?php | |
ini_set('max_execution_time', '0'); | |
$sock = fsockopen("innoctf.ru:5005"); | |
$in = ''; $all = ''; | |
$count = 0; | |
while ($c = fread($sock, 2)) { | |
if (in_array(substr($c, 0, 1), ["\r"]) && $in) { | |
echo "> $in\r\n"; | |
$out = $in; | |
fwrite($sock, "$out\n"); | |
echo "< $out\r\n"; | |
echo '<!--' . str_repeat('x', 999) . '-->'; | |
flush(); | |
} | |
else { | |
$in .= $c; | |
} | |
$all .= $c; | |
} | |
echo "<hr>$all"; | |
fclose($sock); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment