diff --git a/README.md b/README.md index ae1fa53b..516891de 100644 --- a/README.md +++ b/README.md @@ -6,33 +6,42 @@ A program to securely share a file of any size with someone, designed to be run ## Quick Start -You need to run this script as root, so make sure you set an administrator password when you boot Tails. Run onionshare.py, and pass it a filename. It will look something like this: +### If you're using Tails - amnesia@amnesia:~/Persistent/code/onionshare$ sudo ./onionshare.py ~/Persistent/file_to_send.gpg +You need to run OnionShare as root in Tails, so make sure you set an administrator password when you boot Tails. First, get a copy of the OnionShare program: + + git clone https://github.com/micahflee/onionshare.git + cd onionshare + +To run it, use the onionshare-tails script: + + amnesia@amnesia:~/Persistent/code/onionshare$ sudo ./onionshare-tails ~/Persistent/file_to_send.pgp [sudo] password for amnesia: - Modifying torrc to configure hidden service on port 41710 - Reloading tor daemon configuration... [ DONE ] + Connecting to Tor ControlPort to set up hidden service on port 16089 Punching a hole in the firewall - Waiting 10 seconds for hidden service to get configured... - Give this information to the person youre sending the file to: - URL: http://b6vgwkuo77qieguy.onion/ - Username: 5eebeba8b70cfdfc - Password: f5a7fa91c294479a + Give this information to the person you're sending the file to: + URL: http://muqi5o5dfdraj2ms.onion/ + Username: f3bce5f2b373906f + Password: 866b2f1a710ece73 Press Ctrl-C to stop server - * Running on http://127.0.0.1:41710/ - 127.0.0.1 - - [20/May/2014 19:41:19] "GET / HTTP/1.1" 401 - - 127.0.0.1 - - [20/May/2014 19:41:28] "GET / HTTP/1.1" 200 - - 127.0.0.1 - - [20/May/2014 19:41:31] "GET /favicon.ico HTTP/1.1" 404 - - 127.0.0.1 - - [20/May/2014 19:41:31] "GET /favicon.ico HTTP/1.1" 404 - + * Running on http://127.0.0.1:16089/ + 127.0.0.1 - - [21/May/2014 18:47:42] "GET / HTTP/1.1" 401 - + 127.0.0.1 - - [21/May/2014 18:47:52] "GET / HTTP/1.1" 200 - + 127.0.0.1 - - [21/May/2014 18:47:55] "GET /favicon.ico HTTP/1.1" 404 - + 127.0.0.1 - - [21/May/2014 18:47:55] "GET /favicon.ico HTTP/1.1" 404 - Securely send the URL, username, and password to the person you are sending the file to (like by using Jabber and OTR). When they load the website, they will be connecting directly to your computer. They'll need the username and password to authenticate. You can watch all the web requests that are getting made. Once you confirm that they have downloaded the file you're sending (ask them), press Ctrl-C to shut down the server and clean up your Tails setup. - Restoring original torrc - Reloading tor daemon configuration... [ DONE ] + 127.0.0.1 - - [21/May/2014 18:48:50] "GET /download HTTP/1.1" 200 - + ^C + Closing hole in firewall +### If you're using other operating systems + +Non-Tails operating systems coming soon. diff --git a/onionshare-tails b/onionshare-tails new file mode 100755 index 00000000..7d654679 --- /dev/null +++ b/onionshare-tails @@ -0,0 +1,12 @@ +#!/bin/bash + +if [[ $EUID -ne 0 ]]; then + echo "You need to run this as root" 1>&2 + exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +export ONIONSHARE_PLATFORM=Tails +$DIR/onionshare.py $@ + diff --git a/onionshare.py b/onionshare.py index 95263a8e..d6a56f50 100755 --- a/onionshare.py +++ b/onionshare.py @@ -48,18 +48,17 @@ def download(): basename = os.path.basename(filename) return send_from_directory(dirname, basename, as_attachment=True) -def modify_firewall(port, open_port=True): - if open_port: - action = 'ACCEPT' - else: - action = 'REJECT' - subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', action]) +def tails_open_port(port): + if os.environ['ONIONSHARE_PLATFORM'] == 'Tails': + print 'Punching a hole in the firewall' + subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', 'ACCEPT']) + +def tails_close_port(port): + if os.environ['ONIONSHARE_PLATFORM'] == 'Tails': + print 'Closing hole in firewall' + subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', 'REJECT']) if __name__ == '__main__': - # check for root - if not os.geteuid()==0: - sys.exit('You need to run this as root') - # validate filename if len(sys.argv) != 2: sys.exit('Usage: {0} [filename]'.format(sys.argv[0])); @@ -103,8 +102,7 @@ if __name__ == '__main__': onion_host = open('/tmp/onionshare_hidden_service_{0}/hostname'.format(port), 'r').read().strip() # punch a hole in the firewall - print 'Punching a hole in the firewall' - modify_firewall(port) + tails_open_port(port) # instructions print '\nGive this information to the person you\'re sending the file to:' @@ -119,5 +117,4 @@ if __name__ == '__main__': print '\n' # shutdown - print 'Closing hole in firewall' - modify_firewall(port, False) + tails_close_port(port)