Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/app/python-gvm-24.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oliv10 authored Jan 18, 2024
2 parents 889ae0a + e5c3b85 commit c040c49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN openssl req -newkey rsa:4096 \
-keyout ./certs/key.key \
-subj "/C=US/ST=IN/L=IN/O=Shield/OU=Shield/CN=www.hopliteconsulting.com"

ENV VERSION=3.0.16
ENV VERSION=3.0.18

COPY . ./app

Expand Down
38 changes: 19 additions & 19 deletions app/routes/target/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,21 @@ async def create_target(
LOGGER.error(f"GMP Error: {err}")
return ErrorResponse("Internal Server Error")

@ROUTER.get("/get/{target_id}")
async def get_target(
@ROUTER.get("/get/targets")
async def get_targets(
current_user: Annotated[Auth.User, Depends(Auth.get_current_active_user)],
target_id: str,
tasks: Optional[bool] = None
filter_string: Optional[str] = None,
filter_id: Optional[str] = None,
trash: Optional[bool] = None,
tasks: Optional[bool] = None,
):
"""Request a single target
"""Request a list of targets
Arguments:
target_id: UUID of an existing target
filter_string: Filter term to use for the query
filter_id: UUID of an existing filter to use for the query
trash: Whether to get the trashcan targets instead
tasks: Whether to include list of tasks that use the target
Returns:
Expand All @@ -79,26 +83,22 @@ async def get_target(
with Gmp(connection=UnixSocketConnection()) as gmp:
gmp.authenticate(username=current_user.username, password=Auth.get_admin_password())
try:
return gmp.get_target(target_id=target_id, tasks=tasks)
return gmp.get_targets(filter_string=filter_string,filter_id=filter_id,trash=trash,tasks=tasks)
except Exception as err:
LOGGER.error(f"GMP Error: {err}")
return ErrorResponse("Internal Server Error")
@ROUTER.get("/get/targets")
async def get_targets(

@ROUTER.get("/get/{target_id}")
async def get_target(
current_user: Annotated[Auth.User, Depends(Auth.get_current_active_user)],
filter_string: Optional[str] = None,
filter_id: Optional[str] = None,
trash: Optional[bool] = None,
tasks: Optional[bool] = None,
target_id: str,
tasks: Optional[bool] = None
):
"""Request a list of targets
"""Request a single target
Arguments:
filter_string: Filter term to use for the query
filter_id: UUID of an existing filter to use for the query
trash: Whether to get the trashcan targets instead
target_id: UUID of an existing target
tasks: Whether to include list of tasks that use the target
Returns:
Expand All @@ -107,7 +107,7 @@ async def get_targets(
with Gmp(connection=UnixSocketConnection()) as gmp:
gmp.authenticate(username=current_user.username, password=Auth.get_admin_password())
try:
return gmp.get_targets(filter_string=filter_string,filter_id=filter_id,trash=trash,tasks=tasks)
return gmp.get_target(target_id=target_id, tasks=tasks)
except Exception as err:
LOGGER.error(f"GMP Error: {err}")
return ErrorResponse("Internal Server Error")
Expand Down

0 comments on commit c040c49

Please sign in to comment.