#!/bin/bash
# Compact status for periodic monitoring. Offline reads only.
export LC_ALL=C
cd /root/recon
echo "=== $(date -u +%FT%TZ) ==="
echo "[masscan]"; (grep -ahE 'START|DONE' run_scan.log run_scan2.log 2>/dev/null | tail -4; tail -c 200 run_scan.log | tr '\r' '\n' | tail -1)
echo "[prober]"; grep -a '.' prober_stats.log 2>/dev/null | tail -2; grep -ac . respA.tsv 2>/dev/null || echo 0
echo "[products top]"; cut -f5 respA.tsv hitsB.tsv 2>/dev/null | grep -a . | tr ',' '\n' | sort | uniq -c | sort -rn | head -12
echo "[sector hits]"; awk -F'\t' '$5!=""' respA.tsv hitsB.tsv 2>/dev/null | awk -F'\t' '{print $1"\t"$5}' | grep -aFf <(cut -f1 sec_gov_uniq.tsv sec_medical_uniq.tsv sec_legal_uniq.tsv 2>/dev/null) | tail -15
echo "[hits count]"; awk -F'\t' '$5!=""' respA.tsv hitsB.tsv 2>/dev/null | wc -l
echo "[f5]"; wc -l f5_resp.tsv 2>/dev/null; awk -F'\t' '$5!=""' f5_resp.tsv 2>/dev/null | wc -l; awk -F'\t' '$5!=""' f5_resp.tsv 2>/dev/null | grep -aiE 'my.policy|apm|vpn|ssl' | cut -c1-140 | head -5
