pwn 0.4.401 → 0.4.404

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: df5af1174ba725397e50c9d8bc0cee20fcc78b5b3165b1cdbce60214e28b2a20
4
- data.tar.gz: e974e9c0b3c9fbf469a9763944fe41826b75797d0de81f5f7c0ad420c91c9bd7
3
+ metadata.gz: 2650275afca4dd7b4c13aa921f3e4cabd450511a401fdf5eb1a0219aee7ad67d
4
+ data.tar.gz: c7e2794dcb3ea63dd3b3e304297cc3fe4740e2eea214758989a9200b57d3efad
5
5
  SHA512:
6
- metadata.gz: 2741cfce43753c589425978fe24cc90e5a8e6d2ee3d6a371b1eb01c361135d4bc14e6078cf2649353827122d2a2e5e33b35a76ba3ab4f2ac8866b2d7b9708d71
7
- data.tar.gz: d4ab2d9808ef6ec84fd37e8c50165ec7fe85e859e4ed2ec510374657c2408f482f1278a8fc49d416641d6c331d77538e8a6b978ea09a467d83b9eacddf0854d1
6
+ metadata.gz: cbc0b37169c8eb25846fddeaa4cb818c91db138d122382e1e762ca3e32f04e9f798aa989b68629c78d9fbc639e38d090145a6f35407b5750a6e47466d684947c
7
+ data.tar.gz: f9b831849963dcbfe2979b34cb7f55631722c0f9d707e1d248a8d8f2d59a66bff3c1ac2b4106b61a4148eb33838ef6b0fe94ab1f382ba56f0eb190260ab28974
data/Gemfile CHANGED
@@ -16,9 +16,9 @@ gem 'anemone', '0.7.2'
16
16
  gem 'authy', '3.0.0'
17
17
  gem 'aws-sdk', '3.1.0'
18
18
  gem 'bettercap', '1.6.2'
19
- gem 'brakeman', '5.2.1'
19
+ gem 'brakeman', '5.2.2'
20
20
  gem 'bson', '4.14.1'
21
- gem 'bundler', '>=2.3.10'
21
+ gem 'bundler', '>=2.3.11'
22
22
  gem 'bundler-audit', '0.9.0.1'
23
23
  gem 'bunny', '2.19.0'
24
24
  gem 'colorize', '0.8.1'
@@ -41,7 +41,7 @@ gem 'net-ldap', '0.17.0'
41
41
  gem 'net-openvpn', '0.8.7'
42
42
  gem 'net-smtp', '0.3.1'
43
43
  gem 'nexpose', '7.3.0'
44
- gem 'nokogiri', '1.13.3'
44
+ gem 'nokogiri', '1.13.4'
45
45
  gem 'oily_png', '1.2.1'
46
46
  gem 'os', '1.1.4'
47
47
  gem 'packetfu', '1.1.13'
@@ -55,10 +55,10 @@ gem 'rbvmomi', '3.0.0'
55
55
  gem 'rdoc', '6.4.0'
56
56
  gem 'rest-client', '2.1.0'
57
57
  gem 'rex', '2.0.13'
58
- gem 'rmagick', '4.2.4'
58
+ gem 'rmagick', '4.2.5'
59
59
  gem 'rspec', '3.11.0'
60
60
  gem 'rtesseract', '3.1.2'
61
- gem 'rubocop', '1.26.1'
61
+ gem 'rubocop', '1.27.0'
62
62
  gem 'rubocop-rake', '0.6.0'
63
63
  gem 'rubocop-rspec', '2.9.0'
64
64
  gem 'ruby-audio', '1.6.1'
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.1@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.401]:001 >>> PWN.help
40
+ pwn[v0.4.404]: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.1.1@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.401]:001 >>> PWN.help
55
+ pwn[v0.4.404]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
data/bin/pwn CHANGED
@@ -56,6 +56,14 @@ begin
56
56
  end
57
57
 
58
58
  # Define Custom REPL Commands
59
+ Pry::Commands.create_command 'welcome-banner' do
60
+ description 'Display the random welcome banner, including basic usage.'
61
+
62
+ def process
63
+ puts PWN::Banner.welcome
64
+ end
65
+ end
66
+
59
67
  Pry::Commands.create_command 'toggle-pager' do
