Manage processes via an HTTP based API
Project description
manageritm
Manage a mitmproxy service on another system over a RESTful API
Getting Started
- Install manageritm.
pip install manageritm gunicorn
- Start manageritm server on port 8000.
gunicorn --bind 0.0.0.0:8000 --workers 1 --log-level debug "manageritm.app:main()"
- In Python, create a client, start the mitmproxy service, stop the mitmproxy service
import manageritm manageritm_addr = "localhost" manageritm_port = "8000" # create a manageritm client mc = manageritm.client.ManagerITMProxyClient(f'http://{manageritm_addr}:{manageritm_port}') proxy_details = mc.client() print(f"proxy port: {proxy_details['port']}") print(f"proxy webport: {proxy_details['webport']}") # start a proxy server mc.start() # set your application to use the proxy # host: "localhost" # port: f"{proxy_details['port']}" # do some work... # stop the proxy server mc.stop()
Or start a video client
- Create a custom configuration file named
flask_config_video.py
MANAGERITM_CLIENT_COMMAND = ['/opt/bin/video.sh']
-
Start manageritm server on port 8000.
gunicorn --bind 0.0.0.0:8000 --workers 1 --log-level debug "manageritm.app:main()"
-
In Python, create a client, start the ffmpeg service, stop the ffmpeg service
import manageritm manageritm_addr = "localhost" manageritm_port = "8000" # create a manageritm client mc = manageritm.client.ManagerITMCommandClient(f'http://{manageritm_addr}:{manageritm_port}') client_details = mc.client(additional_env={ 'DISPLAY_CONTAINER_NAME': 'hanet_chrome_1', 'DISPLAY_NUM': '99', 'SE_VIDEO_FOLDER': '/videos', 'FILE_NAME': 'blahh.mp4' }) # start a proxy server mc.start() # recording should happening # ... # stop the proxy server mc.stop()
Local Development
- Check out this repository
- Create a virtual environment
make pyenv - Install Python dependencies
make install - Start the server
make server - Start a client, in a Python interpreter:
import manageritm manageritm_addr = "localhost" manageritm_port = "8000" # create a manageritm client mc = manageritm.client.ManagerITMProxyClient(f'http://{manageritm_addr}:{manageritm_port}') proxy_details = mc.client() print(f"proxy port: {proxy_details['port']}") print(f"proxy webport: {proxy_details['webport']}") # start a proxy server mc.start()
- Navigate a web browser to
http://localhost:<proxy webport>to watch the traffic - Configure a web browser to use the proxy port.
- Stop the client
# stop the proxy server mc.stop()
Helpful Commands
To build a package for the development version:
make all
To install a copy into your local python virtualenv
make install
To run the test cases:
make test
To run the development version of the service:
make run
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file manageritm-0.4.0.tar.gz.
File metadata
- Download URL: manageritm-0.4.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5c6e654df716905955dd723fb13e40c79173aa0edc0893474d71a9315a8727e
|
|
| MD5 |
c8eaf14736cca5380dab176098d3ec91
|
|
| BLAKE2b-256 |
a64a1a46091882797a0ee95a39a213599ada05acaf178f5d109e39d2db73905f
|
File details
Details for the file manageritm-0.4.0-py3-none-any.whl.
File metadata
- Download URL: manageritm-0.4.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc18941a18406f1c77f3b2d8771a115547b18662786e26b5dd6440e6de144dbc
|
|
| MD5 |
8098eac91a586ec4480b5ebdb9ffb053
|
|
| BLAKE2b-256 |
a8d326de33f9ef1437b6c87293eb3487b1bd52af0b4b7cff1515b23e247363b9
|