micro-hookit 0.12.12 → 0.12.13
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 +4 -4
- data/lib/hookit/resource/socket.rb +21 -4
- data/lib/hookit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc551132af22f42e71583f69e1326282535369dbfa428c659f5c3e88f4d29549
|
4
|
+
data.tar.gz: 31165b8b6fb9e566bd0f8ec0e5fd86b18e8fe2715277f10537bb56fdf4afd1b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e892dcbe1e1e0c42d15e1e7adfa9ded7a045462df80b14f433c904c5c0767bbba995e3cf2523b0e6d72d5c05029b2f7c5db3fc4c279103bf3838933dcc6f5c5b
|
7
|
+
data.tar.gz: 68c1eae42ec479b08ee9498850c9de145f1c353fd2ee311e6f453114e9cfa3cebc2564106f84778aff2a240577509e20da0abd7c97b53dd4407bbd9ea7f43f04
|
@@ -3,6 +3,7 @@ module Hookit
|
|
3
3
|
class Socket < Base
|
4
4
|
|
5
5
|
field :port
|
6
|
+
field :protocol
|
6
7
|
field :interface
|
7
8
|
field :service
|
8
9
|
field :max_checks
|
@@ -12,16 +13,32 @@ module Hookit
|
|
12
13
|
|
13
14
|
def initialize(name)
|
14
15
|
service name unless service
|
16
|
+
protocol :tcp unless protocol
|
15
17
|
max_checks 3 unless max_checks
|
16
18
|
super
|
17
19
|
|
20
|
+
case protocol
|
21
|
+
when :tcp
|
22
|
+
sun_proto_switch = "-f inet -P tcp"
|
23
|
+
proto_switch = "4t"
|
24
|
+
when :udp
|
25
|
+
sun_proto_switch = "-f inet -P udp"
|
26
|
+
proto_switch = "4u"
|
27
|
+
when :unix
|
28
|
+
sun_proto_switch = "-f unix"
|
29
|
+
proto_switch = "x"
|
30
|
+
else
|
31
|
+
sun_proto_switch = ""
|
32
|
+
proto_switch = ""
|
33
|
+
end
|
34
|
+
|
18
35
|
case platform.os
|
19
36
|
when 'sun'
|
20
|
-
@active_com = "netstat -an | egrep '\*\.#{port}' | grep LISTEN"
|
21
|
-
@inactive_com = "netstat -an | grep 'ESTABLISHED' | awk '{ print $1 }' | grep \"$(ifconfig #{interface} | grep inet | awk '{ print $2 }')\.#{port}\""
|
37
|
+
@active_com = "netstat -an #{sun_proto_switch} | egrep '\*\.#{port}' | grep LISTEN"
|
38
|
+
@inactive_com = "netstat -an #{sun_proto_switch} | grep 'ESTABLISHED' | awk '{ print $1 }' | grep \"$(ifconfig #{interface} | grep inet | awk '{ print $2 }')\.#{port}\""
|
22
39
|
else
|
23
|
-
@active_com = "netstat -an | egrep ':#{port}' | grep LISTEN"
|
24
|
-
@inactive_com = "netstat -an | grep 'ESTABLISHED' | awk '{ print $4 }' | grep \"$(ifconfig #{interface} | awk '/inet addr/ { print $2}' | cut -f2 -d':' | tr -d '\n'):#{port}\""
|
40
|
+
@active_com = "netstat -an#{proto_switch} | egrep ':#{port}' | grep LISTEN"
|
41
|
+
@inactive_com = "netstat -an#{proto_switch} | grep 'ESTABLISHED' | awk '{ print $4 }' | grep \"$(ifconfig #{interface} | awk '/inet addr/ { print $2 }' | cut -f2 -d':' | tr -d '\n'):#{port}\""
|
25
42
|
end
|
26
43
|
end
|
27
44
|
|
data/lib/hookit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro-hookit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hennik Hunsaker
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-03
|
13
|
+
date: 2022-04-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: tilt
|