Skip to content

Instantly share code, notes, and snippets.

@umrysh
Created July 18, 2013 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umrysh/6030771 to your computer and use it in GitHub Desktop.
Save umrysh/6030771 to your computer and use it in GitHub Desktop.
To alleviate paranoia run this script every minute through your crontab and you will get an alert if unknown IPs are connecting to your Bittorent Sync folders.
#!/bin/sh
######################################################################################
# The location of your Bittorent Sync log
LOG_LOCATION="/home/user/.btsync/btsync/sync.log"
# The list of known IPs you do not require an alert about
KNOWN_IPS="192.168.1|69.147.76.15|216.239.51.9"
# The icon for your alert
# I found a great little image here:
# http://i1-win.softpedia-static.com/screenshots/icon-60/BitTorrent-Sync.png
ALERT_IMAGE="/home/user/bin/BitTorrent-Sync.png"
######################################################################################
cat $LOG_LOCATION | grep Incoming | cut -d ' ' -f6 | cut -d ':' -f1 | grep -Ev $KNOWN_IPS | sort -u | while read ALERT_OUT; do DISPLAY=:0.0 XAUTHORITY=~/.Xauthority notify-send -i $ALERT_IMAGE -t 5000 --hint=int:transient:1 -- 'Unknown BTsync Connection' "$ALERT_OUT";done
@umrysh
Copy link
Author

umrysh commented Aug 20, 2013

If after a while you start getting alerts about an unknown connection but the pop-up shows no other information you will need to delete your "sync.log" file and restart BitTorrent Sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment