mirror of
https://github.com/brygphilomena/pyhuntress.git
synced 2026-03-05 17:02:35 +00:00
Compare commits
No commits in common. "7532b475a7db2179b87ce700841e762fccea2529" and "949d44e8533a9275e8d3c9d14aeb0dbf6a0e4d21" have entirely different histories.
7532b475a7
...
949d44e853
4 changed files with 5 additions and 44 deletions
|
|
@ -153,8 +153,4 @@ Contributions to the project are welcome. If you find any issues or have suggest
|
||||||
:heart:
|
:heart:
|
||||||
|
|
||||||
# Inspiration and Stolen Code
|
# Inspiration and Stolen Code
|
||||||
The premise behind this came from the [pyConnectWise](https://github.com/HealthITAU/pyconnectwise) package and I stole **most** of the code and adapted it to the Huntress API endpoints.
|
The premise behind this came from the [pyConnectWise](https://github.com/HealthITAU/pyconnectwise) package and I stole **most** of the code and adapted it to the Huntress API endpoints.
|
||||||
|
|
||||||
# How to Build
|
|
||||||
> python -m build
|
|
||||||
> python -m twine upload dist/*
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "pyhuntress"
|
name = "pyhuntress"
|
||||||
version = "0.2.16"
|
version = "0.2.14"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="Peter Annabel", email="peter.annabel@gmail.com" },
|
{ name="Peter Annabel", email="peter.annabel@gmail.com" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
requests
|
requests==2.32.4
|
||||||
pydantic
|
pydantic==2.11.7
|
||||||
typing_extensions
|
typing_extensions==4.14.1
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
|
||||||
)
|
)
|
||||||
from pyhuntress.models.managedsat import SATPhishingCampaignAttempts
|
from pyhuntress.models.managedsat import SATPhishingCampaignAttempts
|
||||||
from pyhuntress.responses.paginated_response import PaginatedResponse
|
|
||||||
from pyhuntress.types import (
|
from pyhuntress.types import (
|
||||||
JSON,
|
JSON,
|
||||||
HuntressSATRequestParams,
|
HuntressSATRequestParams,
|
||||||
|
|
@ -14,43 +12,10 @@ from pyhuntress.types import (
|
||||||
class PhishingCampaignsIdAttemptsEndpoint(
|
class PhishingCampaignsIdAttemptsEndpoint(
|
||||||
HuntressEndpoint,
|
HuntressEndpoint,
|
||||||
IGettable[SATPhishingCampaignAttempts, HuntressSATRequestParams],
|
IGettable[SATPhishingCampaignAttempts, HuntressSATRequestParams],
|
||||||
IPaginateable[SATPhishingCampaignAttempts, HuntressSATRequestParams],
|
|
||||||
):
|
):
|
||||||
def __init__(self, client, parent_endpoint=None) -> None:
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
HuntressEndpoint.__init__(self, client, "attempts", parent_endpoint=parent_endpoint)
|
HuntressEndpoint.__init__(self, client, "attempts", parent_endpoint=parent_endpoint)
|
||||||
IGettable.__init__(self, SATPhishingCampaignAttempts)
|
IGettable.__init__(self, SATPhishingCampaignAttempts)
|
||||||
IPaginateable.__init__(self, SATPhishingCampaignAttempts)
|
|
||||||
|
|
||||||
def paginated(
|
|
||||||
self,
|
|
||||||
page: int,
|
|
||||||
limit: int,
|
|
||||||
params: HuntressSATRequestParams | None = None,
|
|
||||||
) -> PaginatedResponse[SATPhishingCampaignAttempts]:
|
|
||||||
"""
|
|
||||||
Performs a GET request against the /phishing-campaign-scenarios/{id}/attempts endpoint and returns an initialized PaginatedResponse object.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
page (int): The page number to request.
|
|
||||||
limit (int): The number of results to return per page.
|
|
||||||
params (dict[str, int | str]): The parameters to send in the request query string.
|
|
||||||
Returns:
|
|
||||||
PaginatedResponse[SATPhishingCampaignAttempts]: The initialized PaginatedResponse object.
|
|
||||||
"""
|
|
||||||
if params:
|
|
||||||
params["page[number]"] = page
|
|
||||||
params["page[size]"] = limit
|
|
||||||
else:
|
|
||||||
params = {"page[number]": page, "page[size]": limit}
|
|
||||||
return PaginatedResponse(
|
|
||||||
super()._make_request("GET", params=params),
|
|
||||||
SATPhishingCampaignAttempts,
|
|
||||||
self,
|
|
||||||
"data",
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
params,
|
|
||||||
)
|
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue