LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Terminal Wireless tool... (https://www.linuxquestions.org/questions/linux-wireless-networking-41/terminal-wireless-tool-491159/)

kbutcher5 10-10-2006 12:43 PM

Terminal Wireless tool...
 
I have made a bash wireless tool to configure wireless very easily, it has probably been seen before, but i have constructed it to learn bash scripting.
My friend suggested to upload it, so here it is.
I have ideas for a wpa expansion later on, but it might be a while. Ideas and suggestions will be appreciated :)
The script is currently at v0.3!
Wireless Tool v0.3

Brian1 10-10-2006 05:50 PM

Link not pointing correctly. You can use the code option and post the script contents in your post. Example of it. Note remove the _ in the code line.
[_code_]
Insert text here. Remove the _ before and after the word code. Had to do it this way to show in text.
[_/code]
Brian

kbutcher5 10-11-2006 05:30 PM

Well people can just dl it and read it, and btw the sudo install part only works for arch atm...
well here is the code:
Code:

#!/bin/bash
echo "Automatic Wireless setup tool v0.3"
echo "Remember to be root!"
echo "Remember to be root!"
echo "Remember to be root!"
sleep 4
clear
echo "Choose wireless settings, 1=Essid 2=Channel 4=Wep Key."
echo "If you want more than one setting, just add them together."
echo "Remember essid is required!"
read opt
echo "Wireless Card interface name:"
read ycard

beg ()
{
echo "#!/bin/bash" > /usr/bin/wire
echo "echo Booting Card..." >> /usr/bin/wire
echo "sudo ifconfig $ycard up" >> /usr/bin/wire
echo "echo AP Scan:" >> /usr/bin/wire
echo "sleep 1" >> /usr/bin/wire
echo "iwlist $ycard scan" >> /usr/bin/wire
}

essid ()
{
        echo "echo Define essid:" >> /usr/bin/wire
        echo "read ysid" >> /usr/bin/wire
        echo -e "sudo iwconfig $ycard essid \$ysid" >> /usr/bin/wire
}

channel ()
{
        echo "echo Define channel:" >> /usr/bin/wire
        echo "read ychan" >> /usr/bin/wire
        echo -e "sudo iwconfig $ycard channel \$ychan" >> /usr/bin/wire
}

wep ()
{
        echo "echo Define wep key:" >> /usr/bin/wire
        echo "read ywep" >> /usr/bin/wire
        echo -e "sudo iwconfig $ycard key \$ywep" >> /usr/bin/wire
}

if [ $opt -eq "1" ]; then
        beg
        essid
elif [ $opt -eq "3" ]; then
        beg
        essid
        channel
elif [ $opt -eq "5" ]; then
        beg
        essid
        wep
elif [ $opt -eq "7" ]; then
        beg
        essid
        channel
        wep
else
        echo "Wrong wireless settings chosen!!!"
        exit
fi

echo "echo Arp request..." >> /usr/bin/wire
echo "sudo dhcpcd $ycard" >> /usr/bin/wire
echo "echo Wireless Running!" >> /usr/bin/wire
echo "Copyright by MentalButcher"
chmod 777 /usr/bin/wire
pacman -Qs sudo > sudo
read sudoi <sudo
rm sudo
if [ -z "$sudoi" ]; then
                pacman -S sudo --noconfirm
                echo "Sudo installed!"
else
                echo "Sudo already installed, continuing..."
fi
grep /sbin/dhcpcd /etc/sudoers > sudo
read chk <sudo
rm sudo
if [ -z "$chk" ]; then
                echo "ALL ALL=(root) NOPASSWD: /sbin/ifconfig, /usr/sbin/iwconfig, /sbin/dhcpcd" >> /etc/sudoers
                echo "Sudo Set!"
else
                echo "Sudo config already set, continuing..."
fi
echo "Processing done, type wire to start utility!"
echo "Copyright by MentalButcher"
exit


Brian1 10-13-2006 02:11 PM

Nice little script. Very simply and clean looking.

Brian

kbutcher5 10-13-2006 05:11 PM

thx man, but as you see it uses arch's package manager to get sudo, but i was thinking to make it check for linux type aswell in the next version, get it to work for dpkg aswell, and maybe rpm, though i do not know how it works, anyone able to help?

trubled 11-03-2006 02:30 AM

