network_interface 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3d0cb4999f24c11d163ca55348ddeabe91595407a8ca2440ea04c2c4f172e717
4
+ data.tar.gz: d1b2f9f5bec054bc222b77a2a19d72646c844151f9b0bfe2bf4a184d2a1dc90a
5
+ SHA512:
6
+ metadata.gz: 0a3f59b944c17959dc30d92a86a8730c7993030fd93f8e7d9560d6e23d51b884c6232be64339660343950b80eb26fba5b5fc1d7dd24a94d0125f8d0e25c9afb3
7
+ data.tar.gz: 6f2b20d6e6314a4f86cc5c9cb82ff31bdea177737ff42d5f5457bc07749571a4ed576b72dbb18aed2a8889846ec0fabf1f8db9d72969ee0192d1a8622b0e69f7
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ K�V�O�4j )I������V����"c�<-�C�#����殟U �+�d�R8�"�� ���>�'籂S��Z�4ep��NM��cM_���ce��[�4�A\ ��AO�U����&�8�����L��'��?E�<�h+�z�eJb2-�|HV�1��EKJ�y;�մ���s����h�Mq}�K�?>�o<j7
2
+ B�v���fu��+��
@@ -0,0 +1,60 @@
1
+ name: Verify
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ test:
13
+ timeout-minutes: 40
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os:
19
+ - ubuntu-20.04
20
+ ruby:
21
+ - '2.5'
22
+ - '2.6'
23
+ - '2.7'
24
+ - '3.0'
25
+ include:
26
+ - { os: ubuntu-latest, ruby: '3.0', docker_image: 'ruby:3.0' }
27
+ env:
28
+ RAILS_ENV: test
29
+
30
+ runs-on: ${{ matrix.os }}
31
+
32
+ name: Ruby ${{ matrix.ruby }} ${{ matrix.docker_image && 'Docker' || matrix.os }}
33
+ steps:
34
+ - name: Checkout code
35
+ uses: actions/checkout@v2
36
+
37
+ - name: Setup Ruby
38
+ if: ${{ !matrix.docker_image }}
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+ bundler-cache: true
43
+
44
+ - name: Rake Compile with Bundle
45
+ if: ${{ !matrix.docker_image }}
46
+ run: |
47
+ bundle exec rake compile
48
+
49
+ - name: ${{ matrix.test_cmd }}
50
+ if: ${{ !matrix.docker_image }}
51
+ run: |
52
+ bundle exec rspec
53
+
54
+ - name: Run tests in docker
55
+ if: ${{ matrix.docker_image }}
56
+ env:
57
+ DOCKER_IMAGE: ${{ matrix.docker_image }}
58
+ run: |
59
+ docker network create --ipv6 --subnet 2001:0DB8::/112 ip6net
60
+ docker run --rm --network ip6net -w $(pwd) -v $(pwd):$(pwd) ${DOCKER_IMAGE} /bin/sh -c "ls -lah; apt update; apt install -y git net-tools; bundle install; bundle exec rake compile; bundle exec rspec"
data/.gitignore CHANGED
@@ -7,5 +7,6 @@ rdoc
7
7
  pkg
8
8
  tmp
9
9
  *.so
10
+ *.gem
10
11
  .ruby-gemset
11
12
  .ruby-version
data/Gemfile.lock CHANGED
@@ -1,30 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- network_interface (0.0.1)
4
+ network_interface (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.2.4)
10
- rake (10.0.3)
11
- rake-compiler (0.8.3)
9
+ diff-lcs (1.4.4)
10
+ rake (13.0.3)
11
+ rake-compiler (1.1.1)
12
12
  rake
