Live data from Hacker News

Show HN: Run unknown shell script with a line-by-line confirmation prompt

gist.github.com

21–30 of 86 posts

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#21
If you are considering using this tool, then I would suggest that you seriously reevaluate your life choices. You should never run shell scripts without reading them first, ever. That is so irresponsible. Validating shell scripts will make you a more competent and informed worker. Tools like this breed incompetence, and encourage carelessness.

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#22
post #8

Possibly relevant, the bash restricted shell (bash -r): https://www.gnu.org/software/bash/manual/html_node/The-Restr...

> When a command that is found to be a shell script is executed (see Shell Scripts), rbash turns off any restrictions in the shell spawned to execute the script.

Can you provide example of a scenario where this restricted shell is useful?

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#23

If you are considering using this tool, then I would suggest that you seriously reevaluate your life choices. You should never run shell scripts without reading them first, ever. That is so irresponsible. Validating shell scripts will make you a more competent and informed worker. Tools like this breed incompetence, and encourage carelessness.

I want this to run my own shell scripts. I have a bunch of scripts that are halfway between "documentation" and "automation"; mostly the record of the last time I did X. Add a prompt to eval a command or two or change variables that are hard coded, and it's ipython for shell.

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#24
post #13
post #4

> Useful for running unknown scripts Or just, you know, read them before you run them.

One complication is that websites can hijack your copy buffer, and the text you paste isn't the text you copied. I avoid this by pasting into an editor, not directly into a shell.

newer versions of gnome-terminal have a feature where it will hold your paste buffer in the linefeed before executing anything, does not matter how long or how many line breaks there are. You can then inspect what you just paste into the terminal, even edit it, before actually executing it.

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#25

If you are considering using this tool, then I would suggest that you seriously reevaluate your life choices. You should never run shell scripts without reading them first, ever. That is so irresponsible. Validating shell scripts will make you a more competent and informed worker. Tools like this breed incompetence, and encourage carelessness.

I want this to run my own shell scripts. I have a bunch of scripts that are halfway between "documentation" and "automation"; mostly the record of the last time I did X. Add a prompt to eval a command or two or change variables that are hard coded, and it's ipython for shell.

> I want this to run my own shell scripts.

That's really the only use case for this tool that I could get behind, and I commend you for your diligence.

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#26

If you are considering using this tool, then I would suggest that you seriously reevaluate your life choices. You should never run shell scripts without reading them first, ever. That is so irresponsible. Validating shell scripts will make you a more competent and informed worker. Tools like this breed incompetence, and encourage carelessness.

I assume you also read all the source code for every program you run too?

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#27

It’s probably possible to craft a script that looks innocuous line-by-line, but does something malicious as a whole.

Indeed. If the person does not understand why/what is encoded by things like xxd or base64 or using tr to swap/filter characters, then one should hopefully pull the eject lever. When in doubt, one can sandbox scripts and see what they are in effect trying to do.

Or LFS=

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#29

If you are considering using this tool, then I would suggest that you seriously reevaluate your life choices. You should never run shell scripts without reading them first, ever. That is so irresponsible. Validating shell scripts will make you a more competent and informed worker. Tools like this breed incompetence, and encourage carelessness.

> You should never run shell scripts without reading them first, ever. That is so irresponsible.

Do you run on Gentoo? and presumably read the millions of lines of code your machine is running on?

People have been downloading and running executables almost pretty much as as the internet has been around... and the world is still going 'round.

Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt

#30

If you are considering using this tool, then I would suggest that you seriously reevaluate your life choices. You should never run shell scripts without reading them first, ever. That is so irresponsible. Validating shell scripts will make you a more competent and informed worker. Tools like this breed incompetence, and encourage carelessness.

> You should never run shell scripts without reading them first, ever. That is so irresponsible. Do you run on Gentoo? and presumably read the millions of lines of code your machine is running on? People have been downloading and running executables almost pretty much as as the internet has been around... and the world is still going 'round.

I understand your point, but there is a big difference between running a 20 year old program written in C and running a shell script that someone with one or two years of experience hacked out in ten minutes. To answer your question, I do fuzz many of the GNU utilities that I use regularly, and I have discovered vulnerabilities that way. Of course it is unreasonable to read all of the code that runs in our operating systems, but it is not unreasonable to read shell scripts before you run them.
Post reply on HN