Added support for apache24 mod_wsgi.
This commit is contained in:
parent
25e17d32fd
commit
0630e5f841
4 changed files with 77 additions and 47 deletions
15
README.rst
15
README.rst
|
@ -14,7 +14,10 @@ below).
|
|||
Content size can be limited.
|
||||
It uses lock which allows only one request at a time.
|
||||
It is implemented with bottle microframework.
|
||||
|
||||
It is a hack! :)
|
||||
This tool was written to deceive/fool proxy which prevented me to
|
||||
download usefull tools and/or source code files.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
@ -39,19 +42,23 @@ save it to data.tar.xz:
|
|||
|
||||
cat DATA.txt | python x.py d > data.tar.xz
|
||||
|
||||
Run it in development mode:
|
||||
Run it in development mode using python wsgiref:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python x.py ANY-ARG
|
||||
python x.py x
|
||||
|
||||
Run it in production mode:
|
||||
Run it in production mode using python wsgiref:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python x.py
|
||||
|
||||
Run it as apache24 wsig:
|
||||
|
||||
see apache-config file for apache configuration
|
||||
|
||||
When you use this same tool for prepareing target URL and decrypting
|
||||
target content on the client then x.py need to be defined with the same AES
|
||||
KEY and IV values as on the server.
|
||||
|
@ -61,6 +68,8 @@ Installation
|
|||
|
||||
Copy bottle.py and x.py to the desired server and directory and run it.
|
||||
|
||||
For use with apache24 install mod_wsgi and see apache-config file for apache configuration.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
|
@ -82,7 +91,5 @@ Further development ideas
|
|||
|
||||
* Add configuration file.
|
||||
|
||||
* Add apache mod_wsgi support.
|
||||
|
||||
* Support defined maximum requests at a time instead of one lock.
|
||||
|
||||
|
|
13
apache-config
Executable file
13
apache-config
Executable file
|
@ -0,0 +1,13 @@
|
|||
<VirtualHost _default_:80>
|
||||
ServerName cloak
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
WSGIScriptAlias /x "/home/freebsd/x/wsgi.py"
|
||||
WSGIDaemonProcess x user=www group=www python-path="/home/freebsd/x"
|
||||
|
||||
<Directory "/home/freebsd/x">
|
||||
WSGIProcessGroup x
|
||||
WSGIApplicationGroup %{GLOBAL%}
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
6
wsgi.py
Executable file
6
wsgi.py
Executable file
|
@ -0,0 +1,6 @@
|
|||
import os
|
||||
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
||||
import x
|
||||
application = x.b.default_app()
|
10
x.py
10
x.py
|
@ -22,12 +22,15 @@ AES_MODE = AES.MODE_CFB
|
|||
AES_IV = r'A123B890JKL @%#$'
|
||||
AES_KEY = r')(*+AKIM 313 321kjah.;klk@sfsd%$'
|
||||
|
||||
debug = False
|
||||
|
||||
py3k = sys.version_info >= (3, 0, 0)
|
||||
if py3k:
|
||||
import urllib.request as urlreq
|
||||
import urllib.parse as urlpar
|
||||
|
||||
stdout_write = sys.stdout.buffer.write
|
||||
|
||||
def get_content_length(r):
|
||||
foo = r.getheader('Content-Length')
|
||||
if foo:
|
||||
|
@ -39,6 +42,7 @@ else:
|
|||
import urllib as urlpar
|
||||
|
||||
stdout_write = sys.stdout.write
|
||||
|
||||
def get_content_length(r):
|
||||
foo = r.info().getheaders('Content-Length')
|
||||
if foo and len(foo) >= 1:
|
||||
|
@ -108,6 +112,7 @@ def x(url):
|
|||
aes = aes_new()
|
||||
return base64.b64encode(zlib.compress(aes.encrypt(x)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
argc = len(sys.argv)
|
||||
if argc > 1:
|
||||
aes = aes_new()
|
||||
|
@ -115,8 +120,8 @@ if argc > 1:
|
|||
print("usage: {0} -h print help".format(sys.argv[0]))
|
||||
print("usage: {0} c TARGET encode TARGET".format(sys.argv[0]))
|
||||
print("usage: {0} d decode stdin".format(sys.argv[0]))
|
||||
print("usage: {0} ANY run server in debug mode on 8080".format(
|
||||
sys.argv[0]))
|
||||
print("usage: {0} ANY run server in debug mode on"
|
||||
"8080".format(sys.argv[0]))
|
||||
print("usage: {0} run server on 80".format(sys.argv[0]))
|
||||
sys.exit(0)
|
||||
elif sys.argv[1] == 'c':
|
||||
|
@ -153,4 +158,3 @@ else:
|
|||
debug = False
|
||||
|
||||
b.run(host=host, port=port, debug=debug, reloader=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue