Skip to content

Mixing trafficparrot, mitm proxy and pact.io, without using all of them. Real mocks, Recording, Inspections, PACT and NULL infrastructure at once

License

Notifications You must be signed in to change notification settings

kendarorg/HttpAnsweringMachine

Repository files navigation

Motivation

How to test interdependent applications when you have no control over them.

A mocking library could work, but they are intrusive and with specific configuration that interposes itself into the whole development chain.

Testing over the wire is difficult too, outages on dev environment and not preventable errors can arise.

The AnsweringMachine is built to overcome this troubles

If you like it Buy me a coffe :)

paypal

New!!


Coming Soon

  • Recording MySQL, and Postgres db calls with NATIVE drivers (no need for different jdbc drivers)
  • Automatic recording of httpS calls (just add the HAM root certificate on your machine)

At glance

Ready-to-run examples

  • Recording interactions 10 minutes
    • Run the sample application (1 fe, 2 be)
    • Record the interactions
  • Hacking google 10 minutes
    • Hijack DNS
    • Setup a fake root certificate authority
    • Bing-ify Google home page
  • Intercept your Android phone! 10 minutes
    • Hijack DNS
    • Setup a fake root certificate authority
    • Bing-ify Google home page
  • Fast recording/replaying 20 minutes
    • Run the sample application (1 fe, 2 be)
    • Run the front-end with a mocked back-end
    • Run the front-end with a gateway and a mocked back-end
  • Fast Automatic NullInfrastructure Test 30 minutes
    • Run the sample application (1 fe, 2 be)
    • Test a back-end in isolation
    • Verify match between template data
  • Simulating a real database 20 minutes
    • Record the db interactions
    • Shut down the real db
    • Run the application without db!
  • Fast Automatic NullInfrastructure Test With DB 20 minutes
    • Record the db interactions
    • Shut down the real db and all environment but the application to test
    • Automagically test the application without db!
  • Modify recorded db calls! 15 minutes
    • Record the db interactions
    • Shut down the real db
    • Modify directly the fake data returned by the db!
    • And use it in your tests!
  • Dockerize any application 20 minutes
    • Build a custom docker cage for your Java/.NET/Node/... wathever application
    • Access via Proxy or via VPN to experience the full environment
    • Custom path:

Features

  • Store logs and recordings on any Jdbc DB
  • Default embedded h2 database
  • Proxying of any kind of http/https calls
  • Internal socks5/http/https proxy to run even dockerless
  • Spy mode to log all traffic
  • Configurable Https hijacking with auto generated SSL certificates
  • Redirection of services through other destinations
  • Java and Javascript plugins to intercept and modify any http/s call
  • Record and replay api flows, with automatic stateful flows detection
  • Custom oidc "authorize all" server
  • Embedded web server with REST APIs
  • All functions manageable via REST APIs
  • Configurable DNS hijacking (when not using VPNs) or...generated hosts file
  • Internal events system
  • Support for brotli encoding and jackson-smile
  • Multiple server ports configurable
  • Proxy/recording/replaying/filtering of JDBC communications
  • Proxy/recording/replaying/filtering of MongoDb communications

Docker for development

  • Configurable DNS hijacking
  • Transparent access via OpenVpn to the internal network
  • Debug docker applications directly
  • Direct access to the main server via web interface

Docker For CI

  • Can run in a single docker container with applications
  • Can be controlled via REST APIs to load scenarios (recordings)
  • More configurable than wiremock
  • Can use all the real configurations without changes via the Https/DNS hijacking
  • Can be used an alternative dns server on docker, supposed you add on the machines connecting to it the Special DNS Server

History

This project was born as a way to intercept http/s calls through a PHP application with apache, dnsmasq and openvpn on docker. To avoid changing all application configurations to debug against real environments. Then i added an oidc server, and looking at other products like Traffic Parrot or Hoverfly.io, the recording replaying was inserted as feature. To speed up stuffs it was then ported to Spring Boot and was added a true UI.

Conventions

Notice that all configuration values are in fact -paths- inside the external.json file. For example "global.logging.request.basic=true" means the following

[
  {
    "id": "global",
    ...
    "logging": {
      "request": {
        "basic": true
...

In case of arrays "ssl.domains[1].address=local.test" means the following

[
  {
    "id": "ssl",
    ...
    "domains": [
      {
        ...
      },
      {
        ....
        "address": "local.test"

Configurations

Basic functions

Plugins

Utils

Examples