被動掃描器研發(1):golang生成cdata xml格式數據

背景

我已經把awvs變成了被動掃描器引擎,其中一些關鍵環節,我會做一些總結以筆記形式發出來。

awvs可以通過導入burpsuite的導出xml文件作為被動掃描器流量的流量輸入,它還可以接收如下所述的數據格式

<code>Accepted formats include text file with a list of URLs (.txt), Fiddler session archives (.saz), Swagger files (.json, .yaml or .yml), Web Services Definition Files (.wsdl), BURP saved files (.xml) and state files, Selenium (.html, .side), Web Application Description Language (.wadl), ASP.NET Web Forms Project Files (.csproj, .vbproj), Paros log files (.session.data), Postman Collections v2 (.json) or HTTP archive files (*.har)/<code>

原burpsuite xml導出數據格式

<code>]><items>  <item>    <time>Tue Feb 04 17:55:28 CST 2020/<time>        <host>192.168.0.108/<host>    <port>80/<port>    <protocol>http/<protocol>    <method>    <path>    <extension>null/<extension>    <request>    <status>404/<status>    <responselength>4842/<responselength>    <mimetype>HTML/<mimetype>    <response>    <comment>  /<item>/<items>/<code>

精簡後xml數據格式:

為什麼需要精簡成如下數據格式?因為經過調研調試,發現url節點是必須的,而request節點awvs會在post請求中使用,method節點多一個也不多,就順便帶入。其他節點刪除後,並沒有明顯的影響漏洞掃描結果數據。在awvs12中url節點還不是必須的,而awvs13不設置url節點會無法掃描”terminate called after throwing an instance of ‘ax::utility::WvsException’\\n what(): HttpJob: unable to set url:”。

<code><items>    <item>        <method>    <request>  /<item>/<items>/<code>

cdata xml with golang of export burpsuite

<code>package mainimport ("encoding/xml""fmt")type items struct {XMLName xml.Name `xml:"items"`Version string   `xml:"burpVersion,attr"`Itemlist []item `xml:"item"`}type item struct {URL CdataStringUrl`xml:"url"`METHOD CdataStringMethod `xml:"method"`Req CdataString `xml:"request"`}type CdataString struct {Value string `xml:",cdata"`Base64 string `xml:"base64,attr"`}type CdataStringUrl struct {Value string `xml:",cdata"`}type CdataStringMethod struct {Value string `xml:",cdata"`}func main() {v := &items{Version: "2.1.06"}for i:=0;i<10;i++{v.Itemlist = append(v.Itemlist, item{URL:CdataStringUrl{Value:"http://123.com"}, METHOD:CdataStringMethod{Value:"GET"}, Req: CdataString{Value: "bbbccc", Base64:"true"}})}output, err := xml.MarshalIndent(v, "", "  ")if err != nil {fmt.Printf("error: %v\\n", err)}fmt.Println(string(output))}/<code>

輸出結果:
對base64數據在demo中沒有轉碼,這裡只做整體數據格式參考

<code><items>  <item>        <method>    <request>  /<item>  <item>        <method>    <request>  /<item>  <item>        <method>    <request>  /<item>  <item>        <method>    <request>  /<item>  <item>        <method>    <request>  /<item>  <item>     
<method> <request> /<item> <item> <method> <request> /<item> <item> <method> <request> /<item> <item> <method> <request> /<item> <item> <method> <request> /<item>/<items>/<code>


被動掃描器研發(1):golang生成cdata xml格式數據


分享到:


相關文章: