pwn 0.5.436 → 0.5.437
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/reports/sast.rb +50 -57
- data/lib/pwn/sast/amqp_connect_as_guest.rb +17 -1
- data/lib/pwn/sast/apache_file_system_util_api.rb +17 -1
- data/lib/pwn/sast/aws.rb +17 -1
- data/lib/pwn/sast/banned_function_calls_c.rb +17 -1
- data/lib/pwn/sast/base64.rb +17 -1
- data/lib/pwn/sast/beef_hook.rb +17 -1
- data/lib/pwn/sast/cmd_execution_java.rb +17 -1
- data/lib/pwn/sast/cmd_execution_python.rb +17 -1
- data/lib/pwn/sast/cmd_execution_ruby.rb +17 -1
- data/lib/pwn/sast/cmd_execution_scala.rb +17 -1
- data/lib/pwn/sast/csrf.rb +17 -1
- data/lib/pwn/sast/deserial_java.rb +17 -1
- data/lib/pwn/sast/emoticon.rb +17 -1
- data/lib/pwn/sast/eval.rb +17 -1
- data/lib/pwn/sast/factory.rb +17 -1
- data/lib/pwn/sast/http_authorization_header.rb +17 -1
- data/lib/pwn/sast/inner_html.rb +17 -1
- data/lib/pwn/sast/keystore.rb +17 -1
- data/lib/pwn/sast/local_storage.rb +17 -1
- data/lib/pwn/sast/location_hash.rb +17 -1
- data/lib/pwn/sast/log4j.rb +17 -1
- data/lib/pwn/sast/logger.rb +17 -1
- data/lib/pwn/sast/md5.rb +17 -1
- data/lib/pwn/sast/outer_html.rb +17 -1
- data/lib/pwn/sast/padding_oracle.rb +17 -1
- data/lib/pwn/sast/password.rb +17 -1
- data/lib/pwn/sast/php_input_mechanisms.rb +17 -1
- data/lib/pwn/sast/php_type_juggling.rb +17 -1
- data/lib/pwn/sast/pom_version.rb +17 -1
- data/lib/pwn/sast/port.rb +17 -1
- data/lib/pwn/sast/post_message.rb +17 -1
- data/lib/pwn/sast/private_key.rb +17 -1
- data/lib/pwn/sast/redirect.rb +17 -1
- data/lib/pwn/sast/redos.rb +17 -1
- data/lib/pwn/sast/shell.rb +17 -1
- data/lib/pwn/sast/signature.rb +17 -1
- data/lib/pwn/sast/sql.rb +17 -1
- data/lib/pwn/sast/ssl.rb +17 -1
- data/lib/pwn/sast/sudo.rb +17 -1
- data/lib/pwn/sast/task_tag.rb +17 -1
- data/lib/pwn/sast/throw_errors.rb +17 -1
- data/lib/pwn/sast/token.rb +17 -1
- data/lib/pwn/sast/type_script_type_juggling.rb +17 -1
- data/lib/pwn/sast/version.rb +17 -1
- data/lib/pwn/sast/window_location_hash.rb +17 -1
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc4595f20cb20cc81eb1633ea84a91a9d3fd7ab8c7a17b718ec2ba15451412d5
|
4
|
+
data.tar.gz: 991eb600f873d5f1ad790ade4791dcacedd3eecab8e6375bb646a3a3c4979afb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289bb8fafb11ccc48cd7335fbbbc451f9629414f2c7d4f47913d2568649ae63b57d36cf3e5d8711bb38dd8ce59741f629d27a264aa4879daca55d851a635e430
|
7
|
+
data.tar.gz: fc6256cc8b76c11f1286531e97c762572bda96fe337b73a905e30941fedc7978ce69886cf1f77a8895ee2284cdf624fe732df1407f36027f70ffaceb5ad1eee2
|
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.
|
40
|
+
pwn[v0.5.437]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.5.
|
55
|
+
pwn[v0.5.437]: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.4.4@pwn
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
64
64
|
$ pwn
|
65
|
-
pwn[v0.5.
|
65
|
+
pwn[v0.5.437]: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:
|
data/lib/pwn/reports/sast.rb
CHANGED
@@ -25,62 +25,55 @@ module PWN
|
|
25
25
|
}
|
26
26
|
report_name = opts[:report_name] ||= File.basename(Dir.pwd)
|
27
27
|
|
28
|
-
ai_instrospection = PWN::Env[:ai][:introspection]
|
29
|
-
puts "Analyzing source code using AI engine: #{engine}\nModel: #{model}\nSystem Role Content: #{system_role_content}\nTemperature: #{temp}" if ai_instrospection
|
30
|
-
|
31
28
|
# Calculate percentage of AI analysis based on the number of entries
|
32
|
-
total_entries = results_hash[:data].sum { |entry| entry[:line_no_and_contents].size }
|
33
|
-
puts "Total entries to analyze: #{total_entries}" if engine
|
34
|
-
|
35
|
-
percent_complete = 0.0
|
36
|
-
entry_count = 0
|
37
|
-
spin = TTY::Spinner.new(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
)
|
42
|
-
spin.auto_spin
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
total_entries: total_entries
|
81
|
-
)
|
82
|
-
end
|
83
|
-
end
|
29
|
+
# total_entries = results_hash[:data].sum { |entry| entry[:line_no_and_contents].size }
|
30
|
+
# puts "Total entries to analyze: #{total_entries}" if engine
|
31
|
+
|
32
|
+
# percent_complete = 0.0
|
33
|
+
# entry_count = 0
|
34
|
+
# spin = TTY::Spinner.new(
|
35
|
+
# '[:spinner] Report Generation Progress: :percent_complete :entry_count of :total_entries',
|
36
|
+
# format: :dots,
|
37
|
+
# hide_cursor: true
|
38
|
+
# )
|
39
|
+
# spin.auto_spin
|
40
|
+
|
41
|
+
# ai_instrospection = PWN::Env[:ai][:introspection]
|
42
|
+
# puts "Analyzing source code using AI engine: #{engine}\nModel: #{model}\nSystem Role Content: #{system_role_content}\nTemperature: #{temp}" if ai_instrospection
|
43
|
+
|
44
|
+
# results_hash[:data].each do |hash_line|
|
45
|
+
# git_repo_root_uri = hash_line[:filename][:git_repo_root_uri]
|
46
|
+
# filename = hash_line[:filename][:entry]
|
47
|
+
# hash_line[:line_no_and_contents].each do |src_detail|
|
48
|
+
# entry_count += 1
|
49
|
+
# percent_complete = (entry_count.to_f / total_entries * 100).round(2)
|
50
|
+
# line_no = src_detail[:line_no]
|
51
|
+
# source_code_snippet = src_detail[:contents]
|
52
|
+
# author = src_detail[:author].to_s.scrub.chomp.strip
|
53
|
+
# response = nil
|
54
|
+
# if ai_instrospection
|
55
|
+
# request = {
|
56
|
+
# scm_uri: "#{git_repo_root_uri}/#{filename}",
|
57
|
+
# line: line_no,
|
58
|
+
# source_code_snippet: source_code_snippet
|
59
|
+
# }.to_json
|
60
|
+
# response = PWN::AI::Introspection.reflect(request: request)
|
61
|
+
# end
|
62
|
+
# ai_analysis = nil
|
63
|
+
# if response.is_a?(Hash)
|
64
|
+
# ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
65
|
+
# ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
66
|
+
# puts "AI Analysis Progress: #{percent_complete}% Line: #{line_no} | Author: #{author} | AI Analysis: #{ai_analysis}\n\n\n" if ai_analysis
|
67
|
+
# end
|
68
|
+
# src_detail[:ai_analysis] = ai_analysis.to_s.scrub.chomp.strip
|
69
|
+
# spin.update(
|
70
|
+
# percent_complete: "#{percent_complete}%",
|
71
|
+
# entry_count: entry_count,
|
72
|
+
# total_entries: total_entries
|
73
|
+
# )
|
74
|
+
# end
|
75
|
+
# end
|
76
|
+
|
84
77
|
# JSON object Completion
|
85
78
|
# File.open("#{dir_path}/pwn_scan_git_source.json", 'w') do |f|
|
86
79
|
# f.print(results_hash.to_json)
|
@@ -467,8 +460,8 @@ module PWN
|
|
467
460
|
end
|
468
461
|
rescue StandardError => e
|
469
462
|
raise e
|
470
|
-
|
471
|
-
spin.stop unless spin.nil?
|
463
|
+
# ensure
|
464
|
+
# spin.stop unless spin.nil?
|
472
465
|
end
|
473
466
|
|
474
467
|
# Author(s):: 0day Inc. <support@0dayinc.com>
|
@@ -75,10 +75,26 @@ module PWN
|
|
75
75
|
end
|
76
76
|
author ||= 'N/A'
|
77
77
|
|
78
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_instrospection
|
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
|
+
|
78
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
79
94
|
line_no: line_no,
|
80
95
|
contents: contents,
|
81
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
82
98
|
)
|
83
99
|
current_count += 2
|
84
100
|
end
|
@@ -75,10 +75,26 @@ module PWN
|
|
75
75
|
end
|
76
76
|
author ||= 'N/A'
|
77
77
|
|
78
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_instrospection
|
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
|
+
|
78
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
79
94
|
line_no: line_no,
|
80
95
|
contents: contents,
|
81
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
82
98
|
)
|
83
99
|
|
84
100
|
current_count += 2
|
data/lib/pwn/sast/aws.rb
CHANGED
@@ -76,10 +76,26 @@ module PWN
|
|
76
76
|
end
|
77
77
|
author ||= 'N/A'
|
78
78
|
|
79
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
80
|
+
ai_analysis = nil
|
81
|
+
if ai_instrospection
|
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
|
+
|
79
94
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
80
95
|
line_no: line_no,
|
81
96
|
contents: contents,
|
82
|
-
author: author
|
97
|
+
author: author,
|
98
|
+
ai_analysis: ai_analysis
|
83
99
|
)
|
84
100
|
|
85
101
|
current_count += 2
|
@@ -203,10 +203,26 @@ module PWN
|
|
203
203
|
end
|
204
204
|
author ||= 'N/A'
|
205
205
|
|
206
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
207
|
+
ai_analysis = nil
|
208
|
+
if ai_instrospection
|
209
|
+
request = {
|
210
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
211
|
+
line_no: line_no,
|
212
|
+
source_code_snippet: contents
|
213
|
+
}.to_json
|
214
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
215
|
+
if response.is_a?(Hash)
|
216
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
217
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
206
221
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
207
222
|
line_no: line_no,
|
208
223
|
contents: contents,
|
209
|
-
author: author
|
224
|
+
author: author,
|
225
|
+
ai_analysis: ai_analysis
|
210
226
|
)
|
211
227
|
|
212
228
|
current_count += 2
|
data/lib/pwn/sast/base64.rb
CHANGED
@@ -74,10 +74,26 @@ module PWN
|
|
74
74
|
end
|
75
75
|
author ||= 'N/A'
|
76
76
|
|
77
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
78
|
+
ai_analysis = nil
|
79
|
+
if ai_instrospection
|
80
|
+
request = {
|
81
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
82
|
+
line_no: line_no,
|
83
|
+
source_code_snippet: contents
|
84
|
+
}.to_json
|
85
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
86
|
+
if response.is_a?(Hash)
|
87
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
88
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
77
92
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
78
93
|
line_no: line_no,
|
79
94
|
contents: contents,
|
80
|
-
author: author
|
95
|
+
author: author,
|
96
|
+
ai_analysis: ai_analysis
|
81
97
|
)
|
82
98
|
|
83
99
|
current_count += 2
|
data/lib/pwn/sast/beef_hook.rb
CHANGED
@@ -74,10 +74,26 @@ module PWN
|
|
74
74
|
end
|
75
75
|
author ||= 'N/A'
|
76
76
|
|
77
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
78
|
+
ai_analysis = nil
|
79
|
+
if ai_instrospection
|
80
|
+
request = {
|
81
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
82
|
+
line_no: line_no,
|
83
|
+
source_code_snippet: contents
|
84
|
+
}.to_json
|
85
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
86
|
+
if response.is_a?(Hash)
|
87
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
88
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
77
92
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
78
93
|
line_no: line_no,
|
79
94
|
contents: contents,
|
80
|
-
author: author
|
95
|
+
author: author,
|
96
|
+
ai_analysis: ai_analysis
|
81
97
|
)
|
82
98
|
|
83
99
|
current_count += 2
|
@@ -76,10 +76,26 @@ module PWN
|
|
76
76
|
end
|
77
77
|
author ||= 'N/A'
|
78
78
|
|
79
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
80
|
+
ai_analysis = nil
|
81
|
+
if ai_instrospection
|
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
|
+
|
79
94
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
80
95
|
line_no: line_no,
|
81
96
|
contents: contents,
|
82
|
-
author: author
|
97
|
+
author: author,
|
98
|
+
ai_analysis: ai_analysis
|
83
99
|
)
|
84
100
|
|
85
101
|
current_count += 2
|
@@ -78,10 +78,26 @@ module PWN
|
|
78
78
|
end
|
79
79
|
author ||= 'N/A'
|
80
80
|
|
81
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
82
|
+
ai_analysis = nil
|
83
|
+
if ai_instrospection
|
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
|
+
|
81
96
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
82
97
|
line_no: line_no,
|
83
98
|
contents: contents,
|
84
|
-
author: author
|
99
|
+
author: author,
|
100
|
+
ai_analysis: ai_analysis
|
85
101
|
)
|
86
102
|
|
87
103
|
current_count += 2
|
@@ -86,10 +86,26 @@ module PWN
|
|
86
86
|
end
|
87
87
|
author ||= 'N/A'
|
88
88
|
|
89
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
90
|
+
ai_analysis = nil
|
91
|
+
if ai_instrospection
|
92
|
+
request = {
|
93
|
+
scm_uri: "#{hash_line[:filename][:git_repo_root_uri]}/#{hash_line[:filename][:entry]}",
|
94
|
+
line_no: line_no,
|
95
|
+
source_code_snippet: contents
|
96
|
+
}.to_json
|
97
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
98
|
+
if response.is_a?(Hash)
|
99
|
+
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
100
|
+
ai_analysis = response[:choices].last[:content] if response[:choices].last.keys.include?(:content)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
89
104
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
90
105
|
line_no: line_no,
|
91
106
|
contents: contents,
|
92
|
-
author: author
|
107
|
+
author: author,
|
108
|
+
ai_analysis: ai_analysis
|
93
109
|
)
|
94
110
|
|
95
111
|
current_count += 2
|
@@ -76,10 +76,26 @@ module PWN
|
|
76
76
|
end
|
77
77
|
author ||= 'N/A'
|
78
78
|
|
79
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
80
|
+
ai_analysis = nil
|
81
|
+
if ai_instrospection
|
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
|
+
|
79
94
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
80
95
|
line_no: line_no,
|
81
96
|
contents: contents,
|
82
|
-
author: author
|
97
|
+
author: author,
|
98
|
+
ai_analysis: ai_analysis
|
83
99
|
)
|
84
100
|
|
85
101
|
current_count += 2
|
data/lib/pwn/sast/csrf.rb
CHANGED
@@ -75,10 +75,26 @@ module PWN
|
|
75
75
|
end
|
76
76
|
author ||= 'N/A'
|
77
77
|
|
78
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_instrospection
|
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
|
+
|
78
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
79
94
|
line_no: line_no,
|
80
95
|
contents: contents,
|
81
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
82
98
|
)
|
83
99
|
|
84
100
|
current_count += 2
|
@@ -83,10 +83,26 @@ module PWN
|
|
83
83
|
end
|
84
84
|
author ||= 'N/A'
|
85
85
|
|
86
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
87
|
+
ai_analysis = nil
|
88
|
+
if ai_instrospection
|
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
|
+
|
86
101
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
87
102
|
line_no: line_no,
|
88
103
|
contents: contents,
|
89
|
-
author: author
|
104
|
+
author: author,
|
105
|
+
ai_analysis: ai_analysis
|
90
106
|
)
|
91
107
|
|
92
108
|
current_count += 2
|
data/lib/pwn/sast/emoticon.rb
CHANGED
@@ -81,10 +81,26 @@ module PWN
|
|
81
81
|
end
|
82
82
|
author ||= 'N/A'
|
83
83
|
|
84
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
85
|
+
ai_analysis = nil
|
86
|
+
if ai_instrospection
|
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
|
+
|
84
99
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
85
100
|
line_no: line_no,
|
86
101
|
contents: contents,
|
87
|
-
author: author
|
102
|
+
author: author,
|
103
|
+
ai_analysis: ai_analysis
|
88
104
|
)
|
89
105
|
|
90
106
|
current_count += 2
|
data/lib/pwn/sast/eval.rb
CHANGED
@@ -75,10 +75,26 @@ module PWN
|
|
75
75
|
end
|
76
76
|
author ||= 'N/A'
|
77
77
|
|
78
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_instrospection
|
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
|
+
|
78
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
79
94
|
line_no: line_no,
|
80
95
|
contents: contents,
|
81
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
82
98
|
)
|
83
99
|
|
84
100
|
current_count += 2
|
data/lib/pwn/sast/factory.rb
CHANGED
@@ -78,10 +78,26 @@ module PWN
|
|
78
78
|
end
|
79
79
|
author ||= 'N/A'
|
80
80
|
|
81
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
82
|
+
ai_analysis = nil
|
83
|
+
if ai_instrospection
|
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
|
+
|
81
96
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
82
97
|
line_no: line_no,
|
83
98
|
contents: contents,
|
84
|
-
author: author
|
99
|
+
author: author,
|
100
|
+
ai_analysis: ai_analysis
|
85
101
|
)
|
86
102
|
|
87
103
|
current_count += 2
|
@@ -83,10 +83,26 @@ module PWN
|
|
83
83
|
end
|
84
84
|
author ||= 'N/A'
|
85
85
|
|
86
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
87
|
+
ai_analysis = nil
|
88
|
+
if ai_instrospection
|
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
|
+
|
86
101
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
87
102
|
line_no: line_no,
|
88
103
|
contents: contents,
|
89
|
-
author: author
|
104
|
+
author: author,
|
105
|
+
ai_analysis: ai_analysis
|
90
106
|
)
|
91
107
|
|
92
108
|
current_count += 2
|
data/lib/pwn/sast/inner_html.rb
CHANGED
@@ -75,10 +75,26 @@ module PWN
|
|
75
75
|
end
|
76
76
|
author ||= 'N/A'
|
77
77
|
|
78
|
+
ai_instrospection = PWN::Env[:ai][:introspection]
|
79
|
+
ai_analysis = nil
|
80
|
+
if ai_instrospection
|
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
|
+
|
78
93
|
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
79
94
|
line_no: line_no,
|
80
95
|
contents: contents,
|
81
|
-
author: author
|
96
|
+
author: author,
|
97
|
+
ai_analysis: ai_analysis
|
82
98
|
)
|
83
99
|
|
84
100
|
current_count += 2
|