You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var re1 = regexp.MustCompile(` +`)
func testCmd(s string, data string) {
a := re1.Split(s, -1)
//log.Println(strings.Join(a, "\n"))
Cmd := exec.Command(a[0], a[1:]...)
var err error
var wt io.WriteCloser
var wg sync.WaitGroup
wg.Add(2)
if wt, err = Cmd.StdinPipe(); nil == err {
bufout := bufio.NewWriter(wt)
go func() {
defer wg.Done()
bufout.Write([]byte(data + "\n"))
/*
I am not in a hurry to close wt here, there will be more uses in the future
At this point I hope nuclei has started running and output the results
But we found that if wt is not closed here, http will hang and will never start execution.
In other words, it will not friendly process and execute the stream from time to time.
When the stream becomes larger one by one, it will cause memory overflow, the same problem., tlsx does not have this problem. It can process the stream line by line in a friendly manner without waiting for the stream to be closed.
*/
bufout.Flush()
//wt.Close()
}()
} else {
fmt.Println(err)
}
if out, err1 := Cmd.StdoutPipe(); nil == err1 {
go func() {
defer wg.Done()
buf := make([]byte, 4096) // 设置适当的缓冲区大小
for {
n, err8 := out.Read(buf)
if 0 < n {
os.Stdout.Write(buf[:n])
}
if err8 == io.EOF {
break
}
if err8 != nil {
log.Println(err8)
break
}
}
}()
} else {
log.Println(err)
}
if err4 := Cmd.Start(); nil != err4 {
log.Println("Cmd.Start", err4)
}
if err6 := Cmd.Wait(); nil != err6 {
log.Println("Cmd.Wait", err6)
}
wg.Wait()
wt.Close()
}
func TestKatana(t *testing.T) {
testCmd("katana -nc -silent -j -hl -system-chrome -headless-options '--blink-settings=\"imagesEnabled=false\",--enable-quic=\"imagesEnabled=false\"' -jc -kf all", "https://51pwn.com")
}
If it can friendly support line-by-line processing stream
This helps parse the results in one pass, including the results of other programs, and then give them continuous input of some parameters that need to be iterated over
The text was updated successfully, but these errors were encountered:
hktalent
added
the
Type: Bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
label
Jan 1, 2024
myxxx23
pushed a commit
to GhostTroops/scan4all
that referenced
this issue
Jan 1, 2024
projectdiscovery/nuclei#4560
same bug
If it can friendly support line-by-line processing stream
This helps parse the results in one pass, including the results of other programs, and then give them continuous input of some parameters that need to be iterated over
The text was updated successfully, but these errors were encountered: