Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ export default function TabLayout() {
}}
/>
<Tabs.Screen
name="sessions"
name="tools"
options={{
title: "Sessions",
tabBarIcon: ({ color }) => <IconSymbol size={24} name="clock.arrow.circlepath" color={color} />,
title: "Tools",
tabBarIcon: ({ color }) => <IconSymbol size={24} name="square.grid.2x2.fill" color={color} />,
}}
/>
<Tabs.Screen
name="catalog"
name="sessions"
options={{
title: "Threat Intel",
tabBarIcon: ({ color }) => <IconSymbol size={24} name="book.closed.fill" color={color} />,
title: "Sessions",
tabBarIcon: ({ color }) => <IconSymbol size={24} name="clock.arrow.circlepath" color={color} />,
}}
/>
<Tabs.Screen
Expand All @@ -68,6 +68,8 @@ export default function TabLayout() {
tabBarIcon: ({ color }) => <IconSymbol size={24} name="cable.connector" color={color} />,
}}
/>
<Tabs.Screen name="catalog" options={{ href: null }} />
<Tabs.Screen name="wireless-diagnostics-screen" options={{ href: null }} />
</Tabs>
);
}
134 changes: 134 additions & 0 deletions app/(tabs)/tools.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { useRouter } from "expo-router";
import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";

import { ScreenContainer } from "@/components/screen-container";
import { IconSymbol } from "@/components/ui/icon-symbol";
import { palette } from "@/constants/commander";

type ToolItem = {
title: string;
eyebrow: string;
detail: string;
icon: string;
route: "/(tabs)/wireless-diagnostics-screen" | "/(tabs)/catalog" | "/(tabs)/sessions" | "/(tabs)/usb";
tag: string;
};

const tools: ToolItem[] = [
{
title: "Wireless diagnostics",
eyebrow: "WI-FI · BLUETOOTH",
detail: "Review the current preview and see what is required for real radio discovery.",
icon: "wifi",
route: "/(tabs)/wireless-diagnostics-screen",
tag: "PREVIEW",
},
{
title: "CVE & patch library",
eyebrow: "THREAT INTELLIGENCE",
detail: "Review catalog freshness, patch references and evidence-based host correlations.",
icon: "book.closed.fill",
route: "/(tabs)/catalog",
tag: "LOCAL + FEEDS",
},
{
title: "Session reports",
eyebrow: "HISTORY · AUDIT",
detail: "Open saved host assessments and export the privileged-action disclosure.",
icon: "clock.arrow.circlepath",
route: "/(tabs)/sessions",
tag: "LOCAL",
},
{
title: "USB Link",
eyebrow: "COOPERATIVE TRANSPORT",
detail: "Inspect USB-host capability, permission requests and approved companion status.",
icon: "cable.connector",
route: "/(tabs)/usb",
tag: "DEVICE SUPPORT",
},
];

export default function ToolsScreen() {
const router = useRouter();

return (
<ScreenContainer containerClassName="bg-[#F5F3EE]" safeAreaClassName="bg-[#F5F3EE]">
<ScrollView contentContainerStyle={styles.content} showsVerticalScrollIndicator={false}>
<View style={styles.headerRow}>
<View style={styles.headerCopy}>
<Text style={styles.kicker}>DROID COMMANDER / TOOLKIT</Text>
<Text style={styles.title}>Choose a tool.</Text>
</View>
<View style={styles.mark}>
<IconSymbol name="slider.horizontal.3" size={24} color="#FFFFFF" />
</View>
</View>
<Text style={styles.subtitle}>
Device checks first. Every tool states its data source and limits before you act.
</Text>

<View style={styles.notice}>
<Text style={styles.noticeLabel}>CURRENT DEVICE SESSION</Text>
<Text style={styles.noticeTitle}>Read-only by default</Text>
<Text style={styles.noticeBody}>
Droid Commander does not bypass Android permissions. A visible tool or a successful UI action does not mean the underlying native capability is available.
</Text>
</View>

{tools.map((tool, index) => (
<Pressable
key={tool.title}
accessibilityRole="button"
accessibilityLabel={`Open ${tool.title}`}
onPress={() => router.push(tool.route)}
style={({ pressed }) => [styles.toolCard, pressed && styles.pressed]}
>
<View style={styles.toolTop}>
<View style={styles.toolIcon}>
<IconSymbol name={tool.icon as never} size={22} color={palette.orange} />
</View>
<Text style={styles.tag}>{tool.tag}</Text>
</View>
<Text style={styles.toolEyebrow}>{`0${index + 1} / ${tool.eyebrow}`}</Text>
<Text style={styles.toolTitle}>{tool.title}</Text>
<Text style={styles.toolDetail}>{tool.detail}</Text>
<View style={styles.openRow}>
<Text style={styles.openText}>Open tool</Text>
<Text style={styles.arrow}>→</Text>
</View>
</Pressable>
))}
<Text style={styles.footer}>
Preview labels are intentional. Real-device discovery and vulnerability correlation must be supported by native readings before results are treated as evidence.
</Text>
</ScrollView>
</ScreenContainer>
);
}

