Created
October 23, 2022 11:02
-
-
Save X-C3LL/abc0182bf127fe649408ce7b9f6436e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Obtain teams token - you can reuse it for GoMapEnum for example | |
// Author: Juan Manuel Fernandez (@TheXC3LL) | |
const puppeteer = require('puppeteer'); | |
(async () => { | |
console.log("\t\tMS Teams Token Generator - @TheXC3LL\n\n"); | |
const username = process.argv[2]; | |
const password = process.argv[3]; | |
console.log("[*] Using credentials: %s:%s", username, password); | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
// Detect URL changes | |
page.on('framenavigated', frame => { | |
const url = frame.url(); | |
if (url.startsWith('https://teams.microsoft.com/go') && url.indexOf('token_type=Bearer') > 0){ | |
const token = url.substring(url.indexOf('access_token=') + 13, url.lastIndexOf('&token_type=Bearer')); | |
console.log("[*] Encoded Teams token: \n\n" + token + "\n\n"); | |
console.log("[^] Have a nice day!") | |
process.exit(); | |
} | |
}); | |
// Login | |
await page.goto('https://teams.microsoft.com/'); | |
page.waitForNavigation(); | |
await page.waitForSelector('[name="loginfmt"]'); | |
await page.type('[name="loginfmt"]', username); | |
await page.click('[type="submit"]'); | |
page.waitForNavigation(); | |
await page.waitForSelector('input[type="password"]'); | |
await page.type('input[type="password"]', password); | |
await page.waitForTimeout(1000); | |
await page.click('[type="submit"]'); | |
page.waitForNavigation(); | |
await page.waitForTimeout(3000); | |
await page.keyboard.press('Enter'); | |
console.log("[*] Processing URLs... it can take a few seconds!"); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment