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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5420e18a9f3591fb4a6b3b630569752837738607a572c5bc44a72f158f1e3c1a
4
- data.tar.gz: 2528859528b403be16080e0d443b65a884ebc4979887fe0faaae078ea537b6d7
3
+ metadata.gz: 7476cddf4ef34bf866a63dbc44c2e4f09b23d6a50469c8cd9f94635e6ff44fd7
4
+ data.tar.gz: 2bbbe18c615932fda347f7203ed0d66acf0841a2a24c2d5bf89f1be5fdcde282
5
5
  SHA512:
6
- metadata.gz: d23d25ff25f48423f9e1cd06f21f86f8c13a78db47c0da27d6d1ff176e830a78809ff3a007f28218366253f66d77fe42be1bc82260a53aafa9fff6dad235c83b
7
- data.tar.gz: ef7bcf278c79ea39b59d035d0bf027ba414b050f7a6f487825ed80462f2c6d4d93b20a1b42b5a99081f0e9c0775e46a112cc89c9700261b14eb4bf8eb3646a88
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.879]:001 >>> PWN.help
40
+ pwn[v0.4.880]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](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.879]:001 >>> PWN.help
55
+ pwn[v0.4.880]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
data/bin/pwn_www_checkip CHANGED
@@ -49,7 +49,7 @@ begin
49
49
  puts "PUBLIC IP: #{public_ip_address}"
50
50
  if ipinfo
51
51
  puts PWN::Plugins::IPInfo.get(
52
- ip_or_host: public_ip_address,
52
+ target: public_ip_address,
53
53
  proxy: proxy
54
54
  )
55
55
  end
@@ -47,52 +47,47 @@ module PWN
47
47
 
48
48
  # Supported Method Parameters::
49
49
  # ip_info_struc = PWN::Plugins::IPInfo.get(
50
- # ip_or_host: 'required - IP or Host to lookup',
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
- ip_or_host = opts[:ip_or_host].to_s.scrub.strip.chomp
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?(ip_or_host)
62
+ if IPAddress.valid?(target)
63
63
  if proxy
64
- ip_resp_json = ip_info_rest_call(ip: ip_or_host, proxy: proxy)
64
+ ip_resp_json = ip_info_rest_call(ip: target, proxy: proxy)
65
65
  else
66
- ip_resp_json = ip_info_rest_call(ip: ip_or_host)
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(ip_or_host) do |ip|
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: ip_or_host,
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
- tls_sock_obj = PWN::Plugins::Sock.connect(
88
- target: ip_or_host,
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
- tls_sock_obj.sync_close = true
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
- ip_or_host: 'required - IP or Host to lookup',
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
  )
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.4.879'
4
+ VERSION = '0.4.880'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.879
4
+ version: 0.4.880
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.