pwn 0.5.436 → 0.5.438
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 +3 -3
- data/lib/pwn/ai/introspection.rb +0 -1
- data/lib/pwn/reports/sast.rb +50 -58
- data/lib/pwn/sast/amqp_connect_as_guest.rb +19 -2
- data/lib/pwn/sast/apache_file_system_util_api.rb +19 -2
- data/lib/pwn/sast/aws.rb +19 -2
- data/lib/pwn/sast/banned_function_calls_c.rb +19 -2
- data/lib/pwn/sast/base64.rb +19 -2
- data/lib/pwn/sast/beef_hook.rb +19 -2
- data/lib/pwn/sast/cmd_execution_java.rb +19 -2
- data/lib/pwn/sast/cmd_execution_python.rb +19 -2
- data/lib/pwn/sast/cmd_execution_ruby.rb +19 -2
- data/lib/pwn/sast/cmd_execution_scala.rb +19 -2
- data/lib/pwn/sast/csrf.rb +19 -2
- data/lib/pwn/sast/deserial_java.rb +19 -2
- data/lib/pwn/sast/emoticon.rb +19 -2
- data/lib/pwn/sast/eval.rb +19 -2
- data/lib/pwn/sast/factory.rb +19 -2
- data/lib/pwn/sast/http_authorization_header.rb +19 -2
- data/lib/pwn/sast/inner_html.rb +19 -2
- data/lib/pwn/sast/keystore.rb +19 -2
- data/lib/pwn/sast/local_storage.rb +19 -2
- data/lib/pwn/sast/location_hash.rb +19 -2
- data/lib/pwn/sast/log4j.rb +19 -2
- data/lib/pwn/sast/logger.rb +19 -2
- data/lib/pwn/sast/md5.rb +19 -2
- data/lib/pwn/sast/outer_html.rb +19 -2
- data/lib/pwn/sast/padding_oracle.rb +19 -2
- data/lib/pwn/sast/password.rb +19 -2
- data/lib/pwn/sast/php_input_mechanisms.rb +19 -2
- data/lib/pwn/sast/php_type_juggling.rb +19 -2
- data/lib/pwn/sast/pom_version.rb +19 -2
- data/lib/pwn/sast/port.rb +19 -2
- data/lib/pwn/sast/post_message.rb +19 -2
- data/lib/pwn/sast/private_key.rb +19 -2
- data/lib/pwn/sast/redirect.rb +19 -2
- data/lib/pwn/sast/redos.rb +19 -2
- data/lib/pwn/sast/shell.rb +19 -2
- data/lib/pwn/sast/signature.rb +19 -2
- data/lib/pwn/sast/sql.rb +19 -2
- data/lib/pwn/sast/ssl.rb +19 -2
- data/lib/pwn/sast/sudo.rb +19 -2
- data/lib/pwn/sast/task_tag.rb +19 -2
- data/lib/pwn/sast/throw_errors.rb +19 -2
- data/lib/pwn/sast/token.rb +19 -2
- data/lib/pwn/sast/type_script_type_juggling.rb +19 -2
- data/lib/pwn/sast/version.rb +19 -2
- data/lib/pwn/sast/window_location_hash.rb +19 -2
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if (File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/) && File.extname(entry).include?('.php') && entry !~ /test/i
|
@@ -80,10 +82,25 @@ module PWN
|
|
80
82
|
end
|
81
83
|
author ||= 'N/A'
|
82
84
|
|
85
|
+
ai_analysis = nil
|
86
|
+
if ai_introspection
|
87
|
+
request = {
|
88
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
89
|
+
line_no: line_no,
|
90
|
+
source_code_snippet: contents
|
91
|
+
}.to_json
|
92
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
93
|
+
if response.is_a?(Hash)
|
94
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
95
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
83
99
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
84
100
|
line_no: line_no,
|
85
101
|
contents: contents,
|
86
|
-
author: author
|
102
|
+
author: author,
|
103
|
+
ai_analysis: ai_analysis
|
87
104
|
)
|
88
105
|
|
89
106
|
current_count += 2
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if (File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/) && File.extname(entry).include?('.php') && entry !~ /test/i
|
@@ -78,10 +80,25 @@ module PWN
|
|
78
80
|
end
|
79
81
|
author ||= 'N/A'
|
80
82
|
|
83
|
+
ai_analysis = nil
|
84
|
+
if ai_introspection
|
85
|
+
request = {
|
86
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
87
|
+
line_no: line_no,
|
88
|
+
source_code_snippet: contents
|
89
|
+
}.to_json
|
90
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
91
|
+
if response.is_a?(Hash)
|
92
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
93
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
81
97
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
82
98
|
line_no: line_no,
|
83
99
|
contents: contents,
|
84
|
-
author: author
|
100
|
+
author: author,
|
101
|
+
ai_analysis: ai_analysis
|
85
102
|
)
|
86
103
|
|
87
104
|
current_count += 2
|
data/lib/pwn/sast/pom_version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -20,7 +21,8 @@ module PWN
|
|
20
21
|
dir_path = opts[:dir_path]
|
21
22
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
23
|
result_arr = []
|
23
|
-
|
24
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
25
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
24
26
|
|
25
27
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
26
28
|
if File.file?(entry) && File.basename(entry) == 'pom.xml' && entry !~ /test/i
|
@@ -77,10 +79,25 @@ module PWN
|
|
77
79
|
end
|
78
80
|
author ||= 'N/A'
|
79
81
|
|
82
|
+
ai_analysis = nil
|
83
|
+
if ai_introspection
|
84
|
+
request = {
|
85
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
86
|
+
line_no: line_no,
|
87
|
+
source_code_snippet: contents
|
88
|
+
}.to_json
|
89
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
90
|
+
if response.is_a?(Hash)
|
91
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
92
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
80
96
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
81
97
|
line_no: line_no,
|
82
98
|
contents: contents,
|
83
|
-
author: author
|
99
|
+
author: author,
|
100
|
+
ai_analysis: ai_analysis
|
84
101
|
)
|
85
102
|
|
86
103
|
current_count += 2
|
data/lib/pwn/sast/port.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -21,7 +22,8 @@ module PWN
|
|
21
22
|
dir_path = opts[:dir_path]
|
22
23
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
23
24
|
result_arr = []
|
24
|
-
|
25
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
26
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
25
27
|
|
26
28
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
27
29
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -81,10 +83,25 @@ module PWN
|
|
81
83
|
end
|
82
84
|
author ||= 'N/A'
|
83
85
|
|
86
|
+
ai_analysis = nil
|
87
|
+
if ai_introspection
|
88
|
+
request = {
|
89
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
90
|
+
line_no: line_no,
|
91
|
+
source_code_snippet: contents
|
92
|
+
}.to_json
|
93
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
94
|
+
if response.is_a?(Hash)
|
95
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
96
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
84
100
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
85
101
|
line_no: line_no,
|
86
102
|
contents: contents,
|
87
|
-
author: author
|
103
|
+
author: author,
|
104
|
+
ai_analysis: ai_analysis
|
88
105
|
)
|
89
106
|
|
90
107
|
current_count += 2
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -20,7 +21,8 @@ module PWN
|
|
20
21
|
dir_path = opts[:dir_path]
|
21
22
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
23
|
result_arr = []
|
23
|
-
|
24
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
25
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
24
26
|
|
25
27
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
26
28
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -75,10 +77,25 @@ module PWN
|
|
75
77
|
end
|
76
78
|
author ||= 'N/A'
|
77
79
|
|
80
|
+
ai_analysis = nil
|
81
|
+
if ai_introspection
|
82
|
+
request = {
|
83
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
84
|
+
line_no: line_no,
|
85
|
+
source_code_snippet: contents
|
86
|
+
}.to_json
|
87
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
88
|
+
if response.is_a?(Hash)
|
89
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
90
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
78
94
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
79
95
|
line_no: line_no,
|
80
96
|
contents: contents,
|
81
|
-
author: author
|
97
|
+
author: author,
|
98
|
+
ai_analysis: ai_analysis
|
82
99
|
)
|
83
100
|
|
84
101
|
current_count += 2
|
data/lib/pwn/sast/private_key.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -74,10 +76,25 @@ module PWN
|
|
74
76
|
end
|
75
77
|
author ||= 'N/A'
|
76
78
|
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_introspection
|
81
|
+
request = {
|
82
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
83
|
+
line_no: line_no,
|
84
|
+
source_code_snippet: contents
|
85
|
+
}.to_json
|
86
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
87
|
+
if response.is_a?(Hash)
|
88
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
89
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
77
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
78
94
|
line_no: line_no,
|
79
95
|
contents: contents,
|
80
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
81
98
|
)
|
82
99
|
|
83
100
|
current_count += 2
|
data/lib/pwn/sast/redirect.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -76,10 +78,25 @@ module PWN
|
|
76
78
|
end
|
77
79
|
author ||= 'N/A'
|
78
80
|
|
81
|
+
ai_analysis = nil
|
82
|
+
if ai_introspection
|
83
|
+
request = {
|
84
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
85
|
+
line_no: line_no,
|
86
|
+
source_code_snippet: contents
|
87
|
+
}.to_json
|
88
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
89
|
+
if response.is_a?(Hash)
|
90
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
91
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
79
95
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
80
96
|
line_no: line_no,
|
81
97
|
contents: contents,
|
82
|
-
author: author
|
98
|
+
author: author,
|
99
|
+
ai_analysis: ai_analysis
|
83
100
|
)
|
84
101
|
|
85
102
|
current_count += 2
|
data/lib/pwn/sast/redos.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -20,7 +21,8 @@ module PWN
|
|
20
21
|
dir_path = opts[:dir_path]
|
21
22
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
23
|
result_arr = []
|
23
|
-
|
24
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
25
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
24
26
|
|
25
27
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
26
28
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -81,10 +83,25 @@ module PWN
|
|
81
83
|
end
|
82
84
|
author ||= 'N/A'
|
83
85
|
|
86
|
+
ai_analysis = nil
|
87
|
+
if ai_introspection
|
88
|
+
request = {
|
89
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
90
|
+
line_no: line_no,
|
91
|
+
source_code_snippet: contents
|
92
|
+
}.to_json
|
93
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
94
|
+
if response.is_a?(Hash)
|
95
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
96
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
84
100
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
85
101
|
line_no: line_no,
|
86
102
|
contents: contents,
|
87
|
-
author: author
|
103
|
+
author: author,
|
104
|
+
ai_analysis: ai_analysis
|
88
105
|
)
|
89
106
|
|
90
107
|
current_count += 2
|
data/lib/pwn/sast/shell.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -82,10 +84,25 @@ module PWN
|
|
82
84
|
end
|
83
85
|
author ||= 'N/A'
|
84
86
|
|
87
|
+
ai_analysis = nil
|
88
|
+
if ai_introspection
|
89
|
+
request = {
|
90
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
91
|
+
line_no: line_no,
|
92
|
+
source_code_snippet: contents
|
93
|
+
}.to_json
|
94
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
95
|
+
if response.is_a?(Hash)
|
96
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
97
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
85
101
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
86
102
|
line_no: line_no,
|
87
103
|
contents: contents,
|
88
|
-
author: author
|
104
|
+
author: author,
|
105
|
+
ai_analysis: ai_analysis
|
89
106
|
)
|
90
107
|
|
91
108
|
current_count += 2
|
data/lib/pwn/sast/signature.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -74,10 +76,25 @@ module PWN
|
|
74
76
|
end
|
75
77
|
author ||= 'N/A'
|
76
78
|
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_introspection
|
81
|
+
request = {
|
82
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
83
|
+
line_no: line_no,
|
84
|
+
source_code_snippet: contents
|
85
|
+
}.to_json
|
86
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
87
|
+
if response.is_a?(Hash)
|
88
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
89
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
77
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
78
94
|
line_no: line_no,
|
79
95
|
contents: contents,
|
80
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
81
98
|
)
|
82
99
|
|
83
100
|
current_count += 2
|
data/lib/pwn/sast/sql.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -20,7 +21,8 @@ module PWN
|
|
20
21
|
dir_path = opts[:dir_path]
|
21
22
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
23
|
result_arr = []
|
23
|
-
|
24
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
25
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
24
26
|
|
25
27
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
26
28
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -78,10 +80,25 @@ module PWN
|
|
78
80
|
end
|
79
81
|
author ||= 'N/A'
|
80
82
|
|
83
|
+
ai_analysis = nil
|
84
|
+
if ai_introspection
|
85
|
+
request = {
|
86
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
87
|
+
line_no: line_no,
|
88
|
+
source_code_snippet: contents
|
89
|
+
}.to_json
|
90
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
91
|
+
if response.is_a?(Hash)
|
92
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
93
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
81
97
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
82
98
|
line_no: line_no,
|
83
99
|
contents: contents,
|
84
|
-
author: author
|
100
|
+
author: author,
|
101
|
+
ai_analysis: ai_analysis
|
85
102
|
)
|
86
103
|
|
87
104
|
current_count += 2
|
data/lib/pwn/sast/ssl.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -78,10 +80,25 @@ module PWN
|
|
78
80
|
end
|
79
81
|
author ||= 'N/A'
|
80
82
|
|
83
|
+
ai_analysis = nil
|
84
|
+
if ai_introspection
|
85
|
+
request = {
|
86
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
87
|
+
line_no: line_no,
|
88
|
+
source_code_snippet: contents
|
89
|
+
}.to_json
|
90
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
91
|
+
if response.is_a?(Hash)
|
92
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
93
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
81
97
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
82
98
|
line_no: line_no,
|
83
99
|
contents: contents,
|
84
|
-
author: author
|
100
|
+
author: author,
|
101
|
+
ai_analysis: ai_analysis
|
85
102
|
)
|
86
103
|
|
87
104
|
current_count += 2
|
data/lib/pwn/sast/sudo.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -74,10 +76,25 @@ module PWN
|
|
74
76
|
end
|
75
77
|
author ||= 'N/A'
|
76
78
|
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_introspection
|
81
|
+
request = {
|
82
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
83
|
+
line_no: line_no,
|
84
|
+
source_code_snippet: contents
|
85
|
+
}.to_json
|
86
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
87
|
+
if response.is_a?(Hash)
|
88
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
89
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
77
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
78
94
|
line_no: line_no,
|
79
95
|
contents: contents,
|
80
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
81
98
|
)
|
82
99
|
|
83
100
|
current_count += 2
|
data/lib/pwn/sast/task_tag.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -20,7 +21,8 @@ module PWN
|
|
20
21
|
dir_path = opts[:dir_path]
|
21
22
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
23
|
result_arr = []
|
23
|
-
|
24
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
25
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
24
26
|
|
25
27
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
26
28
|
if File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/ && entry !~ /test/i
|
@@ -88,10 +90,25 @@ module PWN
|
|
88
90
|
end
|
89
91
|
author ||= 'N/A'
|
90
92
|
|
93
|
+
ai_analysis = nil
|
94
|
+
if ai_introspection
|
95
|
+
request = {
|
96
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
97
|
+
line_no: line_no,
|
98
|
+
source_code_snippet: contents
|
99
|
+
}.to_json
|
100
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
101
|
+
if response.is_a?(Hash)
|
102
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
103
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
91
107
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
92
108
|
line_no: line_no,
|
93
109
|
contents: contents,
|
94
|
-
author: author
|
110
|
+
author: author,
|
111
|
+
ai_analysis: ai_analysis
|
95
112
|
)
|
96
113
|
|
97
114
|
current_count += 2
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'socket'
|
4
5
|
|
5
6
|
module PWN
|
@@ -19,7 +20,8 @@ module PWN
|
|
19
20
|
dir_path = opts[:dir_path]
|
20
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
21
22
|
result_arr = []
|
22
|
-
|
23
|
+
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
+
logger_results = "AI Introspection => #{ai_introspection} => "
|
23
25
|
|
24
26
|
PWN::Plugins::FileFu.recurse_in_dir(dir_path: dir_path) do |entry|
|
25
27
|
if (File.file?(entry) && File.basename(entry) !~ /^pwn.+(html|json|db)$/ && File.basename(entry) !~ /\.JS-BEAUTIFIED$/) && entry !~ /test/i
|
@@ -77,10 +79,25 @@ module PWN
|
|
77
79
|
end
|
78
80
|
author ||= 'N/A'
|
79
81
|
|
82
|
+
ai_analysis = nil
|
83
|
+
if ai_introspection
|
84
|
+
request = {
|
85
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
86
|
+
line_no: line_no,
|
87
|
+
source_code_snippet: contents
|
88
|
+
}.to_json
|
89
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
90
|
+
if response.is_a?(Hash)
|
91
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
92
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
80
96
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
81
97
|
line_no: line_no,
|
82
98
|
contents: contents,
|
83
|
-
author: author
|
99
|
+
author: author,
|
100
|
+
ai_analysis: ai_analysis
|
84
101
|
)
|
85
102
|
|
86
103
|
current_count += 2
|