Skip to content

Commit 126932f

Browse files
committed
Merge community
2 parents c72a37b + 7090d3e commit 126932f

58 files changed

Lines changed: 3667 additions & 2251 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ Project contributors
2121
* Andres Tarantini
2222
* Martin Tartarelli
2323
* Ronald Iraheta
24+
* Thierry Beauquier

RELEASE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Please run ./faraday.py --update
1010
New features in the latest update
1111
=====================================
1212

13+
Apr 29, 2016:
14+
---
15+
* Added Open services count to Hosts list in WEB UI
16+
* Improved zsh integration
17+
* Added GTK3 interface prototype
18+
* Added plugin detection through report name
19+
* Fixed an error in wcscan script
20+
* Fixed nikto plugin
21+
* Fixed openvas plugin
22+
1323
Apr 04, 2016
1424
---
1525
* Added cli mode (see wiki for usage instructions)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.18
1+
1.0.19

apis/rest/api.py

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from tornado.httpserver import HTTPServer
1717
from tornado.ioloop import IOLoop
1818

19-
from plugins.core import PluginControllerForApi
2019
from model.visitor import VulnsLookupVisitor
2120

2221
import utils.logs as logger
@@ -41,10 +40,10 @@ def stopServer():
4140
_http_server.stop()
4241

4342

44-
def startAPIs(plugin_manager, model_controller, mapper_manager, hostname, port):
43+
def startAPIs(plugin_controller, model_controller, hostname, port):
4544
global _rest_controllers
4645
global _http_server
47-
_rest_controllers = [PluginControllerAPI(plugin_manager, mapper_manager), ModelControllerAPI(model_controller)]
46+
_rest_controllers = [PluginControllerAPI(plugin_controller), ModelControllerAPI(model_controller)]
4847

4948
app = Flask('APISController')
5049

@@ -92,12 +91,12 @@ def getRoutes(self):
9291
def badRequest(self, message):
9392
error = 400
9493
return jsonify(error=error,
95-
message=message), error
94+
message=message)
9695

9796
def noContent(self, message):
9897
code = 204
9998
return jsonify(code=code,
100-
message=message), code
99+
message=message)
101100

102101
def ok(self, message):
103102
code = 200
@@ -287,54 +286,71 @@ def statusCheck(self):
287286

288287

289288
class PluginControllerAPI(RESTApi):
290-
def __init__(self, plugin_manager, mapper_manager):
291-
self.plugin_controller = PluginControllerForApi(
292-
"PluginController",
293-
plugin_manager.getPlugins(),
294-
mapper_manager)
289+
def __init__(self, plugin_controller):
290+
self.plugin_controller = plugin_controller
295291

296292
def getRoutes(self):
297293
routes = []
298294
routes.append(Route(path='/cmd/input',
299-
view_func=self.postCmdInput,
300-
methods=['POST']))
295+
view_func=self.postCmdInput,
296+
methods=['POST']))
301297
routes.append(Route(path='/cmd/output',
302-
view_func=self.postCmdOutput,
303-
methods=['POST']))
298+
view_func=self.postCmdOutput,
299+
methods=['POST']))
304300
routes.append(Route(path='/cmd/active-plugins',
305-
view_func=self.clearActivePlugins,
306-
methods=['DELETE']))
301+
view_func=self.clearActivePlugins,
302+
methods=['DELETE']))
307303
return routes
308304

309-
def pluginAvailable(self, new_cmd, output_file):
305+
def pluginAvailable(self, plugin, cmd):
310306
code = 200
311307
return jsonify(code=code,
312-
cmd=new_cmd,
313-
custom_output_file=output_file)
308+
cmd=cmd,
309+
plugin=plugin)
314310

315311
def postCmdInput(self):
316312
json_data = request.get_json()
317313
if 'cmd' in json_data.keys():
318-
cmd = json_data.get('cmd')
319-
has_plugin, new_cmd, output_file = self.plugin_controller.\
320-
processCommandInput(cmd)
321-
if has_plugin:
322-
return self.pluginAvailable(new_cmd, output_file)
323-
return self.noContent("no plugin available for cmd")
324-
#cmd not sent, bad request
325-
return self.badRequest("cmd parameter not sent")
314+
if 'pid' in json_data.keys():
315+
if 'pwd' in json_data.keys():
316+
try:
317+
cmd = base64.b64decode(json_data.get('cmd'))
318+
pwd = base64.b64decode(json_data.get('pwd'))
319+
except:
320+
cmd = ''
321+
pwd = ''
322+
pid = json_data.get('pid')
323+
plugin, new_cmd = self.plugin_controller.\
324+
processCommandInput(pid, cmd, pwd)
325+
if plugin:
326+
return self.pluginAvailable(plugin, new_cmd)
327+
else:
328+
return self.noContent("no plugin available for cmd")
329+
else:
330+
return self.badRequest("pwd parameter not sent")
331+
else:
332+
return self.badRequest("pid parameter not sent")
333+
else:
334+
return self.badRequest("cmd parameter not sent")
335+
336+
326337

