title: "Python" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-web/python.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/python.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#
Python#
Python-specific execution probe#
When an input appears to be evaluated as a Python expression, a harmless call to str() can help confirm that the result is being executed rather than reflected verbatim. Adapt the surrounding quotes to the injection context:[1]
"+str(True)+" # If True is printed, the expression was evaluated.
Do not treat this probe alone as proof that arbitrary statements or operating-system commands can run; the sink may expose only a restricted expression language.