2018-12-22 15:08:04 +00:00
|
|
|
SHELL := /bin/bash
|
|
|
|
|
|
|
|
NS ?= abhinavsingh
|
|
|
|
IMAGE_NAME ?= proxy.py
|
Proxy.py Dashboard (#141)
* Remove redundant variables
* Initialize frontend dashboard app (written in typescript)
* Add a WebsocketFrame.text method to quickly build a text frame raw packet, also close connection for static file serving, atleast Google Chrome seems to hang up instead of closing the connection
* Add read_and_build_static_file_response method for reusability in plugins
* teardown websocket connection when opcode CONNECTION_CLOSE is received
* First draft of proxy.py dashboard
* Remove uglify, obfuscator is superb enough
* Correct generic V
* First draft of dashboard
* ProtocolConfig is now Flags
* First big refactor toward no-single-file-module
* Working tests
* Update dashboard for refactored imports
* Remove proxy.py as now we can just call python -m proxy -h
* Fix setup.py for refactored code
* Banner update
* Lint check
* Fix dashboard static serving and no UNDER_TEST constant necessary
* Add support for plugin imports when specified in path/to/module.MyPlugin
* Update README with instructions to run proxy.py after refactor
* Move dashboard under /dashboard path
* Rename to devtools.ts
* remove unused
* Update github workflow for new directory structure
* Update test command too
* Fix coverage generation
* *.py is an invalid syntax on windows
* No * on windows
* Enable execution via github zip downloads
* Github Zip downloads cannot be executed as Github puts project under a folder named after Github project, this breaks python interpreter expectation of finding a __main__.py in the root directory
* Forget zip runs for now
* Initialize ProxyDashboard on page load rather than within typescript i.e. on script load
* Enforce eslint with standard style
* Add .editorconfig to make editor compatible with various style requirements (Makefile, Typescript, Python)
* Remove extra empty line
* Add ability to pass headers with HttpRequestRejected exception, also remove proxy agent header for HttpRequestRejected
* Add ability to pass headers with HttpRequestRejected exception, also remove proxy agent header for HttpRequestRejected
* Fix tests
* Move common code under common sub-module
* Move flags under common module
* Move acceptor under core
* Move connection under core submodule
* Move chunk_parser under http
* Move http_parser as http/parser
* Move http_methods as http/methods
* Move http_proxy as http/proxy
* Move web_server as http/server
* Move status_codes as http/codes
* move websocket as http/websocket
* Move exception under http/exception, also move http/proxy exceptions under http/exceptions
* move protocol_handler as http/handler
* move devtools as http/devtools
* Move version under common/version
* Lifecycle if now core Event
* autopep8
* Add core event queue
* Register / unregister handler
* Enable inspection support for frontend dashboard
* Dont give an illusion of exception for HttpProtocolExceptions
* Update readme for refactored codebase
* DictQueueType everywhere
* Move all websocket API related code under WebsocketApi class
* Inspection enabled on tab switch.
1. Additionally now acceptors are assigned an int id.
2. Fix tests to match change in constructor.
* Corresponding ends of the work queues can be closed immediately.
Since work queues between AcceptorPool and Acceptor process is used only
once, close corresponding ends asap instead of at shutdown.
* No need of a manager for shared multiprocess Lock.
This unnecessarily creates additional manager process.
* Move threadless into its own module
* Merge acceptor and acceptor_pool tests
* Defer os.close
* Change content display with tab clicks.
Also ensure relay manager shutdown.
* Remove --cov flags
* Use right type for SyncManager
* Ensure coverage again
* Print help to discover flags, --cov certainly not available on Travis for some reason
* Add pytest-cov to requirements-testing
* Re-add windows on .travis also add changelog to readme
* Use 3.7 and no pip upgrade since it fails on travis windows
* Attempt to fix pip install on windows
* Disable windows on travis, it fails and uses 3.8. Try reporting coverage from github actions
* Move away from coveralls, use codecov
* Codecov app installation either didnt work or token still needs to be passed
* Remove travis CI
* Use https://github.com/codecov/codecov-action for coverage uploads
* Remove run codecov
* Ha, codecov action only works on linux, what a mess
* Add cookie.js though unable to use it with es5/es6 modules yet
* Enable testing for python 3.8 also Build dashboard during testing
* No python 3.8 on github actions yet
* Autopep8
* Add separate workflows for library (python) and dashboard (node) app
* Type jobs not job
* Add checkout
* Fix parsing node version
* Fix dashboard build on windows
* Show codecov instead of coveralls
2019-10-28 21:57:33 +00:00
|
|
|
VERSION ?= v$(shell python -m proxy --version)
|
2019-02-09 05:13:34 +00:00
|
|
|
LATEST_TAG := $(NS)/$(IMAGE_NAME):latest
|
2018-12-22 15:08:04 +00:00
|
|
|
IMAGE_TAG := $(NS)/$(IMAGE_NAME):$(VERSION)
|
|
|
|
|
2019-09-25 02:02:57 +00:00
|
|
|
HTTPS_KEY_FILE_PATH := https-key.pem
|
|
|
|
HTTPS_CERT_FILE_PATH := https-cert.pem
|
|
|
|
|
|
|
|
CA_KEY_FILE_PATH := ca-key.pem
|
|
|
|
CA_CERT_FILE_PATH := ca-cert.pem
|
|
|
|
CA_SIGNING_KEY_FILE_PATH := ca-signing-key.pem
|
|
|
|
|
2019-11-13 03:20:28 +00:00
|
|
|
.PHONY: all https-certificates ca-certificates autopep8 devtools
|
2019-11-06 09:33:12 +00:00
|
|
|
.PHONY: lib-clean lib-test lib-package lib-release-test lib-release lib-coverage lib-lint lib-profile
|
|
|
|
.PHONY: container container-run container-release
|
2019-11-15 21:29:48 +00:00
|
|
|
.PHONY: dashboard dashboard-clean
|
2013-12-23 21:51:45 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
all: lib-clean lib-test
|
2013-12-23 21:51:45 +00:00
|
|
|
|
2019-11-13 03:20:28 +00:00
|
|
|
devtools:
|
|
|
|
pushd dashboard && npm run devtools && popd
|
|
|
|
|
2019-10-30 03:41:39 +00:00
|
|
|
autopep8:
|
2019-11-30 17:03:23 +00:00
|
|
|
autopep8 --recursive --in-place --aggressive proxy
|
|
|
|
autopep8 --recursive --in-place --aggressive tests
|
2019-10-30 03:41:39 +00:00
|
|
|
autopep8 --recursive --in-place --aggressive setup.py
|
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
https-certificates:
|
|
|
|
# Generate server key
|
|
|
|
openssl genrsa -out $(HTTPS_KEY_FILE_PATH) 2048
|
|
|
|
# Generate server certificate
|
|
|
|
openssl req -new -x509 -days 3650 -key $(HTTPS_KEY_FILE_PATH) -out $(HTTPS_CERT_FILE_PATH)
|
|
|
|
|
2019-10-30 03:41:39 +00:00
|
|
|
ca-certificates:
|
|
|
|
# Generate CA key
|
|
|
|
openssl genrsa -out $(CA_KEY_FILE_PATH) 2048
|
|
|
|
# Generate CA certificate
|
|
|
|
openssl req -new -x509 -days 3650 -key $(CA_KEY_FILE_PATH) -out $(CA_CERT_FILE_PATH)
|
|
|
|
# Generate key that will be used to generate domain certificates on the fly
|
|
|
|
# Generated certificates are then signed with CA certificate / key generated above
|
|
|
|
openssl genrsa -out $(CA_SIGNING_KEY_FILE_PATH) 2048
|
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
lib-clean:
|
2013-12-23 21:51:45 +00:00
|
|
|
find . -name '*.pyc' -exec rm -f {} +
|
|
|
|
find . -name '*.pyo' -exec rm -f {} +
|
|
|
|
find . -name '*~' -exec rm -f {} +
|
2018-12-22 20:43:17 +00:00
|
|
|
rm -f .coverage
|
Proxy.py Dashboard (#141)
* Remove redundant variables
* Initialize frontend dashboard app (written in typescript)
* Add a WebsocketFrame.text method to quickly build a text frame raw packet, also close connection for static file serving, atleast Google Chrome seems to hang up instead of closing the connection
* Add read_and_build_static_file_response method for reusability in plugins
* teardown websocket connection when opcode CONNECTION_CLOSE is received
* First draft of proxy.py dashboard
* Remove uglify, obfuscator is superb enough
* Correct generic V
* First draft of dashboard
* ProtocolConfig is now Flags
* First big refactor toward no-single-file-module
* Working tests
* Update dashboard for refactored imports
* Remove proxy.py as now we can just call python -m proxy -h
* Fix setup.py for refactored code
* Banner update
* Lint check
* Fix dashboard static serving and no UNDER_TEST constant necessary
* Add support for plugin imports when specified in path/to/module.MyPlugin
* Update README with instructions to run proxy.py after refactor
* Move dashboard under /dashboard path
* Rename to devtools.ts
* remove unused
* Update github workflow for new directory structure
* Update test command too
* Fix coverage generation
* *.py is an invalid syntax on windows
* No * on windows
* Enable execution via github zip downloads
* Github Zip downloads cannot be executed as Github puts project under a folder named after Github project, this breaks python interpreter expectation of finding a __main__.py in the root directory
* Forget zip runs for now
* Initialize ProxyDashboard on page load rather than within typescript i.e. on script load
* Enforce eslint with standard style
* Add .editorconfig to make editor compatible with various style requirements (Makefile, Typescript, Python)
* Remove extra empty line
* Add ability to pass headers with HttpRequestRejected exception, also remove proxy agent header for HttpRequestRejected
* Add ability to pass headers with HttpRequestRejected exception, also remove proxy agent header for HttpRequestRejected
* Fix tests
* Move common code under common sub-module
* Move flags under common module
* Move acceptor under core
* Move connection under core submodule
* Move chunk_parser under http
* Move http_parser as http/parser
* Move http_methods as http/methods
* Move http_proxy as http/proxy
* Move web_server as http/server
* Move status_codes as http/codes
* move websocket as http/websocket
* Move exception under http/exception, also move http/proxy exceptions under http/exceptions
* move protocol_handler as http/handler
* move devtools as http/devtools
* Move version under common/version
* Lifecycle if now core Event
* autopep8
* Add core event queue
* Register / unregister handler
* Enable inspection support for frontend dashboard
* Dont give an illusion of exception for HttpProtocolExceptions
* Update readme for refactored codebase
* DictQueueType everywhere
* Move all websocket API related code under WebsocketApi class
* Inspection enabled on tab switch.
1. Additionally now acceptors are assigned an int id.
2. Fix tests to match change in constructor.
* Corresponding ends of the work queues can be closed immediately.
Since work queues between AcceptorPool and Acceptor process is used only
once, close corresponding ends asap instead of at shutdown.
* No need of a manager for shared multiprocess Lock.
This unnecessarily creates additional manager process.
* Move threadless into its own module
* Merge acceptor and acceptor_pool tests
* Defer os.close
* Change content display with tab clicks.
Also ensure relay manager shutdown.
* Remove --cov flags
* Use right type for SyncManager
* Ensure coverage again
* Print help to discover flags, --cov certainly not available on Travis for some reason
* Add pytest-cov to requirements-testing
* Re-add windows on .travis also add changelog to readme
* Use 3.7 and no pip upgrade since it fails on travis windows
* Attempt to fix pip install on windows
* Disable windows on travis, it fails and uses 3.8. Try reporting coverage from github actions
* Move away from coveralls, use codecov
* Codecov app installation either didnt work or token still needs to be passed
* Remove travis CI
* Use https://github.com/codecov/codecov-action for coverage uploads
* Remove run codecov
* Ha, codecov action only works on linux, what a mess
* Add cookie.js though unable to use it with es5/es6 modules yet
* Enable testing for python 3.8 also Build dashboard during testing
* No python 3.8 on github actions yet
* Autopep8
* Add separate workflows for library (python) and dashboard (node) app
* Type jobs not job
* Add checkout
* Fix parsing node version
* Fix dashboard build on windows
* Show codecov instead of coveralls
2019-10-28 21:57:33 +00:00
|
|
|
rm -rf htmlcov
|
|
|
|
rm -rf dist
|
|
|
|
rm -rf build
|
|
|
|
rm -rf proxy.py.egg-info
|
|
|
|
rm -rf .pytest_cache
|
2019-10-30 03:41:39 +00:00
|
|
|
rm -rf .hypothesis
|
2013-12-23 21:51:45 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
lib-lint:
|
2019-11-16 07:49:51 +00:00
|
|
|
flake8 --ignore=W504 --max-line-length=127 proxy/ tests/ setup.py
|
|
|
|
mypy --strict --ignore-missing-imports proxy/ tests/ setup.py
|
2018-12-22 15:08:04 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
lib-test: lib-lint
|
2019-12-01 06:54:20 +00:00
|
|
|
pytest -v tests/
|
2019-02-09 02:57:44 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
lib-package: lib-clean
|
2019-12-02 03:01:28 +00:00
|
|
|
python setup.py sdist
|
2019-11-06 09:33:12 +00:00
|
|
|
|
|
|
|
lib-release-test: lib-package
|
|
|
|
twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*
|
|
|
|
|
|
|
|
lib-release: lib-package
|
|
|
|
twine upload dist/*
|
|
|
|
|
|
|
|
lib-coverage:
|
Proxy.py Dashboard (#141)
* Remove redundant variables
* Initialize frontend dashboard app (written in typescript)
* Add a WebsocketFrame.text method to quickly build a text frame raw packet, also close connection for static file serving, atleast Google Chrome seems to hang up instead of closing the connection
* Add read_and_build_static_file_response method for reusability in plugins
* teardown websocket connection when opcode CONNECTION_CLOSE is received
* First draft of proxy.py dashboard
* Remove uglify, obfuscator is superb enough
* Correct generic V
* First draft of dashboard
* ProtocolConfig is now Flags
* First big refactor toward no-single-file-module
* Working tests
* Update dashboard for refactored imports
* Remove proxy.py as now we can just call python -m proxy -h
* Fix setup.py for refactored code
* Banner update
* Lint check
* Fix dashboard static serving and no UNDER_TEST constant necessary
* Add support for plugin imports when specified in path/to/module.MyPlugin
* Update README with instructions to run proxy.py after refactor
* Move dashboard under /dashboard path
* Rename to devtools.ts
* remove unused
* Update github workflow for new directory structure
* Update test command too
* Fix coverage generation
* *.py is an invalid syntax on windows
* No * on windows
* Enable execution via github zip downloads
* Github Zip downloads cannot be executed as Github puts project under a folder named after Github project, this breaks python interpreter expectation of finding a __main__.py in the root directory
* Forget zip runs for now
* Initialize ProxyDashboard on page load rather than within typescript i.e. on script load
* Enforce eslint with standard style
* Add .editorconfig to make editor compatible with various style requirements (Makefile, Typescript, Python)
* Remove extra empty line
* Add ability to pass headers with HttpRequestRejected exception, also remove proxy agent header for HttpRequestRejected
* Add ability to pass headers with HttpRequestRejected exception, also remove proxy agent header for HttpRequestRejected
* Fix tests
* Move common code under common sub-module
* Move flags under common module
* Move acceptor under core
* Move connection under core submodule
* Move chunk_parser under http
* Move http_parser as http/parser
* Move http_methods as http/methods
* Move http_proxy as http/proxy
* Move web_server as http/server
* Move status_codes as http/codes
* move websocket as http/websocket
* Move exception under http/exception, also move http/proxy exceptions under http/exceptions
* move protocol_handler as http/handler
* move devtools as http/devtools
* Move version under common/version
* Lifecycle if now core Event
* autopep8
* Add core event queue
* Register / unregister handler
* Enable inspection support for frontend dashboard
* Dont give an illusion of exception for HttpProtocolExceptions
* Update readme for refactored codebase
* DictQueueType everywhere
* Move all websocket API related code under WebsocketApi class
* Inspection enabled on tab switch.
1. Additionally now acceptors are assigned an int id.
2. Fix tests to match change in constructor.
* Corresponding ends of the work queues can be closed immediately.
Since work queues between AcceptorPool and Acceptor process is used only
once, close corresponding ends asap instead of at shutdown.
* No need of a manager for shared multiprocess Lock.
This unnecessarily creates additional manager process.
* Move threadless into its own module
* Merge acceptor and acceptor_pool tests
* Defer os.close
* Change content display with tab clicks.
Also ensure relay manager shutdown.
* Remove --cov flags
* Use right type for SyncManager
* Ensure coverage again
* Print help to discover flags, --cov certainly not available on Travis for some reason
* Add pytest-cov to requirements-testing
* Re-add windows on .travis also add changelog to readme
* Use 3.7 and no pip upgrade since it fails on travis windows
* Attempt to fix pip install on windows
* Disable windows on travis, it fails and uses 3.8. Try reporting coverage from github actions
* Move away from coveralls, use codecov
* Codecov app installation either didnt work or token still needs to be passed
* Remove travis CI
* Use https://github.com/codecov/codecov-action for coverage uploads
* Remove run codecov
* Ha, codecov action only works on linux, what a mess
* Add cookie.js though unable to use it with es5/es6 modules yet
* Enable testing for python 3.8 also Build dashboard during testing
* No python 3.8 on github actions yet
* Autopep8
* Add separate workflows for library (python) and dashboard (node) app
* Type jobs not job
* Add checkout
* Fix parsing node version
* Fix dashboard build on windows
* Show codecov instead of coveralls
2019-10-28 21:57:33 +00:00
|
|
|
pytest --cov=proxy --cov-report=html tests/
|
2019-08-24 18:31:55 +00:00
|
|
|
open htmlcov/index.html
|
2018-12-22 20:43:17 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
lib-profile:
|
|
|
|
sudo py-spy -F -f profile.svg -d 3600 proxy.py
|
|
|
|
|
2019-10-30 03:41:39 +00:00
|
|
|
dashboard:
|
2019-12-02 05:30:29 +00:00
|
|
|
pushd dashboard && npm run build && popd
|
2019-10-30 03:41:39 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
dashboard-clean:
|
2019-12-02 05:30:29 +00:00
|
|
|
if [[ -d dashboard/public ]]; then rm -rf dashboard/public; fi
|
2019-09-25 22:51:12 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
container:
|
|
|
|
docker build -t $(LATEST_TAG) -t $(IMAGE_TAG) .
|
2019-02-09 05:13:34 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
container-release:
|
2019-02-09 05:13:34 +00:00
|
|
|
docker push $(IMAGE_TAG)
|
2019-10-10 22:45:57 +00:00
|
|
|
docker push $(LATEST_TAG)
|
2019-09-25 02:02:57 +00:00
|
|
|
|
2019-11-06 09:33:12 +00:00
|
|
|
container-run:
|
2019-10-30 03:41:39 +00:00
|
|
|
docker run -it -p 8899:8899 --rm $(LATEST_TAG)
|