Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
spelling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Check Spelling
uses: SFLScientific/spellcheck-github-actions@master
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:

- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pydocstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_testing_eu1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
# python-version: ['3.6', '3.7', '3.8', '3.9']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_testing_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# runs-on: ${{ matrix.os }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_testing_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_testing_us2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
us2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_testing_usgov1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
usgov1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_testing_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# runs-on: ${{ matrix.os }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down
37 changes: 31 additions & 6 deletions samples/discover/spyglass.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# pylint: disable=R0902,R0904,R0912,R0914,R0915
import os
import json
import logging
from datetime import datetime
from argparse import ArgumentParser, RawTextHelpFormatter
from concurrent.futures import ThreadPoolExecutor
Expand Down Expand Up @@ -66,6 +67,8 @@
class Application:
"""Class to store configuration and performance detail."""

_debug = False

_timing = {
"start_time": datetime.now().timestamp(),
"end_time": 0,
Expand All @@ -88,6 +91,7 @@ class Application:
_status = {"running": True, "cancelled": False}

def __init__(self):
"""Construct an instance of the application."""
self.configure_application()
if not self.show_updates:
print("Depending on the size of your environment, "
Expand Down Expand Up @@ -214,6 +218,11 @@ def configure_application(self):
default=None,
required=False
)
parser.add_argument("--debug",
help="Enable API debugging",
action="store_true",
default=False
)
parsed = parser.parse_args()
cats = parsed.categories.split(",")
if "all" in cats:
Expand Down Expand Up @@ -243,11 +252,16 @@ def configure_application(self):
self.applications_filter = parsed.applications_filter
if parsed.applications_sort:
self.applications_sort = parsed.applications_sort
if parsed.debug:
self.debug = True
self.show_updates = False
logging.basicConfig(level=logging.DEBUG)

# Everything before this moment happens within milliseconds
self.sdk = Discover(client_id=parsed.falcon_client_id,
client_secret=parsed.falcon_client_secret,
base_url=parsed.region
base_url=parsed.region,
debug=self.debug
)
self.hosts = Hosts(auth_object=self.sdk)

Expand Down Expand Up @@ -288,6 +302,16 @@ def extra(self) -> dict:
return self._configuration["extra"]

# Mutable
@property
def debug(self) -> bool:
"""Retrieve the end time property."""
return self._debug

@debug.setter
def debug(self, val: bool):
"""Set the end time property."""
self._debug = val

@property
def end_time(self) -> int:
"""Retrieve the end time property."""
Expand Down Expand Up @@ -463,7 +487,7 @@ def batch_get_details(sdk, cat):
def get_detail(ids):
"""Retrieve detail information for the ID list provided."""
returned = False
if APP.running:
if APP.running: # pylint: disable=E0606
APP.api_calls += 1
returned = cmd(ids=ids)["body"]["resources"]
return returned
Expand Down Expand Up @@ -492,9 +516,9 @@ def get_detail(ids):
details.extend(get_detail(returned))
if APP.show_updates:
print(f" Details for {len(details)} {cat} retrieved.",
end=f"{' '*40}\r",
flush=True
)
end=f"{' '*40}\r",
flush=True
)
if running_total >= total or not APP.running:
running = False
else:
Expand Down Expand Up @@ -670,7 +694,7 @@ def display_accounts(account_list: list):
row_break()


def display_hosts(hosts_list: list):
def display_hosts(hosts_list: list): # noqa
"""Display the hosts results."""
print(category_header("Hosts"), end="\r")
row_break(23)
Expand All @@ -697,6 +721,7 @@ def display_hosts(hosts_list: list):
for host in hosts_list:
first_seen = ''
last_seen = ''
managed = ''
if host.get("first_seen_timestamp", None):
first_seen = datetime.strptime(host["first_seen_timestamp"], "%Y-%m-%dT%H:%M:%SZ")
first_seen = bold(first_seen.strftime("%m-%d-%Y %H:%M:%S"))
Expand Down
Loading