{"action":"created","issue":{"url":"https://api.github.com/repos/ptrkrysik/gr-gsm/issues/141","repository_url":"https://api.github.com/repos/ptrkrysik/gr-gsm","labels_url":"https://api.github.com/repos/ptrkrysik/gr-gsm/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/ptrkrysik/gr-gsm/issues/141/comments","events_url":"https://api.github.com/repos/ptrkrysik/gr-gsm/issues/141/events","html_url":"https://github.com/ptrkrysik/gr-gsm/issues/141","id":133101534,"number":141,"title":"Saving scanning results into a file and running a scan in a loop","user":{"login":"MatejKovacic","id":3339198,"avatar_url":"https://avatars.githubusercontent.com/u/3339198?v=3","gravatar_id":"","url":"https://api.github.com/users/MatejKovacic","html_url":"https://github.com/MatejKovacic","followers_url":"https://api.github.com/users/MatejKovacic/followers","following_url":"https://api.github.com/users/MatejKovacic/following{/other_user}","gists_url":"https://api.github.com/users/MatejKovacic/gists{/gist_id}","starred_url":"https://api.github.com/users/MatejKovacic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatejKovacic/subscriptions","organizations_url":"https://api.github.com/users/MatejKovacic/orgs","repos_url":"https://api.github.com/users/MatejKovacic/repos","events_url":"https://api.github.com/users/MatejKovacic/events{/privacy}","received_events_url":"https://api.github.com/users/MatejKovacic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-11T22:13:27Z","updated_at":"2016-02-14T11:39:14Z","closed_at":null,"body":"It would be useful to have an option (switch) to write (append) results into a text file (or maybe database). My idea is to have an option to save the following data into tab-delimited or CSV file:\r\n\r\n- timestamp\r\n- ARFCN\r\n- Freqency\r\n- CID\r\n- LAC\r\n- MCC\r\n- MNC\r\n- Pwr\r\n- some additional data (for instance ID of sensor, GPS location, etc.)\r\n\r\nThese additional data would be passed as parameter to an application, for instance:\r\n`airprobe_rtslsdr_scanner.py -save-to-file <filename> -additional-parameter <GPS_X=xxx:GPS_Y=yyy:someother_data>`\r\n\r\nThe file would then look like:\r\n```\r\ndate;time; ARFCN; Freq; CID; LAC; MCC; MNC; Pwr;additionals\r\n2016-02-11;22:37:24;11;958.0M;122;50;292;21;-26;\"GPS_X=xxx:GPS_Y=yyy:someother_data\"\r\n```\r\n\r\nWhen importing this into the database it would be very simple to split the last column into several separate columns (in a given case separator is a semicolon).\r\n\r\nThere should be another option - a switch to run GSM scanner in a loop. In that case you could be able to run it for several days and save data into the database and do some analysis later (for instance try to detect if there pop up some new base station, especially one which is moving around - i.e. IMSI catcher).\r\n\r\nActually, something like this could be already done with some bash programming:\r\n1. Create a file loopscan.sh (please note that I need to calibrate my device - airprobe_rtlsdr_scanner.py **-p 34**):\r\n\r\n```\r\n#!/bin/bash\r\n\r\necho \"date;time;ARFCN;Freq;CID;LAC;MCC;MNC;Pwr\" > data.csv\r\nwhile true;\r\ndo\r\n  tmpf=$(tempfile)\r\n  grtime=\"$(date +\"%Y-%m-%d;%H\":%M:%S)\"\r\n  echo \"Scanning GSM... [Current scan started at: $grtime. Hit CTRL+C to\r\nstop!]\"\r\n  stdbuf -oL airprobe_rtlsdr_scanner.py -p 34 >&1 > $tmpf\r\n  more +3 $tmpf | awk -v x=\"$grtime\" 'BEGIN {FS=\"[:, ]+\"} {print\r\nx\";\"$2\";\"$4\";\"$6\";\"$8\";\"$10\";\"$12\";\"$14}' >> data.csv\r\n  rm $tmpf\r\ndone\r\n```\r\n\r\n2. Run it:\r\n`sh loopscan.sh`\r\n\r\n3. Stop it with **Ctrl-C** and view the results:\r\n`cat data.csv`\r\n\r\nData from data.csv now can be imported into the database or analyzed in spreadsheet app... Anyway, timestamp here is fixed for the whole pass, and it would really be nice to have an option to save data into a file directly from GSM scanner"},"comment":{"url":"https://api.github.com/repos/ptrkrysik/gr-gsm/issues/comments/183876720","html_url":"https://github.com/ptrkrysik/gr-gsm/issues/141#issuecomment-183876720","issue_url":"https://api.github.com/repos/ptrkrysik/gr-gsm/issues/141","id":183876720,"user":{"login":"MatejKovacic","id":3339198,"avatar_url":"https://avatars.githubusercontent.com/u/3339198?v=3","gravatar_id":"","url":"https://api.github.com/users/MatejKovacic","html_url":"https://github.com/MatejKovacic","followers_url":"https://api.github.com/users/MatejKovacic/followers","following_url":"https://api.github.com/users/MatejKovacic/following{/other_user}","gists_url":"https://api.github.com/users/MatejKovacic/gists{/gist_id}","starred_url":"https://api.github.com/users/MatejKovacic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatejKovacic/subscriptions","organizations_url":"https://api.github.com/users/MatejKovacic/orgs","repos_url":"https://api.github.com/users/MatejKovacic/repos","events_url":"https://api.github.com/users/MatejKovacic/events{/privacy}","received_events_url":"https://api.github.com/users/MatejKovacic/received_events","type":"User","site_admin":false},"created_at":"2016-02-14T11:39:14Z","updated_at":"2016-02-14T11:39:14Z","body":"There should be another option - when scanner is run in the loop, it should be autokalibrated each pass or each n-passes. This is important, because some RTL-SDR devices need to be rekalibrated after they warm up.\r\n\r\nAlso, in ouptut CSV file there should also be exported RTL-SDR device ID and kalibration parameter. That will be useful for analysis how kalibration of a RTL-SDR device changes over time (does it stabilize, does it start flipping,...)."}}