How projectdiscovery/interactsh works
Major Components
• Client Side:
– Interactsh Client: Found under “cmd/interactsh-client” and “pkg/client”. This component generates unique payloads, polls for interactions, displays or logs outbound event data, and supports different features (AES encryption, verbose mode, session persistence, etc.).
– Benchmark Clients: Located under “cmd/benchmark-server” demonstrating performance aspects.
– CLI Options: Various flags and configurations are implemented in “pkg/options” to tweak payload generation and session behavior.
• Server Side:
– Interactsh Server: Found under “cmd/interactsh-server” and key server logic in “pkg/server”. The server handles multiple protocols (DNS, HTTP, SMTP, LDAP, FTP, SMB, etc.), manages dynamic responses, wildcard interactions, and integrates with external DNS records.
– ACME Integration & TLS Support: Under “pkg/server/acme”, the server hosts automatic certificate generation and renewal.
– Storage & Logging: “pkg/storage” deals with storing interaction data (in-memory or disk-based), while “pkg/filewatcher” can be used for monitoring changes.
• Deployment and Integrations:
– Deployment configurations, Dockerfiles, and workflow scripts (in “.github” and “deploy”) indicate CI/CD, containerization and deployment practices.
– External Extensions: The README details integrations with tools like Burp Suite, OWASP ZAP, and Caido Proxy.
Architectural Relationships and Data Flow
• Separation between Frontend and Backend: Although not a full-stack web application, the separation of client (payload generator/poller) and server (interaction listener and responder) is fundamental. The client generates payloads that are then triggered externally (via DNS lookups, HTTP requests, etc.), and those events are funneled into the server.
• Multi-Protocol Support:
• Interaction Lifecycle:
– Show the client sending out requests (or simply “payload generation”) which then crosses to external targets.
– Capture how external systems’ interaction (for example, a DNS query or HTTP request) flows back to the server.
• Configuration and Extensibility:
– Include an “options/configurations” node representing the command line flags and configuration files (e.g., go.mod, YAML configs) that allow users to modify payload length, security options (authentication, token usage) and service endpoints.
– Highlight the use of dynamic response features (query-parameter driven HTTP responses) and static file hosting via “-http-directory”, emphasizing customization.
Key Architectural Patterns and Design Principles
• Modular Design: The strict separation between “cmd”, “internal”, and “pkg” directories shows that the project follows a modular approach. Represent each logical module (client, server, storage, options, and ACME integration) as separate blocks.
• Containerization & CI/CD: The presence of Dockerfiles in “.github/docker” and numerous GitHub workflows (build, test, release) suggests robust automation. Illustrate these as peripheral but integrated development and deployment tools ensuring quality and repeatability.
• Within the server block, subdivide into modules based on services: DNS, HTTP/HTTPS, SMTP/SMTPS, LDAP, and additional services (FTP, SMB, Responder).