Closed 13m0n4de closed 1 year ago
目前计划将 build_xxx_command
从返回命令序列改为返回 subprocess.check_output
的所有参数,返回类型是 Dict
,同时函数名也稍作修改
现在已经基本完成了,现在改为为模块实现 build_xxx_execution_kwargs
以解析模块参数或上一模块的结果列表,并返回 subprocess.check_output
的参数。
masscan 比较特殊,它只能通过配置文件来指定 IP:PORT
列表,也许要生成整个配置文件的内容也说不定。
现在已经基本完成了,现在改为为模块实现
build_xxx_execution_kwargs
以解析模块参数或上一模块的结果列表,并返回subprocess.check_output
的参数。masscan 比较特殊,它只能通过配置文件来指定
IP:PORT
列表,也许要生成整个配置文件的内容也说不定。
感觉不太现实,nmap 也是同样的情况。
我想可能得有个标记,如果不支持从批量读入目标列表,就使用之前的方案
https://github.com/13m0n4de/fastapi-dramatiq-demo/commit/76eac1ed6465bb4c50bb6b5a232aa35390e75199
现在 build_execution_kwargs
可以不支持 List[ScanResults]
而只支持单个的输入。
需要同时传递 support_read_targets
参数,这样 run_scan
可以选择是否遍历逐个执行并拼接结果。
读入多个目标是通过 input
参数实现的:
这种情况下的命令不同,需要创建一个 chains_command
:
build_command
传入一个 chains=True
即可
比如
httpx
,其支持多个ip:port
作为扫描目标输入,采用标准输入:当前,接受到来自上一任务的结果列表
List[XXXScanResult]
时,是逐个执行处理的:https://github.com/13m0n4de/fastapi-dramatiq-demo/blob/8229fd07b812703f3a90a4b249c865d185ee3692/app/actors/utils.py#L119-L126
完全可以使用以上方法交给工具批量运行。
要解决两点:
前者要慎重考虑一下怎么设计,后者我认为可以暂时忽略,默认所有工具都能从标准输入读取目标列表(只要支持从文件读取扫描目标的工具都可以实现)。