Spbctf winter meetup. My tasks writeups
@ Rakovsky Stanislav | Saturday, Jan 30, 2021 | 2 minutes read | Update at Saturday, Jan 30, 2021

I’ve written three tasks for my speech on spbctf winter meetup 2020. Here are writeups on them.

Tasks:

You can watch the writeup on YouTube (on russian).

(open the post to view more)

Writeup status: In progress! Need to catch some time to describe it in English completely. You can see some main points on the pictures below. If you have some questions - contact me)

Odna pika

>>> a = ['s', 'b', 't', '{', '1', 's', '_', '4', 'k']
>>> b = ['}', 'S', '7', '7', 'r', 'f', 'f', 'c', 'p'][::-1]
>>> "".join(a[i] + b[i] for i in range(len(a)))
'spbctf{f1rs7_74Sk}'

Dve piki

>>> a = marshal.loads(open("pyc_spbctf_2.pyc", "rb").read())
>>> marshal.loads(open("pyc_spbctf_2.pyc", "rb").read()[len(a)+5:])
(<code object spbctf at 0x7f71951036b0, file "pyc_spbctf_2.py", line 3>, -1, None, '__main__', 2, 1)
c = marshal.loads(open("pyc_spbctf_2.pyc", "rb").read()[len(a)+5:])

Tri piki

>>> import bytecode_graph
>>> import marshal
>>> import sys, uncompyle6
>>> from dis import opmap
>>> bcg = bytecode_graph.BytecodeGraph(marshal.loads(open("pyc_spbctf_3.n.pyc", "rb").read()[8:]))
>>> nodes = [x for x in bcg.nodes()]
>>> for n in nodes:
...  if n.opcode == opmap['NOP']:
...   bcg.delete_node(n)
...
>>> new_code = bcg.get_code()
>>> new_code
<code object <module> at 0x7f5c90502bb0, file "pyc_spbctf_3.py", line 4>
>>> uncompyle6.main.decompile(2.7, new_code, sys.stdout)
# uncompyle6 version 3.7.3
# Python bytecode 2.7
# Decompiled from: Python 2.7.17 (default, Nov  7 2019, 10:07:09)
# [GCC 7.4.0]
# Embedded file name: pyc_spbctf_3.py
import sys
if len(sys.argv) != 2:
    print 'Bye!'
    exit()
if len(sys.argv[1]) == 25 or len(sys.argv[1]) == 27:
    print 'Bye-bye!'
    exit()
if len(sys.argv[1]) != 26:
    print 'Bye-bye!'
    exit()
a = sys.argv[1]
if not all([a[0] == 's',
 a[1] == 'p',
 a[2] == 'b',
 a[3] == 'c',
 a[4] == 't' and a[5] == 'f' and a[6] == '{']):
    print 'Wow, but not'
    exit()
if any([a[25] != '}', a[24] != 'k']):
    print 'Bruh'
    exit()
if a[7] == '0' and a[8] == 'c' and a[9] == 'h' and a[10] == 'e' and a[11] == 'n' and a[12] == '_' and a[13] == 'z' and a[14] == 'l' and a[15] == '0' and a[16] == 'j' and a[17] == 'n' and a[18] == '1' and a[19] == 'j' and a[20] == '_' and a[21] == '7' and a[22] == '4' and a[23] == 's' and a[24] == 'k':
    print 'Great!'
else:
    print 'Ahhh'<uncompyle6.semantics.pysource.SourceWalker object at 0x7f5c904c97d0>

Cats!

Under construction

Wow! Flipable!

Hello from another side of the Moon!

Looking for a flag? Okay, take this:
LFXXKIDBOJSSA43XMVSXIIC6LYQCAIA=

About me

Under construction. You can try to contact me and fill this field… haha… ha…