{"id":44401225,"url":"https://github.com/kendarorg/the-protocol-master-samples","last_synced_at":"2026-02-25T18:15:53.375Z","repository":{"id":263851241,"uuid":"891569437","full_name":"kendarorg/the-protocol-master-samples","owner":"kendarorg","description":"TPM-Proxy Real Life tests in: Python, Java, Go and .NetCore. Runnable on Docker","archived":false,"fork":false,"pushed_at":"2026-02-10T11:42:00.000Z","size":48851,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-10T16:21:04.990Z","etag":null,"topics":["api-simulation","golang","java","mock","net","netcore","python","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kendarorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-20T15:09:25.000Z","updated_at":"2026-02-10T11:42:05.000Z","dependencies_parsed_at":"2024-12-05T15:22:06.491Z","dependency_job_id":"4efe7fb6-0fe0-46c2-8b6c-97379e8c4433","html_url":"https://github.com/kendarorg/the-protocol-master-samples","commit_stats":null,"previous_names":["kendarorg/the-protocol-master-samples"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/kendarorg/the-protocol-master-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendarorg%2Fthe-protocol-master-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendarorg%2Fthe-protocol-master-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendarorg%2Fthe-protocol-master-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendarorg%2Fthe-protocol-master-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kendarorg","download_url":"https://codeload.github.com/kendarorg/the-protocol-master-samples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendarorg%2Fthe-protocol-master-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29360641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-simulation","golang","java","mock","net","netcore","python","testing"],"created_at":"2026-02-12T06:20:54.950Z","updated_at":"2026-02-25T18:15:53.366Z","avatar_url":"https://github.com/kendarorg.png","language":"Java","funding_links":["https://www.paypal.com/paypalme/kendarorg/1"],"categories":[],"sub_categories":[],"readme":"## The Protocol Master Proxy Samples\n\n![](protocolmaster_s.gif)\n\n### Table of Contents\n\n* \u003ca href=\"#nme\"\u003eSimple to-do app\u003c/a\u003e (.net-core, mysql, EF)\n* \u003ca href=\"#jmm\"\u003eJava Quotations app\u003c/a\u003e (java, mysql, mqtt)\n* \u003ca href=\"#pma\"\u003ePython Quotations app\u003c/a\u003e (python, mysql, amqp-091)\n* \u003ca href=\"#gca\"\u003eGolang Chat app\u003c/a\u003e (golang, postgres, redis)\n* \u003ca href=\"#mitms\"\u003eIntercept Phone\u003c/a\u003e with Wireguard\n\nThese are simple environments to test [The Protocol Master](https://github.com/kendarorg/the-protocol-master)\napplication. We will mock without a line of code the database and a rest api of a simple TODO web application.\n\n* The documentation for the protocol master is [here](https://github.com/kendarorg/the-protocol-master)\n\n### Running the applications\n\nFirst run the start.sh/ps1 script in the root directory of the project to enable all scripts to run.\n\nOn the various applications you can find a start.sh/ps1 script that will start everything for you.\nIf the protocol master compiled source is in the directory parallel to the samples it will use\nthe jar from there.\n\nYou can also run the applications via the tests in the e2etest project.\n\nPS For the e2etest to run you need to be able to run a privileged container\n\n### Notes for macOs Users\n\nThe only way i have seen to run testcontainers on macOs supporting networks, linked containers\nand docker in docker is to use or an external docker server or [OrbStack](https://orbstack.dev/).\n\n\n\n### If you like it Buy me a coffee :)\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/paypalme/kendarorg/1)\n\n\u003cbr\u003e\n\n## Prerequisites\n\n* A Docker environment\n* The Docker environment address (let's use DOCKER_SERVER for now)\n* To play with the applications as stand-alone you can replace all 192.168.131.20 addresses (my docker server) with your\n  docker server address\n* All needed docker images loaded (if you wanna pre-setup everything)\n\n`\ndocker image pull mysql:8.0.40\ndocker image pull mcr.microsoft.com/dotnet/aspnet:8.0\ndocker image pull eclipse-temurin:25-jdk-alpine\ndocker image pull docker.io/library/node:18-alpine\ndocker image pull docker.io/library/node:lts-alpine\ndocker image pull eclipse-mosquitto:2.0.20\ndocker image pull eclipse-temurin:25-jdk-alpine\ndocker image pull postgres:9.6.18\ndocker image pull golang:1.18-bullseye\ndocker image pull python:3.9.13\n`\n\n### Automatic testing\n\nThe project `net-core` can be run automatically with selenium and testcontainers starting the tests inside the `e2etest`\nproject. If no env variable is set, the Chrome browser will run till the end of the test. Two environment variables can\nbe used\n\n* RUN_VISIBLE: Show the browser\n* HUMAN_DRIVEN: Show the browser AND show blocking messages in the various phases\n\n### Machine Dependant Stuffs! Beware\n\nAll .NET applications run out of the box only on Intel architecture, that means\n\n* Platform: linux/amd64\n* Target Architecture: amd64\n\nFor Apple M processors should work the following, change the [HttpServer](net-core/HttpServer/Dockerfile)\nand [RestServer](net-core/RestServer/Dockerfile) dockerfile according to your needs (see on\n[Microsoft](https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/) for\nfurther info on the subject)\n\n* Platform: linux/arm64\n* Target Architecture: arm64\n\n\u003ca id=\"nme\"\u003e\u003c/a\u003e\n\n\n\n## Simple TODO app (mysql,http,.NET)\n\n(Thanks [patrick-baker](https://github.com/patrick-baker/to-do-list) for the UI!)\n\nIf you have Intellij or know what are *.http files you can configure [this](net-core/someutilities.http) setting the\n`myhost` variable to ```DOCKER_SERVER```\n\n### Startup\n\n* Clone the repo ```https://github.com/kendarorg/the-protocol-master-samples.git```\n* Configure your browser to use DOCKER_SERVER:29000 as HTTP/S Proxy\n* Navigate to the \"net-core\" directory\n* Run ```docker-compose up``` to generate the environment\n* Several containers will be created\n    * net-core-tpm: The Protocol Master server\n    * net-core-mysql: The mysql database\n    * net-core-http: The web-ui\n    * net-core-rest: The rest back-end\n* Download the DER SSL certificate (root certificate) from the [tpm host ui](http://net-core-tpm:8081/plugins/http-01/ssl-plugin?accordion=collapseSpecificPlugin)\n  and install it as a trusted root certificate\n\nYou can check now the application navigating (in the proxied browser) to anything\nyou want, and you will se the calls flowing on the console.\n\nYou can even try the application on [http://net-core-http/index.html](http://net-core-http/index.html)\nbut for the sake of simplicity please delete all tasks before continuing the tutorial\n\n### Recording\n\n* Start all the recording-plugins [on the UI](http://net-core-tpm:8081/plugins?accordion=collapseWildcard)\n* Navigate to [http://net-core-http/index.html](http://net-core-http/index.html)\n* Insert a new task and click Submit\n    * Task Name: Laundry\n    * Priority: High\n    * Notes: Separate Colors\n* Set the status to Completed\n* Click Update\n* Click Archive\n* Go on Archive tab (upper right) and notice the task\n* Stop all the recording-plugins [on the UI](http://net-core-tpm:8081/plugins?accordion=collapseWildcard)\n* You can download all the [on the ui](http://net-core-tpm:8081/storage) as a zip file\n\n### Look Ma, NO DATABASE\n\n* Stop the ```db_mysql``` container\n* Start on MySQL the [replay-plugin](http://net-core-tpm:8081/plugins/mysql-01/replay-plugin)\n* Refresh the page [http://net-core-http/index.html](http://net-core-http/index.html)\n* Redo exactly all the actions\n* And everything will work!!!! But with a fake DB\n* Stop on MySQL the [replay-plugin](http://net-core-tpm:8081/plugins/mysql-01/replay-plugin)\n\n### Look Ma, NOT EVEN THE API SERVER\n\n* Stop the ```net-core-rest``` container\n* Start on Http the [replay-plugin](http://net-core-tpm:8081/plugins/http-01/replay-plugin)\n* Refresh the page [http://net-core-http/index.html](http://net-core-http/index.html)\n* Redo exactly all the actions\n* And everything will work!!!! But with a fake Rest API!!\n* Stop on Http the [replay-plugin](http://net-core-tpm:8081/plugins/http-01/replay-plugin)\n\n\u003ca id=\"jmm\"\u003e\u003c/a\u003e\n\n## Simple quotes app (java,mysql,mqtt)\n\nIf you have Intellij or know what are *.http files you can configure [this](net-core/someutilities.http) setting the\n`myhost` variable to ```DOCKER_SERVER```\n\nYou can check the quotations going to ```http:\\\\java-rest\\index.html```\n\n### Startup\n\n* Clone the repo ```https://github.com/kendarorg/the-protocol-master-samples.git```\n* Configure your browser to use DOCKER_SERVER:29000 as HTTP/S Proxy\n* Navigate to the \"java\" directory\n* Run ```docker-compose up``` to generate the environment\n* Several containers will be created\n    * java-tpm: The Protocol Master server\n    * java-mysql: The mysql database\n    * java-mosquitto: The mqtt broker\n    * java-rest: The application reading mqtt messages (and showing on [APIs](http://java-rest/swagger-ui/index.html))\n    * java-quote-generator: The quote generation (every 10 seconds random stock quotes)\n* Download the DER SSL certificate (root certificate) from the [tpm host ui](http://java-tpm:8081/plugins/http-01/ssl-plugin?accordion=collapseSpecificPlugin)\n  and install it as a trusted root certificate\n* Connect your mysql ui to ```DOCKER_HOST:23306``` and use the database ```db```\n\nNow your environment is ready for a real test!\n\n### Recording\n\n* Start on Mqtt the [record-plugin](http://java-tpm:8081/plugins/mqtt-01/record-plugin)\n* Delete all records on ```db.quotations``` table\n* Wait for some data on ```quotations``` table (at least 10 seconds, this is the \"run-time\")\n* Stop on Mqtt the [record-plugin](http://java-tpm:8081/plugins/mqtt-01/record-plugin)\n* You can download all the [on the ui](http://java-tpm:8081/storage) as a zip file\n\n### Look Ma, NO BROKER\n\n* Stop the ```java-quote-generation``` container\n* Stop the ```java-rest``` container\n* Delete all data on ```quotations``` table\n* Refresh all the open pages for `java-rest`\n* Start on Mqtt the [replay-plugin](http://java-tpm:8081/plugins/mqtt-01/replay-plugin)\n* Check the new data on ```quotations``` table or look on the chart the values updating\n* Mqtt simulation... done!\n* Start on Mqtt the [replay-plugin](http://java-tpm:8081/plugins/mqtt-01/replay-plugin)\n\n### Faking a message\n\n* Activate the Mqtt  [publish-plugin](http://java-tpm:8081/plugins/mqtt-01/publish-plugin)\n* Restart Mosquitto\n* Open the publish plugin \"[Publish Section](http://java-tpm:8081/plugins/mqtt-01/publish-plugin?accordion=collapseSpecificPlugin)\"\n* Set the `content-type` to `JSON`\n* Topic to `quotations`\n* Message body to the following with the `UNIXTIMESTAMP` being current time in milliseconds\n\n```\n{ \"symbol\" : \"META\",\"date\" : 1744030940999,\"price\" : 1000.00,  \"volume\" : 1000 }\n```\n\n* Look on your message on the graph! Here it is your fake message\n\n\u003ca id=\"pma\"\u003e\u003c/a\u003e\n\n## Simple quotes app (python,mysql,amqp)\n\nIf you have Intellij or know what are *.http files you can configure [this](net-core/someutilities.http) setting the\n`myhost` variable to ```DOCKER_SERVER```\n\nYou can check the quotations going to ```http:\\\\py-rest\\index.html```\n\n### Startup\n\n* Clone the repo ```https://github.com/kendarorg/the-protocol-master-samples.git```\n* Configure your browser to use DOCKER_SERVER:29000 as HTTP/S Proxy\n* Navigate to the \"python\" directory\n* Run ```docker-compose up``` to generate the environment\n* Several containers will be created\n    * py-tpm: The Protocol Master server\n    * py-mysql: The mysql database\n    * py-rabbit: The amqp broker\n    * py-rest: The application reading mqtt messages (and showing on [APIs](java-rest/swagger-ui/index.html))\n    * py-quote-generator: The quote generation (every 10 seconds random stock quotes)\n* Download the DER SSL certificate (root certificate) from the [tpm host ui](http://py-tpm:8081/plugins/http-01/ssl-plugin?accordion=collapseSpecificPlugin)\n  and install it as a trusted root certificate\n* Connect your mysql ui to ```DOCKER_HOST:23306``` and use the database ```db```\n\nNow your environment is ready for a real test!\n\n### Recording\n\n* Start on Amqp the [record-plugin](http://py-tpm:8081/plugins/amqp-01/record-plugin)\n* Delete all records on ```db.quotations``` table\n* Wait for some data on ```quotations``` table (at least 10 seconds, this is the \"run-time\")\n* Stop on Amqp the [record-plugin](http://py-tpm:8081/plugins/amqp-01/record-plugin)\n* You can download all the [on the ui](http://py-tpm:8081/storage) as a zip file\n\n### Look Ma, NO BROKER\n\n* Stop the ```py-quote-generation``` container\n* Stop the ```py-rest``` container\n* Delete all data on ```quotations``` table\n* Refresh all the open pages for `py-rest`\n* Start on Amqp the [replay-plugin](http://py-tpm:8081/plugins/amqp-01/replay-plugin)\n* Check the new data on ```quotations``` table or look on the chart the values updating \n* Amqp simulation... done!\n* Stop on Amqp the [replay-plugin](http://py-tpm:8081/plugins/amqp-01/replay-plugin)\n\n### Faking a message\n\n* Activate the Amqp  [publish-plugin](http://py-tpm:8081/plugins/amqp-01/publish-plugin)\n* Restart Mosquitto\n* Open the publish plugin \"[Publish Section](http://py-tpm:8081/plugins/amqp-01/publish-plugin?accordion=collapseSpecificPlugin)\"\n* Set the connection to \"ALL\"\n* Set the `app-id` to `test`\n* Queue to `quotations`\n* Exchange to `stock`\n* Message body to the following with a time after \"now\"\n\n```\n{ \"symbol\" : \"META\",\"date\" :\"2025-04-07 15:11:11\",\"price\" : 1000.1,  \"volume\" : 1000 }\n```\n\n* Look on your message on the graph! Here it is your fake message\n\n\n\u003ca id=\"gca\"\u003e\u003c/a\u003e\n\n## Golang Chat app (golang, postgres, redis)\n\n### Startup\n\n* Clone the repo ```https://github.com/kendarorg/the-protocol-master-samples.git```\n* Configure your browser to use DOCKER_SERVER:29000 as HTTP/S Proxy\n* Navigate to the \"golang\" directory\n* Run ```docker-compose up``` to generate the environment\n* Several containers will be created\n    * go-tpm: The Protocol Master server\n    * go-postgres: The postgres database\n    * go-redis: The Redis server\n    * go-rest: The chat application\n* Download the DER SSL certificate (root certificate) from the [tpm host ui](http://go-tpm:8081/plugins/http-01/ssl-plugin?accordion=collapseSpecificPlugin)\n  and install it as a trusted root certificate\n* Connect your postgres ui to ```DOCKER_HOST:25432``` and use the database ```db```\n\nNow your environment is ready for a real test!\n\n### Recording\n\n* Start on Redis the [record-plugin](http://go-tpm:8081/plugins/redis-01/record-plugin)\n* Open the proxied browser on [http://go-rest/index.html](http://go-rest/index.html) and login as \"user1\" on channel \"\n  common\"\n* Open another tab of the proxied browser on [http://go-rest/index.html](http://go-rest/index.html) and login as \"user2\"\n  on channel \"common\"\n* Write some messages on both browsers\n* Stop on Redis the [record-plugin](http://go-tpm:8081/plugins/redis-01/record-plugin)\n* You can download all the [on the ui](http://go-tpm:8081/storage) as a zip file\n\n### Look Ma, NO BROKER\n\n* Start on Redis the [replay-plugin](http://go-tpm:8081/plugins/redis-01/replay-plugin)\n* Restart inserting data on the messages\n* Stop on Redis the [replay-plugin](http://go-tpm:8081/plugins/redis-01/replay-plugin)\n\n\n### Faking a message\n\n* Activate the Redis  [publish-plugin](http://go-tpm:8081/plugins/redis-01/publish-plugin)\n* Open the publish plugin \"[Publish Section](http://py-tpm:8081/plugins/redis-01/publish-plugin?accordion=collapseSpecificPlugin)\"\n* Set the `content-type` to `JSON`\n* Queue to `common`\n* Message body to `fake: message`\n* Look on your message on the chat!\n\n\u003ca id=\"mitm\"\u003e\u003c/a\u003e\n\n## Intercept Phone\n\nThis works well even when working with applications that do not support proxies\n\nBoth the Docker and your phone must be on the same network and visible to each other\n\n* First replace in `mitm/docker-compose.yml` the `WG_HOST` variable with the one of your Docker Server\n* Run `docker-compose up` in `mitm` directory\n* Install the Wireguard client on your phone \n* Navigate to the Wireguard interface http://YOUR_DOCKER_SERVER:51821/\n* And create a profile to install in Wireguard\n* Now going on the report plugin http://YOUR_DOCKER_SERVER:28081/plugins/global/report-plugin\n* You can query all DNS calls and see all requested domains\n* Next step will be intercepting all this calls through TPM\n\n```\nSELECT(\n  WHAT(cnt=COUNT(),tags.requestedDomain=tags.requestedDomain),\n  GROUPBY(tags.requestedDomain),\n  ORDERBY(DESC(cnt))\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkendarorg%2Fthe-protocol-master-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkendarorg%2Fthe-protocol-master-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkendarorg%2Fthe-protocol-master-samples/lists"}