ipscannerplus 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8c323b7c3b017afcc003fca0cb111f3b6dcf1923c978037527b2e890c5e1c8a6
4
+ data.tar.gz: 0bb88d5338f4de67cd9c60cd6a144cb5068eb94f52adc78495de7bd99bb44a92
5
+ SHA512:
6
+ metadata.gz: 73b2b4c9ae5b92f8a37a3758a5f0d0f723617c1cbfce5d87404ee9617a4984a0ebd88c98388c3001f0c1ea4058563253e9b4a45e3aa13720aa298b2ab71c5d39
7
+ data.tar.gz: 1838a3b34f6c52bee0631cbc6ff53ec9aed641550ace1d32d1ce50cecaa29b0a55237660a96ac2ea349c80e99d1c3d44fbe7e2da6ce458da00f724774b16b664
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ i��8��;�T����s-I�b�.��DUX������ש�N��Xȴf�7���H � �5 I׺x�ӿ�����ז� @��}��2�w�(�E�i� dX�S�-c�d��� ��[�,Rq�D��#N����߾ }&��^��k����ҧ��3�ʠ-�={E��k�tK, ]c}���We��VVz�^@��0��z�w�bO�^A�� �kl ď׍����x艌���N����Ci�d_;G}�{H�N�C�uv?m�E���ę�W�^�������U ռ�E}�/�&���Z�?���L�ע^��C��c����ѫ�iu�:No�"�*�n#��A����������Px��N�)����k�~���D�e^��
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: ipscannerplus.rb
4
+
5
+ require 'ipscanner'
6
+ require 'fast_port_scanner'
7
+
8
+
9
+ PORTS = "
10
+ 21 FTP
11
+ 22 SSH
12
+ 25 SMTP
13
+ 53 DNS
14
+ 80 HTTP
15
+ 443 HTTPS
16
+ 110 POP3
17
+ 111 ONC RPC
18
+ 119 NNTP
19
+ 139 NetBIOS Session Service
20
+ 445 Microsoft-DS (Directory Services) SMB file sharing
21
+ "
22
+
23
+
24
+ class IPScannerPlus
25
+
26
+ attr_reader :result
27
+
28
+ def initialize(devices: nil, ports: nil)
29
+
30
+ @custom_ports = ports.strip.lines.map do |x|
31
+ (x.chomp.split(/ +/,2) + ['']).take(2)
32
+ end.to_h
33
+
34
+ @known_ports = PORTS.strip.lines.map {|x| x.chomp.split(/ +/,2)}.to_h
35
+
36
+ @devices = devices.strip.lines.map do |x|
37
+ a = x.chomp.split(/ +/,3)
38
+ [a[0], a[1..2]]
39
+ end.to_h
40
+
41
+ @ports = @known_ports.merge(@custom_ports)
42
+
43
+ end
44
+
45
+ def lookup(service: nil, port: nil)
46
+
47
+ if service then
48
+ @result.find {|x| x.last.find {|y| y.last =~ /#{service}/i}}
49
+ elsif port
50
+ @result.find {|x| x.last.find {|y| y.first == port.to_i}}
51
+ end
52
+
53
+ end
54
+
55
+ def scan()
56
+
57
+ @result = IPScanner.scan.map do |ip|
58
+
59
+ ports = FastPortScanner.scan(ip, ports: (1..1000).to_a \
60
+ + @custom_ports.keys.map(&:to_i))
61
+
62
+ [
63
+ [ip, @devices[ip[/\d+$/]]],
64
+ ports.map { |port| [port, @ports[port.to_s]] }
65
+ ]
66
+
67
+ end
68
+
69
+ end
70
+ end
71
+
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ipscannerplus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwMjEwMDAzNzAzWhcN
15
+ MjEwMjA5MDAzNzAzWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9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p0jvOJ2IMN+W2VJ+89x3Vwz3y2F/Ux0Y0nG4e9ETrc1O+9mEsR
32
+ J7ytqcZZdqFFpIs68iNN1uszYsWnp6ZWCJa1Li8lwDsBCBJADNxrs8K+9QimkqJi
33
+ EfBSoCtcinIHlgEnulqGK7r5clwXB/GdIBTOSlUe0vP0K3SYP9j1/WYRgtDdNYkF
34
+ KEioxU2JqOP6fUhQpXnxQUk/kIw9YUWG9a9Biq/2NylKx7kKNjp0RVFUvIgFMGvV
35
+ Q36Io7+P0a6/QUCyXyvqOV7+wdwLRxZI/xovFVhCo5vfEQjzXPOnLCyyADtrr287
36
+ GYf+zjxtwaOh87Ywi7PjCu3D
37
+ -----END CERTIFICATE-----
38
+ date: 2020-02-10 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: ipscanner
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.3.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.3'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.3.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.3'
60
+ - !ruby/object:Gem::Dependency
61
+ name: fast_port_scanner
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 0.1.0
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.1'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 0.1.0
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.1'
80
+ description:
81
+ email: james@jamesrobertson.eu
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - lib/ipscannerplus.rb
87
+ homepage: https://github.com/jrobertson/ipscannerplus
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Helps find out what service is running where in the network.
110
+ test_files: []
metadata.gz.sig ADDED
Binary file