diff --git a/.gitignore b/.gitignore index 7193a06..8c35933 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ data/probes.csv data/maps/tiles/* data/ChmodBPF/* build/ +package-lock.json +node_modules diff --git a/.gitmodules b/.gitmodules index 33ce010..6cca39f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "node/src/wigle-api"] path = node/src/wigle-api - url = https://github.com/brannondorsey/wigle-api.git + url = https://github.com/ibirisol/wigle-api.git diff --git a/README.md b/README.md index 742476f..2c1d76f 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,30 @@ sudo ./install.sh open "Probe Kit.app" # OS X only ``` +### Source Code Install with Virtualenv + +That is for you minimalist guy... + +```bash +sudo apt-get install libpcap-dev virtualenv mongodb tshark +sudo -E useradd -G wireshark $USER +git clone https://github.com/brannondorsey/ProbeKit.git +cd ProbeKit/ +virtualenv -p python3 ._env +source ._env/bin/activate +pip install nodeenv +nodeenv --python-virtualenv +npm install node/ +./shell/generate_settings.sh +``` +To run web server and upload server. + +```bash +node node/server.js -i & +node node/upload_server.js & + +``` + ## Getting Started ## License and Attribution @@ -85,4 +109,4 @@ Probe Kit is built using the following libraries and projects: - [Node.js](https://nodejs.org/) - [NW.js](http://nwjs.io) - [WiGLE.net](https://wigle.net) -- [MapBox](https://www.mapbox.com/) \ No newline at end of file +- [MapBox](https://www.mapbox.com/) diff --git a/node/blue_server.js b/node/blue_server.js new file mode 100644 index 0000000..2f26f3a --- /dev/null +++ b/node/blue_server.js @@ -0,0 +1,23 @@ +noble = require('noble') + +noble.on('stateChange', function(state) { + console.log("Status: " + state); + if (state === 'poweredOn') { + console.log("Scanning..."); + noble.startScanning(); + } else { + console.log("Stoping..."); + noble.stopScanning(); + } +}); + +noble.on('discover', function(peripheral) { + console.log('Found device with local name: ' + peripheral.advertisement.localName,' and id: ' + peripheral._noble.address); + console.log('Advertising the following service uuid\'s: ' + peripheral.advertisement.serviceUuids); + Object.keys(peripheral.advertisement).forEach(function (key) { + var val = peripheral.advertisement[key]; + console.log(key, ': ' + val); + }); + console.dir(peripheral, {depth: null, colors: true}); + console.log(); +}); diff --git a/node/package.json b/node/package.json index 55f3e16..51a5813 100644 --- a/node/package.json +++ b/node/package.json @@ -7,7 +7,8 @@ "node": ">=0.12.0" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "preinstall": "npm install --global nw node-webkit-builder" }, "repository": { "type": "git", diff --git a/node/src/WigleBatchDownloader.js b/node/src/WigleBatchDownloader.js index cabce2a..f0c2d10 100644 --- a/node/src/WigleBatchDownloader.js +++ b/node/src/WigleBatchDownloader.js @@ -2,15 +2,15 @@ var util = require('util'); var wigle = require('./wigle-api'); var _ = require('underscore'); -function WigleBatchDownloader(username, password, callback) { +function WigleBatchDownloader(api_token, callback) { var self = this; self.requestTimeout = 1000 * 60; // default // self.maxConcurrentRequests = 1; self.downloading = false; - if (username && password && callback) { - self.wigleClient = wigle.createClient(username, password, callback); + if (api_token && callback) { + self.wigleClient = wigle.createClient(api_token, callback); } } diff --git a/node/wigle_dump.js b/node/wigle_dump.js index 325960c..f729690 100644 --- a/node/wigle_dump.js +++ b/node/wigle_dump.js @@ -3,8 +3,7 @@ var argv = require('minimist')(process.argv.slice(2)); var _ = require('underscore'); var WigleBatchDownloader = require('./src/WigleBatchDownloader'); -var username = argv.username || argv.u || '46ea0d5b2'; -var password = argv.password || argv.p || '46ea0d5b2'; +var api_token = argv.token || argv.t || '46ea0d5b2'; var lastupdt = argv.lastupdt || argv.l; var latrange1 = argv.north || argv.latrange1; var latrange2 = argv.south || argv.latrange2; @@ -24,8 +23,7 @@ if (!(latrange1 && latrange2 && longrange1 && longrange2)) { console.log(' --east=, longrange2='); console.log(); console.log('Options:'); - console.log(' --username=[username], -u [username] Wigle.net username.'); - console.log(' --password=[password], -c [password] Wigle.net password.'); + console.log(' --token=[api_token], -t [api_token] Wigle.net API token.'); console.log(' --chunkSize=[chunkSize], -c [chunkSize] Set the chunkSize. i.e. 0.005'); console.log(' --lastupdt=[lastupdt], -l [lastupdt] Search only networks found since YYYYMMDDHHMMSS. i.e. 20100101000000'); console.log(' --dryRun, -d Calculate number of prepaired requests only. Does not actually execute reqests.'); @@ -72,11 +70,11 @@ if (dryRun) { process.exit(0); } -var batchDownloader = new WigleBatchDownloader(username, password, function(err){ +var batchDownloader = new WigleBatchDownloader(api_token, function(err){ // fires on wigle.net login or (err on login failed if (err) { - console.log('Login failed using username: ' + username + ' password: ' + password); + console.log('Login failed using this API token: ' + api_token); process.exit(1); } diff --git a/package.json b/package.json index dbe56ca..5aedaca 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,18 @@ "node-main": "node/nw_start.js", "main": "public/loading.html", "window": { - "title": "Probe Kit", - "icon": "media/icon_butterfly.png", - "toolbar": false, - "position": "center", - "resizable": true, + "title": "Probe Kit", + "icon": "media/icon_butterfly.png", + "toolbar": false, + "position": "center", + "resizable": true, "width": 1024, "height": 768, - "min_width": 1024, - "min_height": 600 + "min_width": 1024, + "min_height": 600 + }, + "dependencies": { + "ProbeKit": "file:node", + "noble": "^1.8.1" } }