Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The danger of just trusting the cat command
#!/usr/bin/env python3
hidden_cmd = "echo 'You forgot to check `cat -A`!' > oops"
visible_cmd = "echo 'Hello world!'"
if __name__ == "__main__":
with open("demo.sh", "w") as f:
txt = "#!/bin/sh\n"
txt += hidden_cmd + ";" + visible_cmd + " #\r" + visible_cmd + " " * (len(hidden_cmd) + 3) + "\n"
f.write(txt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment