我一直在为我的一个小项目编写此代码,我想解析一些看起来像这样的JSON数据:
{
"payloads": [
{
"xss": [
{
"payload": "{{RANDSTR}}\"><scRiPT>alert(1)</ScrIPT>{{RANDSTR}}",
"search": "{{RANDSTR}}\"><scRi"
},
{
"payload": "{{RANDSTR}}\"",
"search": "{{RANDSTR}}\""
},
{
"payload": "{{RANDSTR}}'",
"search": "{{RANDSTR}}'"
}
],
"tpli": [
{
"payload": "{{RANDSTR}}${{ {{RANDINT}} * {{RANDINT}} }}",
"search": "{{RANDSTR}}{{RANDINT}}"
},
{
"payload": "{{RANDSTR}}{{ {{RANDINT}} * {{RANDINT}} }}",
"search": "{{RANDSTR}}{{RANDINT}}"
},
{
"payload": "{{RANDSTR}}{! {{RANDINT}} * {{RANDINT}} !}",
"search": "{{RANDSTR}}{{RANDINT}}"
},
{
"payload": "{{RANDSTR}}{% {{RANDINT}} * {{RANDINT}} %}",
"search": "{{RANDSTR}}{{RANDINT}}"
}
]
}
]
}
这是我的结构声明:
type Payload struct {
Payload []struct {
Payload string `json:"payload"`
Search string `json:"search"`
}
}
type Payloads struct {
Payloads []Payload `json:"payloads"`
}
我知道这不是我应该做的事情,但我不确定最好的方法。我不想指定键(xss,tpli等),因为我想轻松扩展此文件而无需修改Go文件。
有人能为我指出如何实现这一目标的正确方向吗?
宝慕林4294392
相关分类