13
- rspec (2.13.0)
14
- rspec-core (~> 2.13.0)
15
- rspec-expectations (~> 2.13.0)
16
- rspec-mocks (~> 2.13.0)
17
- rspec-core (2.13.1)
18
- rspec-expectations (2.13.0)
19
- diff-lcs (>= 1.1.3, < 2.0)
20
- rspec-mocks (2.13.1)
13
+ rspec (3.10.0)
14
+ rspec-core (~> 3.10.0)
15
+ rspec-expectations (~> 3.10.0)
16
+ rspec-mocks (~> 3.10.0)
17
+ rspec-core (3.10.1)
18
+ rspec-support (~> 3.10.0)
19
+ rspec-expectations (3.10.1)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.10.0)
22
+ rspec-mocks (3.10.2)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.10.0)
25
+ rspec-support (3.10.2)
21
26
 
22
27
  PLATFORMS
23
28
  ruby
24
29
 
25
30
  DEPENDENCIES
26
- bundler (~> 1.3)
27
31
  network_interface!
28
32
  rake
29
33
  rake-compiler
30
34
  rspec
35
+
36
+ BUNDLED WITH
37
+ 2.1.4
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # $Id$
4
+ # $Revision$
5
+ #
6
+ # This small utility will display all the informations about the network interfaces
7
+ # that one can use under Windows with modules using pcaprub and having the INTERFACE option (ex: arp_poisonning, arp_sweep, ...).
8
+ # To use th interface option under Windows use the Index value displayed by this tool (ex: "SET INTERFACE 1")
9
+ #
10
+ #
11
+
12
+ begin
13
+ require 'network_interface'
14
+ rescue ::Exception => e
15
+ $stderr.puts "Error: NetworkInterface is not installed..."
16
+ exit
17
+ end
18
+
19
+ found = false
20
+ NetworkInterface.interfaces.each_with_index do |iface, i|
21
+ found = true
22
+ detail = NetworkInterface.interface_info(iface)
23
+ addr = NetworkInterface.addresses(iface)
24
+ puts "#" * 70
25
+ puts ""
26
+ puts "INDEX : " + (i + 1).to_s
27
+ if detail
28
+ puts "NAME : " + detail["name"]
29
+ puts "DESCRIPTION : " + detail["description"]
30
+ puts "GUID : " + detail["guid"]
31
+ else
32
+ puts "NAME : " + iface
33
+ end
34
+ if addr[NetworkInterface::AF_LINK][0]['addr']
35
+ puts "MAC ADDRESS : #{addr[NetworkInterface::AF_LINK][0]['addr']}"
36
+ else
37
+ puts "MAC ADDRESS : NONE"
38
+ end
39
+ if addr && addr[NetworkInterface::AF_INET]
40
+ addr[NetworkInterface::AF_INET].each do |ip4|
41
+ puts "IP ADDRESS : #{ip4['addr']}/#{ip4['netmask']}"
42
+ end
43
+ else
44
+ puts "IP ADDRESS : NONE"
45
+ end
46
+ puts ""
47
+ end
48
+ if found
49
+ puts "#" * 70
50
+ else
51
+ $stderr.puts "Error, no network interfaces have been detected"
52
+ end
@@ -677,7 +677,7 @@ rbnetifaces_s_interfaces (VALUE self)
677
677
  return Qnil;
678
678
  }
679
679
 
680
- *pfreq = ifc.CNAME(ifc_req);
680
+ pfreq = ifc.CNAME(ifc_req);
681
681
 
682
682
  for (n = 0; n < ifc.CNAME(ifc_len)/sizeof(struct CNAME(ifreq));n++,pfreq++)
683
683
  {
@@ -30,6 +30,7 @@
30
30
  /* For Linux, include all the sockaddr
31
31
  definitions we can lay our hands on. */
32
32
  #if !HAVE_SOCKADDR_SA_LEN
33
+ # include <netinet/in.h>
33
34
  # if HAVE_NETASH_ASH_H
34
35
  # include <netash/ash.h>
35
36
  # endif
@@ -1,3 +1,3 @@
1
1
  module NetworkInterface
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -16,14 +16,17 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = "https://github.com/rapid7/network_interface"
17
17
  spec.license = "MIT"
18
18
 
19
- spec.files = `git ls-files`.split($/)
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|tmp)/}) }
23
+ end
20
24
  spec.extensions = ['ext/network_interface_ext/extconf.rb']
