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

Update versions + print unknown version #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions panos-scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def check_date(version_table: dict, date: datetime.date) -> list:


def get_matches(date_headers: dict, resp_headers: dict, version_table: dict) -> list:
unmatched_date=""
matches = []
for header in date_headers.keys():
if header in resp_headers:
Expand All @@ -141,8 +142,9 @@ def get_matches(date_headers: dict, resp_headers: dict, version_table: dict) ->
matches.extend(check_date(version_table, date))
if len(matches) == 0 and 'date' in locals(): # if no matching but data return add as debug log
logger.debug(f"no matching for : {date.strftime('%b %d %Y')}")
unmatched_date = str(date.strftime('%b %d %Y'))
return matches,unmatched_date

return matches


def strip_url(fullurl: str) -> str:
Expand Down Expand Up @@ -263,6 +265,8 @@ def main():
# Total of responses per target
total_responses = 0

# returned date Etag if unmatched
unknown_version = ""
# Check for the presence of each static resource.
for resource in static_resources:
try:
Expand All @@ -282,7 +286,7 @@ def main():
total_responses += len(resp_headers)
# Convert date-related HTTP headers to a standardized format, and
# store any matching version strings.
resource_matches = get_matches(date_headers, resp_headers, version_table)
resource_matches,unknown_version = get_matches(date_headers, resp_headers, version_table)
for match in resource_matches:
match["resource"] = resource
total_matches.extend(resource_matches)
Expand Down Expand Up @@ -314,7 +318,8 @@ def main():

if not len(total_matches):
logger.error("no matching versions found for : " + target_to_scan)
continue
results = {"target": target_to_print, "unmatch": {}, "etag": unknown_version}

else:
closest = sorted(total_matches, key=lambda x: x["precision"], reverse=True)[0]
results["match"] = closest
Expand Down
12 changes: 12 additions & 0 deletions version-table.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,35 +170,47 @@
10.0.3 Dec 07 2020
10.1.7 Sep 06 2022
10.2.0 Feb 26 2022
10.2.0-h3 Apr 18 2024
10.2.1 Apr 13 2022
10.2.1-h2 Apr 18 2024
10.2.2 Jun 02 2022
10.2.2-h2 Aug 08 2022
10.2.2-h5 Apr 18 2024
10.2.3 Sep 27 2022
10.2.3-h2 Dec 09 2022
10.2.3-h4 Feb 08 2023
10.2.3-h9 Nov 03 2023
10.2.3-h11 Dec 19 2023
10.2.3-h12 Dec 19 2023
10.2.3-h13 Apr 18 2024
10.2.4 Mar 26 2023
10.2.4-h2 May 12 2023
10.2.4-h3 Jun 29 2023
10.2.4-h4 Jul 25 2023
10.2.4-h16 Apr 16 2024
10.2.5 Aug 15 2023
10.2.5-h6 Apr 15 2024
10.2.6 Sep 20 2023
10.2.6-h1 Jan 03 2024
10.2.6-h3 Apr 15 2024
10.2.7 Nov 02 2023
10.2.7-h3 Dec 16 2023
10.2.7-h6 Feb 28 2024
10.2.7-h8 Apr 15 2024
10.2.8 Feb 08 2024
10.2.9 Mar 30 2024
10.2.9-h1 Apr 14 2024
10.2.10 Jun 22 2024
11.0.0 Nov 17 2022
11.0.0-h1 Nov 03 2023
11.0.1 Mar 26 2023
11.0.1-h4 Apr 18 2024
11.0.2 Jun 23 2023
11.0.2-h4 Apr 16 2024
11.0.3 Oct 26 2023
11.0.3-h3 Jan 13 2024
11.0.3-h5 Feb 20 2024
11.0.3-h10 Apr 16 2024
11.0.4 Apr 07 2024
11.0.4-h1 Apr 14 2024
11.1.0 Oct 31 2023
Expand Down