#!/bin/bash
# Parameters example
# Disclaimer: any resemblance to actual exercices or CTF is purely coincidental ;-)
files_pattern='pcap_??.pcap'
flags_pattern='.{8}-.{4}-.{4}-.{4}-.{12}'
clear
echo
echo -e "\x1b[1;38;5;208m** Capture flags in files with strings **\n"
echo -e -n "\x1b[22m\x1b[38;5;220m"
echo "Warning: this method is absolutely not educational, you will not lean"
echo " anything about the structure and content of the files to analyze!"
echo
echo -e "\x1b[22m\x1b[37mFiles pattern: \x1b[1;95m$files_pattern"
echo -e "\x1b[22m\x1b[37mFlags pattern: \x1b[1;95m$flags_pattern"
results=''
for file in $files_pattern
do
results=$results"\n\x1b[1;96m* $file:\n"
results=$results"\x1b[0;92m"
results=$results$(strings --bytes=36 $file | egrep -o $flags_pattern | sort -u)
results=$results"\n"
done
echo -e "$results"
📢 Warning: this method is absolutely not educational, you will not lean anything about the structure and content of the files to analyze!