21
25
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
27
  spec.require_paths = ["lib"]
24
28
 
25
- spec.add_development_dependency "bundler", "~> 1.3"
26
29
  spec.add_development_dependency "rake"
27
- spec.add_development_dependency "rake-compiler", ">= 0"
30
+ spec.add_development_dependency "rake-compiler"
28
31
  spec.add_development_dependency "rspec"
29
32
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,138 +1,191 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brandon Turner
9
8
  - Lance Sanchez
10
9
  autorequire:
11
10
  bindir: bin
12
- cert_chain: []
13
- date: 2013-07-08 00:00:00.000000000 Z
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
15
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
16
+ d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
17
+ b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
18
+ EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
19
+ cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
20
+ MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
21
+ JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP
22
+ mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+
23
+ wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4
24
+ VYcgoc/lbQrISXwxmDNsI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AN+GL5/myPWg7oH4mVrG7/OhXF1MoYQF0ddaNiqaweEHMuKJBQCVZRbL
91
+ 37HojoKXXv2yyRJBCeTB+ojrxX+5PdLVZa0ss7toWzJ2A1poPXZ1eZvm5xeFD32z
92
+ YQaTmmNWNI3PCDTyJ2PXUc+bDiNNwcZ7yc5o78UNRvp9Jxghya17Q76c9Ov9wvnv
93
+ dxxQKWGOQy0m4fBrkyjAyH9Djjn81RbQrqYgPuhd5nD0HjN3VUQLhQbIJrk9TVs0
94
+ EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
95
+ 9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
96
+ -----END CERTIFICATE-----
97
+ date: 2023-08-14 00:00:00.000000000 Z
14
98
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: bundler
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: '1.3'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: '1.3'
31
99
  - !ruby/object:Gem::Dependency
32
100
  name: rake
33
101
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
102
  requirements:
36
- - - ! '>='
103
+ - - ">="
37
104
  - !ruby/object:Gem::Version
38
105
  version: '0'
39
106
  type: :development
40
107
  prerelease: false
41
108
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
109
  requirements:
44
- - - ! '>='
110
+ - - ">="
45
111
  - !ruby/object:Gem::Version
46
112
  version: '0'
47
113
  - !ruby/object:Gem::Dependency
48
114
  name: rake-compiler
49
115
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
116
  requirements:
52
- - - ! '>='
117
+ - - ">="
53
118
  - !ruby/object:Gem::Version
54
119
  version: '0'
55
120
  type: :development
56
121
  prerelease: false
57
122
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
123
  requirements:
60
- - - ! '>='
124
+ - - ">="
61
125
  - !ruby/object:Gem::Version
62
126
  version: '0'
63
127
  - !ruby/object:Gem::Dependency
64
128
  name: rspec
65
129
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
130
  requirements:
68
- - - ! '>='
131
+ - - ">="
69
132
  - !ruby/object:Gem::Version
70
133
  version: '0'
71
134
  type: :development
72
135
  prerelease: false
73
136
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
137
  requirements:
76
- - - ! '>='
138
+ - - ">="
77
139
  - !ruby/object:Gem::Version
78
140
  version: '0'
79
- description: ! "\n This gem was originally added to the Metasploit Pcaprub gem.
141
+ description: "\n This gem was originally added to the Metasploit Pcaprub gem.
80
142
  It's been spun\n out into its own gem for anyone who might want to programmatically
81
143
  get\n information on their network interfaces. "
82
144
  email:
83
145
  - lance.sanchez@rapid7.com
84
146
  - brandon_turner@rapid7.com
85
- executables: []
147
+ executables:
148
+ - list_interfaces.rb
86
149
  extensions:
87
150
  - ext/network_interface_ext/extconf.rb