60
68
  description 'Toggle less on returned objects surpassing the terminal.'
61
69
 
@@ -67,12 +75,7 @@ begin
67
75
 
68
76
  # Define REPL Hooks
69
77
  Pry.config.hooks.add_hook(:before_session, :welcome) do |output, _binding, _pry|
70
- output.puts PWN::Banner.get
71
- output.puts 'Use the #help command & methods for more options.'
72
- output.puts 'e.g help'
73
- output.puts 'e.g PWN.help'
74
- output.puts 'e.g PWN::Plugins.help'
75
- output.puts 'e.g PWN::Plugins::TransparentBrowser.help'
78
+ output.puts PWN::Banner.welcome
76
79
  end
77
80
 
78
81
  # Define PS1 Prompt
data/bin/pwn_sast CHANGED
@@ -76,12 +76,13 @@ begin
76
76
  CmdExecutionRuby
77
77
  CmdExecutionScala
78
78
  CSRF
79
- Emoticon
80
79
  DeserialJava
80
+ Emoticon
81
81
  Eval
82
- InnerHTML
83
- FilePermission
84
82
  Factory
83
+ FilePermission
84
+ HTTPAuthorizationHeader
85
+ InnerHTML
85
86
  LocationHash
86
87
  Log4J
87
88
  Logger
@@ -23,7 +23,7 @@ module PWN
23
23
  d4 = '%%%%%'.black
24
24
  d5 = '-----'.light_blue
25
25
  d6 = '@@@@@'.black
26
- d7 = ':::::'.white
26
+ d7 = 'PWN::'.red
27
27
  ee1 = '######'.red
28
28
  ee2 = '......'.white
29
29
  ee3 = '******'.blue
@@ -46,7 +46,6 @@ module PWN
46
46
  #{ee1}#{ee2}#{ee3}#{ee4}#{ee5}#{f1}
47
47
  #{ee1}#{ee2}#{ee3}#{ee4}#{ee5}#{f1}
48
48
  #{ee1}#{ee2}#{ee3}#{ee4}#{ee5}#{f1}
49
- PWN
50
49
  "
51
50
  rescue StandardError => e
52
51
  raise e
data/lib/pwn/banner.rb CHANGED
@@ -39,6 +39,20 @@ module PWN
39
39
  banner
40
40
  end
41
41
 
42
+ # Supported Method Parameters::
43
+ # PWN::Banner.get(
44
+ # index: 'optional - defaults to random banner index'
45
+ # )
46
+
47
+ public_class_method def self.welcome
48
+ banner = PWN::Banner.get
49
+ banner = "#{banner}\nUse the #help command & methods for more options.\n"
50
+ banner = "#{banner}e.g help\n"
51
+ banner = "#{banner}e.g PWN.help\n"
52
+ banner = "#{banner}e.g PWN::Plugins.help\n"
53
+ banner = "#{banner}e.g PWN::Plugins::TransparentBrowser.help\n"
54
+ end
55
+
42
56
  # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
43
57
 
44
58
  public_class_method def self.authors
@@ -55,6 +69,8 @@ module PWN
55
69
  index: 'optional - defaults to random banner index'
56
70
  )
57
71
 
72
+ banner = #{self}.welcome
73
+
58
74
  #{self}.authors
59
75
  "
60
76
  end
@@ -9,6 +9,7 @@ module PWN
9
9
  # Supported Method Parameters::
10
10
  # PWN::Plugins::RabbitMQ.open(
11
11
  # hostname: 'required',
12
+ # port: 'optional - defaults to 5672',
12
13
  # username: 'optional',
13
14
  # password: 'optional'
14
15
  # )
@@ -12,7 +12,7 @@ module PWN
12
12
  @@logger = PWN::Plugins::PWNLogger.create
13
13
 
14
14
  # Supported Method Parameters::
15
- # PWN::SAST::Deseria.scan(
15
+ # PWN::SAST::DeserialJava.scan(
16
16
  # :dir_path => 'optional path to dir defaults to .'
17
17
  # :git_repo_root_uri => 'optional http uri of git repo scanned'
