漏洞扫描器 - cmd命令行执行

该漏洞扫描器可以通过cmd命令行执行。

cmd命令行执行方式通过Click模块实现,Click用于快速创建命令行,相比于Argparse更加简便。代码如下所示:

@click.command()
@click.option("--verbose", help="Verbose or not (default False)", type=bool, required=False, default=True)
@click.option("--port", help="Port ranges, example: 22 or 1-1024 (default 1-65535)", default="1-65535")
@click.option("--ping", help="ICMP ping before scan", default=True)
@click.option("--syn", help="TCP SYN scan", default=True)
@click.option("--ssh", help="If SSH service is open, scan ssh version and detect weak password or not", default=True)
@click.option("--os_ttl", help="Use the parameter ttl to scan the type of OS", default=True)
@click.option("--os_nmap", help="Use the tool nmap to scan the type of OS", default=True)
@click.option("--size", help="Thread group size", default=1000)
@click.option("--timeout", help="How much time to wait after the last packet has been sent", default=3.0)
@click.argument("dst", required=True, type=str)

首先用 @click.command() 装饰scanner() 函数,使之成为命令行接口。

随后通过 @click.option() 等装饰函数添加命令行选项。

@click.option()函数的第一个参数指定了命定行选项的名称;help为参数说明,将在帮助界面向用户展示出来;default参数设置命令行参数的默认值;此外还可以通过nargs参数指定命令行参数接收的值的个数。

@click.argument(“dst”, required=True, type=str) 函数用来添加固定参数,要求必须输入目标IP地址。

下图为cmd帮助界面,可以看到dst参数为必填参数,还有可选选项列表。
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值