使用gvm_cli命令来实现

先创建一个空的配置

copy_id = '085569ce-73ed-11df-83c3-002264764cea'
new_config = '''
<create_config>
<copy>{}</copy>
<name>{}</name>
</create_config>

'''.format(copy_id,target_name)

gvm-cli socket --sockpath /var/run/gvmd.sock --gmp-username usr --gmp-password 'pass' -xml  new_config

再往配置里面修改添加需要扫描的项的oid和所属的family

modify_config = <modify_config config_id="{}">
  <nvt_selection>
    <family>Web Servers</family>
    <nvt oid="{}"/>
    <family>Denial of Service</family>
    <nvt oid="{}"/>
    <family>General</family>
    <nvt oid="{}"/>
  </nvt_selection>
</modify_config>

gvm-cli socket --sockpath /var/run/gvmd.sock --gmp-username usr --gmp-password 'pass' -xml  modify_config

最后添加两个必须得基础项  ping,nasl  namp.nasl

oid1 = '1.3.6.1.4.1.25623.1.0.14259'
oid2 = '1.3.6.1.4.1.25623.1.0.100315'

modify_config = '''
<modify_config config_id="{}">
<nvt_selection>
<family>Port scanners</family>
<nvt oid="{}"/>
<nvt oid="{}"/>
</nvt_selection>
</modify_config>
'''.format(config_id, oid1, oid2)

gvm-cli socket --sockpath /var/run/gvmd.sock --gmp-username usr --gmp-password 'pass' -xml  modify_config

官网链接  https://docs.greenbone.net/API/GMP/gmp-7.0.html#command_modify_config

还有两个博客也是这方面的知识

https://github.com/greenbone/gvm-tools/blob/246f9dad215fea37eecc3ee3bc73b99a034e0471/scripts/nvt-scan.gmp.py#L49

https://github.com/greenbone/gvm-tools/blob/master/scripts/start-nvt-scan.gmp.py

openvas在centos中扫描单项的python实现的更多相关文章

  1. centos中从源程序升级python方法

    http://www.cnblogs.com/sky20081816/p/3441920.html 1 .wget http://python.org/ftp/python/2.7.3/Python- ...

  2. 记在centos中连接无线网络的一次过程

    1. 首先, 你的系统要能驱动无限网卡, 要是人品好的话, 系统已经自带了你的网卡的驱动程序. 不然就要先搞定无线网卡的驱动再说. 不然后面的步骤也就没必要了. 2. 看一下你的无线网卡叫什么: iw ...

  3. CentOS中输入yum报错:sudo: unable to execute /bin/yum: No such file or directory

    今天尝试更新了下虚拟机CentOS中的python版本后. 运行“yum”命令,就报错:“sudo: unable to execute /bin/yum: No such file or direc ...

  4. 在CentOS 6.X 上面安装 Python 2.7.X

    在CentOS 6.X 上面安装 Python 2.7.X CentOS 6.X 自带的python版本是 2.6 , 由于工作需要,很多时候需要2.7版本.所以需要进行版本升级.由于一些系统工具和服 ...

  5. centos中忘记root密码问题

    centos中root密码问题   几次在虚拟机中安装cenos,都没有提示输入root密码,具体操作如下: 1.在启动的时候,进入启动界面后,按除了Enter键之外的任意键,即可进入该界面.然后 按 ...

  6. 在新安装的Centos中安装python3.7 解决pip和yum问题

    首先要先安装依赖包: yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-deve ...

  7. centos中yum命令删除还原的补救方法介绍

    前言 yum,是Yellow dog Updater Modified的简称,起初是由yellow dog这一发行版的开发者Terra Soft研发,用python写成,那时还叫做yup(yellow ...

  8. [转]在Linux CentOS 6.6上安装Python 2.7.9

    在Linux CentOS 6.6上安装Python 2.7.9 查看python安装版本 python -V yum中最新的也是Python 2.6.6,所以只能下载Python 2.7.9的源代码 ...

  9. CentOS 中卸载 RPM 包文件

    CentOS 中卸载 RPM 包文件 一.原由 因为之前卸载 openvas 这个工具,使用了 find / -name "openvas"-exec rm -rf {} \ ; ...

  10. 案例3-ubuntu和centos中自动部署tomcat相关服务的脚本

    涉及redis,mysql,xtrabackup, tomcat 1. ubuntu中 #!/bin/bash #first, change to root #出错立刻中断 set -e apt-ge ...

随机推荐

  1. 初次安装虚拟机和Linux

    --初学Linux记录点滴 使用软件 VMware-Workstation-15.0.4 CentOS-7-x86_64-Minimal-2003.iso 1.首先使用 VMware-Workstat ...

  2. NVIDIA的GPU算力Compute Capalibity

    可查看官方查询地址:https://developer.nvidia.com/cuda-gpus

  3. kill 多个进程的脚本

    杀死多个进程的脚本 #!/bin/bash pids=$(ps -ef | grep warehouse |awk '{print $2}') for pid in $pids do echo $pi ...

  4. vue 图片下载

       getBase64Image(img) {        var canvas = document.createElement("canvas");        canv ...

  5. python读取文本中的字典

    首先得明确文本的每行是存的json或者用python的write(str(一个字典))写入的,那么不用借助json模块就能读取为字典,使用eval函数就行,json只能处理带双引号的字符串,但很多时候 ...

  6. Abp框架使用Swgger注释加分组

    1.在ConfigureSwaggerServices中配置SwaggerDoc,并options.DocInclusionPredicate((doc, desc) => { return d ...

  7. Ubuntu查看系统服务

    Linux服务是Linux系统非常重要的一环,查看服务,需要用到chkconfig工具,然而在Ubuntu 12.0版本,却没有查找到此命令. 查询stackOverflow获取了正确答案,对于Ubu ...

  8. Docker的常见使用

    一.Docker的常见使用 1.docker的使用 1.1 查看docker版本号信息 docker version docker info 1.2 启动docker systemctl start ...

  9. H5分享功能--带图标、说明

    代码实现 index.vue <template> <div id="app"> <SelfSharePage v-if="share_da ...

  10. mysql数据库常用指令

    1.查询当前连接数据库别名 select database(); Current database 项显示当前连接的数据库 2.查询数据表中当天的数据 select * from 表名 WHERE T ...