Skip to content

Commit

Permalink
Make Citrix NetScaler version check more lenient (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunzheng committed Aug 18, 2023
1 parent 3c35db6 commit e2d6c09
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions dissect/target/plugins/os/unix/bsd/citrix/_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,21 @@ def hostname(self) -> Optional[str]:

@export(property=True)
def version(self) -> Optional[str]:
version = "Unknown"
version_path = self.target.fs.path("/flash/.version")
version = version_path.read_text().strip()
loader_conf = self.target.fs.path("/flash/boot/loader.conf").read_text()
if match := RE_LOADER_CONFIG_KERNEL_VERSION.search(loader_conf):
kernel_version = match.groupdict()["version"]
return f"{version} ({kernel_version})"
self.target.log.warn("Could not determine kernel version")
if version_path.is_file():
version = version_path.read_text().strip()

loader_conf_path = self.target.fs.path("/flash/boot/loader.conf")
if loader_conf_path.is_file():
loader_conf = loader_conf_path.read_text()
if match := RE_LOADER_CONFIG_KERNEL_VERSION.search(loader_conf):
kernel_version = match.groupdict()["version"]
version = f"{version} ({kernel_version})" if version else kernel_version

if not version:
self.target.log.warn("Could not determine kernel version")

return version

@export(property=True)
Expand Down

0 comments on commit e2d6c09

Please sign in to comment.