Skip to content

Commit

Permalink
Merge pull request #4 from pi-resource/v1.3.1-Bug-Fixes
Browse files Browse the repository at this point in the history
V1.3.1 bug fixes
  • Loading branch information
pi-resource committed Dec 6, 2017
2 parents 4ff9f03 + 560f9a6 commit 3050f9e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion WarDriving.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
#
# Number of seconds the script pauses when it is started, to enable the GPS to get a fix.
timerGps=1
timerGps=10
#
# Once running, the number of seconds before Kismet Server is restarted, log files compressed and an attempt to upload them is made.
timerRepeat=60
Expand Down
20 changes: 12 additions & 8 deletions WarDriving.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# 9. Wait a set amount of time before restarting this script
#
# Author: pi-resource.com
# Version: 1.2
# Date: 2017-11-15
VERSION='1.3.1'
RELEASE_DATE='2017-12-06'

#############
# Constants #
Expand Down Expand Up @@ -88,7 +88,9 @@ function upsCheckStatus {
chipAddress=0x69
dataAddress=0x00

if i2cget -y $i2cBus $chipAddress $dataAddress b > /dev/null; then
if [ $upsInstalled -ne 1 ]; then
local UpsStatus=0
elif i2cget -y $i2cBus $chipAddress $dataAddress b > /dev/null 2>&1; then
# UPS is available

response=$(i2cget -y $i2cBus $chipAddress $dataAddress b)
Expand Down Expand Up @@ -180,7 +182,7 @@ function upsConfigure {
# returns: 0 if running
# 1 if not running
function checkKismetRunning {
if pgrep -x "kismet_server" > /dev/null
if pgrep -x "kismet_server" > /dev/null 2>&1
then
return 0
else
Expand Down Expand Up @@ -212,8 +214,8 @@ function displayIntro {
printf "\n%sIt uses Kismet to log WiFi hotspots. After a set amount of time Kismet is restarted which forces Kismet to write its log files." $DEFAULT
printf "\n%sOnce the Kismet Server has restarted, the war driving files from the previous instance are compressed an attempt made to upload them." $DEFAULT
printf "\n%sAny Comments, questions or suggested improvements, please visit %s%shttp://www.pi-resource.com" $DEFAULT $BLUE $UNDERLINE
printf "\n%sVersion: 1.1" $DEFAULT
printf "\n%sRelease date: 2017-11-15" $DEFAULT
printf "\n%sVersion: %s" $DEFAULT $VERSION
printf "\n%sRelease date: %s" $DEFAULT $RELEASE_DATE
}

# Prints the configuration out to screen.
Expand Down Expand Up @@ -592,7 +594,7 @@ do
printf "%sWARNING%s - Pi is running on UPS battery power. Therefore not starting Kismet." $YELLOW $DEFAULT
else
# under all other conditions, i.e. no UPS, unknown value returned, or mains power, then proceed to start Kismet
sudo kismet_server -s -p /home/pi/WarDriving/logs/kismet > /dev/null &
sudo kismet_server -s -p /home/pi/WarDriving/logs/kismet > /dev/null 2>&1 &
sleep 1
if checkKismetRunning; then
printf "%sSUCCESS%s - Kismet Server Started" $GREEN $DEFAULT
Expand Down Expand Up @@ -630,7 +632,9 @@ do

# Fetch a MAC address to use as a machine UUID. Not perfect, but good enough for this application.
mac=$(ifconfig | grep -m 1 -oP 'HWaddr \K.................' | sed 's/://g')

if [ -z $mac ]; then
mac=$(ifconfig | grep -m 1 -oP 'ether \K.................' | sed 's/://g')
fi
# Generate a random 8 character alphanumeric string (upper and lowercase)
# uuid=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
uuid=$RANDOM
Expand Down
7 changes: 6 additions & 1 deletion history.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v1.3.1
- Compatibility added for Raspbian Stretch.
- Fixed bug that resulted in the reporting of the wrong version number.
- Fixed bug that even when UPS was disabled in configuration - the script would still attempt to use the UPS if one were installed.

v1.3
Added support for a UPS. (Uninterruptible Power Supply)
This addresses two concerns which are best illustrated when the War Driving rig is installed in a car. On arrival at the destination the ignition is typically turned off very soon after the car stops and this results in:
Expand All @@ -19,7 +24,7 @@ An example configuration file is provided - WarDriving.cfg.example
If the user does not have an existing WarDriving.cfg file (i.e. first download and not an upgrade), then they should edit the example file before renaming it to WarDriving.cfg (i.e. cp WarDriving.cfg.example WarDriving.cfg)

v1.0
Initial public release
Initial public release.

v0.1 - v0.6
Development and private use/testing

0 comments on commit 3050f9e

Please sign in to comment.