def my_quick_VDSMflaw_scan(subtask_id,args):
    from quick_flaw_scan.ShowInfoOfScanVDSM_flaw import getFlawInfoBySql
    report = getFlawInfoBySql("select * from VDSM_flaw_scan")#此处的report返回一个包含所有VDSM漏洞信息的列表
    
    if report == null:
        agent.post_failure(subtask_id)
    else:
        agent.post_report(subtask_id,
                          severity=1,
                          result=0,
                          brief='result of quick_VDSMflaw_scan',
                          detail=report["result"],
                          json_data={'detail_report': report["detail"]})
def my_quick_ovirtflaw_scan(subtask_id,args):
    from quick_flaw_scan.ShowInfoOfScanOvirt_flaw import getFlawInfoBySql
    print 'startup quick_ovirtflaw_scan'
    report = getFlawInfoBySql("select * from Ovirt_flaw_scan")#此处的report返回一个包含所有Ovirt漏洞信息的列表
    
    if report == None:
        agent.post_failure(subtask_id)
    else:
        agent.post_report(subtask_id,
                          severity=1,
                          result=0,
                          brief='result of quick_ovirtflaw_scan',
                          detail=report["result"],
                          json_data={'detail_report': report["detail"]})
def my_quick_kvmflaw_scan(subtask_id,args):
    from quick_flaw_scan.ShowInfoOfScankvm_flaw import getFlawInfoBySql
    print 'startup quick_kvmflaw_scan'

    virus_table = "select * from kvm_flaw_scan"
    #vm_disk_size=int(get_vm_disk_size(vm_disk_path))
    #print vm_disk_size
    report = getFlawInfoBySql(virus_table)#此处的report返回一个包含所有kvm漏洞信息的列表
    if report == null:
        agent.post_failure(subtask_id)
    #下面的部分还不知道该怎么改
    else:
        agent.post_report(subtask_id,
                          severity=1,
                          result=0,
                          brief='result of quick_kvmflaw_scan',
                          detail=report["result"],
                          json_data={'detail_report': report["detail"]})
def my_quick_libvirtflaw_scan(subtask_id, args):
    from quick_flaw_scan.ShowInfoOfScanlibvirt_flaw import getFlawInfoBySql
    # 此处的report返回一个包含所有libvirt漏洞信息的列表
    report = getFlawInfoBySql("select * from libvirt_flaw_scan")
    if report == []:
        detail = '测试功能获取系统信息,然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \
                 '在此系统中没有发现libvirt漏洞。\n'
        report = [{'bugName': '无', 'bugInfo': '无'}]
    else:
        detail = '测试功能获取系统信息,然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \
                 'libvirt漏洞:根据系统环境,扫描系统列出系统中可能存在的libvirt漏洞。\n'

    agent.post_report(subtask_id,
                      severity=1,
                      result=0,
                      brief='result of quick_kvmflaw_scan',
                      detail=detail.replace('\n', '</br>'),
                      json_data=report)
def my_quick_kvmflaw_scan(subtask_id, args):
    from quick_flaw_scan.ShowInfoOfScankvm_flaw import getFlawInfoBySql
    virus_table = "select * from kvm_flaw_scan"
    # 此处的report返回一个包含所有kvm漏洞信息的列表
    report = []
    report = getFlawInfoBySql(virus_table)
    if report == []:
        detail = '测试功能获取系统信息,然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \
                 '本次扫描在此系统中没有发现QEMU-KVM漏洞。\n'
        report = [{'bugName': '无', 'bugInfo': '无'}]
    else:
        detail = '测试功能获取系统信息,然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \
                 'QEMU-KVM漏洞:根据系统环境,扫描系统列出系统中可能存在的QEMU-KVM漏洞。\n'

    agent.post_report(subtask_id,
                      severity=1,
                      result=0,
                      brief='result of quick_kvmflaw_scan',
                      detail=detail.replace('\n', '</br>'),
                      json_data=report)
def my_quick_VDSMflaw_scan(subtask_id, args):
    from quick_flaw_scan.ShowInfoOfScanVDSM_flaw import getFlawInfoBySql
    print("Start scan. . .\n")
    report = getFlawInfoBySql(
        "select * from VDSM_flaw_scan")  #此处的report返回一个包含所有VDSM漏洞信息的列表
    if report == []:
        detail = '测试功能获取系统信息,然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \
                 '在此系统中没有发现VDSM漏洞。\n'
        report = [{'bugName': '无', 'bugInfo': '无'}]
    else:
        detail = '测试功能获取系统信息,然后扫描vce,oval漏洞信息库,列出漏洞名称和漏洞信息。\n' \
                 'VDSM漏洞:根据系统环境,扫描系统列出系统中可能存在的VDSM漏洞。\n'

    print detail, report
    agent.post_report(subtask_id,
                      severity=1,
                      result=0,
                      brief='result of quick_kvmflaw_scan',
                      detail=detail.replace('\n', '</br>'),
                      json_data=report)