Current Issue: Your device shows as "unauthorized"
Fix:
- Look at your phone screen - There should be a popup dialog
- The dialog says: "Allow USB debugging?"
- Tap "Allow"
- (Optional) Check "Always allow from this computer"
Verify it worked:
adb devicesShould show:
List of devices attached
GA7L555TMBFELZVC device ← Should say "device" NOT "unauthorized"
If still showing "unauthorized":
- Unplug and replug USB cable
- Try a different USB port
- Disable and re-enable Developer Options on phone
- Run:
adb kill-server && adb start-server
Just double-click this file:
install_and_test.bat
This will:
- Check device connection
- Install the APK
- Launch the app
- Start monitoring logs automatically
cd C:\Users\ritik\Downloads\AppDev\APP\andronet
adb install -r "build\app\outputs\flutter-apk\app-debug.apk"Open a new terminal/command prompt and run:
cd C:\Users\ritik\Downloads\AppDev\APP\andronet
adb logcat -s AnomalyDetector:D SignatureDatabase:D RuleEngine:DExpected startup messages:
I/SignatureDatabase: Loaded 18 signatures
I/RuleEngine: Loaded 10 detection rules
I/AnomalyDetector: Initialization complete
If you see these messages, the detection system is working! ✅
Do this:
- Open AndroNet app
- Tap "Start Capture" button
- Open Chrome browser on phone
- Visit:
https://www.google.com - Wait 10 seconds
- Stop capture
What to check:
- ✅ Packets appear in app
- ✅ Domain shows "Google" with globe icon
- ✅ No errors in logcat
Log command:
adb logcat -s PacketAnalysisManager:D | grep "Packet processed"Do this:
- Start packet capture in AndroNet
- Quickly open 10+ different apps/websites:
- Chrome → google.com
- Chrome → facebook.com
- Chrome → youtube.com
- Chrome → twitter.com
- Open Instagram app
- Open WhatsApp
- Open Telegram
- Open Gmail
- Open Maps
- etc.
- Do this rapidly (within 30 seconds)
Expected result:
W/AnomalyDetector: 🚨 Anomaly detected: Port scan detected
OR
W/AnomalyDetector: 🚨 Anomaly detected: [RULE-001] Advanced Port Scan
Why this works: Opening many apps quickly creates connections to multiple different IPs, triggering port scan detection.
Do this:
-
Start packet capture
-
In Chrome, rapidly visit 20+ different websites one after another:
- google.com
- facebook.com
- youtube.com
- amazon.com
- netflix.com
- twitter.com
- instagram.com
- reddit.com
- wikipedia.org
- github.com
- stackoverflow.com
- linkedin.com
- etc. (keep going fast!)
-
Try to visit them as fast as possible (generates many DNS queries)
Expected result:
W/AnomalyDetector: 🚨 Anomaly detected: Possible DNS tunneling detected
OR
W/RuleEngine: Rule matched: RULE-004 - DNS Tunneling
W/AnomalyDetector: 🚨 Anomaly detected: [RULE-004] DNS Tunneling
Why this works: Rapid DNS queries trigger the DNS tunneling detection rule.
Do this:
- Start packet capture
- Open Chrome on your phone
- Visit this test URL (safe vulnerability testing site):
http://testphp.vulnweb.com/artists.php?artist=1' OR '1'='1
Expected result:
W/RuleEngine: Rule matched: RULE-002 - SQL Injection Attempt
W/AnomalyDetector: 🚨 Anomaly detected: [RULE-002] SQL Injection Attempt
Alternative test URLs:
http://testphp.vulnweb.com/listproducts.php?cat=1 UNION SELECT null,null,null
http://testphp.vulnweb.com/artists.php?artist=1'; DROP TABLE users--
Why this works: The URL contains SQL injection keywords that trigger RULE-002.
Do this:
- Start packet capture
- You need to make an HTTP request with curl/wget/python User-Agent
If you have ADB shell access:
adb shell
# On device shell:
curl http://example.comExpected result:
W/RuleEngine: Rule matched: RULE-009 - Suspicious User-Agent
W/AnomalyDetector: 🚨 Anomaly detected: [RULE-009] Suspicious User-Agent
Why this works: curl/wget/python User-Agents are considered suspicious.
Do this:
- Start packet capture
- Open Instagram or Twitter app
- Rapidly scroll through your feed as fast as possible
- Keep scrolling for 30 seconds non-stop
Expected result:
W/AnomalyDetector: 🚨 Anomaly detected: Connection flood detected
Why this works: Social media apps make many rapid API calls when scrolling, triggering connection flood detection.
Best command for testing:
adb logcat -s AnomalyDetector:D SignatureDatabase:D RuleEngine:D PacketAnalysisManager:ITo see just the 🚨 alerts:
adb logcat -s AnomalyDetector:D | findstr "🚨"Or on Windows:
adb logcat -s AnomalyDetector:D | findstr "Anomaly detected"adb logcat -d -s AnomalyDetector:D | findstr /C:"🚨" | find /C "🚨"adb logcat -s AnomalyDetector:D SignatureDatabase:D RuleEngine:D > test_results.logThen open test_results.log in notepad to review.
D/SignatureDatabase: Checking packet against signatures...
D/SignatureDatabase: Signature match: RECON-001 - Nmap Scan
W/AnomalyDetector: 🚨 Anomaly detected: [RECON-001] Nmap Scan: Nmap network scanner detected
What happened: Packet matched signature RECON-001 (Nmap Scanner)
D/RuleEngine: Evaluating 10 rules for packet...
D/RuleEngine: Rule RULE-002 checking conditions...
D/RuleEngine: ✓ Condition matched: ProtocolEquals(HTTP)
D/RuleEngine: ✓ Condition matched: PortIn([80, 443])
D/RuleEngine: ✓ Condition matched: UrlContains(UNION SELECT)
W/RuleEngine: Rule matched: RULE-002 - SQL Injection Attempt
W/AnomalyDetector: 🚨 Anomaly detected: [RULE-002] SQL Injection Attempt: SQL injection pattern detected
What happened: Packet satisfied all conditions of RULE-002, triggered SQL injection alert.
D/AnomalyDetector: Port scan check: source 192.168.1.100 accessed 18 unique destinations
W/AnomalyDetector: 🚨 Anomaly detected: Port scan detected from 192.168.1.100 (18 unique ports/IPs)
What happened: One source IP connected to 18+ different destinations, triggered port scan detection.
Check:
adb logcat -s "*:E" # Show all errorsSolution:
- App might have crashed - check for exceptions
- VPN service might not be running - restart capture
This is normal! Most traffic is legitimate. To force detection:
- Do Test 2 (rapid app opening)
- Do Test 3 (rapid website visiting)
- Do Test 6 (rapid social media scrolling)
Examples:
W/AnomalyDetector: 🚨 Anomaly detected: Port scan detected (every few seconds)
This can happen with:
- Social media apps (they connect to many servers)
- News apps (many ad/tracking connections)
- Games (many API endpoints)
This is expected! You can adjust thresholds later in AnomalyDetector.kt.
Try these in order:
- Unplug and replug USB cable
adb kill-serverthenadb start-server- On phone: Developer Options → Revoke USB debugging authorizations → Re-enable USB debugging
- Try different USB cable
- Try different USB port on computer
- Restart phone
- Restart computer
- Device authorized
- App installs without errors
- App launches and starts capture
- Packets appear in app
- Logs show "Loaded 18 signatures"
- Logs show "Loaded 10 detection rules"
- At least 1 anomaly detected during testing
- All of the above, plus:
- Multiple anomaly types detected (port scan, DNS, connection flood)
- Signature matches logged correctly
- Rule matches logged correctly
- No app crashes
- Packet capture still works normally
- All of the above, plus:
- SQL injection test triggers RULE-002
- Performance feels smooth (no lag)
- Domain names still showing correctly
- HTTP payload formatting still works
- Only real anomalies detected (few false positives)
# 1. Check device
adb devices
# 2. Install app
cd C:\Users\ritik\Downloads\AppDev\APP\andronet
adb install -r "build\app\outputs\flutter-apk\app-debug.apk"
# 3. Monitor logs
adb logcat -s AnomalyDetector:D SignatureDatabase:D RuleEngine:D
# 4. See only alerts
adb logcat -s AnomalyDetector:D | findstr "🚨"
# 5. Count anomalies
adb logcat -d -s AnomalyDetector:D | findstr "Anomaly detected" | find /C "Anomaly"
# 6. Save to file
adb logcat -s AnomalyDetector:D SignatureDatabase:D RuleEngine:D > test_results.log
# 7. Clear logs before test
adb logcat -c
# 8. Launch app
adb shell am start -n com.example.packet_analyzer/.MainActivityD/AnomalyDetector: Analyzing packet: TCP 192.168.1.100:54321 → 93.184.216.34:443
D/AnomalyDetector: Port scan check: 192.168.1.100 has accessed 16 unique destinations
W/AnomalyDetector: 🚨 Anomaly detected: Port scan detected from 192.168.1.100 (16 unique ports/IPs)
D/RuleEngine: Evaluating packet: HTTP GET /artists.php?artist=1' OR '1'='1
D/RuleEngine: RULE-002 conditions: [✓] Protocol=HTTP [✓] Port=80 [✓] URL contains "' OR '1'='1"
W/RuleEngine: Rule matched: RULE-002 - SQL Injection Attempt
W/AnomalyDetector: 🚨 Anomaly detected: [RULE-002] SQL Injection Attempt: SQL injection pattern detected in HTTP request
D/AnomalyDetector: DNS query rate: 15 queries/sec
W/AnomalyDetector: 🚨 Anomaly detected: Possible DNS tunneling detected (high query rate: 15/sec)
D/AnomalyDetector: Connection rate from 192.168.1.100: 62 connections/sec
W/AnomalyDetector: 🚨 Anomaly detected: Connection flood detected from 192.168.1.100 (62 connections/sec, threshold: 50)
Once you confirm detection is working:
- Take screenshots of anomaly logs
- Note which tests worked and which didn't
- Check for false positives (anomalies on normal traffic)
Then we can move to Phase 2: Flutter UI Integration so you can see anomalies in the app itself (not just in logs)!
Can't get device authorized? See "Issue: Device still unauthorized" section above
No anomalies showing? Try Test 2 (rapid app opening) - this almost always triggers something
Too many logs? Use: adb logcat -s AnomalyDetector:W (shows only warnings = anomalies)
Want to see everything? Use: adb logcat -v color (colorized full logs)