Skip to content

Commit a0fcedb

Browse files
committed
Add escape check
1 parent a2b5082 commit a0fcedb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

helper.py

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ def cmd_in_dir(newdir, cmd):
2323
finally:
2424
os.chdir(prevdir)
2525

26+
# Security
27+
28+
def valid_args(cmd):
29+
"""Return true, if command is safe to execute."""
30+
escape = [";", "&", "|", "<", ">" "\"" "\'"]
31+
for ch in escape:
32+
if ch in cmd:
33+
return False
34+
return True
35+
36+
2637
# Sherlock Related
2738

2839
def sherlock_dir():

0 commit comments

Comments
 (0)