# coding: utf-8 def is_load_external(): return globals().has_key('AGENT_LOADER') if not is_load_external(): from lib.agent.ctest import SwitchAgent agent = SwitchAgent(__name__) @agent.entry("vm_flaw_scan", version='1.0.1') def vm_flaw_scan(subtask_id, args): from access_detection.vm_access_controll_detection import get_vm_infor, version_comapre import sqlite3, re, time # args = {'path': '/root/PycharmProjects/96d9b1b5-2f45-4baf-8462-5a166c87a3bb', # 'name': '96d9b1b5-2f45-4baf-8462-5a166c87a3bb'} json_data = [] time.sleep(10) infor, version = get_vm_infor(args) if (not infor) or (not version): brief = '测试功能首先将虚拟机磁盘挂载,获取虚拟机系统信息。\n' \ '然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \ '虚拟机中未发现漏洞。' json_data = [{'bugName': '无', 'bugInfo': '无'}] else: brief = '测试功能首先将虚拟机磁盘挂载,获取虚拟机系统信息。\n' \ '然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \ '获取虚拟机系统信息:\n'+infor+'\n虚拟机中可能存在的漏洞如下:' version = '.'.join(version.split('.')[:2])
# -*- coding: utf-8 -*- #系统执行execfile时第一次运行该模块 from numpy.dual import det __author__ = 'Henry' def is_load_external(): return globals().has_key('AGENT_LOADER') # Execute this while run this agent file directly if not is_load_external(): # Import ctest package from lib.agent.ctest import SwitchAgent # Create SwitchAgent instance agent = SwitchAgent(__name__) # 这里agent是SwitchAgent的实例,运行该类的entry函数 @agent.entry("mmount", version="1.0.2") def mmount_test(subtask_id,args): from virus_scan.mount import Mounter disk_path = '' disk_name = '' disk_type = '' print args try: disk_path = args["path"] # disk_name = args["name"] # disk_type = args["type"] except:
__author__ = 'zyc' # Determine whether loaded by agent_loader def is_load_external(): return globals().has_key('AGENT_LOADER') # Execute this while run this agent file directly if not is_load_external(): # Import ctest package from lib.agent.ctest import SwitchAgent # Create SwitchAgent instance agent = SwitchAgent(__name__) # 格式修改完成 @agent.entry("testLDAP", version="1.0.1") def my_testLDAP(subtask_id, args): from encryption.processLDAP import loginScript, processLDAPPack, stringLDAPMatch import ConfigParser conf = ConfigParser.ConfigParser() conf.read('encryption/custom.conf') userName = conf.get('Engine', 'userName').strip() userPassword = conf.get('Engine', 'password').strip() domainName = conf.get('Engine', 'domainName').strip() # thread.start_new_thread(loginScript,(userName, userPassword, domainName))
import json # Determine whether loaded by agent_loader def is_load_external(): return globals().has_key('AGENT_LOADER') # Execute this while run this agent file directly if not is_load_external(): # Import ctest package from lib.agent.ctest import SwitchAgent # Create SwitchAgent instance agent = SwitchAgent(__name__) ''' return: OK: "{'json_data':{'start_time':start_time,'conf':conf,'has_auth':has_auth}}" NO: "{'json_data':{'start_time':start_time,'conf':'None','has_auth':has_auth}}" ''' @agent.entry("vmconf", version="1.0.2") def set_vmiconf(subtask_id, args): import json from sec_mem_port import set_vm_libvmi_conf_port from lib.node_ta.ta_common import logger #print '[',args,']','###################',type(args) vm_id = ''
# coding: utf-8 from boto import log __author__ = 'pushpin' def is_load_external(): return globals().has_key('AGENT_LOADER') if not is_load_external(): # Import ctest package from lib.agent.ctest import SwitchAgent # Create SwitchAgent instance agent = SwitchAgent(__name__) # Register function "my_enginecheck" on service "enginecheck" @agent.entry("webengine", version='1.0.1') def my_webengine(subtask_id, args): from encryption.enginecheck import enginecheck engine_ip = '127.0.0.1' print 'startup webengine while the engine ip address is %s ' % engine_ip if engine_ip else 'Nothing' logInfo = "" my_enginecheck = enginecheck(engine_ip) checklist = my_enginecheck.engine_check() my_enginecheck.tools_version() logfile = '.info%s' % engine_ip logio = open(logfile) toolsversion = None