pwn 0.5.434 → 0.5.435
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 +15 -3
- data/lib/pwn/config.rb +1 -5
- data/lib/pwn/reports/sast.rb +14 -8
- 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: 546f4e3bfd971104add0ac67ed3021ffa01634666ebb1cee86a409380d11d6df
|
4
|
+
data.tar.gz: 236a1e0e2a04bf58be219b55fe046b6da559ca77ae7ace6ba3e98a6233ffe84a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f330e88a01859a80bf9bc355c2812593969d34d42239976ac0e9e0f991d3f5ca93499919466cfb57e3135ed936a87b826be3e4a69b4bc7ceaa7bff7f2e1bc202
|
7
|
+
data.tar.gz: 4051a95e8a16ee97832d28400078f561e4dbc46094b6ebfea952756315d22227af99af0324b70af73256ecd4733b3bf38b7c66c277a00ce3e293251b7856d41e
|
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.435]: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.435]: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.435]: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/ai/introspection.rb
CHANGED
@@ -10,10 +10,20 @@ module PWN
|
|
10
10
|
# when `PWN::Env[:ai][:introspection]` is set to `true`.
|
11
11
|
module Introspection
|
12
12
|
# Supported Method Parameters::
|
13
|
-
# response = PWN::AI::Introspection.reflect
|
13
|
+
# response = PWN::AI::Introspection.reflect(
|
14
|
+
# request: 'required - String - What you want the AI to reflect on'
|
15
|
+
# )
|
14
16
|
|
15
|
-
public_class_method def self.reflect
|
17
|
+
public_class_method def self.reflect(opts = {})
|
18
|
+
request = opts[:request]
|
19
|
+
raise 'ERROR: request must be provided' if request.nil?
|
20
|
+
|
21
|
+
response = nil
|
22
|
+
|
23
|
+
valid_ai_engines = PWN::AI.help.reject { |e| e.downcase == :introspection }.map(&:downcase)
|
16
24
|
engine = PWN::Env[:ai][:active].to_s.downcase.to_sym
|
25
|
+
raise "ERROR: Unsupported AI engine. Supported engines are: #{valid_ai_engines}" unless valid_ai_engines.include?(engine)
|
26
|
+
|
17
27
|
base_uri = PWN::Env[:ai][engine][:base_uri]
|
18
28
|
model = PWN::Env[:ai][engine][:model]
|
19
29
|
key = PWN::Env[:ai][engine][:key]
|
@@ -70,7 +80,9 @@ module PWN
|
|
70
80
|
|
71
81
|
public_class_method def self.help
|
72
82
|
puts "USAGE:
|
73
|
-
#{self}.reflect
|
83
|
+
#{self}.reflect(
|
84
|
+
request: 'required - String - What you want the AI to reflect on'
|
85
|
+
)
|
74
86
|
|
75
87
|
#{self}.authors
|
76
88
|
"
|
data/lib/pwn/config.rb
CHANGED
@@ -42,11 +42,7 @@ module PWN
|
|
42
42
|
env = YAML.load_file(pwn_env_path, symbolize_names: true)
|
43
43
|
end
|
44
44
|
|
45
|
-
valid_ai_engines =
|
46
|
-
grok
|
47
|
-
openai
|
48
|
-
ollama
|
49
|
-
]
|
45
|
+
valid_ai_engines = PWN::AI.help.reject { |e| e.downcase == :introspection }.map(&:downcase)
|
50
46
|
|
51
47
|
engine = env[:ai][:active].to_s.downcase.to_sym
|
52
48
|
raise "ERROR: Unsupported AI Engine: #{engine} in #{pwn_env_path}. Supported AI Engines:\n#{valid_ai_engines.inspect}" unless valid_ai_engines.include?(engine)
|
data/lib/pwn/reports/sast.rb
CHANGED
@@ -49,16 +49,22 @@ module PWN
|
|
49
49
|
percent_complete = (entry_count.to_f / total_entries * 100).round(2)
|
50
50
|
line_no = src_detail[:line_no]
|
51
51
|
source_code_snippet = src_detail[:contents]
|
52
|
-
request = {
|
53
|
-
scm_uri: "#{git_repo_root_uri}/#{filename}",
|
54
|
-
line: line_no,
|
55
|
-
source_code_snippet: source_code_snippet
|
56
|
-
}.to_json
|
57
52
|
author = src_detail[:author].to_s.scrub.chomp.strip
|
58
53
|
|
59
|
-
# TODO:
|
60
|
-
#
|
61
|
-
|
54
|
+
# TODO: >>>
|
55
|
+
# 1. Move PWN::AI::Introspection.reflect into each PWN::SAST::* module
|
56
|
+
# This will drastically speed up the overall SAST analysis process
|
57
|
+
# 2. Have PWN::AI::Introspection.reflect assess test case effectiveness
|
58
|
+
response = nil
|
59
|
+
if ai_instrospection
|
60
|
+
request = {
|
61
|
+
scm_uri: "#{git_repo_root_uri}/#{filename}",
|
62
|
+
line: line_no,
|
63
|
+
source_code_snippet: source_code_snippet
|
64
|
+
}.to_json
|
65
|
+
response = PWN::AI::Introspection.reflect(request: request)
|
66
|
+
end
|
67
|
+
|
62
68
|
ai_analysis = nil
|
63
69
|
if response.is_a?(Hash)
|
64
70
|
ai_analysis = response[:choices].last[:text] if response[:choices].last.keys.include?(:text)
|
data/lib/pwn/version.rb
CHANGED