pwn 0.5.441 → 0.5.443
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/Gemfile +1 -1
- data/README.md +3 -3
- data/lib/pwn/plugins/repl.rb +3 -5
- data/lib/pwn/sast/amqp_connect_as_guest.rb +12 -89
- data/lib/pwn/sast/apache_file_system_util_api.rb +11 -91
- data/lib/pwn/sast/aws.rb +13 -93
- data/lib/pwn/sast/banned_function_calls_c.rb +138 -218
- data/lib/pwn/sast/base64.rb +12 -90
- data/lib/pwn/sast/beef_hook.rb +10 -90
- data/lib/pwn/sast/cmd_execution_java.rb +12 -92
- data/lib/pwn/sast/cmd_execution_python.rb +14 -94
- data/lib/pwn/sast/cmd_execution_ruby.rb +22 -102
- data/lib/pwn/sast/cmd_execution_scala.rb +12 -92
- data/lib/pwn/sast/csrf.rb +10 -90
- data/lib/pwn/sast/deserial_java.rb +17 -97
- data/lib/pwn/sast/emoticon.rb +17 -98
- data/lib/pwn/sast/eval.rb +10 -90
- data/lib/pwn/sast/factory.rb +12 -92
- data/lib/pwn/sast/http_authorization_header.rb +20 -100
- data/lib/pwn/sast/inner_html.rb +10 -90
- data/lib/pwn/sast/keystore.rb +10 -90
- data/lib/pwn/sast/local_storage.rb +11 -91
- data/lib/pwn/sast/location_hash.rb +10 -90
- data/lib/pwn/sast/log4j.rb +10 -90
- data/lib/pwn/sast/logger.rb +24 -104
- data/lib/pwn/sast/md5.rb +10 -90
- data/lib/pwn/sast/outer_html.rb +10 -90
- data/lib/pwn/sast/padding_oracle.rb +11 -91
- data/lib/pwn/sast/password.rb +15 -95
- data/lib/pwn/sast/php_input_mechanisms.rb +16 -96
- data/lib/pwn/sast/php_type_juggling.rb +14 -94
- data/lib/pwn/sast/pom_version.rb +1 -1
- data/lib/pwn/sast/port.rb +16 -96
- data/lib/pwn/sast/post_message.rb +10 -90
- data/lib/pwn/sast/private_key.rb +10 -90
- data/lib/pwn/sast/redirect.rb +13 -93
- data/lib/pwn/sast/redos.rb +16 -96
- data/lib/pwn/sast/shell.rb +18 -98
- data/lib/pwn/sast/signature.rb +10 -90
- data/lib/pwn/sast/sql.rb +19 -93
- data/lib/pwn/sast/ssl.rb +14 -94
- data/lib/pwn/sast/sudo.rb +10 -90
- data/lib/pwn/sast/task_tag.rb +23 -103
- data/lib/pwn/sast/test_case_engine.rb +147 -0
- data/lib/pwn/sast/throw_errors.rb +14 -94
- data/lib/pwn/sast/token.rb +12 -92
- data/lib/pwn/sast/type_script_type_juggling.rb +14 -94
- data/lib/pwn/sast/version.rb +12 -92
- data/lib/pwn/sast/window_location_hash.rb +10 -90
- data/lib/pwn/sast.rb +4 -0
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn.rb +0 -2
- data/spec/lib/pwn/sast/test_case_engine_spec.rb +20 -0
- data/third_party/pwn_rdoc.jsonl +1 -1
- metadata +5 -3
data/lib/pwn/sast/token.rb
CHANGED
@@ -19,100 +19,20 @@ module PWN
|
|
19
19
|
public_class_method def self.scan(opts = {})
|
20
20
|
dir_path = opts[:dir_path]
|
21
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
|
-
result_arr = []
|
23
|
-
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
-
logger_results = "AI Introspection => #{ai_introspection} => "
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
js_beautify = `js-beautify #{entry} > #{entry}.JS-BEAUTIFIED 2> /dev/null`.to_s.scrub
|
33
|
-
entry = "#{entry}.JS-BEAUTIFIED"
|
34
|
-
entry_beautified = true
|
35
|
-
end
|
36
|
-
|
37
|
-
test_case_filter = "
|
38
|
-
grep -Fin \
|
39
|
-
-e 'token' \
|
40
|
-
-e 'oauth' \
|
41
|
-
-e 'decodeAndVerify' #{entry} 2> /dev/null
|
42
|
-
"
|
43
|
-
|
44
|
-
str = `#{test_case_filter}`.to_s.scrub
|
45
|
-
|
46
|
-
if str.to_s.empty?
|
47
|
-
# If str length is >= 64 KB do not include results. (Due to Mongo Document Size Restrictions)
|
48
|
-
logger_results = "#{logger_results}~" # Catching bugs is good :)
|
49
|
-
else
|
50
|
-
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
|
51
|
-
|
52
|
-
hash_line = {
|
53
|
-
timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S.%9N %z').to_s,
|
54
|
-
security_references: security_references,
|
55
|
-
filename: { git_repo_root_uri: git_repo_root_uri, entry: entry },
|
56
|
-
line_no_and_contents: '',
|
57
|
-
raw_content: str,
|
58
|
-
test_case_filter: test_case_filter
|
59
|
-
}
|
60
|
-
|
61
|
-
# COMMMENT: Must be a better way to implement this (regex is kinda funky)
|
62
|
-
line_contents_split = str.split(/^(\d{1,}):|\n(\d{1,}):/)[1..-1]
|
63
|
-
line_no_count = line_contents_split.length # This should always be an even number
|
64
|
-
current_count = 0
|
65
|
-
while line_no_count > current_count
|
66
|
-
line_no = line_contents_split[current_count]
|
67
|
-
contents = line_contents_split[current_count + 1]
|
68
|
-
if Dir.exist?('.git')
|
69
|
-
repo_root = '.'
|
70
|
-
|
71
|
-
author = PWN::Plugins::Git.get_author(
|
72
|
-
repo_root: repo_root,
|
73
|
-
from_line: line_no,
|
74
|
-
to_line: line_no,
|
75
|
-
target_file: entry,
|
76
|
-
entry_beautified: entry_beautified
|
77
|
-
)
|
78
|
-
end
|
79
|
-
author ||= 'N/A'
|
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
|
-
|
95
|
-
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
96
|
-
line_no: line_no,
|
97
|
-
contents: contents,
|
98
|
-
author: author,
|
99
|
-
ai_analysis: ai_analysis
|
100
|
-
)
|
23
|
+
test_case_filter = "
|
24
|
+
grep -Fin \
|
25
|
+
-e 'token' \
|
26
|
+
-e 'oauth' \
|
27
|
+
-e 'decodeAndVerify' {PWN_SAST_SRC_TARGET} 2> /dev/null
|
28
|
+
"
|
101
29
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
logger_banner = "http://#{Socket.gethostname}:8808/doc_root/pwn-#{PWN::VERSION.to_s.scrub}/#{to_s.scrub.gsub('::', '/')}.html"
|
110
|
-
if logger_results.empty?
|
111
|
-
@@logger.info("#{logger_banner}: No files applicable to this test case.\n")
|
112
|
-
else
|
113
|
-
@@logger.info("#{logger_banner} => #{logger_results}complete.\n")
|
114
|
-
end
|
115
|
-
result_arr
|
30
|
+
PWN::SAST::TestCaseEngine.execute(
|
31
|
+
test_case_filter: test_case_filter,
|
32
|
+
security_references: security_references,
|
33
|
+
dir_path: dir_path,
|
34
|
+
git_repo_root_uri: git_repo_root_uri
|
35
|
+
)
|
116
36
|
rescue StandardError => e
|
117
37
|
raise e
|
118
38
|
end
|
@@ -19,102 +19,22 @@ module PWN
|
|
19
19
|
public_class_method def self.scan(opts = {})
|
20
20
|
dir_path = opts[:dir_path]
|
21
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
|
-
result_arr = []
|
23
|
-
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
-
logger_results = "AI Introspection => #{ai_introspection} => "
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
entry_beautified = true
|
35
|
-
end
|
36
|
-
|
37
|
-
test_case_filter = "
|
38
|
-
grep -Fn \
|
39
|
-
-e '==' \
|
40
|
-
-e '!=' #{entry} 2>/dev/null | \
|
41
|
-
grep -v \
|
42
|
-
-e '===' \
|
43
|
-
-e '!=='
|
44
|
-
"
|
45
|
-
|
46
|
-
str = `#{test_case_filter}`.to_s.scrub
|
47
|
-
|
48
|
-
if str.to_s.empty?
|
49
|
-
# If str length is >= 64 KB do not include results. (Due to Mongo Document Size Restrictions)
|
50
|
-
logger_results = "#{logger_results}~" # Catching bugs is good :)
|
51
|
-
else
|
52
|
-
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
|
53
|
-
|
54
|
-
hash_line = {
|
55
|
-
timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S.%9N %z').to_s,
|
56
|
-
security_references: security_references,
|
57
|
-
filename: { git_repo_root_uri: git_repo_root_uri, entry: entry },
|
58
|
-
line_no_and_contents: '',
|
59
|
-
raw_content: str,
|
60
|
-
test_case_filter: test_case_filter
|
61
|
-
}
|
62
|
-
|
63
|
-
# COMMMENT: Must be a better way to implement this (regex is kinda funky)
|
64
|
-
line_contents_split = str.split(/^(\d{1,}):|\n(\d{1,}):/)[1..-1]
|
65
|
-
line_no_count = line_contents_split.length # This should always be an even number
|
66
|
-
current_count = 0
|
67
|
-
while line_no_count > current_count
|
68
|
-
line_no = line_contents_split[current_count]
|
69
|
-
contents = line_contents_split[current_count + 1]
|
70
|
-
if Dir.exist?('.git')
|
71
|
-
repo_root = '.'
|
72
|
-
|
73
|
-
author = PWN::Plugins::Git.get_author(
|
74
|
-
repo_root: repo_root,
|
75
|
-
from_line: line_no,
|
76
|
-
to_line: line_no,
|
77
|
-
target_file: entry,
|
78
|
-
entry_beautified: entry_beautified
|
79
|
-
)
|
80
|
-
end
|
81
|
-
author ||= 'N/A'
|
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
|
-
|
97
|
-
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
98
|
-
line_no: line_no,
|
99
|
-
contents: contents,
|
100
|
-
author: author,
|
101
|
-
ai_analysis: ai_analysis
|
102
|
-
)
|
23
|
+
test_case_filter = "
|
24
|
+
grep -Fn \
|
25
|
+
-e '==' \
|
26
|
+
-e '!=' {PWN_SAST_SRC_TARGET} 2>/dev/null | \
|
27
|
+
grep -v \
|
28
|
+
-e '===' \
|
29
|
+
-e '!=='
|
30
|
+
"
|
103
31
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
end
|
111
|
-
logger_banner = "http://#{Socket.gethostname}:8808/doc_root/pwn-#{PWN::VERSION.to_s.scrub}/#{to_s.scrub.gsub('::', '/')}.html"
|
112
|
-
if logger_results.empty?
|
113
|
-
@@logger.info("#{logger_banner}: No files applicable to this test case.\n")
|
114
|
-
else
|
115
|
-
@@logger.info("#{logger_banner} => #{logger_results}complete.\n")
|
116
|
-
end
|
117
|
-
result_arr
|
32
|
+
PWN::SAST::TestCaseEngine.execute(
|
33
|
+
test_case_filter: test_case_filter,
|
34
|
+
security_references: security_references,
|
35
|
+
dir_path: dir_path,
|
36
|
+
git_repo_root_uri: git_repo_root_uri
|
37
|
+
)
|
118
38
|
rescue StandardError => e
|
119
39
|
raise e
|
120
40
|
end
|
data/lib/pwn/sast/version.rb
CHANGED
@@ -19,99 +19,19 @@ module PWN
|
|
19
19
|
public_class_method def self.scan(opts = {})
|
20
20
|
dir_path = opts[:dir_path]
|
21
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
|
-
result_arr = []
|
23
|
-
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
-
logger_results = "AI Introspection => #{ai_introspection} => "
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
grep -in \
|
39
|
-
-e "version\\s=\\s" #{entry} 2> /dev/null | \
|
40
|
-
grep -F '"'
|
41
|
-
)
|
42
|
-
|
43
|
-
str = `#{test_case_filter}`.to_s.scrub
|
44
|
-
|
45
|
-
if str.to_s.empty?
|
46
|
-
# If str length is >= 64 KB do not include results. (Due to Mongo Document Size Restrictions)
|
47
|
-
logger_results = "#{logger_results}~" # Catching bugs is good :)
|
48
|
-
else
|
49
|
-
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
|
50
|
-
|
51
|
-
hash_line = {
|
52
|
-
timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S.%9N %z').to_s,
|
53
|
-
security_references: security_references,
|
54
|
-
filename: { git_repo_root_uri: git_repo_root_uri, entry: entry },
|
55
|
-
line_no_and_contents: '',
|
56
|
-
raw_content: str,
|
57
|
-
test_case_filter: test_case_filter
|
58
|
-
}
|
59
|
-
|
60
|
-
# COMMMENT: Must be a better way to implement this (regex is kinda funky)
|
61
|
-
line_contents_split = str.split(/^(\d{1,}):|\n(\d{1,}):/)[1..-1]
|
62
|
-
line_no_count = line_contents_split.length # This should always be an even number
|
63
|
-
current_count = 0
|
64
|
-
while line_no_count > current_count
|
65
|
-
line_no = line_contents_split[current_count]
|
66
|
-
contents = line_contents_split[current_count + 1]
|
67
|
-
if Dir.exist?('.git')
|
68
|
-
repo_root = '.'
|
69
|
-
|
70
|
-
author = PWN::Plugins::Git.get_author(
|
71
|
-
repo_root: repo_root,
|
72
|
-
from_line: line_no,
|
73
|
-
to_line: line_no,
|
74
|
-
target_file: entry,
|
75
|
-
entry_beautified: entry_beautified
|
76
|
-
)
|
77
|
-
end
|
78
|
-
author ||= 'N/A'
|
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
|
-
|
94
|
-
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
95
|
-
line_no: line_no,
|
96
|
-
contents: contents,
|
97
|
-
author: author,
|
98
|
-
ai_analysis: ai_analysis
|
99
|
-
)
|
100
|
-
|
101
|
-
current_count += 2
|
102
|
-
end
|
103
|
-
result_arr.push(hash_line)
|
104
|
-
logger_results = "#{logger_results}x" # Seeing progress is good :)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
logger_banner = "http://#{Socket.gethostname}:8808/doc_root/pwn-#{PWN::VERSION.to_s.scrub}/#{to_s.scrub.gsub('::', '/')}.html"
|
109
|
-
if logger_results.empty?
|
110
|
-
@@logger.info("#{logger_banner}: No files applicable to this test case.\n")
|
111
|
-
else
|
112
|
-
@@logger.info("#{logger_banner} => #{logger_results}complete.\n")
|
113
|
-
end
|
114
|
-
result_arr
|
23
|
+
test_case_filter = %(
|
24
|
+
grep -in \
|
25
|
+
-e "version\\s=\\s" {PWN_SAST_SRC_TARGET} 2> /dev/null | \
|
26
|
+
grep -F '"'
|
27
|
+
)
|
28
|
+
|
29
|
+
PWN::SAST::TestCaseEngine.execute(
|
30
|
+
test_case_filter: test_case_filter,
|
31
|
+
security_references: security_references,
|
32
|
+
dir_path: dir_path,
|
33
|
+
git_repo_root_uri: git_repo_root_uri
|
34
|
+
)
|
115
35
|
rescue StandardError => e
|
116
36
|
raise e
|
117
37
|
end
|
@@ -19,98 +19,18 @@ module PWN
|
|
19
19
|
public_class_method def self.scan(opts = {})
|
20
20
|
dir_path = opts[:dir_path]
|
21
21
|
git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub
|
22
|
-
result_arr = []
|
23
|
-
ai_introspection = PWN::Env[:ai][:introspection]
|
24
|
-
logger_results = "AI Introspection => #{ai_introspection} => "
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if File.extname(entry) == '.js' && (`wc -l #{entry}`.split.first.to_i < 20 || entry.include?('.min.js') || entry.include?('-all.js'))
|
32
|
-
js_beautify = `js-beautify #{entry} > #{entry}.JS-BEAUTIFIED 2> /dev/null`.to_s.scrub
|
33
|
-
entry = "#{entry}.JS-BEAUTIFIED"
|
34
|
-
entry_beautified = true
|
35
|
-
end
|
36
|
-
|
37
|
-
test_case_filter = "
|
38
|
-
grep -n \
|
39
|
-
-e 'window.location.hash' #{entry} 2> /dev/null
|
40
|
-
"
|
41
|
-
|
42
|
-
str = `#{test_case_filter}`.to_s.scrub
|
43
|
-
|
44
|
-
if str.to_s.empty?
|
45
|
-
# If str length is >= 64 KB do not include results. (Due to Mongo Document Size Restrictions)
|
46
|
-
logger_results = "#{logger_results}~" # Catching bugs is good :)
|
47
|
-
else
|
48
|
-
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
|
49
|
-
|
50
|
-
hash_line = {
|
51
|
-
timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S.%9N %z').to_s,
|
52
|
-
security_references: security_references,
|
53
|
-
filename: { git_repo_root_uri: git_repo_root_uri, entry: entry },
|
54
|
-
line_no_and_contents: '',
|
55
|
-
raw_content: str,
|
56
|
-
test_case_filter: test_case_filter
|
57
|
-
}
|
58
|
-
|
59
|
-
# COMMMENT: Must be a better way to implement this (regex is kinda funky)
|
60
|
-
line_contents_split = str.split(/^(\d{1,}):|\n(\d{1,}):/)[1..-1]
|
61
|
-
line_no_count = line_contents_split.length # This should always be an even number
|
62
|
-
current_count = 0
|
63
|
-
while line_no_count > current_count
|
64
|
-
line_no = line_contents_split[current_count]
|
65
|
-
contents = line_contents_split[current_count + 1]
|
66
|
-
if Dir.exist?('.git')
|
67
|
-
repo_root = '.'
|
68
|
-
|
69
|
-
author = PWN::Plugins::Git.get_author(
|
70
|
-
repo_root: repo_root,
|
71
|
-
from_line: line_no,
|
72
|
-
to_line: line_no,
|
73
|
-
target_file: entry,
|
74
|
-
entry_beautified: entry_beautified
|
75
|
-
)
|
76
|
-
end
|
77
|
-
author ||= 'N/A'
|
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
|
-
|
93
|
-
hash_line[:line_no_and_contents] = line_no_and_contents_arr.push(
|
94
|
-
line_no: line_no,
|
95
|
-
contents: contents,
|
96
|
-
author: author,
|
97
|
-
ai_analysis: ai_analysis
|
98
|
-
)
|
23
|
+
test_case_filter = "
|
24
|
+
grep -n \
|
25
|
+
-e 'window.location.hash' {PWN_SAST_SRC_TARGET} 2> /dev/null
|
26
|
+
"
|
99
27
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
107
|
-
logger_banner = "http://#{Socket.gethostname}:8808/doc_root/pwn-#{PWN::VERSION.to_s.scrub}/#{to_s.scrub.gsub('::', '/')}.html"
|
108
|
-
if logger_results.empty?
|
109
|
-
@@logger.info("#{logger_banner}: No files applicable to this test case.\n")
|
110
|
-
else
|
111
|
-
@@logger.info("#{logger_banner} => #{logger_results}complete.\n")
|
112
|
-
end
|
113
|
-
result_arr
|
28
|
+
PWN::SAST::TestCaseEngine.execute(
|
29
|
+
test_case_filter: test_case_filter,
|
30
|
+
security_references: security_references,
|
31
|
+
dir_path: dir_path,
|
32
|
+
git_repo_root_uri: git_repo_root_uri
|
33
|
+
)
|
114
34
|
rescue StandardError => e
|
115
35
|
raise e
|
116
36
|
end
|
data/lib/pwn/sast.rb
CHANGED
@@ -46,6 +46,10 @@ module PWN
|
|
46
46
|
autoload :SSL, 'pwn/sast/ssl'
|
47
47
|
autoload :Sudo, 'pwn/sast/sudo'
|
48
48
|
autoload :TaskTag, 'pwn/sast/task_tag'
|
49
|
+
|
50
|
+
# This module executes all the other SAST modules
|
51
|
+
autoload :TestCaseEngine, 'pwn/sast/test_case_engine'
|
52
|
+
|
49
53
|
autoload :ThrowErrors, 'pwn/sast/throw_errors'
|
50
54
|
autoload :Token, 'pwn/sast/token'
|
51
55
|
autoload :TypeScriptTypeJuggling, 'pwn/sast/type_script_type_juggling'
|
data/lib/pwn/version.rb
CHANGED
data/lib/pwn.rb
CHANGED
@@ -30,8 +30,6 @@ module PWN
|
|
30
30
|
|
31
31
|
# Initialize PWN configuration file
|
32
32
|
# PWN::Env is the constant that stores the configuration data
|
33
|
-
# Only call this if the program name is not pwn
|
34
|
-
# driver = File.basename($PROGRAM_NAME)
|
35
33
|
PWN::Config.refresh_env
|
36
34
|
rescue StandardError => e
|
37
35
|
puts e.backtrace
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe PWN::SAST::TestCaseEngine do
|
6
|
+
it 'execute method should exist' do
|
7
|
+
execute_response = PWN::SAST::TestCaseEngine
|
8
|
+
expect(execute_response).to respond_to :execute
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should display information for authors' do
|
12
|
+
authors_response = PWN::SAST::TestCaseEngine
|
13
|
+
expect(authors_response).to respond_to :authors
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should display information for existing help method' do
|
17
|
+
help_response = PWN::SAST::TestCaseEngine
|
18
|
+
expect(help_response).to respond_to :help
|
19
|
+
end
|
20
|
+
end
|
data/third_party/pwn_rdoc.jsonl
CHANGED
@@ -894,7 +894,7 @@
|
|
894
894
|
{"messages":[{"role":"user","content":"PWN::Plugins::Pony.standard_options Usage"},{"role":"assistant","content":"`PWN::Plugins::Pony.standard_options`: "}]}
|
895
895
|
{"messages":[{"role":"user","content":"PWN::Plugins::Pony.subject_prefix Usage"},{"role":"assistant","content":"`PWN::Plugins::Pony.subject_prefix`: "}]}
|
896
896
|
{"messages":[{"role":"user","content":"PWN::Plugins::REPL.add_commands Usage"},{"role":"assistant","content":"`PWN::Plugins::REPL.add_commands`: Supported Method Parameters\n\nPWN::Plugins::REPL.add_commands\n"}]}
|
897
|
-
{"messages":[{"role":"user","content":"PWN::Plugins::REPL.add_hooks Usage"},{"role":"assistant","content":"`PWN::Plugins::REPL.add_hooks`: Supported Method Parameters\n\nPWN::Plugins::REPL.add_hooks
|
897
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::REPL.add_hooks Usage"},{"role":"assistant","content":"`PWN::Plugins::REPL.add_hooks`: Supported Method Parameters\n\nPWN::Plugins::REPL.add_hooks\n"}]}
|
898
898
|
{"messages":[{"role":"user","content":"PWN::Plugins::REPL.authors Usage"},{"role":"assistant","content":"`PWN::Plugins::REPL.authors`: Author(s)\n\n0day Inc. <support@0dayinc.com>\n"}]}
|
899
899
|
{"messages":[{"role":"user","content":"PWN::Plugins::REPL.help Usage"},{"role":"assistant","content":"`PWN::Plugins::REPL.help`: "}]}
|
900
900
|
{"messages":[{"role":"user","content":"PWN::Plugins::REPL.refresh_ps1_proc Usage"},{"role":"assistant","content":"`PWN::Plugins::REPL.refresh_ps1_proc`: Supported Method Parameters\n\nPWN::Plugins::REPL.refresh_ps1_proc(\n\nmode: 'required - :splat or nil'\n\n)\n"}]}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.443
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
@@ -407,14 +407,14 @@ dependencies:
|
|
407
407
|
requirements:
|
408
408
|
- - '='
|
409
409
|
- !ruby/object:Gem::Version
|
410
|
-
version: 2.15.
|
410
|
+
version: 2.15.1
|
411
411
|
type: :runtime
|
412
412
|
prerelease: false
|
413
413
|
version_requirements: !ruby/object:Gem::Requirement
|
414
414
|
requirements:
|
415
415
|
- - '='
|
416
416
|
- !ruby/object:Gem::Version
|
417
|
-
version: 2.15.
|
417
|
+
version: 2.15.1
|
418
418
|
- !ruby/object:Gem::Dependency
|
419
419
|
name: jsonpath
|
420
420
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1955,6 +1955,7 @@ files:
|
|
1955
1955
|
- lib/pwn/sast/ssl.rb
|
1956
1956
|
- lib/pwn/sast/sudo.rb
|
1957
1957
|
- lib/pwn/sast/task_tag.rb
|
1958
|
+
- lib/pwn/sast/test_case_engine.rb
|
1958
1959
|
- lib/pwn/sast/throw_errors.rb
|
1959
1960
|
- lib/pwn/sast/token.rb
|
1960
1961
|
- lib/pwn/sast/type_script_type_juggling.rb
|
@@ -2304,6 +2305,7 @@ files:
|
|
2304
2305
|
- spec/lib/pwn/sast/ssl_spec.rb
|
2305
2306
|
- spec/lib/pwn/sast/sudo_spec.rb
|
2306
2307
|
- spec/lib/pwn/sast/task_tag_spec.rb
|
2308
|
+
- spec/lib/pwn/sast/test_case_engine_spec.rb
|
2307
2309
|
- spec/lib/pwn/sast/throw_errors_spec.rb
|
2308
2310
|
- spec/lib/pwn/sast/token_spec.rb
|
2309
2311
|
- spec/lib/pwn/sast/type_script_type_juggling_spec.rb
|