arrow-left

All pages
gitbookPowered by GitBook
1 of 4

Loading...

Loading...

Loading...

Loading...

rotten: caesars

from pwn import *
from string import ascii_letters

def shift(string, offset):
    result = ''
    for c in string:
        result += chr((ord(c)+offset-97)%26 + 97) if c in ascii_letters else c
    return result

flag = [' ']*50

r = remote('jh2i.com', 50034)
r.sendline(r.recvline())
while True:
    line = r.recvline().decode()
    offset = ord('s') - ord(line[0])
    decrypted = shift(line, offset)
    if 'character' in decrypted:
        flag[int(decrypted.split()[6])] = decrypted[-3]
    r.sendline(decrypted)
    print(*flag, sep='')

hashtag
flag{now_you_know_your_caesars}

Merriam

from pwn import *
import enchant

wordlist = enchant.Dict('en-US')

notin = lambda x: not wordlist.check(x)
isin = lambda x: wordlist.check(x)

r = remote('jh2i.com', 50012)
while True:
    line = r.recvline().decode()
    print(line)
    words = r.recvline().decode()
    print(words)
    words = words.split()
    func = notin if 'NOT' in line else isin
    if 'CHRONOLOGICAL' in line:
        result = ' '.join(word for word in words if func(word))
    elif 'ALPHABETICAL' in line:
        result = ' '.join(sorted(word for word in words if func(word)))
    else:
        result = str(sum(map(func, words)))
    r.sendline(result)
    print(r.recvline().decode())

hashtag
flag{you_know_the_dictionary_so_you_are_hired}

Scripting

Gnomes

This was a fairly simple scripting challenge. This relies on getting enough gold for each weapon tier, and working your way up.

from pwn import *
import re

r = remote('jh2i.com', 50031)
weapons = [100000, 10000, 2000, 1000, 100]
while True:
    prompt = r.recvuntil('>').decode()
    print(prompt)
    gold = int(re.findall('Gold: \d+', prompt)[0].split()[1])
    print(gold)
    try: # The try and except was because I'm dumb and when you have nothing in the weapons list you get an index error
        if gold >= weapons[-1]:
            weapons.pop()
            r.sendline('6')
            r.recvuntil(':')
            r.sendline(str(5 - len(weapons)))
        else:
            r.sendline(str(len(weapons) + 1))
    except:
        r.sendline('1')

Flag:

hashtag
flag{it_was_in_fact_you_that_was_really_powerful}