-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy paththreading.js
More file actions
34 lines (27 loc) · 876 Bytes
/
threading.js
File metadata and controls
34 lines (27 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const fs = require('fs')
class ThreadHandler{
constructor(browser,cbHandler){
this.browser = browser
this.workerCount=0
//preload our junk to browser
this.preloadFile = fs.readFileSync(__dirname + '/preload.js', 'utf8');
}
async newThread(browser,fuzzer,cbHandler){
const page = await this.browser.newPage();
var thread = page;
page.id=this.workerCount++;
await page.evaluateOnNewDocument(this.preloadFile);
await page.exposeFunction('xssCallback', (href)=>{
cbHandler.catchXSS(page, href)
callback(thread)
})
await page.exposeFunction('jsRedirectCallback', (href)=>{
cbHandler.catchRedirectJS(page, href)
})
fuzzer.loadNextUrl(thread)
return page
}
}
module.exports = {
ThreadHandler: ThreadHandler
}