Results 1 to 2 of 2
-
06-23-2012 #1Original Mоderating Team


- Join Date
- Sep 2009
- Location
- Sweden
- Age
- 20
- Posts
- 2,001
- Thanks
- 696
- Gamertag
- Ain't telling ;)
[Script] WDrive 2.1 - Android GPS tethering to BT [Linux]
Hey GameTuts, long time since I've been on here...
Might get alittle active again ;D Anyhow.. I'd just like to share a little program I've been working on incase there's any linux users out there!
It's 100% from scratch so if anyone would like to tweak it don't forget to give credits! :)
WDrive 2.1
WDrive 2.1 is a script for Backtrack 5 R2 that will enable you to
"tether GPS data" from your Android Device to Backtrack 5 using a USB Cable,
this will then later be used to assign all this data to AP's discovered while "wardriving"
and later loaded in either Google Maps or Google Earth which
will show you where the AP's were located and which encryption they use + information about
clients connected etc.
This is VERY useful for those who need GPS Data but do not own a gps device.
BlueNMEA is required running on your Aandroid device, you'll find this for free on the official Android Market (or Google Play)
Download and install + run:
Code:wget wdrive.comlu.com/wdrive.sh chmod +x wdrive.sh cp wdrive.sh /usr/bin/wdrive Now you can run wdrive from terminal simply by typing "wdrive"
Alternative download:Downloads - wdrive-bt5 - WDrive - Linux GPS Tethering - Google Project Hosting
Download:

PS! Wdrive 2012 copyright zatixiz should only be used for educational purposes and I am not responsible for whatever this script is used forCode:Wdrive 2.0.0-2- Thu Jun 14 14:43:01 CEST 2012 -Added ASCII art and menu -Added check for installation -Added option to make a kml file out of old Kismet log files -New coloring and other text related changes -Hardcoded some commands WDrive 2.0.3 - Wed Jun 20 16:52:01 CEST 2012 -Added Installation -Added changelog -Added trapped Ctrl + c with cleaning up -Cleaned up code more -Added "check gps" on main menu -Before telling you Kismet, gpsd and socat is running it will check for it if failed it will tell you to resetup -New way of finding IP -No more network restarting -Shortened down some sleep times, still testing and altering those -Some other small changes -Remember created mon(x) and remove it once script is done WDrive 2.0.4 - Wed Jun 20 18:32:05 CEST 2012 -Fixed some kml making bugs and I'm 99% positive it works now -Installation script remade into easier way -Added text ontop (header) -Removed DHCPCD client, seems like I don't even need that anymore Wdrive 2.0.5 - Fri Jun 22 03:23:21 CEST 2012 -Improved kml making, it will now move all files from /tmp/ -Reveresed the order of changelog updates -Added online check for update with download link Wdrive 2.0.6 - Fri Jun 22 05:29:30 CEST 2012 -Added onliecheck + online update -improved offline update check Wdrive 2.1 - Fri Jun 22 14:16:02 CEST 2012 -Wdrive 2.1 Final release, no longer beta release -Improved some minor installation checks -Please report any bugs to [email protected]
-
The Following 4 Users Say Thank You to Joakim For This Useful Post:
Brandon (06-23-2012), Heisenberg (06-23-2012), NoVa Gamester (06-23-2012), Sinclair (06-24-2012)
-
06-23-2012 #2Original Mоderating Team


