pwn 0.5.155 → 0.5.156

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: 47f160c73c391cf48bd0a847d0031d342ef79b77575e86872153105905072141
4
+ data.tar.gz: 7c71dc97fd8e8e4e99584ab8bbb97363d46a2edd6786f2bb8e4ee9bd7c0b16cb
5
5
  SHA512:
6
- metadata.gz: '0928635402765a9b79f4d324cc62efafcce43ff7ad5d7ccac30aa98ba34ead97cf3ff8a81b15e2a8faae3f5f59331f56e2c25837900110b3b8766854cad22962'
7
- data.tar.gz: 1d48dcb220d837be65cd697e9e78e2cdf53a5f6e0a44365b39ccbfe4e0eacfaee576f9da301ac6b23f4cf4c3f93cd01cb7d3023166a5a674062f81b16cc9073e
6
+ metadata.gz: 55c9643d11b525ef375396f51354e2356363567de4ca1b9e0d9ea9281ff2af58698bd819a38f1e8b0c7212b03012403257c5e4622ae16e7ee018a36e1d66c7e1
7
+ data.tar.gz: c67b6fe7fbf5966d2630c4a0e99f254e58e6b09a6b15cad13a79897f9ab42c0f2efb7147547c70b4663e0f830af672d72859abc50e64e54b51ad999c4a33220b
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.156]: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.156]: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.156]: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 = {})
@@ -63,19 +81,29 @@ module PWN
63
81
  ip_info_resp = []
64
82
  ip_resp_hash = {}
65
83
  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
84
+ hostname = '' 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 = dns_resolver.getaddress(target).to_s
93
+ rescue Resolv::ResolvError
94
+ target = nil
95
+ end
72
96
  end
73
97
 
74
98
  ip_resp_hash = ip_info_rest_call(ip: target, proxy: proxy) unless skip_api
99
+ is_rfc1918 = check_rfc1918(ip: target)
75
100
  ip_resp_hash[:ip] = target
101
+ ip_resp_hash[:is_rfc1918] = is_rfc1918
102
+ ip_resp_hash[:hostname] = hostname
103
+
76
104
  ip_info_resp.push(ip_resp_hash) unless target.nil?
77
105
 
78
- if proxy.nil? && is_ip
106
+ if proxy.nil?
79
107
  ip_info_resp.each do |ip_resp|
80
108
  tls_port_avail = PWN::Plugins::Sock.check_port_in_use(
81
109
  server_ip: target,
@@ -202,11 +230,16 @@ module PWN
202
230
 
203
231
  public_class_method def self.help
204
232
  puts "USAGE:
233
+ is_rfc1918 = #{self}.check_rfc1918(
234
+ ip: 'required - IP to check'
235
+ )
236
+
205
237
  ip_info_struc = #{self}.get(
206
238
  target: 'required - IP or Host to lookup',
207
239
  proxy: 'optional - use a proxy',
208
240
  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'
241
+ skip_api: 'optional - skip the API call',
242
+ dns_server: 'optional - DNS server to use for lookup (default: your default DNS server)'
210
243
  )
211
244
 
212
245
  #{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.156'
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.156
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