Created
April 27, 2016 09:10
-
-
Save larrylv/5fbbcbc7db3085fe97e3f419d7fb9858 to your computer and use it in GitHub Desktop.
tcp-stack-blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Listener | |
def initialize(conn, config, dst_ip) | |
@conn = conn | |
@cap = PacketFu::Capture.new( | |
iface: config[:iface], | |
start: true, | |
filter: "tcp and dst #{config[:ip_saddr]} and src #{dst_ip}" | |
) | |
end | |
def listen | |
@cap.stream.each do |pkt| | |
state = @conn.handle(PacketFu::Packet.parse pkt) | |
return if state == Teeceepee::CLOSED_STATE | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment