diff options
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 9 | ||||
| -rw-r--r-- | lib/fake_agent.rb | 5 |
3 files changed, 14 insertions, 1 deletions
@@ -51,5 +51,6 @@ group :development, :test do # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' + gem 'pry-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index a911f50..81a1463 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,6 +50,7 @@ GEM celluloid (0.16.0) timers (~> 4.0.0) chartkick (1.3.2) + coderay (1.1.0) coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) @@ -95,6 +96,7 @@ GEM nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) + method_source (0.8.2) mime-types (2.4.3) mini_portile (0.6.2) minitest (5.5.1) @@ -104,6 +106,12 @@ GEM packetfu (1.1.10) pcaprub (0.12.0) pg (0.18.1) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-rails (0.3.2) + pry (>= 0.9.10) rack (1.6.0) rack-test (0.6.3) rack (>= 1.0) @@ -203,6 +211,7 @@ DEPENDENCIES packetfu pcaprub pg + pry-rails rails (= 4.2.0) sass-rails (~> 5.0) sdoc (~> 0.4.0) diff --git a/lib/fake_agent.rb b/lib/fake_agent.rb index 410a22d..ad25880 100644 --- a/lib/fake_agent.rb +++ b/lib/fake_agent.rb @@ -63,8 +63,11 @@ class FakeAgent capture.stream.each do |p| packet = Packet.parse(p) if packet.is_ip? - next if packet.ip_saddr == Utils.ifconfig(interface)[:ip_saddr] + #next if packet.ip_saddr == Utils.ifconfig(interface)[:ip_saddr] + next unless packet.ip_saddr == Utils.ifconfig(interface)[:ip_saddr] + next unless packet.try(:tcp_dport).present? && packet.tcp_dport == 80 packet_info = [packet.ip_saddr, packet.ip_daddr, packet.size, packet.proto.last] + #puts packet.dissect puts "%-15s -> %-15s %-4d %s" % packet_info end end |
