match-flows.sh 599 B

12345678910111213141516171819
  1. #!/bin/sh
  2. readonly MATCH_FOUND=1
  3. readonly BASE_DIR="$(dirname $0)"
  4. readonly MATCHER="$BASE_DIR/../src/pcap-matcher/pcap-matcher"
  5. readonly OUTFILE="$BASE_DIR/keylog-matchings.txt"
  6. for k in "$BASE_DIR"/keylogs/*/*/*.log; do
  7. printf "%s " "$k"
  8. seq 2 15 | while read i; do
  9. if "$MATCHER" -t $i -l 250 "$k" "$BASE_DIR"/flows/*.pcap; then
  10. return $MATCH_FOUND
  11. fi
  12. done 2> /dev/null
  13. if [ $? -ne $MATCH_FOUND ]; then
  14. echo "No flow file found for $k" 1>&2
  15. printf "\n" # Create empty line for log to represent no match found.
  16. fi
  17. done > "$OUTFILE"