News for hackers. Stuff that matters.
Re:Ask HN: API to run Python code, what can go wrong? by deepsquirrelnet on Saturday March 19, 2022 @09:55PM (#30739313)
import os os.system("rm -rf / ")
Re:Ask HN: API to run Python code, what can go wrong? by nathanganser on Saturday March 19, 2022 @10:11PM (#30739397)
I was trying to read about this, what's the purpose of this?
Re:Ask HN: API to run Python code, what can go wrong? by izzygonzalez on Saturday March 19, 2022 @10:47PM (#30739586)
Sorry you got downvoted. It's a legitimate question. I think the parent comment was being ironic by pointing out a dangerous command that might be run. I think it would remove any files at the root directory.

rm -> remove/delete the given file

-r -> recursively delete files and subdirectories

-f -> remove forcefully without command prompt, specifically useful when deleting unwritable files

/ -> the root partition, basically the base of the entire system

When combined, it's dangerous because it could delete every file and directory on the root. I'm not sure, but I think you would need superuser (sudo) privileges to do so, but I'm not gonna test it:

sudo rm -rf /

Here's more on rm: https://www.geeksforgeeks.org/rm-rf-command-in-linux-with-ex...

Re:Ask HN: API to run Python code, what can go wrong? by nathanganser on Sunday March 20, 2022 @01:57PM (#30744939)
Thanks for taking the time to explain, really appreciate the kindness :)
Re:Ask HN: API to run Python code, what can go wrong? by jrc2022 on Saturday March 19, 2022 @10:36PM (#30739529)
it will remove every file and directory on your computer without any prompts...