Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0x41414141 CTF 2021 - file reader #5

Open
aszx87410 opened this issue Jan 31, 2021 · 0 comments
Open

0x41414141 CTF 2021 - file reader #5

aszx87410 opened this issue Jan 31, 2021 · 0 comments
Labels

Comments

@aszx87410
Copy link
Owner

題目給了一個 python script:

import glob

blocked = ["/etc/passwd", "/flag.txt", "/proc/"]

def read_file(file_path):
    for i in blocked:
        if i in file_path:
                return "you aren't allowed to read that file"
    
    try:
        path = glob.glob(file_path)[0]
    except:
        return "file doesn't exist"
    
    return open(path, "r").read()

user_input = input("> ")
print(read_file(user_input))

寫過同比賽的 hackme 之後這題就秒解了:

/f*
@aszx87410 aszx87410 added the Misc label Jan 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant