Python

Python

Python is a high-level, interpreted programming language known for its simplicity and readability.

Modules

os.path

os.path.join("uploads/", "flag.txt")  # uploads/flag.txt
os.path.join("uploads/", "/flag.txt") # /flag.txt
os.path.join("uploads/", "../flag.txt")  # uploads/../flag.txt

re

FunctionDescription
re.match()checks for a match only at the beginning of the string
re.search()checks for a match anywhere in the string
re.fullmatch()checks for entire string to be a match
>>> re.match(r"\.", "../../../../etc/passwd") # match!
<re.Match object; span=(0, 1), match='.'>

>>> re.match(r"\.", "/../../../../etc/passwd") # no match!

Testing Python regex: