Skip to content

Commit

Permalink
wip scan
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspermayone committed Jul 24, 2024
1 parent 124e4df commit b0667ba
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
40 changes: 33 additions & 7 deletions src/functions/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function sendNewDomainMessage(app: App, domain: String) {
let npmVersion = process.env.npm_package_version;

// create a function that takes in domain and ts, as well as the classification and then returns the json data
async function createData(
async function createClassificationData(
domain: String,
ts: String,
classification: Classification
Expand All @@ -61,7 +61,7 @@ export async function sendNewDomainMessage(app: App, domain: String) {
return JSON.stringify(data);
}

async function creareRejectData(domain: String, ts: String) {
async function createData(domain: String, ts: String) {
let data = {
domain: domain,
ts: ts,
Expand Down Expand Up @@ -112,31 +112,47 @@ export async function sendNewDomainMessage(app: App, domain: String) {
text: "Postal",
emoji: true,
},
value: `${await createData(domain, ts, "postal")}`,
value: `${await createClassificationData(
domain,
ts,
"postal"
)}`,
},
{
text: {
type: "plain_text",
text: "Banking",
emoji: true,
},
value: `${await createData(domain, ts, "banking")}`,
value: `${await createClassificationData(
domain,
ts,
"banking"
)}`,
},
{
text: {
type: "plain_text",
text: "Item Scams",
emoji: true,
},
value: `${await createData(domain, ts, "item_scams")}`,
value: `${await createClassificationData(
domain,
ts,
"item_scams"
)}`,
},
{
text: {
type: "plain_text",
text: "Other",
emoji: true,
},
value: `${await createData(domain, ts, "other")}`,
value: `${await createClassificationData(
domain,
ts,
"other"
)}`,
},
],
action_id: "domain_classification",
Expand All @@ -152,9 +168,19 @@ export async function sendNewDomainMessage(app: App, domain: String) {
text: "Reject Domain (Safe)",
emoji: true,
},
value: `${await creareRejectData(domain, ts)}`,
value: `${await createData(domain, ts)}`,
action_id: "reject_domain",
},
{
type: "button",
text: {
type: "plain_text",
text: "Scan Domain",
emoji: true,
},
value: `${await createData(domain, ts)}`,
action_id: "scan_domain",
},
],
},
{
Expand Down
17 changes: 17 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,23 @@ app.action(/.*?/, async (args) => {
timestamp: rclassmsg.ts,
});

break;
case "scan_domain":
const scan = await axios.post(
"https://urlscan.io/api/v1/scan/",
{
url: domain,
},
{
headers: {
"API-Key": process.env.URLSCAN_API_KEY!,
Referer: "https://phish.directory",
},
}
);

console.log(scan);

break;
default:
console.log("Unknown action");
Expand Down

0 comments on commit b0667ba

Please sign in to comment.