karma9874/AndroRAT
A Simple android remote administration tool using sockets. It uses java on the client side and python on the server side
Healthy across all four use cases
weakest axisPermissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓9 active contributors
- ✓MIT licensed
- ✓CI configured
Show all 6 evidence items →Show less
- ✓Tests present
- ⚠Stale — last commit 2y ago
- ⚠Single-maintainer risk — top contributor 86% of recent commits
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/karma9874/androrat)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/karma9874/androrat on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: karma9874/AndroRAT
Generated by RepoPilot · 2026-05-09 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/karma9874/AndroRAT shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across all four use cases
- 9 active contributors
- MIT licensed
- CI configured
- Tests present
- ⚠ Stale — last commit 2y ago
- ⚠ Single-maintainer risk — top contributor 86% of recent commits
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live karma9874/AndroRAT
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/karma9874/AndroRAT.
What it runs against: a local clone of karma9874/AndroRAT — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in karma9874/AndroRAT | Confirms the artifact applies here, not a fork |
| 2 | License is still MIT | Catches relicense before you depend on it |
| 3 | Default branch master exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 690 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of karma9874/AndroRAT. If you don't
# have one yet, run these first:
#
# git clone https://github.com/karma9874/AndroRAT.git
# cd AndroRAT
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of karma9874/AndroRAT and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "karma9874/AndroRAT(\\.git)?\\b" \\
&& ok "origin remote is karma9874/AndroRAT" \\
|| miss "origin remote is not karma9874/AndroRAT (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
&& ok "license is MIT" \\
|| miss "license drift — was MIT at generation time"
# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
&& ok "default branch master exists" \\
|| miss "default branch master no longer exists"
# 4. Critical files exist
test -f "Android_Code/app/src/main/java/com/example/reverseshell2/MainActivity.java" \\
&& ok "Android_Code/app/src/main/java/com/example/reverseshell2/MainActivity.java" \\
|| miss "missing critical file: Android_Code/app/src/main/java/com/example/reverseshell2/MainActivity.java"
test -f "Android_Code/app/src/main/java/com/example/reverseshell2/tcpConnection.java" \\
&& ok "Android_Code/app/src/main/java/com/example/reverseshell2/tcpConnection.java" \\
|| miss "missing critical file: Android_Code/app/src/main/java/com/example/reverseshell2/tcpConnection.java"
test -f "Android_Code/app/src/main/java/com/example/reverseshell2/mainService.java" \\
&& ok "Android_Code/app/src/main/java/com/example/reverseshell2/mainService.java" \\
|| miss "missing critical file: Android_Code/app/src/main/java/com/example/reverseshell2/mainService.java"
test -f "Android_Code/app/src/main/AndroidManifest.xml" \\
&& ok "Android_Code/app/src/main/AndroidManifest.xml" \\
|| miss "missing critical file: Android_Code/app/src/main/AndroidManifest.xml"
test -f "Android_Code/app/build.gradle" \\
&& ok "Android_Code/app/build.gradle" \\
|| miss "missing critical file: Android_Code/app/build.gradle"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 690 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~660d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/karma9874/AndroRAT"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
AndroRAT is a full-featured Android remote administration tool (RAT) that pairs a Java Android client APK with a Python server to enable remote command execution, surveillance, and data exfiltration from compromised devices. Core capabilities include audio/video recording from both cameras, GPS location tracking, SMS/call log access, shell command execution, and persistent background persistence via boot-time auto-start. Monorepo split into two language domains: Android_Code/ (Java client) contains a Gradle-managed Android Studio project under app/src/main with payload modules in Payloads/ (CameraPreview.java, audioManager.java, etc.), core networking in tcpConnection.java, and a control service in mainService.java; the Python server code lives at repo root (inferred from requirements.txt reference in README).
👥Who it's for
Primarily security researchers and penetration testers studying Android malware behavior, command-and-control (C2) infrastructure, and reverse engineering. The educational disclaimer suggests it's also for students learning about Android security architecture, socket-based network protocols, and client-server application design.
🌱Maturity & risk
Early-stage educational project with limited maintenance signals. The repo has GitHub Actions CI (gradle.yml, auto_close.yml) but no visible test suite in the file list, no recent commit data provided, and the README notes instability on Android 10+. Verdict: experimental proof-of-concept rather than production-ready; primarily useful as a learning resource.
Single-maintainer project (karma9874) with sparse documentation on security, dependency management unclear beyond Android/Python basics. No visible unit/integration tests, no lock files mentioned, and the codebase claims outdated Android API targets (compileSdkVersion 29, targetSdkVersion 22) — well behind current Android standards. The tool's own purpose (malware delivery) makes it a high-risk subject for supply chain or misuse, despite the disclaimer.
Active areas of work
Minimal recent activity visible from the file list; GitHub Actions workflows suggest automated CI/CD gating (gradle.yml runs tests, auto_close.yml manages stale issues), but no PR, branch, or commit data is provided. The project appears in maintenance/archival mode rather than active feature development.
🚀Get running
git config --system core.longpaths true
git clone https://github.com/karma9874/AndroRAT.git
cd AndroRAT
pip install -r requirements.txt
Daily commands:
Build APK: python3 androRAT.py --build -p 8000 -o karma.apk (requires Android SDK/Gradle installed). Start server: python3 androRAT.py --shell (opens interactive shell mode). Interactive mode: Dial *#*#1337#*#* on device for control panel (restart/uninstall options).
🗺️Map of the codebase
Android_Code/app/src/main/java/com/example/reverseshell2/MainActivity.java— Entry point of the Android client; initializes the RAT and establishes initial connection to the server.Android_Code/app/src/main/java/com/example/reverseshell2/tcpConnection.java— Core socket communication layer handling all client-server TCP communication; failure here breaks the entire RAT.Android_Code/app/src/main/java/com/example/reverseshell2/mainService.java— Background service managing persistent backdoor connectivity and command dispatch; must persist across app lifecycle.Android_Code/app/src/main/AndroidManifest.xml— Declares all permissions required for espionage features (camera, SMS, location, audio) and service configurations.Android_Code/app/build.gradle— Gradle build configuration specifying SDK versions (16–22), dependencies, and APK generation settings.Android_Code/app/src/main/java/com/example/reverseshell2/Payloads— Directory containing modular payload implementations (camera, audio, SMS, location) that execute attacker commands.Android_Code/app/src/main/java/com/example/reverseshell2/jobScheduler.java— Manages background job scheduling to maintain persistence even when app is not actively running.
🛠️How to make changes
Add a New Espionage Payload
- Create a new Java class in Android_Code/app/src/main/java/com/example/reverseshell2/Payloads/ extending the payload pattern (e.g., accessing a new system API) (
Android_Code/app/src/main/java/com/example/reverseshell2/Payloads/YourNewPayload.java) - Implement the payload method to return data as a String or serializable object (
Android_Code/app/src/main/java/com/example/reverseshell2/Payloads/YourNewPayload.java) - Register the new command handler in functions.java by adding a new case in the command dispatcher (
Android_Code/app/src/main/java/com/example/reverseshell2/functions.java) - Add required Android permissions to AndroidManifest.xml (e.g., <uses-permission android:name="android.permission.YOUR_PERMISSION" />) (
Android_Code/app/src/main/AndroidManifest.xml) - On server side (Python), add command handler in the server listener loop to invoke the new payload command (
Server-side Python code (not in file list))
Modify Server Connection Parameters
- Edit config.java to change server IP, port, and connection retry parameters (
Android_Code/app/src/main/java/com/example/reverseshell2/config.java) - Update tcpConnection.java socket initialization if socket type or protocol changes needed (
Android_Code/app/src/main/java/com/example/reverseshell2/tcpConnection.java) - Rebuild and sign the APK using Gradle (
Android_Code/app/build.gradle)
Enhance Persistence Mechanism
- Modify jobScheduler.java to adjust job scheduling interval and backoff strategy (
Android_Code/app/src/main/java/com/example/reverseshell2/jobScheduler.java) - Update broadcastReciever.java to handle additional system events (e.g., package install, connectivity) (
Android_Code/app/src/main/java/com/example/reverseshell2/broadcastReciever.java) - Register additional intent filters in AndroidManifest.xml for broadcast receiver (
Android_Code/app/src/main/AndroidManifest.xml) - Ensure mainService.java uses startForeground() for API 26+ to prevent service termination (
Android_Code/app/src/main/java/com/example/reverseshell2/mainService.java)
Build & Deploy Custom APK
- Edit build.gradle to change applicationId, versionCode, or signing configurations (
Android_Code/app/build.gradle) - Run ./gradlew assembleRelease in Android_Code directory to compile release APK (
Android_Code/gradlew) - Optionally obfuscate using ProGuard rules in proguard-rules.pro (
Android_Code/app/proguard-rules.pro) - Sign and align APK, then distribute to target device (
Android_Code/app/release/app-release.apk)
🔧Why these technologies
- Java Android (API 16–28, tested on API 16–29) — Provides native access to Android system APIs (camera, microphone, SMS, location, sensors); allows running arbitrary code with declared permissions.
- TCP Sockets — Enables persistent, low-latency command–control channel between client and attacker-controlled Python
🪤Traps & gotchas
- Windows filename length limit: README explicitly warns Git on Windows has 4096-char filename limit; must set
core.longpaths truebefore clone. 2. Android API mismatch: Project targets API 22 but compiles for API 29; some payloads may fail silently on modern Android (11+) due to runtime permission changes and scoped storage. 3. Ngrok configuration:--ngrokflag requires ngrok binary and auth token in PATH/environment; no error handling for missing dependency mentioned. 4. Secret code interaction: Control panel requires dialing*#*#1337#*#*through phone dialer; 'display pop-up windows in background' permission must be manually enabled per device. 5. Python version constraint: README says Python3 but no explicit version pin (3.6+ vs 3.9+?); requirements.txt format not visible. 6. No documented server discovery: How does client know server IP/port at runtime? Likely hardcoded in config.java or injected at build time (not shown).
🏗️Architecture
💡Concepts to learn
- Android Permissions Model (Runtime vs Manifest) — AndroRAT declares broad permissions (CAMERA, RECORD_AUDIO, ACCESS_FINE_LOCATION, READ_SMS) in AndroidManifest.xml, but Android 6.0+ requires runtime permission requests; understanding the difference is critical for understanding when/how payloads fail silently on modern devices.
- Android Foreground Services & JobScheduler — mainService.java and jobScheduler.java implement persistence strategies; modern Android (8.0+) severely restricts background execution, so grasping how services survive in foreground vs. background is essential for understanding why AndroRAT works on API 16-22 but struggles on API 28+.
- Socket Programming & Custom Protocol Design — tcpConnection.java implements a raw socket client to communicate with the Python server; there is no visible TLS/encryption in the file names, so understanding socket handshakes, message serialization, and error handling is critical for extending or securing the C2 channel.
- BroadcastReceiver & Intent System — broadcastReciever.java listens for system intents (likely BOOT_COMPLETED for auto-start); the Intent/BroadcastReceiver paradigm is core to Android IPC and persistence, making it a key target for detection and defense.
- APK Packaging, Proguard Obfuscation & Signing — app/proguard-rules.pro and build.gradle control how the APK is compiled, optimized, and signed; understanding these is crucial for both detecting the malware (signatures) and hardening it against reverse engineering.
- Camera & Audio APIs (Camera2, MediaRecorder) — Payloads like CameraPreview.java and audioManager.java use Android's Camera and MediaRecorder APIs; these are tightly permission-gated and API-version-dependent, explaining why they're major surveillance vectors but also why they fail on newer Android versions.
- Command-and-Control (C2) Architecture Patterns — AndroRAT exemplifies a centralized C2 model (Python server receives commands, Android client executes payloads and reports back); understanding polling vs. push, command queuing, and response serialization is foundational for both offensive and defensive security roles.
🔗Related repos
AhMyth/AhMyth-Android-RAT— Direct alternative Android RAT with similar Java client + Python server architecture; useful for comparing C2 design patterns and payload implementationsfr0gger/Damn-Vulnerable-Android-App— Educational Android security codelab; complements AndroRAT learning by showing defensive patterns and common vulnerabilities the RAT exploitsFSecureLABS/android-keystore— Deep-dive into Android's cryptographic keystore APIs; relevant for hardening AndroRAT's socket communication against interceptionabuse/tor-android— Demonstrates Tor integration on Android; useful reference for anonymizing C2 traffic in RAT deployments beyond the included ngrok tunnel supportMobSF/Mobile-Security-Framework-MobSF— Industry-standard Android app security analysis tool; can be used to audit AndroRAT's APK for hardening opportunities and to understand detection evasion challenges
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add Python server-side unit tests with pytest
The repo has a complete Android client with test infrastructure (androidTest folder, gradle test config) but NO server-side Python tests visible. The Python server handles critical socket communication, command parsing, and payload execution. Adding pytest tests would catch regressions and improve code quality for the server component.
- [ ] Create Server_Code/tests/ directory structure (if Server_Code exists)
- [ ] Add pytest fixtures for tcpConnection, command parsing, and payload execution
- [ ] Add conftest.py with mock socket objects for isolated testing
- [ ] Create CI workflow in .github/workflows/ to run pytest on push (similar to existing gradle.yml)
Refactor Android_Code/app/src/main/java/com/example/reverseshell2/mainService.java into multiple focused classes
mainService.java likely handles multiple responsibilities (socket management, command routing, payload execution). This violates Single Responsibility Principle, making it hard to test and maintain. Breaking it into CommandHandler, PayloadExecutor, and SocketManager classes would improve testability and follow Android best practices.
- [ ] Analyze mainService.java to identify distinct responsibilities
- [ ] Create new classes: PayloadExecutor.java, CommandRouter.java, ConnectionManager.java in Payloads/ or separate handlers/ package
- [ ] Move corresponding methods and update imports across MainActivity.java and tcpConnection.java
- [ ] Add unit tests for each new class in androidTest/ folder with AndroidJUnit4
Add API documentation for server command protocol with examples
The README lacks specification of the socket protocol between Android client and Python server. Without it, contributors cannot easily add new features or fix client-server communication bugs. A protocol.md file documenting command format, response types, and payload structures is critical.
- [ ] Create docs/PROTOCOL.md documenting JSON/binary message format between client and server
- [ ] Add concrete examples for each command type (e.g., SMS read, camera capture, location)
- [ ] Document payload responses with field definitions (e.g., what fields does locationManager.java return?)
- [ ] Link protocol.md in main README.md under a 'Architecture' or 'Development' section
🌿Good first issues
- Add unit tests for payload modules: Android_Code/app/src/androidTest/java/com/example/reverseshell2/ only has ExampleInstrumentedTest.java stub. Contribute tests for CameraPreview.java, audioManager.java, locationManager.java using Android's Espresso/JUnit framework to improve code coverage and catch regressions.: Tests should verify that each payload correctly reads/sends data without actually accessing hardware (use mocks); focus on the contract between mainService.java and each payload.
- Document the socket protocol specification: No protocol.md or README section describes the message format between tcpConnection.java and the Python server. Reverse-engineer tcpConnection.java and create a formal protocol spec (message types, byte layout, authentication handshake) so new developers can extend the C2 safely.: Include examples: how does 'get location' command flow from Python server → Android payload → response back?
- Add graceful degradation for Android 10+ incompatibilities: README notes that 'some interpreter commands will be unstable' on Android Q+. Add version checks (Build.VERSION.SDK_INT) in each payload (e.g., audioManager.java, videoRecorder.java) and document which features fail on which API levels. Contribute fallback logic or deprecation warnings.: Start with audioManager.java and videoRecorder.java since those are most likely to hit scoped storage / runtime permission issues on Android 10+.
⭐Top contributors
Click to expand
Top contributors
- @karma9874 — 68 commits
- @graysuit — 3 commits
- @Inv3nt0r1 — 2 commits
- @Ahmed-Sharaf-Mohammed — 1 commits
- @marcio-codes — 1 commits
📝Recent commits
Click to expand
Recent commits
1516f5e— Update auto_close.yml (karma9874)9c7c3af— Update auto_close.yml (karma9874)94e896c— Update auto_close.yml (karma9874)bddf566— adding stale issue closer action (karma9874)8b42db5— Merge pull request #303 from Ahmed-Sharaf-Mohammed/master (karma9874)f78089f— Update utils.py (Ahmed-Sharaf-Mohammed)c2ce290— fix for #129 (karma9874)c3ad192— updates (karma9874)a090088— Update README.md (karma9874)968477d— updated readme (karma9874)
🔒Security observations
- Critical · Remote Administration Tool (RAT) - Malicious Software —
Entire codebase - Android_Code/app/src/main/java/com/example/reverseshell2/. AndroRAT is explicitly designed as a remote administration tool (RAT) that can remotely control Android devices and exfiltrate sensitive data including SMS messages, call logs, location, camera feeds, and audio. This is inherently malicious software regardless of educational claims. Fix: Do not deploy, distribute, or use this software. This tool violates computer fraud and abuse laws in most jurisdictions. If encountered in production, immediately isolate affected devices and perform forensic analysis. - Critical · Outdated and Vulnerable Dependencies —
Android_Code/app/build.gradle - dependencies section. Multiple dependencies have known critical vulnerabilities: commons-io 2.0.1 (released 2010, CVE-2021-29425), androidx.appcompat 1.0.2 (outdated), and other legacy libraries. These contain exploitable security flaws. Fix: Update to latest stable versions: commons-io to 2.11.0+, androidx.appcompat to 1.6.1+, and all other dependencies to current versions. Implement dependency scanning in CI/CD pipeline. - Critical · Insecure Network Communication —
Android_Code/app/src/main/java/com/example/reverseshell2/tcpConnection.java. tcpConnection.java indicates unencrypted socket communication between client and server. No evidence of TLS/SSL encryption, making all data transmissions vulnerable to MITM attacks, interception, and eavesdropping. Fix: Implement TLS 1.2+ for all network communications. Use certificate pinning for server authentication. Never transmit sensitive data over unencrypted channels. - Critical · Excessive Dangerous Permissions —
Android_Code/app/src/main/AndroidManifest.xml. Manifest requests permissions for: CAMERA, RECORD_AUDIO, ACCESS_FINE_LOCATION, READ_CALL_LOG, READ_SMS, VIBRATE, and likely others. This exceeds principle of least privilege and enables comprehensive device surveillance. Fix: This is inherent to the malicious design. In legitimate apps, request only necessary permissions and implement runtime permission checks for Android 6.0+. Use scoped storage for file access. - High · Insufficient Input Validation —
Android_Code/app/src/main/java/com/example/reverseshell2/Payloads/ and mainService.java. Command processing in Payloads and mainService.java likely lacks proper input validation and sanitization, enabling command injection attacks from the server. Fix: Implement strict input validation and use parameterized execution methods. Never use Runtime.exec() with unsanitized input. Use ProcessBuilder with argument arrays instead. - High · No Authentication/Authorization Mechanism —
tcpConnection.java, mainService.java. No evidence of client authentication, mutual TLS, tokens, or authorization checks. Any system able to connect to the server can control infected devices. Fix: Implement mutual TLS authentication, OAuth 2.0, or JWT-based authentication. Validate all incoming commands against a whitelist. - High · Hardcoded Configuration —
Android_Code/app/src/main/java/com/example/reverseshell2/config.java. config.java likely contains hardcoded server addresses, ports, or other sensitive configuration embedded in the APK, making them extractable through reverse engineering. Fix: Never hardcode sensitive configuration. Use secure configuration management, environment variables, or encrypted preferences. Consider dynamic configuration loading from secure sources. - High · Disabled ProGuard/Obfuscation in Release Build —
Android_Code/app/build.gradle - buildTypes.release section. build.gradle shows minifyEnabled = false, meaning the APK is shipped unobfuscated, making reverse engineering trivial and exposing all functionality, credentials, and logic. Fix: Set minifyEnabled = true and use aggressive ProGuard rules. However, note that obfuscation alone is insufficient for security - proper encryption and authentication are required. - High · undefined —
undefined. undefined Fix: undefined
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.