Skip to content

[Bug] gogo -F 格式化 smart/alive 类型数据失败,JSON 拼接逻辑导致语法错误 #123

@UUU7777777

Description

@UUU7777777

在使用 gogo -F 对 .dat 文件进行格式化输出时,如果数据类型(json_type)为 smartb, smartc 或 alive,程序会报错并退出。
[-] json error, invalid character ',' after top-level value
复现步骤

创建包含 smartc 类型的扫描结果1.dat
内容如下
{"ip":"10.1.1.1/8","ips":null,"ports":"top1","json_file":"","list_file":"","threads":1000,"mod":"sc","no_scan":false,"alive_spray":null,"port_spray":false,"exploit":"","json_type":"smartc","version_level":0,"RunnerOpt":{"Exploit":"none","VersionLevel":0,"Delay":2,"HttpsDelay":2,"ScanFilters":null,"Debug":false,"Opsec":false,"ExcludeCIDRs":null}}
{"10.0.0.0/16":["10.0.24.0/24","10.0.30.0/24","10.0.32.0/24"]}
{"10.1.0.0/16":["10.1.0.0/24"]}
["done"]

执行命令
gogo -F 1.dat 触发错误

Image

经过排查代码,发现问题出在 parseSmartResultData 方法的 JSON 拼接逻辑上。

该方法在处理多行数据时,只是简单地在行与行之间添加了逗号 ,,但没有在最外层包裹中括号 [] 将其转换为 JSON 数组。

修复建议:

建议参考 parseScanResultData 的实现,在拼接数据前后加上 [ 和 ],确保生成合法的 JSON 数组格式。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions