Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active April 3, 2024 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/234f3b1d3a82bfc9bba82d8bb0af642c to your computer and use it in GitHub Desktop.
Save mcsee/234f3b1d3a82bfc9bba82d8bb0af642c to your computer and use it in GitHub Desktop.
def calculate(mathOperand, firstArgument, secondArgument):
return eval(f'{firstArgument} {mathOperand} {secondArgument}')
# Sample usage to multiply two numbers
result = calculate('*', 4, 6)
# Injection to remove all files
calculate('', "__import__('os').system('rm -rf *')",''))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment