From 39336ed2cfacc3fe16c0b1819bb0dac80ba8c038 Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sat, 12 Aug 2017 11:41:55 -0300 Subject: [PATCH 1/8] Updating Wigle API call in batch downloader to new version --- node/src/WigleBatchDownloader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } } From d2c0562532616b9c148324c9a0187f62dad89e9b Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sat, 12 Aug 2017 11:42:54 -0300 Subject: [PATCH 2/8] Updating methods to call Wigle API with token --- node/wigle_dump.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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); } From 8bc43ba94acb2d91592aea0da0775c3458c44c38 Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sat, 12 Aug 2017 11:44:38 -0300 Subject: [PATCH 3/8] Updating Wigle submodule to sync from a repository with API in the new version --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a45f647d73404ea387bde2cf62d32a86343aa435 Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sun, 13 Aug 2017 04:01:33 -0300 Subject: [PATCH 4/8] Adding in scripts the preinstall command to install dependencies --- node/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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", From 47b1158a1901a1c4fd71059b5a02820caecc3fef Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sun, 13 Aug 2017 04:03:33 -0300 Subject: [PATCH 5/8] Fixing indentation and adding dependency to run npm without change to node directory --- package.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index dbe56ca..c50ee78 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,17 @@ "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" } } From 1a3364542a348ff26db20f20cc465924cbc7f1c6 Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sun, 13 Aug 2017 04:07:04 -0300 Subject: [PATCH 6/8] Adding git ignore entry to node modules and lock file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) 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 From af883e8ef5a9807d83de9868f27618fc221f8e61 Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Sun, 13 Aug 2017 04:08:31 -0300 Subject: [PATCH 7/8] Adding section with guide to install with virtualenv-a --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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/) From 8fc8c61dc7ffd2775e69dd23cc097006615f1134 Mon Sep 17 00:00:00 2001 From: Ibirisol Fontes Date: Fri, 18 Aug 2017 00:51:19 -0300 Subject: [PATCH 8/8] adding initial commit to bluetooth integration --- node/blue_server.js | 23 +++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 node/blue_server.js 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/package.json b/package.json index c50ee78..5aedaca 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "min_height": 600 }, "dependencies": { - "ProbeKit": "file:node" + "ProbeKit": "file:node", + "noble": "^1.8.1" } }