from pwn import*from string import ascii_lettersdefshift(string,offset): result =''for c in string: result +=chr((ord(c)+offset-97)%26+97)if c in ascii_letters else creturn resultflag = [' ']*50r =remote('jh2i.com', 50034)r.sendline(r.recvline())whileTrue: 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='')
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 rer =remote('jh2i.com', 50031)weapons = [100000,10000,2000,1000,100]whileTrue: 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 errorif 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:
flag{it_was_in_fact_you_that_was_really_powerful}
Merriam
flag{you_know_the_dictionary_so_you_are_hired}
from pwn import*import enchantwordlist = enchant.Dict('en-US')notin =lambdax: not wordlist.check(x)isin =lambdax: wordlist.check(x)r =remote('jh2i.com', 50012)whileTrue: line = r.recvline().decode()print(line) words = r.recvline().decode()print(words) words = words.split() func = notin if'NOT'in line else isinif'CHRONOLOGICAL'in line: result =' '.join(word for word in words iffunc(word))elif'ALPHABETICAL'in line: result =' '.join(sorted(word for word in words iffunc(word)))else: result =str(sum(map(func, words))) r.sendline(result)print(r.recvline().decode())