18
18
  # )
@@ -0,0 +1,145 @@
1
+ # frozen_string_literal: false
2
+
3
+ require 'socket'
4
+
5
+ module PWN
6
+ module SAST
7
+ # SAST Module used to identify hard-code/plain-text
8
+ # passwords within source code.
9
+ module HTTPAuthorizationHeader
10
+ @@logger = PWN::Plugins::PWNLogger.create
11
+
12
+ # Supported Method Parameters::
13
+ # PWN::SAST::HTTPAuthorizationHeader.scan(
14
+ # :dir_path => 'optional path to dir defaults to .'
15
+ # :git_repo_root_uri => 'optional http uri of git repo scanned'
16
+ # )
17
+
18
+ public_class_method def self.scan(opts = {})
19
+ dir_path = opts[:dir_path]
20
+ git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
21
+ result_arr = []
22
+ logger_results = ''
23
+
24
+ PWN::Plugins::FileFu.recurse_dir(dir_path: dir_path) do |entry|
25
+ if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/
26
+ line_no_and_contents_arr = []
27
+ filename_arr = []
28
+ entry_beautified = false
29
+
30
+ if File.extname(entry) == '.js' && (`wc -l #{entry}`.split.first.to_i < 20 || entry.include?('.min.js') || entry.include?('-all.js'))
31
+ js_beautify = `js-beautify #{entry} > #{entry}.JS-BEAUTIFIED`.to_s.scrub
32
+ entry = "#{entry}.JS-BEAUTIFIED"
33
+ entry_beautified = true
34
+ end
35
+
36
+ test_case_filter = %(
37
+ grep -Ein \
38
+ -e "Authorization:(\\sBasic|Basic)" \
39
+ -e "Authorization:(\\sBearer|Bearer)" \
40
+ -e "Authorization:(\\sDigest|Digest)" \
41
+ -e "Authorization:(\\sHOBA|HOBA)" \
42
+ -e "Authorization:(\\sMutual|Mutual)" \
43
+ -e "Authorization:(\\sNegotiate|Negotiate)" \
44
+ -e "Authorization:(\\sVapid|Vapid)" \
45
+ -e "Authorization:(\\sSCRAM|SCRAM)" \
46
+ -e "Authorization:(\\sAWS|AWS)" \
47
+ -e "authorization(\\s=|=)" #{entry}
48
+ )
49
+
50
+ str = `#{test_case_filter}`.to_s.scrub
51
+
52
+ if str.to_s.empty?
53
+ # If str length is >= 64 KB do not include results. (Due to Mongo Document Size Restrictions)
54
+ logger_results = "#{logger_results}~" # Catching bugs is good :)
55
+ else
56
+ str = "1:Result larger than 64KB -> Size: #{str.to_s.length}. Please click the \"Path\" link for more details." if str.to_s.length >= 64_000
57
+
58
+ hash_line = {
59
+ timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S.%9N %z').to_s,
60
+ test_case: nist_800_53_requirements,
61
+ filename: filename_arr.push(git_repo_root_uri: git_repo_root_uri, entry: entry),
62
+ line_no_and_contents: '',
63
+ raw_content: str,
64
+ test_case_filter: test_case_filter
65
+ }
66
+
67
+ # COMMMENT: Must be a better way to implement this (regex is kinda funky)
68
+ line_contents_split = str.split(/^(\d{1,}):|\n(\d{1,}):/)[1..-1]
69
+ line_no_count = line_contents_split.length # This should always be an even number
70
+ current_count = 0
71
+ while line_no_count > current_count
72
+ line_no = line_contents_split[current_count]
73
+ contents = line_contents_split[current_count + 1]
74
+ if Dir.exist?("#{dir_path}/.git") ||
75
+ Dir.exist?('.git')
76
+
77
+ repo_root = dir_path
78
+ repo_root = '.' if Dir.exist?('.git')
79
+
80
+ author = PWN::Plugins::Git.get_author(
81
+ repo_root: repo_root,
82
+ from_line: line_no,
83
+ to_line: line_no,
84
+ target_file: entry,
85
+ entry_beautified: entry_beautified
86
+ )
87
+ else
88
+ author = 'N/A'
89
+ end
90
+ hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(line_no: line_no,
91
+ contents: contents,
92
+ author: author)
93
+
94
+ current_count += 2
95
+ end
96
+ result_arr.push(hash_line)
97
+ logger_results = "#{logger_results}x" # Seeing progress is good :)
98
+ end
99
+ end
100
+ end
101
+ logger_banner = "http://#{Socket.gethostname}:8808/doc_root/pwn-#{PWN::VERSION.to_s.scrub}/#{to_s.scrub.gsub('::', '/')}.html"
102
+ if logger_results.empty?
103
+ @@logger.info("#{logger_banner}: No files applicable to this test case.\n")
104
+ else
105
+ @@logger.info("#{logger_banner} => #{logger_results}complete.\n")
106
+ end
107
+ result_arr
108
+ end
109
+
110
+ # Used primarily to map NIST 800-53 Revision 4 Security Controls
111
+ # https://web.nvd.nist.gov/view/800-53/Rev4/impact?impactName=HIGH
112
+ # to PWN Exploit & Static Code Anti-Pattern Matching Modules to
113
+ # Determine the level of Testing Coverage w/ PWN.
114
+
115
+ public_class_method def self.nist_800_53_requirements
116
+ {
117
+ sast_module: self,
118
+ section: 'PROTECTION OF INFORMATION AT REST',
119
+ nist_800_53_uri: 'https://csrc.nist.gov/Projects/risk-management/sp800-53-controls/release-search#!/control/?version=5.1&number=SC-28'
120
+ }
121
+ end
122
+
123
+ # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
124
+
125
+ public_class_method def self.authors
126
+ "AUTHOR(S):
127
+ 0day Inc. <request.pentest@0dayinc.com>
128
+ "
129
+ end
130
+
131
+ # Display Usage for this Module
132
+
133
+ public_class_method def self.help
134
+ puts "USAGE:
135
+ sast_arr = #{self}.scan(
136
+ :dir_path => 'optional path to dir defaults to .',
137
+ :git_repo_root_uri => 'optional http uri of git repo scanned'
138
+ )
139
+
140
+ #{self}.authors
141
+ "
142
+ end
143
+ end
144
+ end
145
+ end
data/lib/pwn/sast.rb CHANGED
@@ -22,6 +22,7 @@ module PWN
22
22
  autoload :Eval, 'pwn/sast/eval'
