pwn 0.5.155 → 0.5.157

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: 750d1cd0053f38007697365f5dfbbbb8558623c4ba39230ace21d7ad85f37cad
4
- data.tar.gz: e4d657864bb71497616619da64b73e2c2fa782ea11a3ade500cecea53cfae7a7
3
+ metadata.gz: 6fa5c25714856b9ee7de2118ac2da2e6f27380bcbae0e82d448774e6ad260329
4
+ data.tar.gz: 841310123fcb027c750b7d94b67851c9b9420ea7f79b3ccfc240347280fb4a04
5
5
  SHA512:
6
- metadata.gz: '0928635402765a9b79f4d324cc62efafcce43ff7ad5d7ccac30aa98ba34ead97cf3ff8a81b15e2a8faae3f5f59331f56e2c25837900110b3b8766854cad22962'
7
- data.tar.gz: 1d48dcb220d837be65cd697e9e78e2cdf53a5f6e0a44365b39ccbfe4e0eacfaee576f9da301ac6b23f4cf4c3f93cd01cb7d3023166a5a674062f81b16cc9073e
6
+ metadata.gz: 4bfcbdcdd0b987a3f8ac1bb90b4f6a687584d1c1269931aca7027cfe542349088416452069f9882c6c2d3287f12ea88f3bbd34d3f2c3c1623ed74a7619adb0f7
7
+ data.tar.gz: 017f565735be76fb7a1f9e28bcef3be061b2700da2333df5f92162d268db9f224468672814135302f52bcdf2618efcb8a11054b4d3da7f421da8314b1fc4e4cd
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ cd /opt/pwn
37
37
  $ ./install.sh
38
38
  $ ./install.sh ruby-gem
39
39
  $ pwn
40
- pwn[v0.5.155]:001 >>> PWN.help
40
+ pwn[v0.5.157]: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.3.1@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.5.155]:001 >>> PWN.help
55
+ pwn[v0.5.157]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
  If you're using a multi-user install of RVM do:
@@ -62,7 +62,7 @@ $ rvm use ruby-3.3.1@pwn
62
62
  $ rvmsudo gem uninstall --all --executables pwn
63
63
  $ rvmsudo gem install --verbose pwn
64
64
  $ pwn
65
- pwn[v0.5.155]:001 >>> PWN.help
65
+ pwn[v0.5.157]:001 >>> PWN.help
66
66
  ```
67
67
 
68
68
  PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
@@ -46,12 +46,30 @@ module PWN
46
46
  raise e
47
47
  end
48
48
 
49
+ # Supported Method Parameters::
50
+ # is_rfc1918 = PWN::Plugins::IPInfo.check_rfc1918(
51
+ # ip: 'required - IP to check'
52
+ # )
53
+ public_class_method def self.check_rfc1918(opts = {})
54
+ ip = opts[:ip].to_s.scrub.strip.chomp
55
+ ip_obj = IPAddress.valid?(ip) ? IPAddress.parse(ip) : nil
56
+
57
+ rfc1918_ranges = [
58
+ IPAddress('10.0.0.0/8'), # 10.0.0.0 - 10.255.255.255
59
+ IPAddress('172.16.0.0/12'), # 172.16.0.0 - 172.31.255.255
60
+ IPAddress('192.168.0.0/16') # 192.168.0.0 - 192.168.255.255
61
+ ]
62
+
63
+ rfc1918_ranges.any? { |range| range.include?(ip_obj) }
64
+ end
65
+
49
66
  # Supported Method Parameters::
50
67
  # ip_info_struc = PWN::Plugins::IPInfo.get(
51
68
  # target: 'required - IP or Host to lookup',
52
69
  # proxy: 'optional - use a proxy',
53
70
  # tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.',
54
- # skip_api: 'optional - skip the API call'
71
+ # skip_api: 'optional - skip the API call',
72
+ # dns_server: 'optional - DNS server to use for lookup (default: your default DNS server)'
55
73
  # )
56
74
 
57
75
  public_class_method def self.get(opts = {})
@@ -61,24 +79,37 @@ module PWN
61
79
  skip_api = opts[:skip_api] ||= false
62
80
 
63
81
  ip_info_resp = []
64
- ip_resp_hash = {}
65
82
  is_ip = IPAddress.valid?(target)
66
-
67
- begin
68
- ip_resp_hash[:hostname] = target
69
- target = Resolv.getaddress(target) unless is_ip
70
- rescue Resolv::ResolvError
71
- target = nil
83
+ hostname = '' if is_ip
84
+ target_arr = [target] if is_ip
85
+
86
+ unless is_ip
87
+ begin
88
+ hostname = target
89
+ dns_server = opts[:dns_server]
90
+ dns_resolver = Resolv::DNS.new(nameserver: [dns_server]) if dns_server
91
+ dns_resolver ||= Resolv::DNS.new
92
+ target_arr = dns_resolver.getaddresses(target).map(&:to_s).uniq
93
+ rescue Resolv::ResolvError
94
+ target_arr = nil
95
+ end
72
96
  end
73
97
 
74
- ip_resp_hash = ip_info_rest_call(ip: target, proxy: proxy) unless skip_api
75
- ip_resp_hash[:ip] = target
76
- ip_info_resp.push(ip_resp_hash) unless target.nil?
98
+ target_arr.each do |this_target|
99
+ ip_resp_hash = ip_info_rest_call(ip: this_target, proxy: proxy) unless skip_api
100
+ ip_resp_hash ||= {}
101
+ is_rfc1918 = check_rfc1918(ip: this_target)
102
+ ip_resp_hash[:ip] = this_target
103
+ ip_resp_hash[:is_rfc1918] = is_rfc1918
104
+ ip_resp_hash[:hostname] = hostname
105
+
106
+ ip_info_resp.push(ip_resp_hash) unless target_arr.nil?
107
+
108
+ next unless proxy.nil?
77
109
 
78
- if proxy.nil? && is_ip
79
110
  ip_info_resp.each do |ip_resp|
80
111
  tls_port_avail = PWN::Plugins::Sock.check_port_in_use(
81
- server_ip: target,
112
+ server_ip: this_target,
82
113
  port: tls_port
83
114
  )
84
115
 
@@ -98,7 +129,7 @@ module PWN
98
129
  next unless tls_port_avail
99
130
 
100
131
  cert_obj = PWN::Plugins::Sock.get_tls_cert(
101
- target: target,
132
+ target: this_target,
102
133
  port: tls_port
103
134
  )
104
135
 
@@ -202,11 +233,16 @@ module PWN
202
233
 
203
234
  public_class_method def self.help
204
235
  puts "USAGE:
236
+ is_rfc1918 = #{self}.check_rfc1918(
237
+ ip: 'required - IP to check'
238
+ )
239
+
205
240
  ip_info_struc = #{self}.get(
206
241
  target: 'required - IP or Host to lookup',
207
242
  proxy: 'optional - use a proxy',
208
243
  tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.',
209
- skip_api: 'optional - skip the API call'
244
+ skip_api: 'optional - skip the API call',
245
+ dns_server: 'optional - DNS server to use for lookup (default: your default DNS server)'
210
246
  )
211
247
 
212
248
  #{self}.bruteforce_subdomains(
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.5.155'
4
+ VERSION = '0.5.157'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.155
4
+ version: 0.5.157
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-04 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport