Barbara Liskov
Barbara Liskov
Barbara Liskov (born November 7, 1939 as Barbara Jane Huberman) is an American computer scientist who has made pioneering contributions to programming languages and distributed computing. Her notable work includes the development of the Liskov substitution principle which describes the fundamental nature of data abstraction, and is used in type theory (see subtyping) and in object-oriented programming (see inheritance). Her work was recognized with the 2008 Turing Award, the highest distinction in computer science. - Wikipedia Entry
Description
Chal: Return the flag back to the 2008 Turing Award Winner
Author: Josh
Solution
We are given a pyc
file, which is python compiled bytecode.
Naive
Naive solution would be to use strings
and figure out the contents.
└─$ strings BarbaraLiskov.pyc
...
validate_inputr
Nz`Y2hjdGZ7dV9uM3Yzcl9uMzNkXzBwdDFtNGxfcDNyZjBybTRuYzMsX3VfbjMzZF9nMDBkLTNuMHVnaF9wM3JmMHJtNG5jM30=r
base64
...
Take what seems to be the Base64
blob -> Y2hjdGZ7dV9uM3Yzcl9uMzNkXzBwdDFtNGxfcDNyZjBybTRuYzMsX3VfbjMzZF9nMDBkLTNuMHVnaF9wM3JmMHJtNG5jM30=
Decode: chctf{u_n3v3r_n33d_0pt1m4l_p3rf0rm4nc3,_u_n33d_g00d-3n0ugh_p3rf0rm4nc3}
Proper
Use Decompyle++ (pycdc) to recover original python code.
└─$ pycdc ./BarbaraLiskov.pyc
# Source Generated with Decompyle++
# File: BarbaraLiskov.pyc (Python 3.11)
import base64
def secret_code():
obfuscated_string = '492d576f6e2d412d547572696e672d4177617264'
return bytes.fromhex(obfuscated_string).decode('utf-8')
def validate_input(user_input):
return user_input == secret_code()
def print_the_flag():
encoded_string = 'Y2hjdGZ7dV9uM3Yzcl9uMzNkXzBwdDFtNGxfcDNyZjBybTRuYzMsX3VfbjMzZF9nMDBkLTNuMHVnaF9wM3JmMHJtNG5jM30='
bytes = base64.b64decode(encoded_string)
data = bytes.decode('utf-8')
print(data)
def main():
user_input = input('Enter the digital code >>> ')
if validate_input(user_input):
print_the_flag()
return None
None('<<< Incorrect code.')
if __name__ == '__main__':
main()
return None
➜ py
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64
>>> def print_the_flag():
... encoded_string = 'Y2hjdGZ7dV9uM3Yzcl9uMzNkXzBwdDFtNGxfcDNyZjBybTRuYzMsX3VfbjMzZF9nMDBkLTNuMHVnaF9wM3JmMHJtNG5jM30='
... bytes = base64.b64decode(encoded_string)
... data = bytes.decode('utf-8')
... print(data)
...
>>> print_the_flag()
chctf{u_n3v3r_n33d_0pt1m4l_p3rf0rm4nc3,_u_n33d_g00d-3n0ugh_p3rf0rm4nc3}
Flag: chctf{u_n3v3r_n33d_0pt1m4l_p3rf0rm4nc3,_u_n33d_g00d-3n0ugh_p3rf0rm4nc3}
Last updated