mirror of
https://github.com/lunchcat/sif.git
synced 2026-06-12 19:11:25 -07:00
ef0408ee8d
sif can now slot into unix pipelines. stdin is drained for targets when it's a pipe (keyed off stdin's mode, not stdout), alongside -u/-f. naked hosts are accepted and default to https://; explicit http(s) is kept, other schemes rejected. -silent routes all banner/spinner/log chrome to stderr and prints one normalized finding per line to stdout via finding.Flatten, so `subfinder | sif -silent | notify` works.
49 lines
2.0 KiB
Go
49 lines
2.0 KiB
Go
/*
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
: :
|
|
: █▀ █ █▀▀ · Blazing-fast pentesting suite :
|
|
: ▄█ █ █▀ · BSD 3-Clause License :
|
|
: :
|
|
: (c) 2022-2026 vmfunc, xyzeva, :
|
|
: lunchcat alumni & contributors :
|
|
: :
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
*/
|
|
|
|
package finding
|
|
|
|
import "testing"
|
|
|
|
// Line is the -silent wire format; its shape is frozen, so pin it.
|
|
func TestFindingLine(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
f Finding
|
|
want string
|
|
}{
|
|
{
|
|
name: "high severity",
|
|
f: Finding{Target: "https://x.com", Module: "sql", Severity: SeverityHigh, Title: "admin panel"},
|
|
want: "[high] https://x.com sql admin panel",
|
|
},
|
|
{
|
|
name: "info recon",
|
|
f: Finding{Target: "https://y.com", Module: "headers", Severity: SeverityInfo, Title: "Server"},
|
|
want: "[info] https://y.com headers Server",
|
|
},
|
|
{
|
|
name: "unknown severity",
|
|
f: Finding{Target: "z.com", Module: "mystery", Severity: SeverityUnknown, Title: "?"},
|
|
want: "[unknown] z.com mystery ?",
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := tt.f.Line(); got != tt.want {
|
|
t.Errorf("Line() = %q, want %q", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|