Skip to content

Commit

Permalink
Removed parameters in createAndAddHost in plugins and Faraday Core.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezequieltbh committed Feb 7, 2017
1 parent cc95dc7 commit 7cbf508
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
17 changes: 4 additions & 13 deletions helpers/plugins/canvas/faraday_report/faraday_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,9 @@ def getAndCreateNewHost(self, node):

#Create Host
host_id = self.faraday_api.createAndAddHost(
node['resolved_from'],
op_sy,
'Unknown',
'Unknown',
node['ip']
)
node['resolved_from'],
op_sy)

host = Host(node['ip'], host_id)
self.host_list.append(host)
return host
Expand Down Expand Up @@ -313,13 +310,7 @@ def parsingAndSendClientd(self):
info_host = self.data['clients'][ip]['agents'][agent]

#Create Host
host_id = self.faraday_api.createAndAddHost(
ip,
os,
'Unknown',
'Unknown',
'Unknown'
)
host_id = self.faraday_api.createAndAddHost(ip, os)

#'IE Flash' is a keyword only for Internet Explorer??'
try:
Expand Down
8 changes: 4 additions & 4 deletions model/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ def _setUpAPIServer(hostname=None, port=None):
# plugin created the object


def createAndAddHost(name, os = "Unknown"):
def createAndAddHost(name, os="Unknown"):
host = newHost(name, os)
if addHost(host, category, update, old_hostname):
if addHost(host):
return host.getID()
return None

Expand Down Expand Up @@ -239,9 +239,9 @@ def createAndAddCredToService(host_id, service_id, username, password):

#TODO: add class check to object passed to be sure we are adding the right thing to the model

def addHost(host, category=None, update = False, old_hostname = None):
def addHost(host):
if host is not None:
__model_controller.addHostASYNC(host, category, update, old_hostname)
__model_controller.addHostASYNC(host)
return True
return False

Expand Down
6 changes: 3 additions & 3 deletions model/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,16 @@ def addUpdate(self, old_object, new_object):
def find(self, obj_id):
return self.mappers_manager.find(obj_id)

def addHostASYNC(self, host, category=None, update=False, old_hostname=None):
def addHostASYNC(self, host):
"""
ASYNC API
Adds an action to the ModelController actions queue indicating a
new host must be added to the model
"""
self.__addPendingAction(modelactions.ADDHOST,
host, category, update, old_hostname)
host)

def addHostSYNC(self, host, category=None, update=False, old_hostname=None):
def addHostSYNC(self, host):
"""
SYNC API
Adds a host directly to the model
Expand Down
6 changes: 3 additions & 3 deletions model/guiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def deregisterWidget(widget):

def createAndAddHost(name, os="Unknown"):
host = model.api.newHost(name, os)
if addHost(host, category, update, old_hostname):
if addHost(host):
return host.getID()
return None

Expand Down Expand Up @@ -205,9 +205,9 @@ def createAndAddCredToService(host_id, service_id, username, password):
return None


def addHost(host, category=None, update = False, old_hostname = None):
def addHost(host):
if host is not None:
__model_controller.addHostSYNC(host, category, update, old_hostname)
__model_controller.addHostSYNC(host)
return True
return False

Expand Down
8 changes: 4 additions & 4 deletions plugins/repo/sentinel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ def parseOutputString(self, output, debug=False):
if self.getSetting("Api_key") == "":
self.log("Please set Sentinel API in plugin configuration", "ERROR")
return True

allVulns = self.getAllVulns()
for element in allVulns['collection']:

vulnClass = element.get('class', "Vuln_Without_Title")
severity = element.get('severity', "INFO")
host = element.get('url', 'Unknown Hostname')

hostId = self.faraday_api.createAndAddHost(host, "", "", False, "")
hostId = self.faraday_api.createAndAddHost(host, "")

interfaceId = self.faraday_api.createAndAddInterface(
hostId,
Expand All @@ -78,9 +78,9 @@ def parseOutputString(self, output, debug=False):
vulnData = self.getAttackVector(element.get('href', 'unknown'))

for vuln in vulnData['collection']:

vuln_information = self.getVulnInformation(element.get('href', 'unknown'))

desc = vuln_information.get("description", "").get("description_prepend", "")
solution = vuln_information.get("solution", "").get("solution_prepend", "")
siteId = vuln_information.get("site", "Unknown")
Expand Down

0 comments on commit 7cbf508

Please sign in to comment.