Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support inline code #44

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v4.X.X (XXXX 2023)
- Parse inline code, not just code blocks

v4.7.0 (February 2023)
- Add issue.classification_owasp2021 as a new avaiable field

Expand Down
2 changes: 1 addition & 1 deletion lib/dradis/plugins/netsparker/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 7
TINY = 0
TINY = 1
PRE = nil

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
Expand Down
3 changes: 3 additions & 0 deletions lib/netsparker/vulnerability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def cleanup_html(source)

result.gsub!(/<a .*?href=(?:\"|\')(.*?)(?:\"|\').*?>(?:<i.*?<\/i>)?(.*?)<\/a>/i) { "\"#{$2.strip}\":#{$1.strip}" }

result.gsub!(/<code>(.*?)<\/code>/) { "@#{$1}@" }
result.gsub!(/<pre.*?>(.*?)<\/pre>\n/) { "\n\nbc. #{$1}\n\n" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 154 already catches the <pre> tag. Instead of adding this one I'm thinking Line 154 should be updated instead to accommodate this change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks @aapomm ! I tested and confirmed that we can remove that line entirely and pushed the updated version.


result.gsub!(/<code><pre.*?>(.*?)<\/pre><\/code>/m) {|m| "\n\nbc.. #{$1}\n\np. \n" }
result.gsub!(/<pre.*?>(.*?)<\/pre>/m) {|m| "\n\nbc.. #{$1}\n\np. \n" }
result.gsub!(/<code>(.*?)<\/code>/m) {|m| "\n\nbc.. #{$1}\n\np. \n" }
Expand Down