1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Quick and dirty hack to import all data
|
---|
4 |
|
---|
5 | DATAROOT=${1:-"`pwd $0`/scan-data"}
|
---|
6 | MAP_CACHE=${MAP_CACHE:-"/usr/local/var/httpd/cache/maps"}
|
---|
7 | MANAGE="`dirname $0`/manage.py"
|
---|
8 | SSH_USER=backup
|
---|
9 | SSH_KEY="`dirname $0`/id_rsa"
|
---|
10 | export PYTHON_EGG_CACHE=/tmp/
|
---|
11 |
|
---|
12 | echo "# rsync webfolder"
|
---|
13 | rsync -e "ssh -i $SSH_KEY -l $SSH_USER -o StrictHostKeyChecking=no" -az tyan.wirelessleiden.nl:/usr/local/www/webfolder/scan-data/ $DATAROOT
|
---|
14 |
|
---|
15 |
|
---|
16 | echo "# unzip compressed .tar.gz files"
|
---|
17 | for FILE in `find $DATAROOT -name '*.tar.gz' | sort`; do
|
---|
18 | TARDIR=`dirname $FILE`
|
---|
19 | tar -C $TARDIR -xkzf $FILE
|
---|
20 | done
|
---|
21 |
|
---|
22 | #Kismet netxml Imports
|
---|
23 | FILES="`find $DATAROOT -name '*netxml*' | sort`"
|
---|
24 | [ -n "$FILES" ] && $MANAGE import_common $ARGS $FILES
|
---|
25 |
|
---|
26 | # Import all measure data
|
---|
27 | for USERDIR in `find $DATAROOT -mindepth 1 -maxdepth 1 -type d | sort`; do
|
---|
28 | for DEVICEDIR in `find $USERDIR -mindepth 1 -maxdepth 1 -type d | sort`; do
|
---|
29 | USERNAME=`basename $USERDIR`
|
---|
30 | DEVICE=`basename $DEVICEDIR`
|
---|
31 | ARGS="-g $USERNAME -e $USERNAME@wirelessleiden.nl -k $DEVICE"
|
---|
32 |
|
---|
33 | echo $ARGS
|
---|
34 | #Kismet gpsxml Imports
|
---|
35 | FILES="`find $DEVICEDIR -name '*gpsxml*'`"
|
---|
36 | [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
|
---|
37 |
|
---|
38 | # DroidStumber imports
|
---|
39 | FILES=`find $DEVICEDIR -name 'ScanResult-*'`
|
---|
40 | [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
|
---|
41 |
|
---|
42 | # Kismet imports
|
---|
43 | FILES=`find $DEVICEDIR -name '*.ns1'`
|
---|
44 | [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
|
---|
45 | done
|
---|
46 | done
|
---|
47 |
|
---|
48 | if [ -r $MAP_CACHE ]; then
|
---|
49 | echo "# Clear cache $MAP_CACHE"
|
---|
50 | htcacheclean -v -l10K -p$MAP_CACHE
|
---|
51 | fi
|
---|
52 |
|
---|