Skip to content

2570 scan metrics #906

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

Draft
wants to merge 23 commits into
base: develop
Choose a base branch
from
Draft

2570 scan metrics #906

wants to merge 23 commits into from

Conversation

Matthew-Grayson
Copy link
Contributor

πŸ—£ Description

πŸ’­ Motivation and context

πŸ§ͺ Testing

βœ… Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced
    in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

βœ… Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

βœ… Post-merge checklist

  • Create a release.

Add query to list_scans to count total organizations and organizations that were successfully scanned by each scan.
Add total_orgs and orgs_with_results fields to scan models and interfaces.
Add optional window_days argument to /scans endpoint to specify window for orgs_with_results query.
Update fetchScans call in ScansView.tsx to include window_days.
Add Success Rate column and associated tooltips to Scans page.
Define windowDays state for get /scans endpoint and tooltips.
Increase width of Admin Tools container to better display tables.
… total_orgs; improve logging for launch_scan_execution.
…an Organization

Rename update_scan_result helper function to upsert_scan_result
Add logic to determine if a scan returns and saves a result for censys, censys_sync, shodan, and shodan_sync
Add logic to upsert timestamp to scan_result table when a scan returns and saves a result for censys, censys_sync, shodan, and shodan_sync


Add logic to dns_twist.py to update scan_result table if domains are found and saved
Add logic to intel_x_identity.py to update scan_result table if both breaches and credentials are found and saved
Move upsert_scan_result.py from xfd_api.helpers to xfd_api.tasks.helpers
…h organization scanned by cybersixgill; add self.scan_id to intel_x __init__.
…sync.

Add logic to credential_sync and sync_asm_sync for recording timestamp of last successful scan per organization.
Add 204 status code to dns_twist for identifying instances where no results are saved.
Refactor Logger.error to use lazy % formatting in censys_sync.py.
Extract queue creation logic from launch_scan_execution to address too_many_statements issue.
@Matthew-Grayson Matthew-Grayson self-assigned this Jun 3, 2025
@Matthew-Grayson Matthew-Grayson added python Pull requests that update Python code backend labels Jun 3, 2025
Add window_days argument
Add annotation to calculate orgs_with_results
Add error handling to match list_scans method
Add total_orgs and orgs_with_results to scan model in list_scan_tasks.
Extract scan query logic to helper function, query_scans, for use by scan and scan_task api methods.
Fix order for arguments to address lint issues
Consolidate default value for window_days by removing it from ScansView.tsx
asm_sync.py:
- Improve error handling and logging
- Add flags to monitor success rate of retrieving both CIDRs and Subdomains
- Track success rate using upsert_scan_result helper function
- Delete commented-out code

credential_sync.py:
- Fix logic for updating data_saved
- Revert code to return status 200 instead of 204 if no data is updated

scan.py
- Modify list_scans and get_scan to return metrics_window_days

shodan.py:
- Improve logging
Update logging for asm_sync
Fix argument order for upsert_scan_results in cybersixgill, dnstwist, and intelx
Update default backend domain for local blocklist queries in dnstwist
Replace f strings in dnstwist
Replace print statements with logging statements in upsert_scan_result helper
Add metrics window to scan response model
Display metrics window in success rate tooltips in scans view
Add tooltip to success rate header in scans view
Removes unused imports and commented out code from scans view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant