Guest User

Untitled

a guest
Jul 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def pcap_sniff(interface)
  2. capture = Pcap::Capture.open_live( interface, 1500 )
  3. capture.setfilter('tcp')
  4. capture.each_packet do |pkt|
  5. data = pkt.tcp_data
  6. #File.open('test.txt', 'a') {|f| f.write "#{data}"}
  7. puts data.grep(/%PDF/) if data =~ /%PDF/
  8. puts data.grep(/%EOF/) if data =~ /%%EOF/
  9. end
  10. end
Add Comment
Please, Sign In to add comment