Skip to content

Commit

Permalink
Merge pull request #114 from dmwoods38/master
Browse files Browse the repository at this point in the history
Added Scanner API Object and Added list scanner appliances function.
  • Loading branch information
paragbaxi authored Jul 11, 2023
2 parents ae3143f + 8fa944a commit 5c47c7f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
24 changes: 24 additions & 0 deletions qualysapi/api_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,27 @@ def deleteReport(self, id):

logging.debug("%s %s %s", res.DATETIME, code, res.TEXT)
return code, res

def listAppliances(self):
call = "/api/2.0/fo/appliance/"
parameters = {
"action": "list"
}

scanner_data = objectify.fromstring(self.request(call, parameters).encode("utf-8"))
scanner_array = []
for scanner in scanner_data.RESPONSE.APPLIANCE_LIST.APPLIANCE:
scanner_array.append(
Scanner(
scanner.find("ID"),
scanner.find("UUID"),
scanner.find("NAME"),
scanner.find("NETWORK_ID"),
scanner.find("SOFTWARE_VERSION"),
scanner.find("RUNNING_SLICES_COUNT"),
scanner.find("RUNNING_SCAN_COUNT"),
scanner.find("STATUS")
)
)

return scanner_array
13 changes: 13 additions & 0 deletions qualysapi/api_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,16 @@ def resume(self, conn):
self.status = objectify.fromstring(
conn.request(call, parameters).encode("utf-8")
).RESPONSE.SCAN_LIST.SCAN.STATUS.STATE


class Scanner:
def __init__(self, id: int, uuid: str, name: str, network_id: int, software_version:str,
running_slices_count: int, running_scan_count: int, status: str):
self.id = id
self.uuid = uuid
self.name = name
self.network_id = network_id
self.software_version = software_version
self.running_slices_count = running_slices_count
self.running_scan_count = running_scan_count
self.status = status
2 changes: 1 addition & 1 deletion qualysapi/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__author__ = "Parag Baxi <parag.baxi@gmail.com>"
__pkgname__ = "qualysapi"
__version__ = "8.0.2"
__version__ = "8.1.0"

0 comments on commit 5c47c7f

Please sign in to comment.