pcaprub 0.12.4 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/Gemfile +2 -11
- data/Rakefile +11 -9
- data/ext/pcaprub_c/pcaprub.c +10 -0
- data/lib/pcaprub/ext.rb +1 -5
- data/lib/pcaprub/version.rb +2 -2
- data/test/test_pcaprub_unit.rb +13 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fdbd4939dcfb61fc4cc143de865f17bd4999ba6
|
4
|
+
data.tar.gz: 58b38fcc9f3a4b9ff136134ab3fb18783ade94b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8af65ed57f6c0fe37c2d2e5d184f4ba38510ed0e7e8ff607ead0aae160d9916cfbd24ef8ec7929ff3cafcdcfd868a47bda74166d8c3cca27ca9284a245b93a5
|
7
|
+
data.tar.gz: db80e02ee8b845edaa10551ecc5a3b327e96a72dd5b7ba5d456578fc5e39322b686c079215f2f060a064398b48cb5b33aee3f96b75baa45e2dc56274d09b3254
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# No more static spec file
|
4
|
-
|
5
|
-
platforms :ruby_18 do
|
6
|
-
gem 'rdoc'
|
7
|
-
end
|
8
|
-
|
9
3
|
group :development, :test do
|
10
4
|
# Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826)
|
11
5
|
gem 'minitest', '~> 4.7.0'
|
@@ -16,7 +10,7 @@ group :development, :test do
|
|
16
10
|
gem 'test-unit'
|
17
11
|
end
|
18
12
|
|
19
|
-
platforms :
|
13
|
+
platforms :ruby_20, :ruby_21, :ruby_22, :ruby_23 do
|
20
14
|
gem 'coveralls', :require => false
|
21
15
|
end
|
22
16
|
end
|
@@ -24,10 +18,7 @@ end
|
|
24
18
|
gem 'rake-compiler', '>= 0.6.0'
|
25
19
|
gem 'rubygems-tasks'
|
26
20
|
|
27
|
-
if Bundler.current_ruby.
|
28
|
-
gem 'rake', '< 10.6'
|
29
|
-
gem 'git', '1.2.9'
|
30
|
-
elsif Bundler.current_ruby.mri? || Bundler.current_ruby.mingw? || Bundler.current_ruby.x64_mingw?
|
21
|
+
if Bundler.current_ruby.mri? || Bundler.current_ruby.mingw? || Bundler.current_ruby.x64_mingw?
|
31
22
|
gem 'rake', '>= 0.9.2'
|
32
23
|
gem 'git', '~> 1.3.0'
|
33
24
|
end
|
data/Rakefile
CHANGED
@@ -9,15 +9,16 @@ ENV['LANG'] = "en_US.UTF-8"
|
|
9
9
|
|
10
10
|
|
11
11
|
@gemspec = Gem::Specification.new do |spec|
|
12
|
-
spec.name
|
13
|
-
spec.version
|
14
|
-
spec.authors
|
15
|
-
spec.email
|
16
|
-
spec.description
|
17
|
-
spec.summary
|
18
|
-
spec.homepage
|
19
|
-
spec.requirements
|
20
|
-
spec.license
|
12
|
+
spec.name = "pcaprub"
|
13
|
+
spec.version = PCAPRUB::Pcap.version
|
14
|
+
spec.authors = ["shadowbq", "crondaemon", "jmcavinee", "unmarshal"]
|
15
|
+
spec.email = "shadowbq@gmail.com"
|
16
|
+
spec.description = "libpcap bindings for Ruby 2.x"
|
17
|
+
spec.summary = "libpcap bindings for ruby"
|
18
|
+
spec.homepage = "https://github.com/pcaprub/pcaprub"
|
19
|
+
spec.requirements = "libpcap"
|
20
|
+
spec.license = "LGPL-2.1"
|
21
|
+
spec.required_ruby_version = '~> 2.0'
|
21
22
|
|
22
23
|
spec.files = [
|
23
24
|
".document",
|
@@ -114,6 +115,7 @@ Gem::Tasks.new
|
|
114
115
|
# Override standard release task
|
115
116
|
require 'git'
|
116
117
|
Rake::Task["release"].clear
|
118
|
+
desc 'Release the gem (create tag, build, publish)'
|
117
119
|
task :release do
|
118
120
|
version = "#{PCAPRUB::VERSION::STRING}"
|
119
121
|
remote = 'origin'
|
data/ext/pcaprub_c/pcaprub.c
CHANGED
@@ -61,6 +61,15 @@ typedef struct rbpacket {
|
|
61
61
|
u_char* pkt;
|
62
62
|
} rbpacket_t;
|
63
63
|
|
64
|
+
/*
|
65
|
+
* Return the pcap version
|
66
|
+
*/
|
67
|
+
static VALUE
|
68
|
+
rbpcap_s_lib_version(VALUE self)
|
69
|
+
{
|
70
|
+
return rb_str_new2(pcap_lib_version());
|
71
|
+
}
|
72
|
+
|
64
73
|
/*
|
65
74
|
* Return the name of a network device on the system.
|
66
75
|
*
|
@@ -1295,6 +1304,7 @@ Init_pcaprub_c()
|
|
1295
1304
|
|
1296
1305
|
rb_define_module_function(rb_cPcap, "lookupdev", rbpcap_s_lookupdev, 0);
|
1297
1306
|
rb_define_module_function(rb_cPcap, "lookupnet", rbpcap_s_lookupnet, 1);
|
1307
|
+
rb_define_module_function(rb_cPcap, "lib_version", rbpcap_s_lib_version, 0);
|
1298
1308
|
|
1299
1309
|
rb_define_const(rb_cPcap, "DLT_NULL", INT2NUM(DLT_NULL));
|
1300
1310
|
rb_define_const(rb_cPcap, "DLT_EN10MB", INT2NUM(DLT_EN10MB));
|
data/lib/pcaprub/ext.rb
CHANGED
data/lib/pcaprub/version.rb
CHANGED
data/test/test_pcaprub_unit.rb
CHANGED
@@ -13,19 +13,20 @@ require File.expand_path '../test_helper.rb', __FILE__
|
|
13
13
|
class Pcap::UnitTest < Test::Unit::TestCase
|
14
14
|
def test_version
|
15
15
|
assert_equal(String, Pcap.version.class)
|
16
|
-
puts "Pcaprub version: #{Pcap.version}"
|
16
|
+
# puts "Pcaprub version: #{Pcap.version}"
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_lookupdev
|
20
20
|
assert_equal(String, Pcap.lookupdev.class)
|
21
|
-
puts "Pcaprub default device: #{Pcap.lookupdev}"
|
21
|
+
# puts "Pcaprub default device: #{Pcap.lookupdev}"
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_lookupnet
|
25
25
|
dev = Pcap.lookupdev
|
26
26
|
assert_equal(Array, Pcap.lookupnet(dev).class)
|
27
27
|
net = Pcap.lookupnet(dev)
|
28
|
-
|
28
|
+
assert net
|
29
|
+
# puts "Pcaprub net (#{dev}): #{net[0]} #{[net[1]].pack("N").unpack("H*")[0]}"
|
29
30
|
end
|
30
31
|
|
31
32
|
def test_pcap_new
|
@@ -106,8 +107,8 @@ class Pcap::UnitTest < Test::Unit::TestCase
|
|
106
107
|
end
|
107
108
|
|
108
109
|
t.kill
|
109
|
-
puts "Background thread ticked #{@c} times while capture was running"
|
110
|
-
puts "Captured #{pkt_count} packets"
|
110
|
+
# puts "Background thread ticked #{@c} times while capture was running"
|
111
|
+
# puts "Captured #{pkt_count} packets"
|
111
112
|
assert(0 < @c, "Background thread failed to tick while capture was running");
|
112
113
|
true
|
113
114
|
end
|
@@ -160,4 +161,11 @@ class Pcap::UnitTest < Test::Unit::TestCase
|
|
160
161
|
o.compile("A non working filter")
|
161
162
|
end
|
162
163
|
end
|
164
|
+
|
165
|
+
def test_lib_version
|
166
|
+
v = Pcap.lib_version.split
|
167
|
+
assert_equal "libpcap", v[0]
|
168
|
+
assert_equal "version", v[1]
|
169
|
+
assert_equal 3, v[2].split('.').size
|
170
|
+
end
|
163
171
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pcaprub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shadowbq
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 4.7.0
|
110
|
-
description: libpcap bindings for
|
110
|
+
description: libpcap bindings for Ruby 2.x
|
111
111
|
email: shadowbq@gmail.com
|
112
112
|
executables: []
|
113
113
|
extensions:
|
@@ -149,9 +149,9 @@ require_paths:
|
|
149
149
|
- lib
|
150
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- - "
|
152
|
+
- - "~>"
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: '0'
|
154
|
+
version: '2.0'
|
155
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
requirements:
|
161
161
|
- libpcap
|
162
162
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.
|
163
|
+
rubygems_version: 2.5.2.1
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: libpcap bindings for ruby
|