MCPcopy Create free account
hub / github.com/SamNet-dev/snix / writeSNITable

Function writeSNITable

cmd/snix/scan.go:295–318  ·  view source on GitHub ↗
(w interface{ Write(p []byte) (int, error) }, all, ranked []scanner.Result)

Source from the content-addressed store, hash-verified

293}
294
295func writeSNITable(w interface{ Write(p []byte) (int, error) }, all, ranked []scanner.Result) error {
296 tw := tabwriter.NewWriter(w, 0, 2, 2, ' ', 0)
297
298 // Summary counts.
299 counts := map[scanner.Outcome]int{}
300 for _, r := range all {
301 counts[r.Outcome]++
302 }
303 fmt.Fprintf(w, "Summary: %d ok, %d reset, %d timeout, %d tls_error, %d refused\n\n",
304 counts[scanner.OutcomeOK], counts[scanner.OutcomeDPIReset],
305 counts[scanner.OutcomeTimeout], counts[scanner.OutcomeTLSError],
306 counts[scanner.OutcomeTCPRefused])
307
308 if len(ranked) == 0 {
309 fmt.Fprintln(w, "No SNI worked against this target. Try a different --target IP.")
310 return nil
311 }
312 fmt.Fprintln(tw, "RANK\tSNI\tHANDSHAKE\tTCP_RTT")
313 for i, r := range ranked {
314 fmt.Fprintf(tw, "%d\t%s\t%s\t%s\n",
315 i+1, r.SNI, r.Handshake.Round(time.Millisecond), r.RTT.Round(time.Millisecond))
316 }
317 return tw.Flush()
318}
319
320func writeIPTable(w interface{ Write(p []byte) (int, error) }, all, ranked []scanner.IPResult) error {
321 tw := tabwriter.NewWriter(w, 0, 2, 2, ' ', 0)

Callers 2

newScanSNICmdFunction · 0.85
newScanAllCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected