pwn 0.4.879 → 0.4.882
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/README.md +2 -2
- data/bin/pwn_www_checkip +1 -1
- data/lib/pwn/plugins/ip_info.rb +19 -20
- data/lib/pwn/plugins/sock.rb +27 -0
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf22b1c254e324d6d66b5b6e2644137c668bb7da964485ac8614d00bcb4a4080
|
|
4
|
+
data.tar.gz: 39c485bb8345e69519595c9eb8d9fe9fcea4a877c66b0b8282d8a83986604c44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94cc6104f8eac1b8ab11c18162e64bb4a2886fc9585ddb30b47bb654e214363758b7302edb93730c132391f01acc9ffa5a3c3a064713012e7b78bf226c1ae8e4
|
|
7
|
+
data.tar.gz: df6b516ae409849a780b2342f1197caeb013bb0ae58cbe8eaf072f41c4b3075d87c5031b8634f65c44a7c6810ba4167cd8c869b6243d5ca4f6229bf0bee3b470
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
|
37
37
|
$ rvm list gemsets
|
|
38
38
|
$ gem install --verbose pwn
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.4.
|
|
40
|
+
pwn[v0.4.882]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.4.
|
|
55
|
+
pwn[v0.4.882]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
|
data/bin/pwn_www_checkip
CHANGED
data/lib/pwn/plugins/ip_info.rb
CHANGED
|
@@ -10,7 +10,7 @@ module PWN
|
|
|
10
10
|
# 1,000 daily requests are allowed for free
|
|
11
11
|
module IPInfo
|
|
12
12
|
# Supported Method Parameters::
|
|
13
|
-
#
|
|
13
|
+
# ip_resp_json = ip_info_rest_call(
|
|
14
14
|
# ip: 'required - IP or Host to lookup',
|
|
15
15
|
# proxy: 'optional - use a proxy'
|
|
16
16
|
# )
|
|
@@ -47,54 +47,53 @@ module PWN
|
|
|
47
47
|
|
|
48
48
|
# Supported Method Parameters::
|
|
49
49
|
# ip_info_struc = PWN::Plugins::IPInfo.get(
|
|
50
|
-
#
|
|
50
|
+
# target: 'required - IP or Host to lookup',
|
|
51
51
|
# proxy: 'optional - use a proxy',
|
|
52
52
|
# tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.'
|
|
53
53
|
# )
|
|
54
54
|
|
|
55
55
|
public_class_method def self.get(opts = {})
|
|
56
|
-
|
|
56
|
+
target = opts[:target].to_s.scrub.strip.chomp
|
|
57
57
|
proxy = opts[:proxy]
|
|
58
58
|
tls_port = opts[:tls_port]
|
|
59
59
|
tls_port ||= 443
|
|
60
60
|
|
|
61
61
|
ip_info_resp = []
|
|
62
|
-
if IPAddress.valid?(
|
|
62
|
+
if IPAddress.valid?(target)
|
|
63
63
|
if proxy
|
|
64
|
-
ip_resp_json = ip_info_rest_call(ip:
|
|
64
|
+
ip_resp_json = ip_info_rest_call(ip: target, proxy: proxy)
|
|
65
65
|
else
|
|
66
|
-
ip_resp_json = ip_info_rest_call(ip:
|
|
66
|
+
ip_resp_json = ip_info_rest_call(ip: target)
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
ip_info_resp.push(ip_resp_json)
|
|
70
70
|
else
|
|
71
|
-
Resolv::DNS.new.each_address(
|
|
71
|
+
Resolv::DNS.new.each_address(target) do |ip|
|
|
72
72
|
ip_info_resp.push(ip_info_rest_call(ip: ip))
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
if proxy.nil?
|
|
77
77
|
ip_info_resp.each do |ip_resp|
|
|
78
|
-
# TODO: add this block as a method in PWN::Plugins::Sock
|
|
79
78
|
tls_port_avail = PWN::Plugins::Sock.check_port_in_use(
|
|
80
|
-
server_ip:
|
|
81
|
-
|
|
79
|
+
server_ip: target,
|
|
80
|
+
port: tls_port
|
|
82
81
|
)
|
|
83
82
|
|
|
84
83
|
ip_resp[:tls_avail] = tls_port_avail
|
|
84
|
+
ip_resp[:cert_txt] = false
|
|
85
|
+
ip_resp[:cert_obj] = false
|
|
85
86
|
next unless tls_port_avail
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
target:
|
|
89
|
-
port: tls_port
|
|
90
|
-
protocol: :tcp,
|
|
91
|
-
tls: true
|
|
88
|
+
cert_obj = PWN::Plugins::Sock.get_tls_cert(
|
|
89
|
+
target: target,
|
|
90
|
+
port: tls_port
|
|
92
91
|
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
|
|
93
|
+
next unless cert_obj.is_a?(OpenSSL::X509::Certificate)
|
|
94
|
+
|
|
95
|
+
ip_resp[:cert_txt] = cert_obj.to_text
|
|
96
96
|
ip_resp[:cert_obj] = cert
|
|
97
|
-
PWN::Plugins::Sock.disconnect(sock_obj: tls_sock_obj)
|
|
98
97
|
end
|
|
99
98
|
end
|
|
100
99
|
|
|
@@ -116,7 +115,7 @@ module PWN
|
|
|
116
115
|
public_class_method def self.help
|
|
117
116
|
puts "USAGE:
|
|
118
117
|
ip_info_struc = #{self}.get(
|
|
119
|
-
|
|
118
|
+
target: 'required - IP or Host to lookup',
|
|
120
119
|
proxy: 'optional - use a proxy',
|
|
121
120
|
tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.'
|
|
122
121
|
)
|
data/lib/pwn/plugins/sock.rb
CHANGED
|
@@ -169,6 +169,33 @@ module PWN
|
|
|
169
169
|
listen_obj = disconnect(sock_obj: listen_obj) unless listen_obj.nil?
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
+
# Supported Method Parameters::
|
|
173
|
+
# cert_obj = PWN::Plugins::Sock.get_tls_cert(
|
|
174
|
+
# target: 'required - target host or ip',
|
|
175
|
+
# port: 'optional - target port (defaults to 443)'
|
|
176
|
+
# )
|
|
177
|
+
|
|
178
|
+
public_class_method def self.get_tls_cert(opts = {})
|
|
179
|
+
target = opts[:target].to_s.scrub
|
|
180
|
+
port = opts[:port]
|
|
181
|
+
port ||= 443
|
|
182
|
+
|
|
183
|
+
tls_sock_obj = connect(
|
|
184
|
+
target: target,
|
|
185
|
+
port: port,
|
|
186
|
+
protocol: :tcp,
|
|
187
|
+
tls: true
|
|
188
|
+
)
|
|
189
|
+
tls_sock_obj.sync_close = true
|
|
190
|
+
tls_sock_obj.peer_cert
|
|
191
|
+
rescue OpenSSL::SSL::SSLError
|
|
192
|
+
false
|
|
193
|
+
rescue StandardError => e
|
|
194
|
+
raise e
|
|
195
|
+
ensure
|
|
196
|
+
tls_sock_obj = disconnect(sock_obj: tls_sock_obj) unless tls_sock_obj.nil?
|
|
197
|
+
end
|
|
198
|
+
|
|
172
199
|
# Supported Method Parameters::
|
|
173
200
|
# sock_obj = PWN::Plugins::Sock.disconnect(
|
|
174
201
|
# sock_obj: 'required - sock_obj returned from #connect method'
|
data/lib/pwn/version.rb
CHANGED