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

Fixed encoding handling when parsing PHP files #271

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions wordfence/cli/vulnscan/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class VulnScanReportColumn(ReportColumnEnum):
SOFTWARE_TYPE = 'software_type', lambda record: record.software.type.value
SLUG = 'slug', lambda record: record.software.slug
VERSION = 'version', lambda record: record.software.version
VERSION = 'version', lambda record: record.software.version.decode('ascii')
ID = 'id', \
lambda record: record.vulnerability.identifier
TITLE = 'title', lambda record: record.vulnerability.title
Expand Down Expand Up @@ -92,6 +92,7 @@ def get_severity_color(self, severity: str) -> str:
def format_record(self, record) -> str:
vuln = record.vulnerability
sw = record.software
sw_version = sw.version.decode('ascii')
yellow = escape(color=Color.YELLOW)
link = vuln.get_wordfence_link()
blue = escape(color=Color.BLUE)
Expand All @@ -115,7 +116,7 @@ def format_record(self, record) -> str:
info_message = ''
return (
f'{yellow}Found {severity_message}{info_message}vulnerability '
f'{vuln.title} in {sw.slug}({sw.version})\n'
f'{vuln.title} in {sw.slug}({sw_version})\n'
f'{white}Details: {blue}{link}{RESET}'
)

Expand Down
5 changes: 4 additions & 1 deletion wordfence/cli/vulnscan/vulnscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def _scan(
raise
log.debug('Located WordPress files at ' + os.fsdecode(site.core_path))
version = site.get_version()
log.debug(f'WordPress Core Version: {version}')
log.debug(
'WordPress Core Version: ' +
version.decode('ascii', 'replace')
)
if scan_path is None:
scan_path = path
scanner.scan_core(version, scan_path)
Expand Down
2 changes: 1 addition & 1 deletion wordfence/intel/vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SoftwareType(str, Enum):
class ScannableSoftware:
type: SoftwareType
slug: str
version: str
version: bytes
scan_path: Optional[str]

def get_key(self) -> str:
Expand Down
Loading
Loading