Skip to content

Instantly share code, notes, and snippets.

@KINGSABRI
Created June 18, 2012 15:59
Show Gist options
  • Save KINGSABRI/2949096 to your computer and use it in GitHub Desktop.
Save KINGSABRI/2949096 to your computer and use it in GitHub Desktop.
PoC for parsing input/output packets' headers
=begin
PoC for parsing input/output packets' headers
This PoC will print "Yes, Got SYN/ACK guys!!" if it capture a AYN/ACK packet to/from 10.20.50.45
Note that you can change IP and flags and many mangy things
=end
require 'packetfu'
config = PacketFu::Config.new(PacketFu::Utils.whoami?(:iface=> "wlan0")).config
cap = PacketFu::Capture.new(:iface => $iface, :start => true, :filter => "tcp and host 10.20.50.45")
puts "[+] Before Start Capturing.."
cap.stream.each do |pkt|
puts "[+] After Start Capturing.. \n\n\n"
puts "[-] Before Analysing Captured data.."
packet = PacketFu::Packet.parse pkt # parse packets
puts "Are SYN/ACK have sent/recived?"
if (packet.tcp_flags.syn == 1 && packet.tcp_flags.ack == 1)
puts "\n Yes, Got SYN/ACK guys!! \n\n"
end
puts "[-] After Analysing Captured data.. \n\n\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment