Skip to content

Commit

Permalink
fix report html;update katana
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy0 committed Mar 26, 2024
1 parent d17dbd8 commit ac28656
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 52 deletions.
2 changes: 1 addition & 1 deletion SCopilot/templates/SCopilot.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ <h4 class="card-title">端口信息</h4>

<div class="tab-pane fade" id="vuln-tab-pane" role="tabpanel" aria-labelledby="vuln-tab" tabindex="0">
<ul class="list-group">
{{range $index, $message := .data.VulMessage }}
{{ range $index, $message := .data.VulMessage }}
<li class="list-group-item">
<div class="vuln-card mb-3 {{ $message.Level }}">
<div class="d-flex justify-content-between align-items-center">
Expand Down
2 changes: 1 addition & 1 deletion conf/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ var Banner = `

const Website = "https://github.com/yhy0/Jie"

const Version = "1.0.6"
const Version = "1.0.7"
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ require (
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/projectdiscovery/fastdialer v0.0.63 // indirect
github.com/projectdiscovery/goflags v0.1.44
github.com/projectdiscovery/fastdialer v0.0.64 // indirect
github.com/projectdiscovery/goflags v0.1.45
github.com/projectdiscovery/hmap v0.0.41 // indirect
github.com/projectdiscovery/ratelimit v0.0.33
github.com/projectdiscovery/retryablehttp-go v1.0.52
github.com/projectdiscovery/utils v0.0.84
github.com/projectdiscovery/retryablehttp-go v1.0.53
github.com/projectdiscovery/utils v0.0.85
github.com/remeh/sizedwaitgroup v1.0.0 // indirect
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect
github.com/rs/xid v1.5.0 // indirect
Expand Down Expand Up @@ -63,7 +63,7 @@ require (
github.com/panjf2000/ants/v2 v2.9.0
github.com/pkg/errors v0.9.1
github.com/projectdiscovery/gologger v1.1.12
github.com/projectdiscovery/katana v1.0.6-0.20240313185050-24c31f49c050
github.com/projectdiscovery/katana v1.1.0
github.com/projectdiscovery/naabu/v2 v2.3.0
github.com/projectdiscovery/nuclei/v3 v3.2.2
github.com/projectdiscovery/retryabledns v1.0.58
Expand Down Expand Up @@ -330,7 +330,7 @@ require (
github.com/projectdiscovery/tlsx v1.1.6 // indirect
github.com/projectdiscovery/uncover v1.0.7 // indirect
github.com/projectdiscovery/useragent v0.0.42 // indirect
github.com/projectdiscovery/wappalyzergo v0.0.113 // indirect
github.com/projectdiscovery/wappalyzergo v0.0.115 // indirect
github.com/projectdiscovery/yamldoc-go v1.0.4 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.41.0 // indirect
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,8 @@ github.com/projectdiscovery/dsl v0.0.48 h1:cdchhF0xofP8pi+HusNcVpw7oUuln7bS7KtzH
github.com/projectdiscovery/dsl v0.0.48/go.mod h1:px2y6PLhdUx77KwPMpk6MBCaQTtTE1PpG4ZVmsgBmK8=
github.com/projectdiscovery/fastdialer v0.0.63 h1:IZlC77aGf71cAgPfbvoUspzwKnJ2ZylWHXqXCKT+f9k=
github.com/projectdiscovery/fastdialer v0.0.63/go.mod h1:MJKyHdU08k0TfeQSKigQIRsF2VwvX2qKJJfNlb4vdBw=
github.com/projectdiscovery/fastdialer v0.0.64 h1:xivkA4g14nwQElOVsxPkGMWsdcYPcp7DPhVjvI6yQkw=
github.com/projectdiscovery/fastdialer v0.0.64/go.mod h1:S/7PAQRmVDYRaU7u4xXD0qA5a48NAZq2JcpcVoEVrlo=
github.com/projectdiscovery/fasttemplate v0.0.2 h1:h2cISk5xDhlJEinlBQS6RRx0vOlOirB2y3Yu4PJzpiA=
github.com/projectdiscovery/fasttemplate v0.0.2/go.mod h1:XYWWVMxnItd+r0GbjA1GCsUopMw1/XusuQxdyAIHMCw=
github.com/projectdiscovery/freeport v0.0.5 h1:jnd3Oqsl4S8n0KuFkE5Hm8WGDP24ITBvmyw5pFTHS8Q=
Expand All @@ -995,6 +997,8 @@ github.com/projectdiscovery/go-smb2 v0.0.0-20240129202741-052cc450c6cb h1:rutG90
github.com/projectdiscovery/go-smb2 v0.0.0-20240129202741-052cc450c6cb/go.mod h1:FLjF1DmZ+POoGEiIQdWuYVwS++C/GwpX8YaCsTSm1RY=
github.com/projectdiscovery/goflags v0.1.44 h1:O/ObgErxBgLO1snPJ4LlM3j3aO1IUFN5l42imtnxSmE=
github.com/projectdiscovery/goflags v0.1.44/go.mod h1:Z9lgmcFjEL8SUr2m1uh3X5z/m/2Z/FJvkyAG+6MTeRE=
github.com/projectdiscovery/goflags v0.1.45 h1:quDCIWRsULQHmDI1UvXptEn9cSRCeiHWT3mxB6bpxnA=
github.com/projectdiscovery/goflags v0.1.45/go.mod h1:JBwA9GYq/7m0a9PTsfRIoPqoB4/+r59MFTVJMDhN0Ic=
github.com/projectdiscovery/gologger v1.1.12 h1:uX/QkQdip4PubJjjG0+uk5DtyAi1ANPJUvpmimXqv4A=
github.com/projectdiscovery/gologger v1.1.12/go.mod h1:DI8nywPLERS5mo8QEA9E7gd5HZ3Je14SjJBH3F5/kLw=
github.com/projectdiscovery/gostruct v0.0.2 h1:s8gP8ApugGM4go1pA+sVlPDXaWqNP5BBDDSv7VEdG1M=
Expand All @@ -1011,6 +1015,8 @@ github.com/projectdiscovery/ipranger v0.0.38 h1:xbZkq8VPIfEgW9srm/rlLJFRD+kPaZV9
github.com/projectdiscovery/ipranger v0.0.38/go.mod h1:uedVYo5AUrmw6nRTh/B4UgZycwp/HHC9gaI0A05XqR0=
github.com/projectdiscovery/katana v1.0.6-0.20240313185050-24c31f49c050 h1:/xY0Isvs3sdZVfeVy/HkVaUxdXRHdzwNxTnkkH2jrOM=
github.com/projectdiscovery/katana v1.0.6-0.20240313185050-24c31f49c050/go.mod h1:g5nS+MYo4D5zPFeJLYYMqYL9Vj6nEGyJcHn8IG+4tmQ=
github.com/projectdiscovery/katana v1.1.0 h1:J4EdSss0eoLKs5LRTJn8/BbHZSyJtHY7AW0/YNcWRfk=
github.com/projectdiscovery/katana v1.1.0/go.mod h1:iDtcbSLcEH3dEP+YN950vlrJg8T/h0/u1McyeDF/K+Y=
github.com/projectdiscovery/ldapserver v1.0.2-0.20240219154113-dcc758ebc0cb h1:MGtI4oE12ruWv11ZlPXXd7hl/uAaQZrFvrIDYDeVMd8=
github.com/projectdiscovery/ldapserver v1.0.2-0.20240219154113-dcc758ebc0cb/go.mod h1:vmgC0DTFCfoCLp0RAfsfYTZZan0QMVs+cmTbH6blfjk=
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983 h1:ZScLodGSezQVwsQDtBSMFp72WDq0nNN+KE/5DHKY5QE=
Expand All @@ -1035,6 +1041,8 @@ github.com/projectdiscovery/retryabledns v1.0.58 h1:ut1FSB9+GZ6zQIlKJFLqIz2RZs81
github.com/projectdiscovery/retryabledns v1.0.58/go.mod h1:RobmKoNBgngAVE4H9REQtaLP1pa4TCyypHy1MWHT1mY=
github.com/projectdiscovery/retryablehttp-go v1.0.52 h1:E1EXok2oXmX1pwCHMyMKkdbiyp0IUxd5bQ7ZbT8AK+o=
github.com/projectdiscovery/retryablehttp-go v1.0.52/go.mod h1:DITjQ0spJHSL81ALR6BEr+yMw/Nxhw0qSdjwF9mGhjI=
github.com/projectdiscovery/retryablehttp-go v1.0.53 h1:Kp4590eOwFhUH9oIaCFMtudLSqL1BX+VNurS42+SC8Q=
github.com/projectdiscovery/retryablehttp-go v1.0.53/go.mod h1:b5zNLih0PcfvrDzTRY+QCB1dhFpODQQ2NjI4TtrmRyY=
github.com/projectdiscovery/sarif v0.0.1 h1:C2Tyj0SGOKbCLgHrx83vaE6YkzXEVrMXYRGLkKCr/us=
github.com/projectdiscovery/sarif v0.0.1/go.mod h1:cEYlDu8amcPf6b9dSakcz2nNnJsoz4aR6peERwV+wuQ=
github.com/projectdiscovery/stringsutil v0.0.2 h1:uzmw3IVLJSMW1kEg8eCStG/cGbYYZAja8BH3LqqJXMA=
Expand All @@ -1047,8 +1055,12 @@ github.com/projectdiscovery/useragent v0.0.42 h1:SA8xpvaKdA3zrz8D1y5vR5cE2cl2f/C
github.com/projectdiscovery/useragent v0.0.42/go.mod h1:HMzxj3qLFGcCVaj8L87gEoKQjWtbvypqN0+8CiiUywA=
github.com/projectdiscovery/utils v0.0.84 h1:1IcaRVOrxow7Qev57OF1CSCj5QTmx3MZL5C25A/qa8k=
github.com/projectdiscovery/utils v0.0.84/go.mod h1:8toAN5TBNqMJFS6uVVQTcmONrOBIMZpHAElrlzT+Y4I=
github.com/projectdiscovery/utils v0.0.85 h1:JpCVc9GJwJLNHy1MBPmAHJcE6rs7bRv72Trb3u84OHE=
github.com/projectdiscovery/utils v0.0.85/go.mod h1:ttiPgS2LmLFd+VRBUdgfLKMMdrF98zX7z5W+K71MX40=
github.com/projectdiscovery/wappalyzergo v0.0.113 h1:aoGOY3iGXX6U1RC2TAVEd/s65BESNYYIqpthZvcsZIk=
github.com/projectdiscovery/wappalyzergo v0.0.113/go.mod h1:hc/o+fgM8KtdpFesjfBTmHTwsR+yBd+4kYZW/DGy/x8=
github.com/projectdiscovery/wappalyzergo v0.0.115 h1:Xe916MBsliAWwogLHZN0qTrjyCy56PHuGUkdl0DTchk=
github.com/projectdiscovery/wappalyzergo v0.0.115/go.mod h1:hc/o+fgM8KtdpFesjfBTmHTwsR+yBd+4kYZW/DGy/x8=
github.com/projectdiscovery/yamldoc-go v1.0.4 h1:eZoESapnMw6WAHiVgRwNqvbJEfNHEH148uthhFbG5jE=
github.com/projectdiscovery/yamldoc-go v1.0.4/go.mod h1:8PIPRcUD55UbtQdcfFR1hpIGRWG0P7alClXNGt1TBik=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
Expand Down
16 changes: 8 additions & 8 deletions pkg/output/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,36 @@ var vulnReportTmpl []byte
var ReportMessageChan = make(chan VulMessage)

func GenerateVulnReport(filename string) {
vulMessages := make([]VulMessage, 0)

var vulMessages []VulMessage
for vulMessage := range ReportMessageChan {
// Append the received vulMessage to the list
vulMessages = append(vulMessages, vulMessage)

// Create the output file
outputFile, err := os.Create(filename)
if err != nil {
logging.Logger.Errorln("Error creating output file:", err)
return
}

// Execute the template and write the output to the file
tmpl, err := template.New("vuln_report").Parse(string(vulnReportTmpl))
if err != nil {
logging.Logger.Errorln("Error parsing template:", err)
return
}

err = tmpl.Execute(outputFile, struct {
VulnMessages []VulMessage
VulMessages []VulMessage
}{
VulnMessages: vulMessages,
VulMessages: vulMessages,
})
if err != nil {
logging.Logger.Errorln("Error executing template:", err)
return
}

outputFile.Close()
}
}
73 changes: 37 additions & 36 deletions pkg/output/vulnReport.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,45 +46,46 @@
<div class="container mt-5">
<h3 class="text-center">Vulnerability Report - Jie</h3>
<ul class="list-group">
{{range $index, $message := .VulnMessages}}
<li class="list-group-item">
<div class="vuln-card mb-3 {{.Level}}">
<div class="d-flex justify-content-between align-items-center">
<h4 class="plugin mb-0">{{.VulnData.VulnType}} - {{.VulnData.Target}} </h4>
<span class="badge rounded-pill bg-danger"> {{ .VulnData.Plugin }}</span>
<span class="toggle-switch btn btn-primary">Toggle Details</span>
</div>
<p >{{.Level}}</p>
{{if .VulnData.Ip}}<p>IP: {{.VulnData.Ip}}</p>{{end}}
{{if .VulnData.CreateTime}}<p>Create Time: {{.VulnData.CreateTime}}</p>{{end}}
<div class="vuln-details collapse">
{{if .VulnData.Method}}<p>Method: {{.VulnData.Method}}</p>{{end}}
{{if .VulnData.Param}}<p>Parameter: {{.VulnData.Param}}</p>{{end}}
{{if .VulnData.Payload}}<p>Payload: {{.VulnData.Payload}}</p>{{end}}
{{if .VulnData.CURLCommand}}<p>CURL Command: {{.VulnData.CURLCommand}}</p>{{end}}
{{if .VulnData.Description}}<p>Description: {{.VulnData.Description}}</p>{{end}}
<!-- Nav tabs for Request and Response -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" data-bs-toggle="tab" href="#request{{$index}}" role="tab" aria-controls="request{{$index}}" aria-selected="true" >Request</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" data-bs-toggle="tab" href="#response{{$index}}" role="tab" aria-controls="response{{$index}}" aria-selected="false" >Response</a>
</li>
</ul>
<!-- Tab panes for Request and Response -->
<div class="tab-content">
<div class="tab-pane fade show active" id="request{{$index}}" role="tabpanel" aria-labelledby="request-tab{{$index}}">
{{if .VulnData.Request}}<pre class="card-text">{{.VulnData.Request}}</pre>{{end}}
</div>
<div class="tab-pane fade" id="response{{$index}}" role="tabpanel" aria-labelledby="response-tab{{$index}}">
{{if .VulnData.Response}}<pre class="card-text">{{.VulnData.Response}}</pre>{{end}}
</div>
{{ range $index, $message := .VulMessages }}
<li class="list-group-item">
<div class="vuln-card mb-3 {{ $message.Level }}">
<div class="d-flex justify-content-between align-items-center">
<h4 class="level mb-0">
{{ if $message.VulnData.VulnType }} {{ $message.VulnData.VulnType }} - {{ end }}{{ $message.VulnData.Target }}
</h4>
<span class="toggle-switch btn btn-primary">Toggle Details</span>
</div>
<p class="level">{{ $message.Level }} <span class="badge rounded-pill bg-danger"> {{ $message.Plugin }}</span></p>
{{ if $message.VulnData.Ip }}<p>IP: {{ $message.VulnData.Ip }}</p>{{ end }}
{{ if $message.VulnData.CreateTime }}<p>Create Time: {{ $message.VulnData.CreateTime }}</p>{{ end }}
{{ if $message.VulnData.Payload }}<p class="level">Payload: {{ $message.VulnData.Payload }}</p>{{ end }}
<div class="vuln-details collapse">
{{ if $message.VulnData.Method }}<p>Method: {{ $message.VulnData.Method }}</p>{{ end }}
{{ if $message.VulnData.Param }}<p>Parameter: {{ $message.VulnData.Param }}</p>{{ end }}
{{ if $message.VulnData.CURLCommand }}<p>CURL Command: {{ $message.VulnData.CURLCommand }}</p>{{ end }}
{{ if $message.VulnData.Description }}<p>Description: {{ $message.VulnData.Description }}</p>{{ end }}
<!-- Nav tabs for Request and Response -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" data-bs-toggle="tab" href="#vuln-request{{$index}}" role="tab" aria-controls="vuln-request{{$index}}" aria-selected="true" >Request</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" data-bs-toggle="tab" href="#vuln-response{{$index}}" role="tab" aria-controls="vuln-response{{$index}}" aria-selected="false" >Response</a>
</li>
</ul>
<!-- Tab panes for Request and Response -->
<div class="tab-content">
<div class="tab-pane fade show active" id="vuln-request{{$index}}" role="tabpanel" aria-labelledby="vuln-request-tab{{$index}}">
{{ if $message.VulnData.Request}}<pre class="card-text">{{ $message.VulnData.Request}}</pre>{{ end }}
</div>
<div class="tab-pane fade" id="vuln-response{{$index}}" role="tabpanel" aria-labelledby="vuln-response-tab{{$index}}">
{{ if $message.VulnData.Response }}<pre class="card-text">{{ $message.VulnData.Response }}</pre>{{ end }}
</div>
</div>
</div>
</li>
{{end}}
</div>
</li>
{{ end }}
</ul>
<div class="footer mt-5 pt-3 text-center">
© 2023 Copyright: <a class="text-dark" href="https://github.com/yhy0/Jie" target="_blank">yhy</a>
Expand Down

0 comments on commit ac28656

Please sign in to comment.