How withsecurelabs/drozer works
Main components of the system
• Console/Client: Represented by the drozer CLI (found in src/drozer/cli and related modules) that the security tester uses.
• Agent (Server-side on Android): The drozer Agent runs on the Android device and provides the “Embedded Server” functionality. Note that installation instructions (using adb) refer directly to installing the drozer Agent.
• API and Communication Infrastructure: There are robust API components defined for handling system requests/responses (src/drozer/api and similar paths in pysolar/api) plus protobuf interfaces (common/protobuf.proto) used for communication between parts.
• Exploits & Modules: There is a vast suite of modules (e.g., src/drozer/modules, subdirectories for app, auxiliary, exploit, scanner, etc.) where each module encapsulates a security test or exploit.
• Build and Packaging Infrastructure: The presence of Docker, Debian and RPM packaging scripts, and build instructions in README indicate that the build and deployment pipelines are also important.
• Supporting Libraries: There are common utilities (e.g., src/WithSecure/common) and additional helper libraries such as for reflection (pysolar/reflection) and payloads.
Relationships and interactions
• The drozer Console (CLI) initiates connections (over network or via adb port-forwarding) to the Agent running on the Android device.
• Once connected, the Console sends commands that are handled by the Agent’s server component. The Agent then uses the API handlers (from src/drozer/api/handlers) to process requests and return responses.
• Many modules lie in between – they encapsulate specific functionalities (e.g., scanning, exploiting, payload delivery). The Console can call these modules, which in turn might use common libraries and modules to perform their operations.
• Additionally, build and packaging components (Dockerfile, build scripts in “scripts”) wrap the code to enable deployment and distribution on multiple systems.
Architectural patterns and principles
• Modularity: The repository is split into many independent modules (for exploits, scanners, and payloads) to allow extensibility.
• Client–Server Interaction: The separation between the drozer Console (client) and the Agent (server) defines clear boundaries with network-based communication.
• Abstraction via APIs: The clear API endpoints (system request/response, reflection APIs) abstract the underlying Android interactions.
• Layer separation: Notice how core utilities (common directory) support both the drozer and pysolar functionalities, meaning shared libraries are abstracted for reuse.
• Extensibility: With directories for module installers (repoman), payload generation, and even for additional tests (test folder), the design supports extensibility and testing.
Relevant external technologies
• Python3 (source code written in Python)
• Java libraries (for components like agent.jar, android-support libraries)
• Protobuf for structured messaging (seen in common/protobuf.proto and in pysolar/api)
• Twisted (asynchronous networking framework used by some parts)
• Docker (containerization setup for deployment)
• Dependencies such as PyOpenSSL, Distro, and Java SDK are also essential.
• A “Communication Layer” component that shows network channels (TCP port 31415) or USB (adb port forwarding).
• API Handlers (system_request_handler, etc.)
• Module Execution Engine (modules folder)
• Connector Components (server/protocols, server/receivers)
• Built-in Web Server functionality (web_root, uploader)
• A “Common Libraries and Utilities” segment that supports both parts (common, pysolar, modules/common).
• A “Build & Packaging” area showing Docker, deb & rpm scripts, and packaging routines that wrap the overall application.
• Optionally, a “Testing” component showing where tests exist to validate functionality (test folder).