Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello. I'm trying to make process of restoring John the Ripper's .rec files. Instead of typing whole command:
john --restore=record | aircrack-ng -w - -b 00:11:22:33:44:55 record.cap
I tried with bash script:
#!/bin/bash
sudo john --restore=record | aircrack-ng -w - -b 00:11:22:33:44:55
It works as it is but...
John has a feature of showing where process of aircracking is when you press any button. Also, when you press q button it saves where it stopped and quits. None of that works when started with script. Only thing I can press and get response is Ctrl + C to quit the process.
Question is can I start process using bash script so it starts exactly the same way as it would if it was started by command only, so the process would react to key presses?
sudo valid only before pipe, so aircrack was executed as current user.
You ought to try: sudo your_bash_script
and bash script contains: john --restore=record | aircrack-ng -w - -b 00:11:22:33:44:55 record.cap
Hello. I'm trying to make process of restoring John the Ripper's .rec files. Instead of typing whole command:
john --restore=record | aircrack-ng -w - -b 00:11:22:33:44:55 record.cap
I tried with bash script:
#!/bin/bash
sudo john --restore=record | aircrack-ng -w - -b 00:11:22:33:44:55
It works as it is but...
John has a feature of showing where process of aircracking is when you press any button. Also, when you press q button it saves where it stopped and quits. None of that works when started with script. Only thing I can press and get response is Ctrl + C to quit the process.
Question is can I start process using bash script so it starts exactly the same way as it would if it was started by command only, so the process would react to key presses?
TIA
Did you ever solve this? My script to call John with different wordlists does not allow the hotkeys to work either, and I'm not using sudo.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
When you run john from the command line the virtual terminal is the shell. But each script has its own shell. Thus, hot keys in the virtual terminal do not affect john called from the script. I don't know of any easy way around this.
When you run john from the command line the virtual terminal is the shell. But each script has its own shell. Thus, hot keys in the virtual terminal do not affect john called from the script. I don't know of any easy way around this.
Interesting. How do other binaries accept user input when ran inside a script? e.g. it works with nmap
Interesting. How do other binaries accept user input when ran inside a script? e.g. it works with nmap
Nmap just reads stdin/stdout. sudo does not, its use for password authentication opens /dev/tty to bypass possible spoofs.
Your use of piping the output john to aircrack-ng doesn't really make sense, no input to aircrack will be accepted.
Note: using the pipe separates the sudo command from aircrack - so aircrack will only run under your original account, not as root (or what is specified for john in the sudo configuration file).
to jpollard: TimewarpUK reopened an old, abandoned thread.
Quote:
Originally Posted by TimewarpUK
Interesting. How do other binaries accept user input when ran inside a script? e.g. it works with nmap
Usually binaries inherit stdin/stdout/stderr from their parent processes, so for example nmap will read stdin as long as it runs and bash will read it again when nmap completed (this is not the whole story, but in short you can imagine something like this).
As it was explained sudo does not rely on it, but uses the terminal (/dev/tty) directly which will not work if actually there was no terminal available.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.