Guest User

Untitled

a guest
Aug 24th, 2016
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. echo ""
  3. echo "=================================================="
  4. echo "====== eapol_dump.sh v0.1 - (c) 2016 by __f ======"
  5. echo "=================================================="
  6. echo ""
  7.  
  8. if [ $# -lt 1 ] ; then
  9.     echo "Error: Insufficient number of arguments."
  10.     echo ""
  11.     echo "Usage: eapol_dump.sh capfile.cap [mac_address] [frame_number] [frame_number] [frame_number] [frame_number]"
  12.     echo "Example 1: ./eapol_dump.sh caps-01.cap \"01:02:03:04:05:06\""
  13.     echo "Example 2: ./eapol_dump.sh caps-01.cap \"01:02:03:04:05:06\" 1672 1673"
  14.  
  15.     echo ""
  16.     echo "eapol_dump will dump an overview. in the overview, check that the frame timestamps between eapol frames are close enough to be plausible."
  17.     echo "if a frame number is specified  nonce and mic values for this 802.11 frame will be displayed."
  18.     exit
  19. fi
  20.  
  21. capfile="$1"
  22. mac_addr="$2"
  23. frameno1="$3"; frameno2="$4"
  24. frameno3="$5"; frameno4="$6"
  25.  
  26. # first, print an overview including frame timestamps
  27. echo "Frame Tstamp      Src MAC          -> Dest MAC          Type, Info"
  28. echo "----------------------------------------------------------------------"
  29. if [[ -n "$mac_addr" ]]; then
  30.         tshark -r ${capfile} -Y "eapol && wlan.addr==${mac_addr}"
  31. else
  32.         tshark -r ${capfile} -Y "eapol"
  33. fi
  34.  
  35. frame_details()
  36. {
  37.         frameno="$1"
  38.  
  39.         # now, print the details:
  40.         if [[ -n "$frameno" ]]; then
  41.                 echo ""
  42.                 echo "Details for frame #${frameno}"
  43.                 echo "----------------------------------------------------------------------"
  44.                 tshark -r "${capfile}" -Y "eapol && wlan.addr==${mac_addr} && frame.number==${frameno}" -V | grep -E "Nonce|WPA Key MIC|Frame.*captured|Key ACK|Key MIC"
  45.         fi
  46. }
  47.  
  48. frame_details $frameno1
  49. frame_details $frameno2
  50. frame_details $frameno3
  51. frame_details $frameno4
  52. echo ""
RAW Paste Data