88
151
  extra_rdoc_files: []
89
152
  files:
90
- - .gitignore
91
- - .rspec
153
+ - ".github/workflows/verify.yml"
154
+ - ".gitignore"
155
+ - ".rspec"
92
156
  - Gemfile
93
157
  - Gemfile.lock
94
158
  - LICENSE
95
159
  - README.md
96
160
  - Rakefile
161
+ - bin/list_interfaces.rb
97
162
  - ext/network_interface_ext/extconf.rb
98
163
  - ext/network_interface_ext/netifaces.c
99
164
  - ext/network_interface_ext/netifaces.h
100
165
  - lib/network_interface.rb
101
166
  - lib/network_interface/version.rb
102
167
  - network_interface.gemspec
103
- - spec/netiface_spec.rb
104
- - spec/spec_helper.rb
105
168
  homepage: https://github.com/rapid7/network_interface
106
169
  licenses:
107
170
  - MIT
171
+ metadata: {}
108
172
  post_install_message:
109
173
  rdoc_options: []
110
174
  require_paths:
111
175
  - lib
112
176
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
177
  requirements:
115
- - - ! '>='
178
+ - - ">="
116
179
  - !ruby/object:Gem::Version
117
180
  version: '0'
118
- segments:
119
- - 0
120
- hash: -3620416272362916495
121
181
  required_rubygems_version: !ruby/object:Gem::Requirement
122
- none: false
123
182
  requirements:
124
- - - ! '>='
183
+ - - ">="
125
184
  - !ruby/object:Gem::Version
126
185
  version: '0'
127
- segments:
128
- - 0
129
- hash: -3620416272362916495
130
186
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 1.8.25
187
+ rubygems_version: 3.1.4
133
188
  signing_key:
134
- specification_version: 3
189
+ specification_version: 4
135
190
  summary: A cross platform gem to help get network interface information
