From d8798651e6b16804ec2df7898823d991f2970fc3 Mon Sep 17 00:00:00 2001 From: tndoan Date: Fri, 4 Mar 2016 22:32:55 +0800 Subject: [PATCH 1/5] file contains the list of IP addresses which are allowed to view our data --- allowed_ip.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 allowed_ip.txt diff --git a/allowed_ip.txt b/allowed_ip.txt new file mode 100644 index 0000000..7b9ad53 --- /dev/null +++ b/allowed_ip.txt @@ -0,0 +1 @@ +127.0.0.1 From c04af7401ec4a474929362ec5353451d7b80f247 Mon Sep 17 00:00:00 2001 From: tndoan Date: Fri, 4 Mar 2016 22:40:56 +0800 Subject: [PATCH 2/5] protect our privacy by allowing only IP addresses in allowed_ip.txt file to view our data --- ulogme_serve.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ulogme_serve.py b/ulogme_serve.py index cbdba9f..a7cda21 100644 --- a/ulogme_serve.py +++ b/ulogme_serve.py @@ -21,6 +21,12 @@ # Custom handler class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): + ip = self.client_address[0] + if not ip in listOfIP: + # only IP address in the list are allowed to view data + # it protects the privacy + print ip + ' is trying to view our data but is blocked' + return # default behavior SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) @@ -67,6 +73,13 @@ def do_POST(self): self.end_headers() self.wfile.write(result) +f = open('../allowed_ip.txt', 'r') +listOfIP = [i.strip('\n') for i in f.readlines()] +f.close() + +for i in listOfIP: + print i + httpd = SocketServer.ThreadingTCPServer((IP, PORT), CustomHandler) print 'Serving ulogme, see it on http://localhost:' + `PORT` From f57b0f2cefe22cfc7e701a70ef6f5b8bb27313b9 Mon Sep 17 00:00:00 2001 From: tndoan Date: Fri, 4 Mar 2016 22:50:25 +0800 Subject: [PATCH 3/5] update readme file to instruct how to use allowed_ip.txt --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0863cbd..4f81900 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,9 @@ See a blog post (along with multiple screenshots) describing the project [here.] **The user interface** 1. **Important**. As a one-time setup, copy over the example settings file to your own copy: `$ cp render/render_settings_example.js render/render_settings.js` to create your own `render_settings.js` settings file. In this file modify everything to your own preferences. Follow the provided example to specify title mappings: A raw window title comes in, and we match it against regular expressions to determine what type of activity it is. For example, the code would convert "Google Chrome - some cool website" into just "Google Chrome". Follow the provided example and read the comments for all settings in the file. -2. Once that's set up, start the web server viewer: `$ python ulogme_serve.py`, and go to to the provided address) for example `http://localhost:8123`) in your browser. Hit the refresh button on top right every time you'd like to refresh the results based on most recently recorded activity -3. If your data isn't loading, try to explicitly run `python export_events.py` and then hit refresh. This should only be an issue the very first time you run ulogme. +2. The file `allowed_ip.txt` contains the list of IP addresses which are allowed to view our data. By default, only local host (i.e. our machine) can view. If you want other users in local network to view, explicitly add their IP addresses to this file. One IP address is in one line. +3. Once that's set up, start the web server viewer: `$ python ulogme_serve.py`, and go to to the provided address) for example `http://localhost:8123`) in your browser. Hit the refresh button on top right every time you'd like to refresh the results based on most recently recorded activity +4. If your data isn't loading, try to explicitly run `python export_events.py` and then hit refresh. This should only be an issue the very first time you run ulogme. ## User Interface From eeeb144b39b1393cb2240a22c1dff9f2ea98e7ef Mon Sep 17 00:00:00 2001 From: tndoan Date: Fri, 4 Mar 2016 22:57:12 +0800 Subject: [PATCH 4/5] remove the code to check ip --- ulogme_serve.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ulogme_serve.py b/ulogme_serve.py index a7cda21..b153f9a 100644 --- a/ulogme_serve.py +++ b/ulogme_serve.py @@ -77,9 +77,6 @@ def do_POST(self): listOfIP = [i.strip('\n') for i in f.readlines()] f.close() -for i in listOfIP: - print i - httpd = SocketServer.ThreadingTCPServer((IP, PORT), CustomHandler) print 'Serving ulogme, see it on http://localhost:' + `PORT` From 988c40a4648a164f87d5f40d38f53489d75f48ad Mon Sep 17 00:00:00 2001 From: tndoan Date: Tue, 2 Jan 2018 15:56:02 +0800 Subject: [PATCH 5/5] add support to gnome-flashback-metacity --- logactivewin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logactivewin.sh b/logactivewin.sh index 68408b1..2cfc0cb 100755 --- a/logactivewin.sh +++ b/logactivewin.sh @@ -24,7 +24,7 @@ do # Assume XFCE folks use xscreensaver (the default). screensaverstate=$(xscreensaver-command -time | cut -f2 -d: | cut -f2-3 -d' ') if [[ $screensaverstate =~ "screen non-blanked" ]]; then islocked=false; fi - elif [[ $GDMSESSION == 'ubuntu' || $GDMSESSION == 'ubuntu-2d' || $GDMSESSION == 'gnome-shell' || $GDMSESSION == 'gnome-classic' || $GDMSESSION == 'gnome-fallback' || $GDMSESSION == 'cinnamon' ]]; then + elif [[ $GDMSESSION == 'ubuntu' || $GDMSESSION == 'ubuntu-2d' || $GDMSESSION == 'gnome-shell' || $GDMSESSION == 'gnome-classic' || $GDMSESSION == 'gnome-fallback' || $GDMSESSION == 'cinnamon' || $GDMSESSION == 'gnome-flashback-metacity' ]]; then # Assume the GNOME/Ubuntu/cinnamon folks are using gnome-screensaver. screensaverstate=$(gnome-screensaver-command -q 2>&1 /dev/null) if [[ $screensaverstate =~ .*inactive.* ]]; then islocked=false; fi