made onionshare-tails, specifically for running in Tails

This commit is contained in:
Micah Lee 2014-05-21 18:51:04 +00:00
parent bd8e6d13fb
commit 4d2a2cec6d
3 changed files with 48 additions and 30 deletions

View file

@ -6,33 +6,42 @@ A program to securely share a file of any size with someone, designed to be run
## Quick Start ## 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: [sudo] password for amnesia:
Modifying torrc to configure hidden service on port 41710 Connecting to Tor ControlPort to set up hidden service on port 16089
Reloading tor daemon configuration... [ DONE ]
Punching a hole in the firewall 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: Give this information to the person you're sending the file to:
URL: http://b6vgwkuo77qieguy.onion/ URL: http://muqi5o5dfdraj2ms.onion/
Username: 5eebeba8b70cfdfc Username: f3bce5f2b373906f
Password: f5a7fa91c294479a Password: 866b2f1a710ece73
Press Ctrl-C to stop server Press Ctrl-C to stop server
* Running on http://127.0.0.1:41710/ * Running on http://127.0.0.1:16089/
127.0.0.1 - - [20/May/2014 19:41:19] "GET / HTTP/1.1" 401 - 127.0.0.1 - - [21/May/2014 18:47:42] "GET / HTTP/1.1" 401 -
127.0.0.1 - - [20/May/2014 19:41:28] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [21/May/2014 18:47:52] "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 - - [21/May/2014 18:47:55] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [20/May/2014 19:41:31] "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. 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. 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 127.0.0.1 - - [21/May/2014 18:48:50] "GET /download HTTP/1.1" 200 -
Reloading tor daemon configuration... [ DONE ] ^C
Closing hole in firewall Closing hole in firewall
### If you're using other operating systems
Non-Tails operating systems coming soon.

12
onionshare-tails Executable file
View file

@ -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 $@

View file

@ -48,18 +48,17 @@ def download():
basename = os.path.basename(filename) basename = os.path.basename(filename)
return send_from_directory(dirname, basename, as_attachment=True) return send_from_directory(dirname, basename, as_attachment=True)
def modify_firewall(port, open_port=True): def tails_open_port(port):
if open_port: if os.environ['ONIONSHARE_PLATFORM'] == 'Tails':
action = 'ACCEPT' print 'Punching a hole in the firewall'
else: subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', 'ACCEPT'])
action = 'REJECT'
subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', action]) 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__': if __name__ == '__main__':
# check for root
if not os.geteuid()==0:
sys.exit('You need to run this as root')
# validate filename # validate filename
if len(sys.argv) != 2: if len(sys.argv) != 2:
sys.exit('Usage: {0} [filename]'.format(sys.argv[0])); 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() onion_host = open('/tmp/onionshare_hidden_service_{0}/hostname'.format(port), 'r').read().strip()
# punch a hole in the firewall # punch a hole in the firewall
print 'Punching a hole in the firewall' tails_open_port(port)
modify_firewall(port)
# instructions # instructions
print '\nGive this information to the person you\'re sending the file to:' print '\nGive this information to the person you\'re sending the file to:'
@ -119,5 +117,4 @@ if __name__ == '__main__':
print '\n' print '\n'
# shutdown # shutdown
print 'Closing hole in firewall' tails_close_port(port)
modify_firewall(port, False)