136
- test_files:
137
- - spec/netiface_spec.rb
138
- - spec/spec_helper.rb
191
+ test_files: []
metadata.gz.sig ADDED
Binary file
@@ -1,48 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe NetworkInterface do
4
-
5
- describe "#interfaces" do
6
- it "should have the same interfaces as the system_interfaces" do
7
- NetworkInterface.interfaces.should include(*system_interfaces_with_addresses.keys)
8
- end
9
- end
10
-
11
- describe "#addresses" do
12
- system_interfaces_with_addresses.each do |interface, hash|
13
- describe "#{friendly_interface_names.key(interface)}" do
14
- if hash.has_key?(:ipv4)
15
- describe "ipv4" do
16
- it "should have an ipv4 address" do
17
- NetworkInterface.addresses(interface).should have_key NetworkInterface::AF_INET
18
- end
19
- it "should match the system interface of #{hash[:ipv4]}" do
20
- NetworkInterface.addresses(interface)[NetworkInterface::AF_INET][0]["addr"].should == hash[:ipv4]
21
- end
22
- end
23
- end
24
- if hash.has_key?(:ipv6)
25
- describe "ipv6" do
26
- it "should have an ipv6 address" do
27
- NetworkInterface.addresses(interface).should have_key NetworkInterface::AF_INET6
28
- end
29
- it "should match the system interface of #{hash[:ipv6]}" do
30
- NetworkInterface.addresses(interface)[NetworkInterface::AF_INET6][0]["addr"].should == hash[:ipv6]
31
- end
32
- end
33
- end
34
- if hash.has_key?(:mac)
35
- describe "MAC address" do
36
- it "should have a MAC address" do
37
- NetworkInterface.addresses(interface).should have_key NetworkInterface::AF_LINK
38
- end
39
- it "should match the system interface of #{hash[:mac]}" do
40
- NetworkInterface.addresses(interface)[NetworkInterface::AF_LINK][0]["addr"].should == hash[:mac]
41
- end
42
- end
43
- end
44
- end
45
- end
46
-
47
- end
48
- end
data/spec/spec_helper.rb DELETED
@@ -1,107 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
3
- require 'network_interface'
4
- require 'rspec'
5
- require 'rspec/autorun'
6
-
7
- RSpec.configure do |config|
8
- end
9
-
10
- def friendly_interface_names
11
- interfaces = NetworkInterface.interfaces
12
- interface_names ||= begin
13
- h = {}
14
- interfaces.each do |interface|
15
- info = NetworkInterface.interface_info(interface)
16
- name = if info && info.has_key?('name')
17
- info['name']
18
- else
19
- interface
20
- end
21
- h[name] = interface
22
- end
23
- h
24
- end
25
- interface_names
26
- end
27
-
28
- if RUBY_PLATFORM =~ /i386-mingw32/
29
- def system_interfaces
30
- ipconfig = `ipconfig`
31
- ipconfig_array = ipconfig.split("\n").reject {|s| s.empty?}
32
-
33
- getmac = `getmac -nh`
34
- getmac_array = getmac.split("\n").reject {|s| s.empty?}
35
- getmac_array.map!{|element| element.split(" ")}
36
- getmac_hash = getmac_array.inject({}) do |hash, array|
37
- hash.merge!({array[1][/\{(.*)\}/,1] => array[0].gsub("-",":").downcase})
38
- end
39
-
40
- interfaces = {}
41
- @key = nil
42
- ipconfig_array.each do |element|
43
- if element.start_with? " "
44
- case element
45
- when /IPv6 Address.*: (.*)/
46
- # interfaces[@key][:ipv6] = $1
47
- when /IPv4 Address.*: (.*)/
48
- interfaces[@key][:ipv4] = $1
49
- interfaces[@key][:mac] = getmac_hash[@key[/\{(.*)\}/,1]]
50
- end
51
- elsif element[/Windows IP Configuration/]
52
- elsif element[/Ethernet adapter (.*):/]
53
- @key = friendly_interface_names[$1]
54
- interfaces[@key] = {}
55
- else
56
- @key = element[/(.*):/,1]
57
- interfaces[@key] = {}
58
- end
59
- end
60
-
61
- interfaces
62
- end
63
-
64
- else
65
- def system_interfaces
66
- ifconfig = `/sbin/ifconfig`
67
- ifconfig_array = ifconfig.split("\n")
68
- ifconfig_array.map!{|element| element.split("\n")}
69
- ifconfig_array.flatten!
70
- interfaces = {}
71
- @key = nil
72
- ifconfig_array.each do |element|
73
- if element.start_with?("\t") || element.start_with?(" ")
74
- case element
75
- when /ether ((\w{2}\:){5}(\w{2}))/
76
- interfaces[@key][:mac] = $1
77
- when /inet6 (.*) prefixlen/
78
- interfaces[@key][:ipv6] = $1
79
- when /inet ((\d{1,3}\.){3}\d{1,3}).*broadcast ((\d{1,3}\.){3}\d{1,3})/
80
- interfaces[@key][:ipv4] = $1
81
- interfaces[@key][:broadcast] = $3
82
- when /addr:((\d{1,3}\.){3}\d{1,3})\s+Bcast:((\d{1,3}\.){3}\d{1,3})/i
83
- interfaces[@key][:ipv4] = $1
84
- interfaces[@key][:broadcast] = $3
85
- end
86
- else
87
- @key = element.split(' ').first[/(\w*)/,1]
88
- interfaces[@key] = {}
89
- if element[/HWaddr ((\w{2}\:){5}(\w{2}))/]
90
- interfaces[@key][:mac] = $1
91
- end
92
- end
93
- end
94
- interfaces
95
- end
96
-
97
- end
98
-
99
- def system_interfaces_with_addresses
100
- interfaces = {}
101
- system_interfaces.each do |key, value|
102
- if value.has_key? :ipv4
103
- interfaces[key] = value
104
- end
105
- end
106
- interfaces
107
- end