Skip to content

Commit

Permalink
Apply isort and black reformatting
Browse files Browse the repository at this point in the history
Signed-off-by: fore-tee <[email protected]>
  • Loading branch information
fore-tee committed Nov 29, 2024
1 parent d31dc5a commit e252d49
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/just_a_sim.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Simulating injection
# Simulating injection


def vulnerable_function():
# Attackers inputs something malicious
user_input = input("Enter a malicious command: ")
exec(user_input) # Will execute without validation or checks

exec(user_input) # Will execute without validation or checks


def test_injection():
# Simulate their input
malicious_input = "__import__('os').system('touch harmless_file')"

try:
# test injection of attackers input
# test injection of attackers input
exec(malicious_input)
print("Vulnerability tested: Command executed successfully.")
except Exception as e:
# error handling
# error handling
print(f"Error caught: {e}")

0 comments on commit e252d49

Please sign in to comment.