mic.git


mic

~ proxy for JA4-TLS fingerprinting evasion
git clone https://github.com/djnnvx/mic.git
log | files | refs | archive | README | LICENSE

commit 5502c1d43a42d948d131755e82e5437b4ba3aa56
parent 9aa351e24e36302ea4f94705c35ac8140ec8e0e7
Author: djnn <[email protected]>
Date: Fri, 20 Feb 2026 11:58:10 +0900

fix(meta): setup / cleanup scripts

Diffstat:
Mscripts/cleanup.sh | 40++++++----------------------------------
Mscripts/setup.sh | 60++++++++++++++++++++----------------------------------------

2 files changed, 26 insertions(+), 74 deletions(-)

diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh
@@ -1,45 +1,17 @@
 #!/usr/bin/env bash
-# cleanup.sh — stop the proxy and remove build artifacts.
 set -euo pipefail
 
 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 ROOT_DIR="$(dirname "$SCRIPT_DIR")"
 BINARY="$ROOT_DIR/mic"
-PID_FILE="$ROOT_DIR/.mic.pid"
 
-# ── stop proxy via PID file ────────────────────────────────────────────────────
-if [ -f "$PID_FILE" ]; then
-    PID="$(cat "$PID_FILE")"
-    if kill -0 "$PID" 2>/dev/null; then
-        echo "[+] Stopping mic (PID $PID)..."
-        kill "$PID"
-        # Wait briefly for clean shutdown.
-        for i in $(seq 1 10); do
-            kill -0 "$PID" 2>/dev/null || break
-            sleep 0.2
-        done
-        if kill -0 "$PID" 2>/dev/null; then
-            echo "[!] Process still alive after 2 s — sending SIGKILL."
-            kill -9 "$PID" || true
-        fi
-    else
-        echo "[~] PID $PID is no longer running."
-    fi
-    rm -f "$PID_FILE"
-else
-    echo "[~] No PID file found."
-fi
-
-# ── catch any stray mic processes ─────────────────────────────────────────────
-if pgrep -x mic >/dev/null 2>&1; then
-    echo "[+] Killing remaining mic processes..."
-    pkill -x mic || true
-fi
-
-# ── remove binary ──────────────────────────────────────────────────────────────
 if [ -f "$BINARY" ]; then
-    echo "[+] Removing binary $BINARY..."
+    echo "[+] Removing binary..."
     rm "$BINARY"
 fi
 
-echo "[+] Cleanup complete."
+echo "[+] Done."
+echo ""
+echo "[i] CA files (ca.pem, ca-key.pem) are left in place."
+echo "    Remove them manually if you no longer need them, and untrust the cert"
+echo "    from your system store if you added it."
diff --git a/scripts/setup.sh b/scripts/setup.sh
@@ -1,51 +1,31 @@
 #!/usr/bin/env bash
-# setup.sh — build the mic binary, create a starter config, and start the proxy.
 set -euo pipefail
 
 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 ROOT_DIR="$(dirname "$SCRIPT_DIR")"
 BINARY="$ROOT_DIR/mic"
-CONFIG="$ROOT_DIR/mic.toml"
-EXAMPLE="$ROOT_DIR/mic.example.toml"
-PID_FILE="$ROOT_DIR/.mic.pid"
+CA_CERT="$ROOT_DIR/ca.pem"
+CA_KEY="$ROOT_DIR/ca-key.pem"
 
-# ── build ──────────────────────────────────────────────────────────────────────
 echo "[+] Building mic..."
 (cd "$ROOT_DIR" && go build -o mic .)
-echo "    Binary: $BINARY"
-
-# ── config ─────────────────────────────────────────────────────────────────────
-if [ ! -f "$CONFIG" ]; then
-    echo "[+] Creating mic.toml from mic.example.toml..."
-    cp "$EXAMPLE" "$CONFIG"
-    echo "    Edit $CONFIG before starting (set mode, fingerprint.tls.ja4, etc.)"
-else
-    echo "[~] mic.toml already exists — leaving it untouched."
-fi
 
-# ── start proxy ────────────────────────────────────────────────────────────────
-if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
-    echo "[~] mic is already running (PID $(cat "$PID_FILE"))."
-else
-    echo "[+] Starting mic in the background..."
-    "$BINARY" --config "$CONFIG" > "$ROOT_DIR/mic.log" 2>&1 &
-    echo $! > "$PID_FILE"
-    echo "    PID $(cat "$PID_FILE") — log: $ROOT_DIR/mic.log"
-    echo "    Stop with:  scripts/cleanup.sh"
-fi
+echo ""
+echo "[i] mic will run in client-front mode on :8080 with chrome-120 fingerprint."
+echo "    MitM CA will be written to $CA_CERT on first run."
+echo "    Trust it once, then use mic as a transparent HTTPS proxy:"
+echo ""
+echo "      curl --cacert $CA_CERT -x http://localhost:8080 https://tlsinfo.me/json"
+echo ""
+echo "    macOS system trust:"
+echo "      sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $CA_CERT"
+echo ""
+echo "    Debian/Ubuntu/Kali system trust:"
+echo "      sudo cp $CA_CERT /usr/local/share/ca-certificates/mic-ca.crt && sudo update-ca-certificates"
+echo ""
 
-# ── client-front: MitM CA hint ─────────────────────────────────────────────────
-# Wait briefly for mic to write the CA files on first run.
-CA_CERT="$ROOT_DIR/ca.pem"
-sleep 0.5
-if [ -f "$CA_CERT" ]; then
-    echo ""
-    echo "[i] MitM CA certificate found: $CA_CERT"
-    echo "    Trust it once, then use mic as an HTTPS proxy:"
-    echo ""
-    echo "    curl --cacert $CA_CERT -x http://localhost:8080 https://tlsinfo.me/json"
-    echo ""
-    echo "    To add it to the system trust store (Debian/Ubuntu/Kali):"
-    echo "      sudo cp $CA_CERT /usr/local/share/ca-certificates/mic-ca.crt"
-    echo "      sudo update-ca-certificates"
-fi
+exec "$BINARY" client \
+    --listen :8080 \
+    --fingerprint chrome-120 \
+    --intercept-cert "$CA_CERT" \
+    --intercept-key "$CA_KEY"