const styles = StyleSheet.create({
content: { paddingHorizontal: 20, paddingTop: 20, paddingBottom: 36 },
headerRow: { flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
headerCopy: { flex: 1, paddingRight: 12 },
kicker: { color: palette.orange, fontSize: 10, fontWeight: "900", letterSpacing: 1.1 },
title: { color: palette.ink, fontSize: 32, fontWeight: "900", letterSpacing: -1.2, marginTop: 5 },
mark: { width: 48, height: 48, borderRadius: 15, backgroundColor: palette.navy, alignItems: "center", justifyContent: "center" },
subtitle: { color: palette.muted, fontSize: 14, lineHeight: 21, marginTop: 10, marginBottom: 18 },
notice: { backgroundColor: palette.navy, borderRadius: 18, padding: 17, marginBottom: 20 },
noticeLabel: { color: palette.navyMuted, fontSize: 9, fontWeight: "900", letterSpacing: 1 },
noticeTitle: { color: "#FFFFFF", fontSize: 18, fontWeight: "800", marginTop: 7 },
noticeBody: { color: palette.navyMuted, fontSize: 12, lineHeight: 18, marginTop: 7 },
toolCard: { backgroundColor: "#FFFFFF", borderColor: palette.line, borderWidth: 1, borderRadius: 18, padding: 16, marginBottom: 12 },
pressed: { opacity: 0.78, transform: [{ scale: 0.99 }] },
toolTop: { flexDirection: "row", justifyContent: "space-between", alignItems: "center" },
toolIcon: { width: 42, height: 42, borderRadius: 13, backgroundColor: palette.orangeSoft, alignItems: "center", justifyContent: "center" },
tag: { color: palette.muted, fontSize: 9, fontWeight: "900", letterSpacing: 0.5, borderWidth: 1, borderColor: palette.line, borderRadius: 7, paddingHorizontal: 8, paddingVertical: 5 },
toolEyebrow: { color: palette.orange, fontSize: 9, fontWeight: "900", letterSpacing: 0.9, marginTop: 14 },
toolTitle: { color: palette.ink, fontSize: 19, fontWeight: "800", marginTop: 4 },
toolDetail: { color: palette.muted, fontSize: 13, lineHeight: 19, marginTop: 5 },
openRow: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginTop: 14, paddingTop: 12, borderTopWidth: 1, borderTopColor: "#EDF0ED" },
openText: { color: palette.ink, fontSize: 12, fontWeight: "800" },
arrow: { color: palette.orange, fontSize: 20, fontWeight: "800" },
footer: { color: palette.muted, fontSize: 11, lineHeight: 16, marginTop: 7, paddingHorizontal: 3 },
});
189 changes: 101 additions & 88 deletions app/(tabs)/wireless-diagnostics-screen.tsx
Original file line number Diff line number Diff line change
@@ -1,109 +1,122 @@
import React, { useState, useEffect } from "react";
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, ActivityIndicator } from "react-native";
import { WirelessManager, WiFiNetwork, BluetoothDevice } from "../../lib/wireless-manager";
import { Alert, Pressable, ScrollView, StyleSheet, Text, View } from "react-native";