Great stuff mate :-)
Kepp up the good work, and if wantr to look at an advanced generator check: www.rootkit.nl 'FreeBSD Shell/Script installer' suit back and have codffee abd watch it instakk every needed port i guess :) I loive that sites tools, ecuae i have used lclam, and spam assassin, and i got a better reult using that, also he allows his users to keep a GREAT feedback/suggests with him, to point he would add code if it is ok..
anyhow i must go a kangaroo just ran past swingin punches.. wooops.. better go!@

OH and this idea ROCKZ0RS, try it if you can get the Imagebases you may need...

trubled 11-03-2006 02:32 AM

thx man, but as you see it uses arch's package manager to get sudo, but i was thinking to make it check for linux type aswell in the next version, get it to work for dpkg aswell, and maybe rpm, though i do not know how it works, anyone able to help?


DO IT, make it pick between the BEST packages...but makesure it staytds opem src fpr atleast abit lik e.. mm 1 month ;) cheers..dunno why it did not join to my other mail but meg=h.. i getin to like this place. I will practice english now and get even a turir ;)

kbutcher5 11-03-2006 03:34 AM

i do know the apt-get version, but i don't know how to integrate rpm, since i have never tried it and never will..

trubled 11-04-2006 12:48 AM

Hmm.. im a checkout the freebsd one, and maybe look for some apps open-src/codeproj
 
Well i was kinda thinking,if you were to integrate apt-get, and pkg_get ,thats almost most distros out there.. i mean bsd will allow apt-get if you install the rpms. so io know it ain't a prob.. heck, i could get started on working on it in cygwin and will make 0 dif :P the one main concern is akll the cronjobs running.. how are you intending to exactly start each separate user, time setting i assume would be the best idea, someone also in the thread mentioned forcing it to check cron every 5minutes and i wonder why need to do that but of course everymaybe 20mins if that is the way you will get aboiut it, also, this wouldb be really modified at time of adding a new user, after coding it, and using it in debug , (I dont see ANY debug in it mind you, and debug is extremely important, you don't know if it is even exploitable, imagine your small tools is exploitable by way of using bad sh command :P .
I rgink, the apt-get , and/or getting to ports which would be easy using the script i showed you for bsd, and might be worth mailing him your script, and showing him what ya want to do, he is a busy guy but i am sure he will like the work, and not all bsd users just use that..
Also, remember to keep yourself a GOOD changelog incase you see any ideas, you should keep that for sure, i think by the v10 or whatever, it should be workable for ANY Linux or Unix (Mainstream/Corp) use, wich could lead you to make a version mayne online like Michael, or just supply it free, or based on donations.. heck i know i paid when whoppix was new, and i wanted to see more..so i cant see why not ever support a team doing dev work i've done it and still do!It is very hard to co ordinate even the best of svn's or simply getting things to run in coexistence.
Think of yourself as a bit of a gy with a mission, to make your installer, the est one, and even if you made open a vers for development users (thats another thing, this could almost be aother BerliOS is that big!).
You could just make sure you use the 'Creative Commons' license god-bless-it,as it will completely cover your work/you, and always make sure that if the code is reused, you are always to be given a copy no matter what it is said or made for, the author should always see his work, at work for others debug is one thing ya need tho i would add it before moving on, and start maybe an ideas+changes log, it will only be as excellent as you are enthusiastic to make it :)
I wish you the best and will hopefully see you at it and use it so,eday , get a 5.5BSD one up and ill be a beta tester.
Heck,ill install some Linux for find even so sure.. ain't hard to find some decent beta helpers especially if it stays very stable and maintanable / maintained.
Cheers / DX

wireless bsd

kbutcher5 11-04-2006 09:49 AM

I think i will be needing a shorter version of that, because i don't really understand all of it.
I think i know what you are getting at, but it is just bash script, anyone could have made it, just a bunch of linux commands that get's executed without touching anything.

I was thinking of just dumping the project, it works for what i need it for, maybe rebuild a graphical version of it in C.
But until then, i've only fixed a few bugs in it, and it should do the trick for most people.

kbutcher5 11-04-2006 09:59 AM

V0.4 is here, if you want it, just take it :P

Changes list since V0.1:
Automatic check of exsistence of sudo.
Automatic download of sudo.
Automatic check of allowance of wireless actions in sudo.
Automatic allowance of wireless actions in /etc/sudoers
Choice between 4 setups wireless defined by:
Essid
Essid and Wep key
Essid and channel
Essid, channel and wep key

Let's you define which card to use.

Changes list in V0.4:
Just fixed a few bugs that made some stuff run outside the script.

Wireauto V0.4


All times are GMT -5. The time now is 02:43 PM.