Issue with AjaxSpider in Golang Code - ZAP Proxy

77 views
Skip to first unread message

Aakhash Ganesh

unread,
Dec 24, 2023, 6:54:06 PM12/24/23
to ZAP Developer Group

Hello ZAP Proxy Group,

 

I hope this message finds you well. I'm currently facing an issue while using AjaxSpider in my Golang code with ZAP Proxy. The error message I'm encountering is as follows:

 

```

65343 [Thread-12] WARN org.openqa.selenium.os.ExternalProcess - failed to copy the output of process 163

java.io.IOException: Stream closed

at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:176) ~[?:?]

at java.io.BufferedInputStream.read(BufferedInputStream.java:342) ~[?:?]

at java.io.InputStream.transferTo(InputStream.java:704) ~[?:?]

at org.openqa.selenium.os.ExternalProcess$Builder.lambda$start$0(ExternalProcess.java:209) ~[?:?]

at java.lang.Thread.run(Thread.java:829) [?:?]

71223 [Thread-79] WARN org.openqa.selenium.os.ExternalProcess - failed to copy the output of process 981

```

 

I'm using the following Golang function for the AjaxSpider scan:

 

```golang

// Note: the spiderAjax Add-on must install to run the AjaxSpiderScan function.

func (rcv PentestRcv) AjaxSpiderScan(targetURL, contextName string) error {

    bar := logger.SetProgressBar(100, "Ajax Spider on target")

    _, err := rcv.Interface.AjaxSpider().Scan(targetURL, "", contextName, "")

    if err != nil {

        return err

    }

    if bar != nil {

        bar.Increment(10)

    }

 

    // Poll the AJAX Spider status until it completes

    for {

        status, err := rcv.Interface.AjaxSpider().Status()

        if err != nil {

logger.Info("Failed to get AJAX Spider status:", err)

        }

logger.Info("process ", status["status"])

 

        if status["status"].(string) == "stopped" {

            fmt.Println("AJAX Spider completed.")

            break

        }

 

        time.Sleep(5 * time.Second) // Adjust the polling interval as needed

    }

    if bar != nil {

        bar.Increment(90)

        bar.MarkAsDone()

    }

    return nil

}

```

 

I would appreciate any guidance or suggestions on resolving this issue. If you need any additional information or code snippets, please let me know.

 

Thank you in advance for your assistance.

 

Best regards

thc...@gmail.com

unread,
Dec 25, 2023, 5:02:47 AM12/25/23
to zaproxy...@googlegroups.com
Hi,

Looks like Selenium failed to get the output from the browser.

When did that happen? It might not be an issue that you need to worry
about if that's happening when the AJAX Spider is already stopping.
That would be unrelated to your code either way.

Best regards.
Reply all
Reply to author
Forward
0 new messages