export default function WirelessDiagnosticsScreen() {
const [wifiNetworks, setWifiNetworks] = useState<WiFiNetwork[]>([]);
const [btDevices, setBtDevices] = useState<BluetoothDevice[]>([]);
const [loading, setLoading] = useState<boolean>(false);
const [adbStatus, setAdbStatus] = useState<string>("Inactive");
const [securityScore, setSecurityScore] = useState<number | null>(null);

const manager = WirelessManager.getInstance();
import { ScreenContainer } from "@/components/screen-container";
import { palette } from "@/constants/commander";

const handleRunDiagnostics = async () => {
setLoading(true);
try {
const wifi = await manager.scanWiFiNetworks();
const bt = await manager.scanBluetoothDevices();
setWifiNetworks(wifi);
setBtDevices(bt);

const report = manager.generateSecurityReport(wifi, bt);
setSecurityScore(report.securityPostureScore);
} catch (err) {
console.error("Failed wireless diagnostics scan", err);
} finally {
setLoading(false);
}
};
const previewNetworks = [
{ name: "Example-Lab-5G", detail: "WPA3 · 5 GHz · sample only", strength: "Strong" },
{ name: "Guest-Network", detail: "Open · 2.4 GHz · sample only", strength: "Review" },
];
const previewDevices = [
{ name: "Example BLE Sensor", detail: "BLE · sample only", status: "Paired" },
{ name: "Example Beacon", detail: "BLE · sample only", status: "Unknown" },
];

const handleEnableAdbWifi = async () => {
const res = await manager.enableWirelessDebugging(5555);
setAdbStatus(`Active on ${res.ipAddress}:${res.port}`);
export default function WirelessDiagnosticsScreen() {
const explainRealScan = () => {
Alert.alert(
"Real scan not available yet",
"This build has no native Wi-Fi/Bluetooth discovery implementation connected to this screen. Android permissions and OS restrictions also apply. The examples below are demo data, not nearby devices. No scan was performed.",
);
};

useEffect(() => {
handleRunDiagnostics();
}, []);

return (
<ScrollView style={styles.container} contentContainerStyle={styles.content}>
<Text style={styles.title}>Wireless & Network Diagnostics</Text>
<Text style={styles.subtitle}>Wi-Fi Posture, BLE Scanning & Wireless ADB Channel</Text>
<ScreenContainer containerClassName="bg-[#F5F3EE]" safeAreaClassName="bg-[#F5F3EE]">
<ScrollView contentContainerStyle={styles.content} showsVerticalScrollIndicator={false}>
<Text style={styles.kicker}>TOOLS / RADIO VISIBILITY</Text>
<Text style={styles.title}>Wireless diagnostics.</Text>
<Text style={styles.subtitle}>
A transparent preview of the intended Wi-Fi and Bluetooth workflow. Live radio discovery is not connected in this build.
</Text>

<View style={styles.card}>
<Text style={styles.cardTitle}>Quick Controls</Text>
<View style={styles.buttonRow}>
<TouchableOpacity style={styles.primaryButton} onPress={handleRunDiagnostics} disabled={loading}>
{loading ? <ActivityIndicator color="#FFF" /> : <Text style={styles.buttonText}>Scan Network</Text>}
</TouchableOpacity>
<TouchableOpacity style={styles.secondaryButton} onPress={handleEnableAdbWifi}>
<Text style={styles.secondaryButtonText}>Enable ADB over Wi-Fi</Text>
</TouchableOpacity>
</View>
<Text style={styles.adbText}>Wireless ADB Status: {adbStatus}</Text>
{securityScore !== null && (
<Text style={[styles.scoreText, { color: securityScore > 75 ? "#4CAF50" : "#FF9800" }]}>
Security Posture Score: {securityScore}/100
<View style={styles.statusCard}>
<View style={styles.statusRow}>
<View style={styles.statusDot} />
<Text style={styles.statusLabel}>DEMO PREVIEW · NOT A LIVE SCAN</Text>
</View>
<Text style={styles.statusTitle}>Device discovery is not enabled</Text>
<Text style={styles.statusDetail}>
Droid Commander currently has no native scanner feeding this screen. The sample entries below are clearly marked and must not be used as evidence of nearby networks or devices.
</Text>
)}
</View>
<Pressable accessibilityRole="button" onPress={explainRealScan} style={({ pressed }) => [styles.primaryButton, pressed && styles.pressed]}>
<Text style={styles.primaryButtonText}>Check live-scan availability</Text>
<Text style={styles.arrow}>→</Text>
</Pressable>
</View>

<View style={styles.card}>
<Text style={styles.cardTitle}>Wi-Fi Networks ({wifiNetworks.length})</Text>
{wifiNetworks.map((net, idx) => (
<View key={idx} style={styles.listItem}>
<View>
<Text style={styles.itemTitle}>{net.ssid} {net.isConnected ? "(Connected)" : ""}</Text>
<Text style={styles.itemSub}>BSSID: {net.bssid} | {net.security}</Text>
<View style={styles.sectionRow}>
<Text style={styles.sectionTitle}>Wi-Fi preview</Text>
<Text style={styles.sectionCount}>2 EXAMPLES</Text>
</View>
{previewNetworks.map((network) => (
<View key={network.name} style={styles.itemCard}>
<View style={styles.itemIcon}><Text style={styles.itemIconText}>Wi</Text></View>
<View style={styles.itemCopy}>
<Text style={styles.itemTitle}>{network.name}</Text>
<Text style={styles.itemDetail}>{network.detail}</Text>
</View>
<Text style={styles.rssiText}>{net.rssi} dBm</Text>
<Text style={[styles.itemStatus, network.strength === "Review" && styles.reviewStatus]}>{network.strength}</Text>
</View>
))}
</View>

<View style={styles.card}>
<Text style={styles.cardTitle}>Bluetooth & BLE Devices ({btDevices.length})</Text>
{btDevices.map((dev, idx) => (
<View key={idx} style={styles.listItem}>
<View>
<Text style={styles.itemSub}>{dev.address} | {dev.type} | {dev.isPaired ? "Paired" : "Unpaired"}</Text>
<View style={[styles.sectionRow, styles.secondSection]}>
<Text style={styles.sectionTitle}>Bluetooth preview</Text>
<Text style={styles.sectionCount}>2 EXAMPLES</Text>
</View>
{previewDevices.map((device) => (
<View key={device.name} style={styles.itemCard}>
<View style={styles.btIcon}><Text style={styles.btIconText}>BT</Text></View>
<View style={styles.itemCopy}>
<Text style={styles.itemTitle}>{device.name}</Text>
<Text style={styles.itemDetail}>{device.detail}</Text>
</View>
<Text style={styles.rssiText}>{dev.rssi} dBm</Text>
<Text style={styles.itemStatus}>{device.status}</Text>
</View>
))}
</View>
</ScrollView>

<View style={styles.limitCard}>
<Text style={styles.limitTitle}>Why is the list not live?</Text>
<Text style={styles.limitBody}>
A screen and a button cannot discover radios by themselves. The app needs supported native APIs, the right runtime permissions, device settings where required, and tested Android-version behavior. Those pieces have not yet been implemented here.
</Text>
</View>
<Text style={styles.footer}>Wireless debugging is not enabled by this screen. Use Android Developer options to manage wireless debugging manually.</Text>
</ScrollView>
</ScreenContainer>
);
}

const styles = StyleSheet.create({
container: { flex: 1, backgroundColor: "#0A0E17" },
content: { padding: 16 },
title: { fontSize: 22, fontWeight: "bold", color: "#E2E8F0", marginBottom: 4 },
subtitle: { fontSize: 13, color: "#94A3B8", marginBottom: 16 },
card: { backgroundColor: "#1E293B", borderRadius: 12, padding: 16, marginBottom: 16, borderWidth: 1, borderColor: "#334155" },
cardTitle: { fontSize: 16, fontWeight: "600", color: "#38BDF8", marginBottom: 12 },
buttonRow: { flexDirection: "row", gap: 10, marginBottom: 12 },
primaryButton: { flex: 1, backgroundColor: "#0284C7", paddingVertical: 12, borderRadius: 8, alignItems: "center" },
secondaryButton: { flex: 1, backgroundColor: "#334155", paddingVertical: 12, borderRadius: 8, alignItems: "center" },
buttonText: { color: "#FFFFFF", fontWeight: "600" },
secondaryButtonText: { color: "#38BDF8", fontWeight: "600" },
adbText: { color: "#CBD5E1", fontSize: 13, marginTop: 4 },
scoreText: { fontSize: 14, fontWeight: "bold", marginTop: 8 },
listItem: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", paddingVertical: 8, borderBottomWidth: 1, borderBottomColor: "#334155" },
itemTitle: { color: "#F8FAFC", fontSize: 14, fontWeight: "500" },
itemSub: { color: "#94A3B8", fontSize: 12, marginTop: 2 },
rssiText: { color: "#38BDF8", fontWeight: "bold", fontSize: 13 },
content: { paddingHorizontal: 20, paddingTop: 20, paddingBottom: 36 },
kicker: { color: palette.orange, fontSize: 10, fontWeight: "900", letterSpacing: 1.1 },
title: { color: palette.ink, fontSize: 30, fontWeight: "900", letterSpacing: -1, marginTop: 5 },
subtitle: { color: palette.muted, fontSize: 14, lineHeight: 20, marginTop: 8, marginBottom: 18 },
statusCard: { backgroundColor: palette.navy, borderRadius: 20, padding: 18, marginBottom: 24 },
statusRow: { flexDirection: "row", alignItems: "center" },
statusDot: { width: 7, height: 7, borderRadius: 5, backgroundColor: palette.orange, marginRight: 8 },
statusLabel: { color: palette.orange, fontSize: 9, fontWeight: "900", letterSpacing: 0.7 },
statusTitle: { color: "#FFFFFF", fontSize: 20, fontWeight: "800", marginTop: 12 },
statusDetail: { color: palette.navyMuted, fontSize: 12, lineHeight: 18, marginTop: 7 },
primaryButton: { backgroundColor: palette.orange, borderRadius: 12, paddingHorizontal: 13, minHeight: 48, marginTop: 16, flexDirection: "row", alignItems: "center", justifyContent: "space-between" },
pressed: { opacity: 0.78 },
primaryButtonText: { color: "#FFFFFF", fontSize: 12, fontWeight: "800" },
arrow: { color: "#FFFFFF", fontSize: 20, fontWeight: "800" },
sectionRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: 10 },
secondSection: { marginTop: 18 },
sectionTitle: { color: palette.ink, fontSize: 18, fontWeight: "800" },
sectionCount: { color: palette.muted, fontSize: 9, fontWeight: "900", letterSpacing: 0.6 },
itemCard: { flexDirection: "row", alignItems: "center", backgroundColor: "#FFFFFF", borderColor: palette.line, borderWidth: 1, borderRadius: 14, padding: 12, marginBottom: 8 },
itemIcon: { width: 38, height: 38, borderRadius: 12, backgroundColor: "#EAF1F7", alignItems: "center", justifyContent: "center" },
itemIconText: { color: palette.navy, fontSize: 11, fontWeight: "900" },
btIcon: { width: 38, height: 38, borderRadius: 12, backgroundColor: palette.orangeSoft, alignItems: "center", justifyContent: "center" },
btIconText: { color: palette.orange, fontSize: 11, fontWeight: "900" },
itemCopy: { flex: 1, paddingHorizontal: 10 },
itemTitle: { color: palette.ink, fontSize: 13, fontWeight: "800" },
itemDetail: { color: palette.muted, fontSize: 10, lineHeight: 15, marginTop: 3 },
itemStatus: { color: palette.green, fontSize: 9, fontWeight: "900" },
reviewStatus: { color: palette.yellow },
limitCard: { backgroundColor: "#FFFFFF", borderColor: palette.line, borderWidth: 1, borderRadius: 16, padding: 16, marginTop: 18 },
limitTitle: { color: palette.ink, fontSize: 15, fontWeight: "800" },
limitBody: { color: palette.muted, fontSize: 12, lineHeight: 18, marginTop: 6 },
footer: { color: palette.muted, fontSize: 11, lineHeight: 16, marginTop: 14, paddingHorizontal: 2 },
});
Loading