support https:// sites by stripping with sslstrip

if this project wasn't perverse enough, the web-rendering-proxy now
requires another proxy as its dependency.
This commit is contained in:
girst 2018-12-28 14:16:01 +01:00
parent 7013f521b3
commit 85063cefc8
2 changed files with 16 additions and 2 deletions

View File

@ -4,8 +4,7 @@ A HTTP proxy server that renders the web page in to a GIF/PNG/JPEG image associa
Version 2.0 brings support for PythonMagick (ImageMagick Library) that allows to optimize and reduce image size or covert to greyscale or bitmap for these cool computers without color displays.
# Current Status
* Due to a recent migration of the whole Internet to SSL/HTTPS, WRP is currently pretty much useless
* Support for a SSL/HTTPS is under way, however not in a proxy mode
* SSL/TLS stripping is delegated to `sslstrip`[1], which you need to install into your PATH first
* I'm also looking for moving away from WebKit, QT and Python
* Stay tuned
@ -25,3 +24,5 @@ Configure your web browser to use HTTP proxy at IP address and port where WRP is
## More info and screenshots
* http://virtuallyfun.superglobalmegacorp.com/2014/03/11/web-rendering-proxy-update/
* http://virtuallyfun.superglobalmegacorp.com/2014/03/03/surfing-modern-web-with-ancient-browsers/
[1]: https://moxie.org/software/sslstrip/

13
wrp.py
View File

@ -18,6 +18,7 @@ __version__ = "2.0"
# Copyright (c) 2012-2013 picidae.net
# Copyright (c) 2004-2013 Paul Hammond
# Copyright (c) 2017-2018 Natalia Portillo
# Copyright (c) 2018 //gir.st/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -47,6 +48,7 @@ WAIT = 1 # sleep for 1 second to allow javascript renders
QUALITY = 75 # For JPEG: image quality 0-100; For PNG: sets compression level (leftmost digit 0 fastest, 9 best)
AUTOWIDTH = True # Check for browser width using javascript
FORMAT = "AUTO" # AUTO = GIF for mac OS, JPG for rest; PNG, GIF, JPG as supported values.
SSLSTRIP = True # enable to automatically downgrade secure requests
# PythonMagick configuration options
MK_MONOCHROME = False # Convert the render to a black and white dithered image
@ -68,6 +70,7 @@ import Queue
import sys
import logging
import StringIO
import subprocess
try:
import PythonMagick
@ -894,6 +897,16 @@ def main():
if (sys.platform.startswith('linux') or sys.platform.startswith('freebsd')) and FORMAT == "GIF" and not HasMagick:
sys.exit("GIF format is not supported on this platform. Exiting.")
# run traffic through sslstrip as a quick workaround for getting SSL webpages to work
# NOTE: modern browsers are doing their best to stop this kind of 'attack'. Firefox
# supports an about:config flag test.currentTimeOffsetSeconds(int) = 12000000, which
# you can use to circumvent those checks.
if SSLSTRIP:
try:
subprocess.check_output(["pidof", "sslstrip"])
except:
subprocess.Popen(["sslstrip"], stdout=open(os.devnull,'w'), stderr=subprocess.STDOUT) # runs on port 10000 by default
QNetworkProxy.setApplicationProxy(QNetworkProxy(QNetworkProxy.HttpProxy, "localhost", 10000))
# Launch Proxy Thread
threading.Thread(target=run_proxy).start()