Introduction to hands-on network monitoring and threat detection with Zeek (formerly Bro). 

 


Task 2


Task 3


Task 5


Task 6


Task 7


Task 8


Task 9

Before starting the walkthrough :
Some useful commands for Zeek

Generate log files from pcap file

 zeek -C -r file.pcap

Generate log files with signature from pcap file

zeek -C -r file.pcap -s signature.sig

Generate log file with a script

zeek -C -r file.pcap script.zeek

Generate log file with a signature and a script together

zeek -C -r file.pcap -s signature.sig script.zeek

Exploring log files.

When generating the logs file is done, use zeek-cut to exploring the log file. You have to know what « fields » you want to find. Don’t use the #types fields.
So before, you have to open the log file with « head » like head conn.log. When you do that, you get the category of the log file like this :


So if you want to know the IP source and his port, you can to do this command :

cat conn.log | zeek-cut id_orig_h id_orig_p

With zeek-cut, it’s possible to use others Linux command lines like | wc -l to count the line or  | sort -u to find to avoid duplicate information. 

Finally 

Use your kung fu command line skills!!!!!

Task 2 : Network Security Monitoring and Zeek

 

Answer : 4.2.1

 

Commande :  

zeek -v

 

 

Answer : 2.4.0

 

Commande :

zeekctl -v

 

Answer : 8

 

Commande :

zeek -C -r sample.pcap

Task 3 : Zeek Logs

Answer : Microknoppix

Command :   

zeek -C -r sample.pcap

cat dhcp.log | zeek-cut host_name

 

Answer : 2

Commande :

cat dns.log | zeek-cut query | sort -u | wc -l

 

Answer : 332.319364

Command :

cat conn.log | zeek-cut duration | sort -n

Task 5 Zeek Signatures

Answer : 10.10.57.178

Command :

zeek -C -r http.pcap -s http-password.sig
cat  http.log | zeek-cut id.orig_h

Answer : 38172

Command :

cat  http.log | zeek-cut id.orig_p

Answer : 20

Command :

zeek -C -r http.pcap -s http-password.sig 

cat conn.log | zeek-cut orig_pkts resp_pkts id.orig_p | grep 38706

Answer : 1413

Command :

zeek -C -r ftp.pcap -s ftp-bruteforce.sig
head notice.log 
cat notice.log | zeek-cut uid | sort -u | wc -l

 

Answer : 1410

Command :

cat notice.log | zeek-cut  msg | grep Brute-force | wc -l

Task 6 Zeek Scripts | Fundamentals

Answer : astaro_vineyard

 

Commande :

zeek -C -r smallFlows.pcap dhcp-hostname.zeek
cat dhcp.log | zeek-cut domain

Answer : 17

 

Command :

zeek -C -r bigFlows.pcap dhcp-hostname.zeek
cat dhcp.log | zeek-cut host_name | sort -u  | wc -l

Answer : jaalam.net

 

Command :

cat dhcp.log | zeek-cut domain

 

Answer : 1312

 

Command :

cat dns.log | zeek-cut query | sort -u | grep -v -e ‘*’ -e ‘-‘ | wc -l

Task 7 Zeek Scripts | Scripts and Signatures

Answer : 87

 

Command :

zeek -C -r sample.pcap 103.zeek
cat conn.log | zeek-cut uid | wc -l

Answer : 1401

 

Command :

cat signatures.log | zeek-cut event_msg
cat signatures.log | zeek-cut event_msg | wc -l

Answer : 731

 

Command :

cat signatures.log | zeek-cut sub_msg
cat signatures.log | zeek-cut sub_msg | grep administrator

Answer : 498

 

Command :

zeek -C -r ftp.pcap local
cat loaded_scripts.log
cat loaded_scripts.log | grep zeek | wc -l

Answer : 2

Command :

zeek -C -r ftp-brute.pcap /opt/zeek/share/zeek/policy/protocols/ftp/detect-bruteforcing.zeek
cat notice.log | zeek-cut note
cat notice.log | zeek-cut note | wc -l

Task 8 Zeek Scripts | Frameworks

Answer : IN_HOST_HEADER

 

Command :

zeek -C -r case1.pcap intelligence-demo.zeek

cat intel.log | zeek-cut seen.where

Answer : knr.exe

 

Command :

cat http.log | zeek-cut uri

Answer : cc28e40b46237ab6d5282199ef78c464

 

Command :

zeek -C -r case1.pcap hash-demo.zeek

cat files.log | zeek-cut tx_rhosts rx_hosts md5

Answer : Microsoft NCSI

 

Command :

zeek -C -r case1.pcap file-extract-demo.zeek

cd extract_files/

cat « first-file. The name will be different » 

Task 9 Zeek Scripts | Packages

Answer : BroZeek

 

Command :

zeek -C -r http.pcap /opt/zeek/share/zeek/site/zeek-sniffpass
head notice.log
cat notice.log | zeek-cut note msg

Answer : Chicago

 

Command :

zeek -C -r case2.pcap /opt/zeek/share/zeek/site/geoip-conn
head conn.log | zeek-cut geo.resp.city
cat conn.log | zeek-cut geo.resp.city

Answer : 23.77.86.54

 

Command :

cat conn.log | zeek-cut id.resp_h geo.resp.city

Answer : 4

 

Command :

zeek -C -r case2.pcap sumstats-countable.zeek

That’s all folks

Thank you for having taken the trouble to come on the site to read this Write-Up

I hope you enjoyed it and that it taught you some new things.

Feel free to leave a comment or share this article.

Facebook
Twitter
LinkedIn
Pinterest

Light

Dark