23
23
  autoload :Factory, 'pwn/sast/factory'
24
24
  autoload :FilePermission, 'pwn/sast/file_permission'
25
+ autoload :HTTPAuthorizationHeader, 'pwn/sast/http_authorization_header'
25
26
  autoload :InnerHTML, 'pwn/sast/inner_html'
26
27
  autoload :Keystore, 'pwn/sast/keystore'
27
28
  autoload :LocationHash, 'pwn/sast/location_hash'
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.401'
4
+ VERSION = '0.4.404'
5
5
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe PWN::SAST::HTTPAuthorizationHeader do
6
+ it 'scan method should exist' do
7
+ scan_response = PWN::SAST::HTTPAuthorizationHeader
8
+ expect(scan_response).to respond_to :scan
9
+ end
10
+
11
+ it 'should display information for nist_800_53_requirements' do
12
+ nist_800_53_requirements_response = PWN::SAST::HTTPAuthorizationHeader
13
+ expect(nist_800_53_requirements_response).to respond_to :nist_800_53_requirements
14
+ end
15
+
16
+ it 'should display information for authors' do
17
+ authors_response = PWN::SAST::HTTPAuthorizationHeader
18
+ expect(authors_response).to respond_to :authors
19
+ end
20
+
21
+ it 'should display information for existing help method' do
22
+ help_response = PWN::SAST::HTTPAuthorizationHeader
23
+ expect(help_response).to respond_to :help
24
+ end
25
+ 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.4.401
4
+ version: 0.4.404
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-05 00:00:00.000000000 Z
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 5.2.1
89
+ version: 5.2.2
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 5.2.1
96
+ version: 5.2.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bson
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 2.3.10
117
+ version: 2.3.11
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 2.3.10
124
+ version: 2.3.11
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler-audit
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -408,14 +408,14 @@ dependencies:
408
408
  requirements:
