Codebase list faraday-plugins / run/61353a38-d68c-4b95-a0ec-aa37f114b747/upstream
Import upstream version 1.9.1 Kali Janitor 1 year, 4 months ago
13 changed file(s) with 88 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
00 Metadata-Version: 2.1
11 Name: faraday-plugins
2 Version: 1.9.0
2 Version: 1.9.1
33 Summary: Faraday plugins package
44 Home-page:
55 Author: Faradaysec
0 __version__ = '1.9.0'
0 __version__ = '1.9.1'
33 import logging
44 import os
55 import shlex
6 import subprocess
6 import subprocess # nosec
77 import sys
88 from pathlib import Path
99
141141 color_message = click.style("Command: ", fg="green")
142142 click.echo(f"{color_message} {command}")
143143 else:
144 p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
144 p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE) # nosec
145145 output = io.StringIO()
146146 while True:
147147 retcode = p.poll()
4848 output being sent is valid.
4949 """
5050 try:
51 f = urlopen(self.getSetting("Host") + "/api/hooks?token=" + self.getSetting("Authkey"))
51 f = urlopen(self.getSetting("Host") + "/api/hooks?token=" + self.getSetting("Authkey")) # nosec
5252 data = json.loads(f.read())
5353 except Exception:
5454 self.logger.info("[BeEF] - Connection with api")
0 """
1 Faraday Penetration Test IDE
2 Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
3 See the file 'doc/LICENSE' for the license information
4
5 """
6
7 from faraday_plugins.plugins.plugin import PluginXMLFormat
8 from faraday_plugins.plugins.plugins_utils import CVE_regex, CWE_regex
9 from xml.etree import ElementTree as ET
10
11 __author__ = "Gonzalo Martinez"
12 __copyright__ = "Copyright (c) 2013, Infobyte LLC"
13 __credits__ = ["Gonzalo Martinez"]
14 __license__ = ""
15 __version__ = "1.0.0"
16 __maintainer__ = "Gonzalo Martinez"
17 __email__ = "[email protected]"
18 __status__ = "Development"
19
20
21 class CisPlugin(PluginXMLFormat):
22
23 def __init__(self, *arg, **kwargs):
24 super().__init__(*arg, **kwargs)
25 self.ns = {
26 "scap-con": "{http://scap.nist.gov/schema/scap/constructs/1.2}",
27 "arf": "{http://scap.nist.gov/schema/asset-reporting-format/1.1}",
28 "dsc": "{http://scap.nist.gov/schema/scap/source/1.2}",
29 "ai": "{http://scap.nist.gov/schema/asset-identification/1.1}",
30 "xccdf": "{http://checklists.nist.gov/xccdf/1.2}"
31 }
32 self.identifier_tag = "asset-report-collection"
33 self.id = "CIS"
34 self.name = "CIS XML Output Plugin"
35 self.plugin_version = "1.0.0"
36
37 def parseOutputString(self, output):
38
39 root = ET.fromstring(output)
40 rules = {}
41 for rule in root.findall(f".//{self.ns['xccdf']}Rule"):
42 rules[rule.attrib['id']] = {
43 "title": rule[0].text,
44 "description": rule[1][0].text
45 }
46 reports = root.findall(f".//{self.ns['arf']}reports")
47 for report in reports:
48 target_address = report.find(f".//{self.ns['xccdf']}target-address").text
49 rules_results = report.findall(f".//{self.ns['xccdf']}rule-result")
50 h_id = self.createAndAddHost(target_address)
51 for rule_result in rules_results:
52 result = rule_result.find(f"{self.ns['xccdf']}result").text
53 if result != "pass":
54 severity = rule_result.attrib.get("severity","unclassified")
55 rule_id = rule_result.attrib['idref']
56 references = []
57 for ident in rule_result.findall(f"{self.ns['xccdf']}ident"):
58 text = ident.text
59 if isinstance(text, str) and len(text) > 10:
60 references.append(text)
61 self.createAndAddVulnToHost(
62 h_id,
63 name=rules[rule_id]["title"],
64 desc=rules[rule_id]["description"],
65 severity=severity,
66 ref=references
67 )
68
69 def createPlugin(*args, **kwargs):
70 return CisPlugin(*args, **kwargs)
116116 return item
117117 try:
118118 item['ip'] = self.resolve_hostname(item['ip'])
119 except:
120 pass # nosec
119 except: # nosec
120 pass
121121 return item
122122
123123 def resolveNS(self, item, items):
124124 try:
125125 item['hosts'][0] = item['ip']
126126 item['ip'] = self.resolve_hostname(item['ip'])
127 except:
127 except: # nosec
128128 pass
129129 return item
130130
33 See the file 'doc/LICENSE' for the license information
44
55 """
6 import subprocess
6 import subprocess # nosec
77 import re
88 import sys
99 import json
181181 can_parse = super().canParseCommandString(current_input)
182182 if can_parse:
183183 try:
184 proc = subprocess.Popen([self.command, '-version'], stderr=subprocess.PIPE)
184 proc = subprocess.Popen([self.command, '-version'], stderr=subprocess.PIPE) # nosec
185185 output = proc.stderr.read()
186186 match = re.search(r"Current Version: ([0-9.]+)", output.decode('UTF-8'))
187187 if match:
0 import subprocess
0 import subprocess # nosec
11 import re
22 import json
33 from packaging import version
137137 can_parse = super().canParseCommandString(current_input)
138138 if can_parse:
139139 try:
140 proc = subprocess.Popen([self.command, '-version'], stderr=subprocess.PIPE)
140 proc = subprocess.Popen([self.command, '-version'], stderr=subprocess.PIPE) # nosec
141141 output = proc.stderr.read()
142142 match = re.search(r"Current Version: ([0-9.]+)", output.decode('UTF-8'))
143143 if match:
4040 int(hostName)
4141 # No exception => host is the next item.
4242 hostName = parameters[1]
43 except:
43 except: # nosec
4444 pass
4545
4646 # Add host and note with output of traceroute.
9696
9797 faraday_obj_name = map_objects_fields.get(field)[0]
9898 faraday_field = map_objects_fields.get(field)[1]
99 except:
99 except: # nosec
100100 continue
101101
102102 if faraday_field == "reference" and value != "":
00 Metadata-Version: 2.1
11 Name: faraday-plugins
2 Version: 1.9.0
2 Version: 1.9.1
33 Summary: Faraday plugins package
44 Home-page:
55 Author: Faradaysec
4444 faraday_plugins/plugins/repo/burp/plugin.py
4545 faraday_plugins/plugins/repo/checkmarx/__init__.py
4646 faraday_plugins/plugins/repo/checkmarx/plugin.py
47 faraday_plugins/plugins/repo/cis/__init__.py
48 faraday_plugins/plugins/repo/cis/plugin.py
4749 faraday_plugins/plugins/repo/cobalt/__init__.py
4850 faraday_plugins/plugins/repo/cobalt/plugin.py
4951 faraday_plugins/plugins/repo/dig/__init__.py