327338
def postCmdOutput(self):
328339
json_data = request.get_json()
329-
if 'cmd' in json_data.keys():
340+
if 'pid' in json_data.keys():
330341
if 'output' in json_data.keys():
331-
cmd = json_data.get('cmd')
332-
output = base64.b64decode(json_data.get('output'))
333-
if self.plugin_controller.onCommandFinished(cmd, output):
334-
return self.ok("output successfully sent to plugin")
335-
return self.badRequest("output received but no active plugin")
342+
if 'exit_code' in json_data.keys():
343+
pid = json_data.get('pid')
344+
output = base64.b64decode(json_data.get('output'))
345+
exit_code = json_data.get('exit_code')
346+
if self.plugin_controller.onCommandFinished(
347+
pid, exit_code, output):
348+
return self.ok("output successfully sent to plugin")
349+
return self.badRequest(
350+
"output received but no active plugin")
351+
return self.badRequest("exit_code parameter not sent")
336352
return self.badRequest("output parameter not sent")
337-
return self.badRequest("cmd parameter not sent")
353+
return self.badRequest("pid parameter not sent")
338354

339355
def clearActivePlugins(self):
340356
self.plugin_controller.clearActivePlugins()

config/default.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<faraday>
33

44
<appname>Faraday - Penetration Test IDE</appname>
5-
<version>1.0.18</version>
5+
<version>1.0.19</version>
66
<debug_status>0</debug_status>
77
<font>-Misc-Fixed-medium-r-normal-*-12-100-100-100-c-70-iso8859-1</font>
88
<home_path>~/</home_path>

config/globals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
CONST_FARADAY_QTRC_PATH = 'deps/qtrc'
1414
CONST_FARADAY_IMAGES = 'images/'
1515
CONST_FARADAY_LOGS_PATH = 'logs/'
16-
CONST_FARADAY_FOLDER_LIST = [ "config", "data", "images",
16+
CONST_FARADAY_FOLDER_LIST = [ "config", "data", "images",
1717
"persistence", "plugins",
1818
"report", "temp", "zsh", "logs" ]
1919

@@ -24,7 +24,7 @@
2424
CONST_FARADAY_QTRC_BACKUP = '~/.qt/.qtrc_faraday.bak'
2525
CONST_FARADAY_ZSHRC = "zsh/.zshrc"
2626
CONST_FARADAY_ZSH_FARADAY = "zsh/faraday.zsh"
27-
CONST_FARADAY_ZSH_PLUGIN = "zsh/plugin_controller_client.py"
27+
CONST_FARADAY_ZSH_OUTPUT_PATH = "zsh/output"
2828
CONST_FARADAY_BASE_CFG = "config/default.xml"
2929
CONST_FARADAY_USER_CFG = "config/config.xml"
3030
CONST_FARADAY_LIB_HELPERS = "shell/core/_helpers.so"

faraday.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
FARADAY_USER_ZSHRC = os.path.join(FARADAY_USER_HOME, CONST_FARADAY_ZSHRC)
5555
FARADAY_USER_ZSH_PATH = os.path.join(FARADAY_USER_HOME, CONST_ZSH_PATH)
5656
FARADAY_BASE_ZSH = os.path.join(FARADAY_BASE, CONST_FARADAY_ZSH_FARADAY)
57-
FARADAY_BASE_ZSH_PLUGIN = os.path.join(FARADAY_BASE,
58-
CONST_FARADAY_ZSH_PLUGIN)
5957

6058
USER_QT = os.path.expanduser(CONST_USER_QT_PATH)
6159
USER_QTRC = os.path.expanduser(CONST_USER_QTRC_PATH)
@@ -141,7 +139,8 @@ def getParserArgs():
141139

142140
parser.add_argument('--gui', action="store", dest="gui",
143141
default="qt3",
144-
help="Select interface to start faraday. Default = qt3")
142+
help="Select interface to start faraday. Supported values are "
143+
"qt3 (deprecated), gtk and 'no' (no GUI at all). Defaults to qt3")
145144

146145
parser.add_argument('--cli', action="store_true",
147146
dest="cli",
@@ -300,9 +299,6 @@ def startFaraday():
300299

301300
logger.info("All done. Opening environment.")
302301
#TODO: Handle args in CONF and send only necessary ones.
303-
# Force OSX to run no gui
304-
if sys.platform == "darwin":
305-
args.gui = "no-gui"
306302

307303
main_app = MainApplication(args)
308304

@@ -400,10 +396,8 @@ def setupZSH():
400396
f.seek(0, 0)
401397
f.write('ZDOTDIR=$OLDZDOTDIR' + '\n' + content)
402398
with open(FARADAY_USER_ZSHRC, "a") as f:
403-
f.write("source %s" % FARADAY_BASE_ZSH)
399+
f.write("source \"%s\"" % FARADAY_BASE_ZSH)
404400
shutil.copy(FARADAY_BASE_ZSH, FARADAY_USER_ZSH_PATH)
405-
shutil.copy(FARADAY_BASE_ZSH_PLUGIN, FARADAY_USER_ZSH_PATH)
406-
407401

408402
def setupXMLConfig():
409403
"""Checks user configuration file status.

gui/gtk/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)