Skip to content

Instantly share code, notes, and snippets.

@astroza
Created March 20, 2015 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astroza/b5993c02278bbeac2643 to your computer and use it in GitHub Desktop.
Save astroza/b5993c02278bbeac2643 to your computer and use it in GitHub Desktop.
FOTM sniffer
require 'packetfu'
include PacketFu
iface = ARGV[0] || "en1"
def sniff(iface)
cap = Capture.new(:iface => iface, :start => true)
cap.stream.each do |p|
pkt = Packet.parse p
if pkt.is_tcp?
next if pkt.ip_daddr != '23.96.96.142'
m = /GET (\/api.+) HTTP.+/.match(pkt.payload)
if m
puts "API REQUEST: curl \"http://fotm.info#{m[1]}\""
end
end
end
end
sniff(iface)
@astroza
Copy link
Author

astroza commented Mar 20, 2015

gem install packetfu pcaprub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment