Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pcap_sniff(interface)
- capture = Pcap::Capture.open_live( interface, 1500 )
- capture.setfilter('tcp')
- capture.each_packet do |pkt|
- data = pkt.tcp_data
- #File.open('test.txt', 'a') {|f| f.write "#{data}"}
- puts data.grep(/%PDF/) if data =~ /%PDF/
- puts data.grep(/%EOF/) if data =~ /%%EOF/
- end
- end
Add Comment
Please, Sign In to add comment