Merge remote-tracking branch 'micahlee/master'

This commit is contained in:
Ulrike Uhlig 2016-09-07 15:31:43 +02:00
commit 3b058f6392
5 changed files with 42 additions and 18 deletions

View File

@ -1,5 +1,13 @@
# OnionShare Changelog
## 0.9.1
* Added Nautilus extension, so you can right-click on a file and choose "Share via OnionShare", thanks to Subgraph developers
* Switch to using the term "onion service" rather than "hidden service"
* Fix CVE-2016-5026, minor security issue related to use of /tmp directory
* Switch from PyInstaller to cx_Freeze for Windows and OSX packaging
* Support CLI in Windows and OSX
## 0.9
* Slugs are now shorter and human-readable, with rate limiting to prevent URL guessing

View File

@ -34,3 +34,11 @@ Open OnionShare and drag and drop files and folders you wish to share, and click
Send this URL to the person you're trying to send the files to. If the files you're sending aren't secret, you can use normal means of sending the URL: emailing it, posting it to Facebook or Twitter, etc. If you're trying to send secret files then it's important to send this URL securely.
The person who is receiving the files doesn't need OnionShare. All they need is to open the URL you send them in Tor Browser to be able to download the file.
## Using the command line version
In Linux: Just run `onionshare` from the terminal.
In Windows: Add `C:\Program Files (x86)\OnionShare` to your PATH. Now you can run `onionshare.exe` in a command prompt.
In Mac OS X: Run `ln -s /Applications/OnionShare.app/Contents/MacOS/onionshare /usr/local/bin`. Now you can run `onionshare` from the terminal.

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import queue, mimetypes, platform, os, sys
import queue, mimetypes, platform, os, sys, socket, logging
from urllib.request import urlopen
from flask import Flask, Response, request, render_template_string, abort
@ -73,7 +73,7 @@ REQUEST_DOWNLOAD = 1
REQUEST_PROGRESS = 2
REQUEST_OTHER = 3
REQUEST_CANCELED = 4
REQUEST_RATE_LIMIT = 4
REQUEST_RATE_LIMIT = 5
q = queue.Queue()
@ -123,12 +123,19 @@ def get_transparent_torification():
"""
return transparent_torification
# Are we running in GUI mode?
gui_mode = False
def set_gui_mode():
"""
Tell the web service that we're running in GUI mode
"""
global gui_mode
gui_mode = True
def debug_mode():
"""
Turn on debugging mode, which will log flask errors to a debug file.
"""
import logging
if platform.system() == 'Windows':
temp_dir = os.environ['Temp'].replace('\\', '/')
else:
@ -213,7 +220,7 @@ def download(slug_candidate):
def generate():
# The user hasn't canceled the download
global client_cancel
global client_cancel, gui_mode
client_cancel = False
# Starting a new download
@ -243,8 +250,8 @@ def download(slug_candidate):
downloaded_bytes = fp.tell()
percent = (1.0 * downloaded_bytes / zip_filesize) * 100
# suppress stdout platform on OSX (#203)
if helpers.get_platform() != 'Darwin':
# only output to stdout if running onionshare in CLI mode, or if using Linux (#203, #304)
if not gui_mode or helpers.get_platform() == 'Linux':
sys.stdout.write(
"\r{0:s}, {1:.2f}% ".format(helpers.human_readable_filesize(downloaded_bytes), percent))
sys.stdout.flush()
@ -351,8 +358,6 @@ def stop(port):
# to stop flask, load http://127.0.0.1:<port>/<shutdown_slug>/shutdown
try:
if transparent_torification:
import socket
s = socket.socket()
s.connect(('127.0.0.1', port))
s.sendall('GET /{0:s}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))

View File

@ -139,10 +139,18 @@ class OnionShareGui(QtWidgets.QMainWindow):
# Reset web counters
web.download_count = 0
web.error404_count = 0
web.set_gui_mode()
# pick an available local port for the http service to listen on
self.app.choose_port()
# start onionshare http service in new thread
t = threading.Thread(target=web.start, args=(self.app.port, self.app.stay_open, self.app.transparent_torification))
t.daemon = True
t.start()
# wait for modules in thread to load, preventing a thread-related cx_Freeze crash
time.sleep(0.2)
# start the onion service in a new thread
def start_onion_service(self):
self.status_bar.showMessage(strings._('gui_starting_server1', True))
@ -154,14 +162,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.starting_server_error.emit(e.args[0])
return
t1 = threading.Thread(target=start_onion_service, kwargs={'self': self})
t1.daemon = True
t1.start()
# start onionshare http service in new thread
t2 = threading.Thread(target=web.start, args=(self.app.port, self.app.stay_open, self.app.transparent_torification))
t2.daemon = True
t2.start()
t = threading.Thread(target=start_onion_service, kwargs={'self': self})
t.daemon = True
t.start()
def start_server_step2(self):
"""

View File

@ -1 +1 @@
0.9.1-dev
0.9.1