コード例 #1
0
ファイル: views.py プロジェクト: wangmingzhitu/coffeesploit
def run_plugin():
    status = main.pluginmanager.plugin_status()
    if request.method == 'POST':
		trace='time: '+time.strftime('%Y-%m-%d %H:%M')+'     plugin: '+main.current_plugin_name()	# 'trace' is used to log
		for arg in status:
			print arg, ":", request.form.get(arg)
			trace+='     '+arg+': '+request.form.get(arg)	# log input ####
			plu_arg = request.form.get(arg)
			plu_arg = str(plu_arg)
			if plu_arg is not None and plu_arg != "":
				main.set(str(arg), plu_arg)
		main.pluginmanager.plugin_run()
		with open(__basedir+'/server/history.log','a+') as f:			#log in file
			trace+='     result: '+pluginmanager.IsSucceed+'\n'
			f.write(trace)

		return jsonify(status='SUCCESS')
コード例 #2
0
ファイル: views.py プロジェクト: wangmingzhitu/coffeesploit
def show_run_result(outMethod):
	showMethods = {True: 'text', False: 'visual'}
	controllers = {'text': True, 'visual': False}
	if request.method == 'POST':
		args_status = request.form
		for k, v in args_status.items():
			main.set(k, v)
		if outMethod == 'text':
			run_result = convertSpaceToInHTML(main.run())
		elif outMethod == 'visual':
			run_result = main.run(outMethod)
		else:
			abort(401)
	else:
		if outMethod == 'text':
			run_result = convertSpaceToInHTML(main.get_result_for_text())
		elif outMethod == 'visual':
			run_result = main.get_result_for_visual()
		else:
			abort(401)
	current_tool = main.current_plugin_name()
	return render_template("show.html", toolCategories=tool_categories, toolsList=tools_of_category, runResult=run_result, currentTool=current_tool, controller=controllers[outMethod], showMethods=showMethods)