Helpful scripts to automate checks and responses
Scripts are little tools you build once, and they quietly do important jobs for you behind the scenes—like looking for signs of spyware, blocking suspicious devices, or copying logs from phones.
The guidance provided here is designed for technical users building pilot systems or testing tool deployments. It can be deployed on an old PC or laptop, but if you are deploying this stack to protect vulnerable people, exercise extreme care. Validate every component in your own environment, and assume nothing is bulletproof out of the box.
For production, we recommend using our pre-made containers (also under active development).
It’s designed for shelters with:
It collects clues from devices (like logs, alerts, and odd behaviour), watches for signs of tracking or intrusion, and gives you a visual dashboard so you can spot threats and act fast.
This is the machine that will run everything.
Minimum spec:
If unsure, ask your IT volunteer to set a fixed IP like 192.168.1.10
.
You can use:
These are the devices this system can serve:
Just needs to connect all devices within the building. The system does not need internet access once set up.
A small toolkit (based on a Raspberry Pi) that checks devices for suspicious behaviour before they join the shelter network. Ideal during intake interviews or outreach.
This is where all your security tools will live.
Ctrl + Alt + T
)sudo apt update && sudo apt install -y curl unzip gnupg
sudo apt install -y openjdk-11-jdk
Wazuh is an open-source system that watches devices, looks for problems, and gives you alerts and a dashboard. It includes:
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | sudo gpg --dearmor -o /usr/share/keyrings/wazuh.gpg
echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" | sudo tee /etc/apt/sources.list.d/wazuh.list
sudo apt update
sudo apt install -y wazuh-manager wazuh-api elasticsearch kibana
sudo systemctl enable --now wazuh-manager elasticsearch kibana
Once everything is running, open a browser on your server and go to your main control room. You’ll log in and see alerts, device info, and more:
http://localhost:5601
Or from another device on the same network:
http://192.168.1.10:5601
Zeek (formerly Bro) is a powerful network analysis framework that monitors all network traffic and creates detailed logs of connections, files, and protocols. It includes:
sudo apt install -y zeek
If Zeek isn’t available in your Ubuntu version (or you need newer features), build from source:
# Install build dependencies
sudo apt install -y cmake make gcc g++ flex bison libpcap-dev libssl-dev python3 python3-dev zlib1g-dev
# Download and build Zeek (replace X.X.X with latest version)
wget https://download.zeek.org/zeek-X.X.X.tar.gz
tar xzf zeek-X.X.X.tar.gz
cd zeek-X.X.X
./configure
make
sudo make install
ip link show
):sudo nano /etc/zeek/node.cfg
Modify to specify your interface (usually eth0
or ens33
):
[zeek]
type=standalone
host=localhost
interface=eth0 # Change this to your actual interface
poweron-spyware.zeek
) to /opt/zeek/share/zeek/site/
or /opt/zeek/poweron-spyware.zeek
./opt/zeek/local.zeek
and add:@load ./poweron-spyware.zeek
/opt/zeek/logs/current/
).sudo chown -R zeekuser:zeekgroup /opt/zeek/logs
sudo chmod -R 750 /opt/zeek/logs
sudo systemctl enable --now zeek
sudo zeekctl deploy # Initial deployment
zeekctl status
Suricata is a high-performance intrusion detection system (IDS) that:
sudo apt install -y suricata jq
sudo nano /etc/suricata/suricata.yaml
Set af-packet
interface:
af-packet:
- interface: eth0 # Replace with your interface
threads: auto
cluster-id: 99
cluster-type: cluster_flow
defrag: yes
Enable EVE JSON output for log shipping:
outputs:
- eve-log:
enabled: yes
filetype: regular
filename: /var/log/suricata/eve.json
types:
- alert
- dns
- http
- tls
- flow
sudo suricata-update
sudo suricata-update update-sources
sudo systemctl restart suricata
Ensure Suricata can write to /var/log/suricata/
:
sudo chown -R suricata:suricata /var/log/suricata
sudo chmod -R 750 /var/log/suricata
sudo systemctl enable suricata
sudo systemctl start suricata
sudo systemctl status suricata
jq '.event_type' /var/log/suricata/eve.json | grep alert | wc -l
Ensure both services will restart automatically:
sudo systemctl enable zeek
sudo systemctl enable suricata
After about 5 minutes, check your Wazuh dashboard at http://192.168.1.10:5601
for:
For troubleshooting, check logs with:
journalctl -u zeek -f
journalctl -u suricata -f
This is how you collect useful logs and alerts from each device.
These devices use a program called the Wazuh Agent to send logs to your server.
What is a Wazuh Agent? A small app that runs in the background, collecting security-related information like login attempts, strange app behaviour, or changes to settings. It sends this data securely to your server.
Option 1: Install agent directly from browser
http://192.168.1.10:5601
192.168.1.10
)Option 2: Install via USB stick (if internet isn’t available on the device)
wget https://packages.wazuh.com/4.x/agents/wazuh-agent_x.x.x.msi
cp wazuh-agent_x.x.x.msi /media/usb
Rooted means full access to the phone’s internal system. If not rooted, see next section.
pkg update && pkg install curl git
curl -s http://192.168.1.10/setup_android.sh | bash
(This script must be prepared on your server.)
You’ll manually extract logs using adb
.
What is adb
? ADB (Android Debug Bridge) is a tool that lets you talk to Android phones from a computer. You’ll
use it to copy system info and logs.
sudo apt install android-tools-adb
Enable USB debugging on the phone:
Connect phone to server with USB cable.
Check it is recognised:
adb devices
You should see a device ID listed. If not, check your USB cable and permissions.
adb logcat -d > /opt/logs/android_logcat.txt
adb bugreport > /opt/logs/android_bugreport.zip
adb shell pm list packages -f > /opt/logs/android_apps.txt
adb shell settings get global http_proxy
Use local backup to pull app data.
sudo apt install libimobiledevice-utils
idevicebackup2 backup /opt/backups/ios_device/
python3 parse_ios_backup.py /opt/backups/ios_device/
Look for:
Sysmon (System Monitor) is a Windows system service that logs:
Install Sysmon after deploying Wazuh agents but before configuring advanced monitoring rules.
Invoke-WebRequest -Uri "https://download.sysinternals.com/files/Sysmon.zip" -OutFile "$env:TEMP\Sysmon.zip"
Expand-Archive -Path "$env:TEMP\Sysmon.zip" -DestinationPath "C:\Program Files\Sysmon"
Use a minimal, spyware-focused config (save as poweron-sysmon-config.xml
):
<Sysmon schemaversion="4.70">
<EventFiltering>
<ProcessCreate onmatch="include" />
<NetworkConnect onmatch="include" />
<ImageLoad onmatch="include" />
<ProcessAccess onmatch="include" />
<CreateRemoteThread onmatch="include" />
<RegistryEvent onmatch="include" />
<Exclude>
<Image condition="is">C:\Windows\System32\svchost.exe</Image>
<Image condition="is">C:\Windows\System32\services.exe</Image>
<Image condition="is">C:\Windows\System32\lsass.exe</Image>
</Exclude>
</EventFiltering>
</Sysmon>
Open PowerShell as Administrator, run:
cd "C:\Program Files\Sysmon"
.\Sysmon64.exe -i poweron-sysmon-config.xml -accepteula
Open: Event Viewer > Applications and Services Logs > Microsoft > Windows > Sysmon > Operational
This should show new process/network events.
ossec.conf
:<localfile>
<log_format>eventchannel</log_format>
<location>Microsoft-Windows-Sysmon/Operational</location>
</localfile>
Since Sysmon is Windows-only, for Linux endpoints:
auditd
for process and file system monitoring.A PiRogue device sits between the network and a phone/laptop and watches all traffic.
ssh pi@piroguedevice.local
sudo ./start_capture.sh --target 192.168.1.75
scp capture.pcap user@192.168.1.10:/opt/forensics/
tshark -r /opt/forensics/capture.pcap
sudo apt install -y filebeat
/etc/filebeat/filebeat.yml
:filebeat.inputs:
- type: log
enabled: true
paths:
- /opt/zeek/logs/current/conn.log
- /opt/zeek/logs/current/dns.log
- /opt/zeek/logs/current/http.log
json.keys_under_root: true
json.add_error_key: true
fields:
source: zeek
fields_under_root: true
output.logstash:
hosts: ["your-wazuh-manager:5044"]
sudo filebeat modules enable zeek
sudo systemctl start filebeat
sudo systemctl enable filebeat
/etc/filebeat/filebeat.yml
, add:filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/suricata/eve.json
json.keys_under_root: true
json.add_error_key: true
fields:
source: suricata
fields_under_root: true
output.logstash:
hosts: ["your-wazuh-manager:5044"]
sudo filebeat modules enable suricata
sudo systemctl restart filebeat
On Wazuh manager or agent config (ossec.conf
), add:
<localfile>
<log_format>json</log_format>
<location>/opt/zeek/logs/current/conn.log</location>
</localfile>
<localfile>
<log_format>json</log_format>
<location>/opt/zeek/logs/current/dns.log</location>
</localfile>
<localfile>
<log_format>json</log_format>
<location>/opt/zeek/logs/current/http.log</location>
</localfile>
Add to ossec.conf
:
<localfile>
<log_format>json</log_format>
<location>/var/log/suricata/eve.json</location>
</localfile>
On Windows agent’s ossec.conf
:
<localfile>
<log_format>eventchannel</log_format>
<location>Microsoft-Windows-Sysmon/Operational</location>
</localfile>
For Zeek logs to be meaningful in Wazuh, you must enable the right decoders and rules. Out of the box, Wazuh doesn’t automatically understand Zeek logs unless told how to read them. Here’s how to get that sorted:
Check your Wazuh manager’s etc/decoders/zeek-decoder.xml
. If it’s not already there, create it with:
<decoder name="zeek">
<program_name>zeek</program_name>
<type>json</type>
</decoder>
If you’re ingesting JSON logs without a program_name
field, add custom rules that trigger on specific Zeek fields
like uid
, id.orig_h
, proto
, etc.
Wazuh needs rules that understand the structure and semantics of Zeek logs. Either:
rules/zeek_rules.xml
file with entries like:<group name="zeek,">
<rule id="100200" level="5">
<decoded_as>json</decoded_as>
<field name="proto">tcp</field>
<description>Zeek TCP connection detected</description>
</rule>
</group>
This lets you flag, correlate, or escalate based on Zeek content.
When Zeek runs on a sensor and sends logs to the SIEM machine:
Permissions: Make sure Filebeat (or your sync process) has permission to read Zeek logs and that they aren’t rotated out before ingestion. Use chmod o+r
or a dedicated group.
Integrity: Avoid tampering or truncation with:
rsync -a --checksum
orTimestamps: Check timezones and use ts
fields from Zeek logs directly – avoid relying on file modification time.
wazuh-logtest
with a Zeek log line to test matching/var/ossec/logs/ossec.log
for decoder errors or warningsalerts.json
or Kibana’s Discover tab to confirm rules are firing as expectedUse Wazuh’s default Suricata decoders and rules or community contributions.
Wazuh includes default Sysmon decoders and rules. Make sure they are enabled.
filebeat test config -c filebeat.yml
before starting Filebeatjq
to manually validate Zeek JSON if ingestion fails mysteriouslyfilebeat test config -c /etc/filebeat/filebeat.yml
wazuh-logtest
/var/ossec/logs/ossec.log
) for decoder errors.See Helpful scripts (to automate checks and responses)
/var/ossec/logs/
folder to a USB or external drive/opt/siem/alerts/suspicious.log
if using script)Component | Installation location | Key config files | Log paths | Permissions |
---|---|---|---|---|
Zeek | Ubuntu server/sensor | /etc/zeek/node.cfg , local.zeek | /opt/zeek/logs/current/*.log | chmod/chown on logs |
Suricata | Ubuntu server/sensor | /etc/suricata/suricata.yaml | /var/log/suricata/eve.json | chmod/chown on logs |
Sysmon | Windows endpoints | poweron-sysmon-config.xml | Windows Event Log (Sysmon channel) | Configure event forwarding |
Filebeat (Linux) | Ubuntu server/sensor | /etc/filebeat/filebeat.yml | Reads Zeek/Suricata logs | Read access to logs |
Filebeat (Win) | Windows endpoints | filebeat.yml | Reads Sysmon .evtx logs | Read access to logs |
Wazuh Manager | Ubuntu server | /var/ossec/etc/ossec.conf | Receives all logs via agents | N/A |
It doesn’t block all threats, but it lets you see them, and that’s half the battle. For added support, reach out to a trusted local digital rights group—they can guide you remotely over encrypted chat or phone.
With this setup based on open-source tools, affordable, everything stays under your roof—no cloud, no third-party exposure. It’s your private radar, quietly watching for stalkerware or tampering. The system’s power comes from simple practices: check logs regularly, respond to alerts, and protect physical access. With basic guidance, everybody in the shelter can help run and understand this system.
Open your preferred web browser.
Enter your Kibana URL, which usually looks like this:
http://your-kibana-server:5601
Index patterns tell Kibana which data to look at.
On the left sidebar, click Stack Management (or just Management depending on your Kibana version).
Under Kibana, select Index Patterns.
Click Create index pattern.
Enter the name of the index pattern matching your log data:
zeek-*
suricata-*
sysmon-*
wazuh-alerts-*
Click Next step.
Select the time field for your index pattern, usually @timestamp
.
Click Create index pattern.
Repeat for each data source.
You will create several visualisations to monitor spyware-related activity.
Goal: See network traffic to known spyware domains or suspicious IPs.
On the left sidebar, click Analytics → Visualize Library.
Click Create visualization.
Choose Lens.
Select the zeek-*
or suricata-*
index pattern.
On the right panel, locate the field destination.ip
or dns.rrname
(domain name requested).
Drag destination.ip
into the main workspace.
Drag source.ip
next to it or add it as a Break down by to see source-to-destination mappings.
To filter for spyware-related domains or IPs:
dns.rrname
or destination.ip
).Adjust the visualisation type if desired (e.g., Bar chart, Table).
Click Save at the top, name it Spyware network connections, and save it.
Goal: Identify DNS queries to suspicious domains.
Create a new visualization as above.
Select the zeek-*
or suricata-*
index pattern.
Drag the dns.rrname
or dns.query
field into the main area.
Set aggregation to Top values and size to something reasonable like 10 or 20.
Add filters:
To include only suspicious domains, add a filter on dns.rrname
for your spyware domains list.
Alternatively, exclude common popular domains:
dns.rrname
is not one of and list common domains (google.com, microsoft.com, etc.).Click Save, name it Suspicious DNS queries.
Goal: Spot repetitive, periodic network calls typical of spyware beaconing.
Create a new visualisation using Lens or Line chart.
Select the zeek-*
or suricata-*
index pattern.
Set the X-axis to Date Histogram based on @timestamp
.
Set the interval to 1 minute or 5 minutes depending on your log volume.
Set the Y-axis to Count of events.
To narrow down to suspicious activity:
destination.ip
or dns.rrname
for spyware IPs or domains.Optionally, add Break down by source.ip
to see which hosts are beaconing.
Save as Beaconing activity.
Goal: View suspicious process creations and network connections from Windows endpoints.
Create a new visualization.
Select the sysmon-*
index pattern.
For process creations:
Filter event_id
= 1 (Sysmon process creation).
Drag process_name
or image
field into the workspace.
Aggregate by top values.
For network connections:
Filter event_id
= 3.
Drag destination_ip
or destination_port
.
Apply filters for known suspicious process names or ports if available.
Save the visualization as Sysmon suspicious activity.
On the left sidebar, click Dashboard.
Click Create new dashboard.
Click Add and select the visualisations you saved:
Arrange the visualisations logically for at-a-glance monitoring.
Click Save, name your dashboard, e.g., Spyware monitoring overview.
This helps link suspicious network activity to particular endpoints.
Make sure your logs have consistent identifiers:
Zeek and Suricata logs: source.ip
, destination.ip
Sysmon logs: hostname
or computer_name
To correlate in Kibana: Use Lens or Canvas to create combined visualisations by matching source.ip
from Zeek/Suricata with hostname
in Sysmon logs.
Example: Build a time-series chart showing network beaconing by source IP alongside suspicious processes from that same IP/hostname.
Connect to your Wazuh manager (Ubuntu server).
Open the custom rules file:
sudo nano /var/ossec/etc/rules/local_rules.xml
<rule id="100500" level="12">
<if_sid>100200</if_sid> <!-- Zeek suspicious connection -->
<if_sid>200300</if_sid> <!-- Suricata spyware alert -->
<if_sid>300400</if_sid> <!-- Sysmon suspicious process -->
<frequency>3</frequency>
<timeframe>600</timeframe> <!-- 10 minutes -->
<description>Spyware activity detected across network and endpoint</description>
</rule>
sudo systemctl restart wazuh-manager
You want Wazuh to notify you when suspicious activity occurs.
sudo nano /var/ossec/etc/ossec.conf
Configure email alerts, Slack webhook, or other notification methods inside the <global>
and <alerts>
sections.
Save and restart Wazuh manager:
sudo systemctl restart wazuh-manager
Generate test events:
Confirm logs appear in Kibana visualisations.
Confirm alerts trigger in Wazuh and you receive notifications.
conn.log
, dns.log
, http.log
) via Filebeat or native ingestion.eve.json
output and map alert.signature
into dashboards.Trigger a Wazuh alert if:
Set notifications for high-confidence hits via email or webhook.
This guide took you from zero to a functional Kibana monitoring dashboard, with Wazuh alerting on combined spyware indicators spanning network and endpoint logs.
You now have:
No prior knowledge needed, just follow each step as written. Your shelter’s digital defences are now far more vigilant.
Scripts are little tools you build once, and they quietly do important jobs for you behind the scenes—like looking for signs of spyware, blocking suspicious devices, or copying logs from phones.
Back of an envelope.
In case you need budget for setting up an security system like this, consider these organisations to apply for grants or budgets. Focused on cybersecurity, digital resilience, social good, and tech infrastructure funding that could realistically cover this kind of setup. Will be updated when we know more.
Template just for inspiration and stealing from.