Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
08-17-2015, 04:48 AM
|
#1
|
LQ Newbie
Registered: Aug 2015
Posts: 2
Rep:
|
Bash script - John the Ripper
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
|
|
|
08-17-2015, 05:17 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,217
|
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
Probably that helps
|
|
|
08-17-2015, 05:51 AM
|
#3
|
LQ Newbie
Registered: Aug 2015
Posts: 2
Original Poster
Rep:
|
It doesn't help. With or without sudo in script it's the same problem.
As I said. Script runs but John the Ripper's "hotkeys" are disabled.
|
|
|
08-17-2015, 10:56 AM
|
#4
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
Quote:
Originally Posted by zardoz1971
It doesn't help. With or without sudo in script it's the same problem.
As I said. Script runs but John the Ripper's "hotkeys" are disabled.
|
You might check the documentation.
It is possible that the program opens /dev/tty directly to implement that, and sudo by default disables terminal access.
|
|
|
08-02-2017, 03:08 PM
|
#5
|
Member
Registered: Dec 2014
Posts: 33
Rep:
|
Quote:
Originally Posted by zardoz1971
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.
|
|
|
08-02-2017, 05:57 PM
|
#6
|
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
|
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.
|
|
|
08-04-2017, 10:53 AM
|
#7
|
Member
Registered: Dec 2014
Posts: 33
Rep:
|
Quote:
Originally Posted by AwesomeMachine
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
|
|
|
08-05-2017, 09:04 PM
|
#8
|
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
|
I believe it's the way the key capture is implemented. But I'm not an expert.
|
|
|
08-06-2017, 07:00 AM
|
#9
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
Quote:
Originally Posted by TimewarpUK
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).
|
|
|
08-07-2017, 10:49 AM
|
#10
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,217
|
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.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 11:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|