pwn 0.4.879 → 0.4.880
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 +12 -17
- data/lib/pwn/plugins/sock.rb +25 -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: 7476cddf4ef34bf866a63dbc44c2e4f09b23d6a50469c8cd9f94635e6ff44fd7
|
4
|
+
data.tar.gz: 2bbbe18c615932fda347f7203ed0d66acf0841a2a24c2d5bf89f1be5fdcde282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d0212df761fb44d0fd97aca483fc344f0fa9a91caa3132be71323ef72c146793aae28096cd4c58bf82e273a1585e46c6851aa5c923a0b9d562b4b7bee34d20d
|
7
|
+
data.tar.gz: 67ea72cc4feb3042ffd43be03f346950fab25d829a6d4df2afbe55d91f273664dfd64e234e94e0c182d31b790c61705f565440162110d792ea2affda2a3cd8d8
|
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.880]: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.880]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
data/bin/pwn_www_checkip
CHANGED
data/lib/pwn/plugins/ip_info.rb
CHANGED
@@ -47,52 +47,47 @@ 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:
|
79
|
+
server_ip: target,
|
81
80
|
server_port: tls_port
|
82
81
|
)
|
83
82
|
|
84
83
|
ip_resp[:tls_avail] = tls_port_avail
|
85
84
|
next unless tls_port_avail
|
86
85
|
|
87
|
-
|
88
|
-
target:
|
89
|
-
port: tls_port
|
90
|
-
protocol: :tcp,
|
91
|
-
tls: true
|
86
|
+
cert_obj = PWN::Plugins::Sock.get_tls_cert(
|
87
|
+
target: target,
|
88
|
+
port: tls_port
|
92
89
|
)
|
93
|
-
|
94
|
-
cert = tls_sock.peer_cert
|
95
|
-
ip_resp[:cert_txt] = cert.to_text
|
90
|
+
ip_resp[:cert_txt] = cert_obj.to_text
|
96
91
|
ip_resp[:cert_obj] = cert
|
97
92
|
PWN::Plugins::Sock.disconnect(sock_obj: tls_sock_obj)
|
98
93
|
end
|
@@ -116,7 +111,7 @@ module PWN
|
|
116
111
|
public_class_method def self.help
|
117
112
|
puts "USAGE:
|
118
113
|
ip_info_struc = #{self}.get(
|
119
|
-
|
114
|
+
target: 'required - IP or Host to lookup',
|
120
115
|
proxy: 'optional - use a proxy',
|
121
116
|
tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.'
|
122
117
|
)
|
data/lib/pwn/plugins/sock.rb
CHANGED
@@ -169,6 +169,31 @@ 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 StandardError => e
|
192
|
+
raise e
|
193
|
+
ensure
|
194
|
+
tls_sock_obj = disconnect(sock_obj: tls_sock_obj) unless tls_sock_obj.nil?
|
195
|
+
end
|
196
|
+
|
172
197
|
# Supported Method Parameters::
|
173
198
|
# sock_obj = PWN::Plugins::Sock.disconnect(
|
174
199
|
# sock_obj: 'required - sock_obj returned from #connect method'
|
data/lib/pwn/version.rb
CHANGED