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
Hey, first off thanks for making this amazing tool!
I recently integrated Gowitness as a BBOT module, and am making heavy use of the feature that saves the DOM of each session to the sqlite database.
Similar to how the urls table contains a dom column, I would love it if the network_logs table also contained a field for the content of each of the files retrieved (JS, CSS, etc.)
GPT 4 has the following to say about it:
To capture the contents of network requests, we would need to use the network.Enable, network.GetResponseBody, and network.RequestWillBeSent functions from the network package.
Here's a general idea of how you might achieve this:
Enable network tracking. To start recording network events, we need to enable the network domain using network.Enable().
Attach an event handler. We can use the chromedp.ListenTarget function to attach a handler for network events. This handler will be called for each network event.
Handle RequestWillBeSent events. The network.RequestWillBeSent event is triggered when a network request is about to be sent. We'll store the request ids for later.
Handle LoadingFinished events. The network.LoadingFinished event is triggered when a network request has been fully loaded. When this event is triggered, we can get the response body for the request using the network.GetResponseBody function.
Here's an example of how you might implement these steps in your buildTasks function:
varrequestIDs=make(map[network.RequestID]struct{})
actions:=append(actions, chromedp.ActionFunc(func(ctx context.Context) error {
// Enable network trackingerr:=network.Enable().Do(ctx)
iferr!=nil {
returnerr
}
// Attach an event handlerchromedp.ListenTarget(ctx, func(evinterface{}) {
switchev:=ev.(type) {
case*network.EventRequestWillBeSent:
// Store the request id when a request is about to be sentrequestIDs[ev.RequestID] =struct{}{}
case*network.EventLoadingFinished:
// When a request has finished loading, get its response bodyif_, ok:=requestIDs[ev.RequestID]; ok {
gofunc() {
// GetResponseBody might block, so run it in a separate goroutinebody, err:=network.GetResponseBody(ev.RequestID).Do(ctx)
iferr!=nil {
log.Printf("Could not get response body for request id %s: %v", ev.RequestID, err)
} else {
// Save the response body// You might want to save it to a file or a database depending on your needsfmt.Printf("Response body for request id %s: %s", ev.RequestID, body)
}
}()
}
}
})
returnnil
}))
// Continue with the rest of your actions...
Please note that this example prints out the response body to the console. You would need to replace that part with your own code to save the response body to a SQLite database or any other storage system you'd like to use. Also, please make sure to handle errors appropriately according to your needs.
Let me know if you'd be interested in having this as a feature, and I can work on tackling it. Thanks again!
The text was updated successfully, but these errors were encountered:
Hey, first off thanks for making this amazing tool!
I recently integrated Gowitness as a BBOT module, and am making heavy use of the feature that saves the DOM of each session to the sqlite database.
Similar to how the
urls
table contains adom
column, I would love it if thenetwork_logs
table also contained a field for the content of each of the files retrieved (JS, CSS, etc.)GPT 4 has the following to say about it:
Let me know if you'd be interested in having this as a feature, and I can work on tackling it. Thanks again!
The text was updated successfully, but these errors were encountered: