Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect privacy #33

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions allowed_ip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
127.0.0.1
2 changes: 1 addition & 1 deletion logactivewin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions ulogme_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -67,6 +73,10 @@ 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()

httpd = SocketServer.ThreadingTCPServer((IP, PORT), CustomHandler)

print 'Serving ulogme, see it on http://localhost:' + `PORT`
Expand Down