409
409
  - - '='
410
410
  - !ruby/object:Gem::Version
411
- version: 1.13.3
411
+ version: 1.13.4
412
412
  type: :runtime
413
413
  prerelease: false
414
414
  version_requirements: !ruby/object:Gem::Requirement
415
415
  requirements:
416
416
  - - '='
417
417
  - !ruby/object:Gem::Version
418
- version: 1.13.3
418
+ version: 1.13.4
419
419
  - !ruby/object:Gem::Dependency
420
420
  name: oily_png
421
421
  requirement: !ruby/object:Gem::Requirement
@@ -604,14 +604,14 @@ dependencies:
604
604
  requirements:
605
605
  - - '='
606
606
  - !ruby/object:Gem::Version
607
- version: 4.2.4
607
+ version: 4.2.5
608
608
  type: :runtime
609
609
  prerelease: false
610
610
  version_requirements: !ruby/object:Gem::Requirement
611
611
  requirements:
612
612
  - - '='
613
613
  - !ruby/object:Gem::Version
614
- version: 4.2.4
614
+ version: 4.2.5
615
615
  - !ruby/object:Gem::Dependency
616
616
  name: rspec
617
617
  requirement: !ruby/object:Gem::Requirement
@@ -646,14 +646,14 @@ dependencies:
646
646
  requirements:
647
647
  - - '='
648
648
  - !ruby/object:Gem::Version
649
- version: 1.26.1
649
+ version: 1.27.0
650
650
  type: :runtime
651
651
  prerelease: false
652
652
  version_requirements: !ruby/object:Gem::Requirement
653
653
  requirements:
654
654
  - - '='
655
655
  - !ruby/object:Gem::Version
656
- version: 1.26.1
656
+ version: 1.27.0
657
657
  - !ruby/object:Gem::Dependency
658
658
  name: rubocop-rake
659
659
  requirement: !ruby/object:Gem::Requirement
@@ -1532,6 +1532,7 @@ files:
1532
1532
  - lib/pwn/sast/eval.rb
1533
1533
  - lib/pwn/sast/factory.rb
1534
1534
  - lib/pwn/sast/file_permission.rb
1535
+ - lib/pwn/sast/http_authorization_header.rb
1535
1536
  - lib/pwn/sast/inner_html.rb
1536
1537
  - lib/pwn/sast/keystore.rb
1537
1538
  - lib/pwn/sast/location_hash.rb
@@ -1825,6 +1826,7 @@ files:
1825
1826
  - spec/lib/pwn/sast/eval_spec.rb
1826
1827
  - spec/lib/pwn/sast/factory_spec.rb
1827
1828
  - spec/lib/pwn/sast/file_permission_spec.rb
1829
+ - spec/lib/pwn/sast/http_authorization_header_spec.rb
1828
1830
  - spec/lib/pwn/sast/inner_html_spec.rb
1829
1831
  - spec/lib/pwn/sast/keystore_spec.rb
1830
1832
  - spec/lib/pwn/sast/location_hash_spec.rb
@@ -1920,7 +1922,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1920
1922
  - !ruby/object:Gem::Version
1921
1923
  version: '0'
1922
1924
  requirements: []
1923
- rubygems_version: 3.3.10
1925
+ rubygems_version: 3.3.11
1924
1926
  signing_key:
1925
1927
  specification_version: 4
1926
1928
  summary: Automated Security Testing for CI/CD Pipelines & Beyond
@@ -2092,6 +2094,7 @@ test_files:
2092
2094
  - spec/lib/pwn/sast/eval_spec.rb
2093
2095
  - spec/lib/pwn/sast/factory_spec.rb
2094
2096
  - spec/lib/pwn/sast/file_permission_spec.rb
2097
+ - spec/lib/pwn/sast/http_authorization_header_spec.rb
2095
2098
  - spec/lib/pwn/sast/inner_html_spec.rb
2096
2099
  - spec/lib/pwn/sast/keystore_spec.rb
2097
2100
  - spec/lib/pwn/sast/location_hash_spec.rb