- Join Date
- Sep 2009
- Location
- Sweden
- Age
- 20
- Posts
- 2,001
- Thanks
- 696
- Gamertag
- Ain't telling ;)
Re: [Script] WDrive 2.1 - Android GPS tethering to BT [Linux]
Source:
Code:#!/bin/bash # (C)opyright 2012 - Bosse/Zatixiz clear tip="Report a bug? [email protected]" tipotd=`curl --silent http://wdrive.comlu.com/wdrive.sh 2>/dev/null | grep tip= | awk -F= NR==1'{print $2 }' | sed 's/"//' | sed 's/"//' 2>/dev/null` shversion="2.1" ### -x if I wish to debug..for some reason I always write +x lol.. ## Contact Information: [email protected] ## = General Notes ### = Notes for myself ## The script running the first menu is at the bottom! #### ### Clean this damn mess up + Tail something maybe? ### Make it a universal Wardrive script sometime and add in sniffing codes etc? ### Make a Youtube Backtrack channel? ### About.. well alot cleaned :) ### Added function to check if Socat, gpsd and kismet is running correctly ## Thanks to ComaX for reviewing my Version 2 and helping me with some of the code! # colors b="\e[1;34m" ## Blue Bold color c="\e[1;36m" ## Cyan Bold color r="\e[1;31m" ## Red Bold color g="\e[1;32m" ## Green Bold Color ce="\e[0m" ## End the color script changelog() ## Output to /tmp/Wdrivechangelog.txt { echo "Wdrive 2.0.0-2 - Thu Jun 14 14:43:01 CEST 2012" > /tmp/Wdrivechangelog.txt echo " -Added ASCII art and menu" >> /tmp/Wdrivechangelog.txt echo " -Added check for installation" >> /tmp/Wdrivechangelog.txt echo " -Added option to make a kml file out of old Kismet log files" >> /tmp/Wdrivechangelog.txt echo " -New coloring and other text related changes" >> /tmp/Wdrivechangelog.txt echo " -Hardcoded some commands" >> /tmp/Wdrivechangelog.txt echo "WDrive 2.0.3 - Wed Jun 20 16:52:01 CEST 2012" >> /tmp/Wdrivechangelog.txt echo " -Added Installation" >> /tmp/Wdrivechangelog.txt echo " -Added changelog" >> /tmp/Wdrivechangelog.txt echo " -Added trapped Ctrl + c with cleaning up" >> /tmp/Wdrivechangelog.txt echo " -Cleaned up code more" >> /tmp/Wdrivechangelog.txt echo " -Added \"check gps\" on main menu" >> /tmp/Wdrivechangelog.txt echo " -Before telling you Kismet, gpsd and socat is running it will check for it" >> /tmp/Wdrivechangelog.txt echo " if failed it will tell you to resetup" >> /tmp/Wdrivechangelog.txt echo " -New way of finding IP" >> /tmp/Wdrivechangelog.txt echo " -No more network restarting" >> /tmp/Wdrivechangelog.txt echo " -Shortened down some sleep times, still testing and altering those" >> /tmp/Wdrivechangelog.txt echo " -Some other small changes" >> /tmp/Wdrivechangelog.txt echo " -Remember created mon(x) and remove it once script is done" >> /tmp/Wdrivechangelog.txt echo "WDrive 2.0.4 - Wed Jun 20 18:32:05 CEST 2012" >> /tmp/Wdrivechangelog.txt echo " -Fixed some kml making bugs and I'm 99% positive it works now" >> /tmp/Wdrivechangelog.txt echo " -Installation script remade into easier way" >> /tmp/Wdrivechangelog.txt echo " -Added text ontop (header)" >> /tmp/Wdrivechangelog.txt echo " -Removed DHCPCD client, seems like I don't even need that anymore" >> /tmp/Wdrivechangelog.txt echo "Wdrive 2.0.5 - Fri Jun 22 03:23:21 CEST 2012" >> /tmp/Wdrivechangelog.txt echo " -Improved kml making, it will now move all files from /tmp/" >> /tmp/Wdrivechangelog.txt echo " -Reveresed the order of changelog updates" >> /tmp/Wdrivechangelog.txt echo " -Added online check for update with download link" >> /tmp/Wdrivechangelog.txt echo "Wdrive 2.0.6 - Fri Jun 22 05:29:30 CEST 2012" >> /tmp/Wdrivechangelog.txt echo " -Added onliecheck + online update" >> /tmp/Wdrivechangelog.txt echo " -improved offline update check" >> /tmp/Wdrivechangelog.txt echo "Wdrive 2.1 - Fri Jun 22 14:16:02 CEST 2012" >> /tmp/Wdrivechangelog.txt echo " -Wdrive 2.1 Final release, no longer "beta" release" >> /tmp/Wdrivechangelog.txt echo " -Improved some minor installation checks" >> /tmp/Wdrivechangelog.txt echo " -Please report any bugs to [email protected]" >> /tmp/Wdrivechangelog.txt ## THIS HAS TO STAY ON THE BOTTOM echo "" >> /tmp/Wdrivechangelog.txt echo "Press any button to close..." >> /tmp/Wdrivechangelog.txt } header() { clear # Always ontop + Resizing var=$(ls /etc | grep kde4) if [[ -z $var ]];then resize -s 77 85 &> /dev/null fi clear echo -e "\e[1;33m __ ______ _ ____ _ \ \ / / _ \ _ __(_)_ _____ |___ \ / | \ \ /\ / /| | | | '__| \ \ / / _ \ __) | | | \ V V / | |_| | | | |\ V / __/ / __/ _| | \_/\_/ |____/|_| |_| \_/ \___| |_____(_)_| Created by Zatixiz/Bosse Copyright 2012 Press CTRL + C to exit anytime and cleanup ------------------------------------------------------------------------------------- Tip of the day: $tipotd " } cleanupctrl() ## Cleanup everything incase CTRL + C is pressed { rm /tmp/Wdrivechangelog.txt &> /dev/null rm /tmp/gpsd.txt &> /dev/null rm /tmp/tail.txt &> /dev/null pkill gpsd pkill socat* pkill kismet* airmon-ng stop $mon &> /dev/null echo -e "${g} Everything cleaned up, goodbye! :) $ce" sleep 3 exit } control_c() # run if user hits control-c { header echo -e "$r ctrl + c pressed, cleaning up and exeting!$ce" cleanupctrl exit $? } # trap keyboard interrupt (control-c) trap control_c SIGINT runscript() ## This is runned at the bottom { # Boot cleaning cleanup() { echo -e "${r} [+] Let's make sure some stuff is closed before we proceed...$ce" pkill kismet_client sleep 2 pkill kismet_server sleep 2 pkill gpsd pkill socat* echo -e "${c} Cleaned ${g}[ OK ]${ce}" sleep 2 } installing() # Installing Required Software { echo -e "${c} Checking for required packages..." if dpkg -l | grep dhcpcd 1>/dev/null && dpkg -l | grep socat 1>/dev/null; then echo -e "${b} Required packages ${ce}${g}[ OK ]$ce" echo "" else echo -e "${r} Something's missing, we gotta fix that!$ce" echo -e "" if dpkg -l | grep dhcpcd 1>/dev/null; then echo -e "${c} dhcpcd installed ${ce}${g}[ OK ]$ce" else echo -e "${c} dhcpcd installed ${ce}${r}[ NO ]$ce" echo -e "" echo -en "${c} This script requires dhcpcd to be installed, would you like to install it? \n y/n: ${ce}" read ans if [[ "$ans" = "y" || "$ans" = "Y" ]]; then echo -e "${c} [+] Installing dhcpcd...\n Please be patient...${ce}" aptitude install dhcpcd -y >/dev/null echo -e "${c} dhcpcd installation ${ce}$g[ OK ]$ce" echo -e "" if dpkg -l | grep socat 1>/dev/null; then echo -e "${c} socat installed ${ce}${g}[ OK ]$ce" else echo -e "${c} socat installed ${ce}${r}[ NO ]$ce" echo -en "${c} This script requires socat to be installed, would you like to install it? \n y/n: ${ce}" read ans if [[ "$ans" = "y" || "$ans" = "Y" ]]; then echo -e "" echo -e "${c} [+] Installing socat...${ce}" aptitude install socat -y 1>/dev/null echo -e "${c} socat installation ${ce}$g[ OK ]$ce" fi fi fi fi fi echo -e "" echo -e "${b} Installation part done! Let's continue with setting up some stuff etc.." sleep 2.5 header ## Clean screen and print header() } echo -e "${b} Alright, let's set up some stuff and get this thing running!\n" echo -e "${b} Session name? Files created later will be named after that" echo -en "$b Name it: " read session sleep 2 ## This is where the ACTUAL script begins: countinterfaces=`ifconfig | awk '/wlan.*/ {print $1}' | wc -w` ## Look for number of wireless cards if [[ $countinterfaces -le 0 ]]; then ## This will tell you that the script could not find any wireless cards and that you have to type in which card to use manually echo -e "${r} I couldn't find any wireless cards, please enter it manually! " echo -en "${c} Interface: " read interface airmon-ng start $interface >/dev/null mon=`airmon-ng | grep mon | sort -rn | awk 'NR==1{print $1}'` echo -e "${c} Using ${interface} for capturing with $mon $ce" sleep 2 else if [[ $countinterfaces -ge 2 ]]; then ## This will tell you that you've got more than ONE wireless card on your computer and you have to type in manually echo -e "${c} You've got more than one wireless interface on your computer, I managed to find $countinterfaces $ce" sleep 2 echo -e "$b Interfaces found:" echo -e "$g`ifconfig | awk '/wlan.*/ {print " " $1}'` " echo -e "" echo -e "${c} Type in which interface to use${ce}" echo -en "${c} Interface: " read interface airmon-ng start $interface >/dev/null mon=`airmon-ng | grep mon* | sort -rn | awk 'NR==1{print $1}'` echo -e "${c} Using ${interface} for capturing with $mon $ce" sleep 2 else echo -e "${c} [+] Which interface would you like to capture with? ${ce}\n" ## This will print if you only got ONE card on your computer interface1=`ifconfig | awk '/wlan*/ {print $1}'` echo -e "${c} Type in your interface or press \"Enter\" to use ${interface1}!${ce}" echo -en "${c} Interface: ${ce}" read interface if [[ "$interface" = "" ]]; then airmon-ng start $interface1 >/dev/null mon=`airmon-ng | grep mon* | sort -rn | awk 'NR==1{print $1}'` echo -e "${c} Using ${interface1} for capturing with $mon $ce" sleep 5 else airmon-ng start $interface >/dev/null mon=`airmon-ng | grep mon* | sort -rn | awk 'NR==1{print $1}'` echo -e "${c} Using ${interface1} for capturing with $mon $ce" sleep 5 fi fi fi header ## Clean screen and print header() # Instructions - This will not be cleaned up for now echo -e "${c} Now I need you to plug in your android and do this:${ce} \n \n ${b} On your Android device enable this: \n${ce} $g"" (System) Settings -> Developer options -> USB debugging${ce} \n \n" sleep 2 echo -e "${b} Now I'd also need you to do enable this: \n${ce} $g"" (System) Settings -> Wireless & Networks -> More -> Tethering & portable hotspot -> USB tethering${ce} \n " sleep 2 echo -e "${r} [+] Looking for usb connection...$ce" EXITSTATUS=-1 until [ ${EXITSTATUS} == 0 ]; do ifconfig -a | grep usb* >/dev/null EXITSTATUS=$? sleep 1 done usbifcfg=`ifconfig -a | awk '/usb*/ {print $1}'` echo -e "${c} $usbifcfg ${ce}${g}[ Connected ] $ce" sleep 3 header ## Clean screen and print header() # Setup USBport usbsetup() { echo -e "${c} Alright! Which USBport is your phone connected to? (usually \"usb0\")${ce} \n" usb1=`ifconfig | awk '/usb*/ {print $1}'` sleep 3 echo -e "${c} I managed to find $usb1, press \"Enter\" to use this port or type in the port that you would like to use" echo -en "${c} Usb Port:" read usb sleep 1 if [[ "$usb" = "" ]]; then EXITSTATUS=-1 until [ ${EXITSTATUS} == 0 ]; do ip link set $usb1 up && dhcpcd $usb1 EXITSTATUS=$? sleep 2 done else EXITSTATUS=-1 until [ ${EXITSTATUS} == 0 ]; do echo -en "${c} Usb Port:" read -e usb ip link set $usb up && dhcpcd $usb EXITSTATUS=$? sleep 2 done fi echo "" echo -e "${b} Alright, tethering is now enabled! ${ce}\n" sleep 4 header ## Clean screen and print header() } # Setup GPSD, SOCAT+Kismet ip=`ip route show | awk '(NR == 1) { print $3}'` mainsetup() { echo -e "${b} Please type in the ip of your phone! \n ${ce}" echo -e "${g} I found the ip: \"$ip\", is this the correct ip of the BlueNMEA client running on your android? (the local ip for the phone)$ce" echo -e "${c} If so press \"Enter\" to use \"$ip\"...$ce" echo -en "${c} Ip: ${ce}" read ip2 echo -e "${c} Please type in the port of the BlueNMEA client running\n or press \"Enter\" to use \"${g}4352${c}\"$ce" echo -en "${c} Port: ${ce}" read port if [[ "$ip2" = "" || "$port" = "" ]]; then ip=`ip route show | awk '(NR == 1) { print $3}'` echo -e "${b} [+] Starting GPSD and Socat+Kismet using the ip=$ip and port=4352... ${ce} \n" socat TCP:$ip:4352 PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd xterm -geom 80x5-0+85 -e gpsd -N -n -D 3 /tmp/gps & sleep 2 xterm -geom 80x30-0+170 -e kismet -p /tmp -c $mon & elif [[ "$ip2" = "" ]]; then ip=`ip route show | awk '(NR == 1) { print $3}'` echo -e "${b} [+] Starting GPSD and Socat+Kismet using the ip=$ip and port=$port... ${ce} \n" socat TCP:$ip:$port PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd xterm -geom 80x5-0+85 -e gpsd -N -n -D 3 /tmp/gps & sleep 2 xterm -geom 80x30-0+170 -e kismet -p /tmp -c $mon & elif [[ "$port" = "" ]]; then echo -e "${b} [+] Starting GPSD and Socat+Kismet using the ip=$ip2 and port=4352... ${ce} \n" socat TCP:$ip2:4352 PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd xterm -geom 80x5-0+85 -e gpsd -N -n -D 3 /tmp/gps & sleep 2 xterm -geom 80x30-0+170 -e kismet -p /tmp -c $mon & else echo -e "${b} [+] Starting GPSD and Socat+Kismet using the ip=$ip2 and port=$port... ${ce} \n" socat TCP:$ip2:$port PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd xterm -geom 80x5-0+85 -e gpsd -N -n -D 3 /tmp/gps & sleep 2 xterm -geom 80x30-0+170 -e kismet -p /tmp -c $mon & fi } failedm() { echo -e "${r} Something failed to start, make sure you've got GPS enabled on your phone and that\n you've setup everything according to WDrive 2.1s instructions${ce}\n" echo -e "${b} Please select an option below: \n" echo -e "${c} 1) Read instructions and resetup gpsd, socat & kismet" echo -e " 2) Only resetup gpsd, socat & kismet" echo -en "${g} Choice: " read failedchoice2 if [[ "$failedchoice2" = "1" ]]; then pkill kismet* pkill socat* pkill gpsd* failedinstructions header mainsetup else echo -e "\n$g Alright, proceeding with setting up Socat + Gpsd, Kismet!$ce" pkill kismet* pkill socat* pkill gpsd* header mainsetup fi } checksgm() { sleep 1 if ps -A | grep gpsd 1>/dev/null && ps -A | grep socat* 1>/dev/null && ps -A | grep kismet* 1>/dev/null; then echo -e "I liek bananas.. Only if they're pink though" else failedm fi } mainsetup checksgm header ## Clean screen and print header() # Cleanup echo -e "${b} Everything running! Type Clean if you wish to stop capturing and start making the .kml file${ce} \n" read clean if [[ "$clean" = "clean" || "$clean" = "Clean" ]]; then echo -e "${r} Closing windows now...${ce}\n" airmon-ng stop $mon cleanup echo -e "${c} Everything stopped and cleaned up!${ce}${g}[ OK ]$ce\n" sleep 1 else echo -e "${r} Well okey... just don't forget to clean it up yourself!${ce}\n" fi # Making KML kmlmv() { xml3=`echo $xml2 | awk -F. '{ print $1 }'` sleep 3 mv /tmp/wireless.dbl $session.dbl mkdir /root/Desktop/${session}_Folder mkdir /root/Desktop/${session}_Folder/Backup cp /tmp/$xml3* /root/Desktop/${session}_Folder/Backup mkdir /root/Desktop/${session}_Folder/Saved mv /tmp/$session.* /root/Desktop/${session}_Folder/Saved sleep 3 rm /tmp/$xml3* echo -e "${g} There we go! Everyting's done $session.kml has been made and put in your \"${session}_Folder/Saved\" folder on your Desktop" read -s -n1 -p " Press any button to close..." rm /tmp/Wdrivechangelog.txt &> /dev/null rm /tmp/gpsd.txt &> /dev/null rm /tmp/tail.txt &> /dev/null } # Make the KML file and save the capture files header echo -e "${g} Now let's finally make the .kml file${ce}\n" sleep 1 xml2=`ls /tmp/ | grep .*.netxml` xml1=`ls /tmp/ | grep .*.netxml | wc -w` if [[ "$xml1" -ge 2 ]]; then ls /tmp/ | grep .*.netxml echo -e "${c} Found more than one .netxml file, type in which one you would like to use:" echo -en " Use: " read xml2 echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE elif [[ "$xml1" -le 0 ]]; then echo -e "$c Could not find any .netxml files, please enter it manually\n" ls /tmp/ echo -e "" echo -en " .netxml: " read xml2 echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE elif [[ "$xml1" = "1" ]]; then ls /tmp/ | grep .*.netxml echo -e "${c} Press \"Enter\" to use $xml2 $ce" echo -en "${c} netxml: $ce" read xml2 if [[ "$xml2" = "" ]]; then xml2=`ls /tmp/ | grep .*.netxml` echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE else echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE fi fi } failedinstructions() { header echo -e "${c} Alright start of by plugging in your Android and opening up BlueNMEA${ce} \n \n ${b} On your Android device enable this: \n${ce} $g"" (System) Settings -> Developer options -> USB debugging${ce} \n \n" sleep 2 echo -e "${b} Now I'd also need you to do enable this: \n${ce} $g"" (System) Settings -> Wireless & Networks -> More -> Tethering & portable hotspot -> USB tethering${ce} \n " sleep 2 echo -e "${r} [+] Looking for usb connection...$ce" EXITSTATUS=-1 until [ ${EXITSTATUS} == 0 ]; do ifconfig | grep usb* >/dev/null EXITSTATUS=$? sleep 1 done usbifcfg=`ifconfig | awk '/usb*/ {print $1}'` echo -e "${c} $usbifcfg ${ce}${g}[ Connected ] $ce" echo -e "${c} Returning to setting up Socat + Gpsd! ${ce}" sleep 3 } gpsdsocat() ## TEST GPS { ip=`ip route show | awk '(NR == 1) { print $3}'` failed() { echo -e "${r} Something failed to start, make sure you've got GPS enabled on your phone and that\n you've setup everything according to WDrive 2.1${ce}\n" echo -e "${b} Please select an option below: \n" echo -e "${c} 1) Read instructions and resetup gpsd & socat" echo -e " 2) Only resetup gpsd & socat" echo -en "${g} Choice: " read failedchoice if [[ "$failedchoice" = "1" ]]; then failedinstructions header gpsdsocat else echo -e "\n$g Alright, proceeding with setting up Socat + Gpsd!$ce" sleep 2.5 header gpsdsocat fi } echo -e "${b} Please type in the ip of your phone! \n ${ce}" echo -e "${g} I found the ip: \"$ip\", is this the correct ip of the BlueNMEA client running on your android? (the local ip for the phone)$ce" echo -e "${c} If so press \"Enter\" to use \"$ip\"...$ce" echo -en "${c} Ip: ${ce}" read ip2 echo -e "${c} Please type in the port of the BlueNMEA client running\n or press \"Enter\" to use \"${g}4352${c}\"$ce" echo -en "${c} Port: ${ce}" read port if [[ "$ip2" = "" || "$port" = "" ]]; then echo -e "${b} [+] Starting GPSD and Socat using the ip=$ip and port=4352... ${ce} \n" socat TCP:$ip:4352 PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd gpsd -N -n -D 3 /tmp/gps &> /tmp/gpsd.txt & sleep 2 elif [[ "$ip2" = "" ]]; then echo -e "${b} [+] Starting GPSD and Socat using the ip=$ip and port=$port... ${ce} \n" socat TCP:$ip:$port PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd gpsd -N -n -D 3 /tmp/gps &> /tmp/gpsd.txt & sleep 2 elif [[ "$port" = "" ]]; then echo -e "${b} [+] Starting GPSD and Socat using the ip=$ip2 and port=4352... ${ce} \n" socat TCP:$ip2:4352 PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd gpsd -N -n -D 3 /tmp/gps &> /tmp/gpsd.txt & sleep 2 else echo -e "${b} [+] Starting GPSD and Socat using the ip=$ip2 and port=$port... ${ce} \n" socat TCP:$ip2:$port PTY,link=/tmp/gps &> /dev/null & sleep 2 pkill gpsd gpsd -N -n -D 3 /tmp/gps &> /tmp/gpsd.txt & sleep 2 fi checksg() { if ps -A | grep gpsd 1>/dev/null && ps -A | grep socat* 1>/dev/null; then echo -e "${g}Everything Seems to be running, looking for gps locations in new \"window\"!$ce" echo "echo -e \"Positions will appear below, please be patient! \\n Look for Lat and Lon, these means it works! \\n\"" > /tmp/tail.txt echo "sleep 2" >> /tmp/tail.txt echo "tail -f < /tmp/gpsd.txt | awk '/lat/ {print \$5}'" >> /tmp/tail.txt chmod +x /tmp/tail.txt xterm -geom 80x80-0+85 -e /tmp/tail.txt rm /tmp/tail.txt rm /tmp/gpsd.txt else failed fi } checksg mainmenu header ## Clean screen and print header() } kmlmv() { xml3=`echo $xml2 | awk -F. '{ print $1 }'` sleep 3 mv /tmp/wireless.dbl $session.dbl mkdir /root/Desktop/${session}_Folder mkdir /root/Desktop/${session}_Folder/Backup cp /tmp/$xml3* /root/Desktop/${session}_Folder/Backup mkdir /root/Desktop/${session}_Folder/Saved mv /tmp/$session.* /root/Desktop/${session}_Folder/Saved sleep 3 rm /tmp/$xml3* echo -e "${g} There we go! Everyting's done $session.kml has been made and put in your \"${session}_Folder/Saved\" folder on your Desktop" read -s -n1 -p " Press any button to close..." rm /tmp/Wdrivechangelog.txt &> /dev/null rm /tmp/gpsd.txt &> /dev/null rm /tmp/tail.txt &> /dev/null } menukml() { cd echo -e "${c} What would you like the database etc to be named later?" echo -en " Name it: " read session xml2=`ls /tmp/ | grep .*.netxml` xml1=`ls /tmp/ | grep .*.netxml | wc -w` if [[ "$xml1" -ge 2 ]]; then ls /tmp/ | grep .*.netxml echo -e "${c} Found more than one .netxml file, type in which one you would like to use:" echo -en " Use: " read xml2 echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE elif [[ "$xml1" -le 0 ]]; then echo -e "$c Could not find any .netxml files, please enter it manually\n" ls /tmp/ echo -e "" echo -en " .netxml: " read xml2 echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE elif [[ "$xml1" = "1" ]]; then ls /tmp/ | grep .*.netxml echo -e "${c} Press \"Enter\" to use $xml2 $ce" echo -en "${c} netxml: $ce" read xml2 if [[ "$xml2" = "" ]]; then xml2=`ls /tmp/ | grep .*.netxml` echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE else echo -e "${c} The database file will be named $session""${ce}" sleep 2 cd /tmp giskismet -x /tmp/$xml2 sleep 2 echo -e "${c} Time for the last step, your .kml file will be named $session.kml""${ce}" giskismet -q "select * from wireless" -o /tmp/$session.kml kmlmv # KMLMAKING HERE fi fi } mainmenu() { # Always ontop + Resizing var=$(ls /etc | grep kde4) if [[ -z $var ]];then resize -s 77 85 &> /dev/null fi clear cleanup() { rm /tmp/Wdrivechangelog.txt echo -e "${r} [+] Let's make sure some stuff is closed before we proceed...$ce" pkill kismet_client sleep 2 pkill kismet_server sleep 2 pkill gpsd pkill socat* echo -e "${c} Cleaned ${g}[ OK ]${ce}" sleep 2 header ## Clean screen and print header() } installing() { # Installing Required Software echo -e "${c} Checking for required packages..." if dpkg -l | grep dhcpcd 1>/dev/null && dpkg -l | grep socat 1>/dev/null; then echo -e "${b} Required packages ${ce}${g}[ OK ]$ce" echo "" else echo -e "${r} Something's missing, we gotta fix that!$ce" echo -e "" if dpkg -l | grep dhcpcd 1>/dev/null; then echo -e "${c} dhcpcd installed ${ce}${g}[ OK ]$ce" else echo -e "${c} dhcpcd installed ${ce}${r}[ NO ]$ce" echo -e "" echo -en "${c} This script requires dhcpcd to be installed, would you like to install it? \n y/n: ${ce}" read ans if [[ "$ans" = "y" || "$ans" = "Y" ]]; then echo -e "${c} [+] Installing dhcpcd...\n Please be patient...${ce}" aptitude install dhcpcd -y >/dev/null echo -e "${c} dhcpcd installation ${ce}$g[ OK ]$ce" echo -e "" if dpkg -l | grep socat 1>/dev/null; then echo -e "${c} socat installed ${ce}${g}[ OK ]$ce" else echo -e "${c} socat installed ${ce}${r}[ NO ]$ce" echo -en "${c} This script requires socat to be installed, would you like to install it? \n y/n: ${ce}" read ans if [[ "$ans" = "y" || "$ans" = "Y" ]]; then echo -e "" echo -e "${c} [+] Installing socat...${ce}" aptitude install socat -y 1>/dev/null echo -e "${c} socat installation ${ce}$g[ OK ]$ce" fi fi fi fi fi echo -e "" echo -e "${b} Installation part done! Let's continue with setting up some stuff etc.." sleep 6 clear } # Main welcome menu header ## Clean screen and print header() echo -e "$b Hello and welcome to WDrive 2.1!\n Please select an option below to get started!\n" echo -e "$r Before you start using WDrive 2.1\n please make sure you've got BlueNMEA on your android (Found in market for free)\n\n\n" echo -e "${b}1) Run the script normally\n" echo -e "2) Check for required packages and install then proceed with WDrive 2.1\n" echo -e "3) Check if GPS works with WDrive 2.1\n" echo -e "${b}4) Put AP's from a previous .netxml file into a KML file and rename the database\n" echo -e "5) Check changelog\n" echo -e "6) Exit WDrive 2.1\n" echo -en "${g}choice:${ce} ${b}" read mainans clear if [[ "$mainans" = "1" ]]; then header ## Clean screen and print header() cleanup runscript elif [[ "$mainans" = "2" ]]; then header ## Clean screen and print header() installing header ## Clean screen and print header() cleanup runscript elif [[ "$mainans" = "3" ]]; then header gpsdsocat header mainmenu elif [[ "$mainans" = "4" ]]; then clear header ## Clean screen and print header() menukml elif [[ "$mainans" = "5" ]]; then changelog xterm -e "cat /tmp/Wdrivechangelog.txt; read" & sleep 1 mainmenu elif [[ "$mainans" = "6" ]]; then exit rm /tmp/Wdrivechangelog.txt else echo -e "${r}NOT A VALID CHOICE, TRY AGAIN..." sleep 3 mainmenu fi } offlineinstall() { header echo -e "The new version (${shversion}) of Wdrive is not installed, would you like to install it?" echo -en "Y/N: " read wdriveinstall if [[ $wdriveinstall = y || $wdriveinstall = Y ]]; then rm /usr/bin/wdrive &>/dev/null cp $0 /usr/bin/wdrive chmod +x /usr/bin/wdrive echo -e "$g \n wdrive has been installed, next time type \"wdrive\" to run it!" sleep 3.5 wdrive else echo -e "$r Not installing...$ce" sleep 3 mainmenu fi } onlineinstall() { header echo -e "The new version ($onlineversion) of Wdrive is not installed, would you like to install it?" echo -en "Y/N: " read wdriveinstall if [[ $wdriveinstall = y || $wdriveinstall = Y ]]; then rm /tmp/wdrive.sh rm /usr/bin/wdrive &>/dev/null wget http://wdrive.comlu.com/wdrive.sh -O /tmp/wdrive.sh chmod +x /tmp/wdrive.sh mv /tmp/wdrive.sh /usr/bin/wdrive echo -e "$g \n wdrive has been installed, next time type \"wdrive\" to run it!" sleep 3.5 wdrive else echo -e "$r Not installing...$ce" sleep 3 mainmenu fi } current=`cat /usr/bin/wdrive | grep shversion= | awk -F= NR==1'{print $2 }' | sed 's/"//' | sed 's/"//'` header changelog &> /dev/null chmod +x /tmp/Wdrivechangelog.txt &> /dev/null sleep 1.5 offlinecheck() { if [[ "$current" = "$shversion" ]]; then echo -e "$b You've got the latest version installed already.." sleep 2.5 mainmenu else offlineinstall fi } onlinecheck() { echo -e "$g Internet connection up, looking for new version..." onlineversion=`curl --silent http://wdrive.comlu.com/wdrive.sh 2>/dev/null | grep shversion= | awk -F= NR==1'{print $2 }' | sed 's/"//' | sed 's/"//' 2>/dev/null ` if [[ "$onlineversion" = "$current" ]]; then echo -e "$b You've got the latest version installed already.." sleep 2 mainmenu else echo -e "$g New version available, proceeding to installation" sleep 3 onlineinstall fi } if ping -c 1 www.google.com | grep -o bytes &>/dev/null; then onlinecheck else header offlinecheck mainmenu ### FIRST THING TO RUN, THIS WILL OPEN THE MENU! fi
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)



LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks