Skip to content

Commit c1f84ac

Browse files
committed
made phishing email a bit harder
1 parent bd889aa commit c1f84ac

1 file changed

Lines changed: 55 additions & 21 deletions

File tree

client/src/game/gameObjs/tasks/phishingEmail.ts

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { Task } from "./task";
22
import { Scene } from "phaser";
33

4+
export type Email = {
5+
sender: string;
6+
recipient: string;
7+
subject: string;
8+
body: string;
9+
isPhishing: boolean;
10+
};
11+
12+
export type ObfuscatableEmailField = "sender" | "subject" | "body";
13+
414
export class PhishingEmail extends Task {
5-
private emails: {
6-
sender: string;
7-
recipient: string;
8-
subject: string;
9-
body: string;
10-
isPhishing: boolean;
11-
}[];
15+
private emails: Email[];
1216
// prevent duplicate emails from being seen
1317
private emailsSeen: Set<number> = new Set();
1418
private score: number = 0;
@@ -44,10 +48,10 @@ export class PhishingEmail extends Task {
4448
const playerRecipient = "randomemployee@therandomcompany.com";
4549
return [
4650
{
47-
sender: "support@bank.com",
51+
sender: "support@bankofscammers.com",
4852
recipient: playerRecipient,
4953
subject: "Urgent: Your Account Has Been Compromised",
50-
body: "Dear user, we have detected suspicious activity on your account. Please click the link below to reset your password immediately:\n\nhttps://fake-bank.com/reset-password\n\nIf you did not request this change, please contact us at support@bank.com.",
54+
body: "Dear user, we have detected suspicious activity on your account. Please click the link below to reset your password immediately:\n\nhttps://bankofscammers.com/reset-password\n\nIf you did not request this change, please contact us at support@bank.com.",
5155
isPhishing: true,
5256
},
5357
{
@@ -61,7 +65,7 @@ export class PhishingEmail extends Task {
6165
sender: "noreply@paypal.com",
6266
recipient: playerRecipient,
6367
subject: "Action Required: Verify Your Account",
64-
body: "We noticed unusual login attempts on your PayPal account. To secure your account, please verify your identity by clicking the link below:\n\nhttps://fake-paypal.com/verify\n\nIf this was not you, please contact us immediately.",
68+
body: "We noticed unusual login attempts on your PayPal account. To secure your account, please verify your identity by clicking the link below:\n\nhttps://paypal-real.com/verify\n\nIf this was not you, please contact us immediately.",
6569
isPhishing: true,
6670
},
6771
{
@@ -75,7 +79,7 @@ export class PhishingEmail extends Task {
7579
sender: "prizes@lottery.com",
7680
recipient: playerRecipient,
7781
subject: "Congratulations! You've Won $1000",
78-
body: "You are the lucky winner of a $1000 gift card! Click the link below to claim your prize:\n\nhttps://fake-lottery.com/claim-prize\n\nHurry, this offer expires soon!",
82+
body: "You are the lucky winner of a $1000 gift card! Click the link below to claim your prize:\n\nhttps://ez-lottery.com/claim-prize\n\nHurry, this offer expires soon!",
7983
isPhishing: true,
8084
},
8185
{
@@ -89,7 +93,7 @@ export class PhishingEmail extends Task {
8993
sender: "no-reply@facebook.com",
9094
recipient: playerRecipient,
9195
subject: "Your Account Has Been Temporarily Locked",
92-
body: "Due to suspicious activity, your account has been temporarily locked. Click the link below to unlock your account:\n\nhttps://fake-facebook.com/unlock-account\n\nIf you did not request this, please contact us immediately.",
96+
body: "Due to suspicious activity, your account has been temporarily locked. Click the link below to unlock your account:\n\nhttps://facebook-real.com/unlock-account\n\nIf you did not request this, please contact us immediately.",
9397
isPhishing: true,
9498
},
9599
{
@@ -103,21 +107,21 @@ export class PhishingEmail extends Task {
103107
sender: "billing@netflix.com",
104108
recipient: playerRecipient,
105109
subject: "Payment Failed - Update Your Payment Information",
106-
body: "We were unable to process your last payment. Please update your payment details to avoid service interruption:\n\nhttps://fake-netflix.com/update-payment",
110+
body: "We were unable to process your last payment. Please update your payment details to avoid service interruption:\n\nhttps://netflix-verify.com/update-payment",
107111
isPhishing: true,
108112
},
109113
{
110-
sender: "noreply@twitter.com",
114+
sender: "noreply@x.com",
111115
recipient: playerRecipient,
112-
subject: "Your Twitter Account Has Been Compromised",
113-
body: "We detected suspicious activity on your Twitter account. Click the link below to secure your account:\n\nhttps://twitter.com/account/secure",
116+
subject: "Your X Account Has Been Compromised",
117+
body: "We detected suspicious activity on your Twitter account. Click the link below to secure your account:\n\nhttps://x.com/account/secure",
114118
isPhishing: false,
115119
},
116120
{
117121
sender: "support@dropbox.com",
118122
recipient: playerRecipient,
119123
subject: "Your Dropbox Storage Is Full",
120-
body: "Your Dropbox storage is full. Upgrade your plan to continue syncing your files:\n\nhttps://fake-dropbox.com/upgrade",
124+
body: "Your Dropbox storage is full. Upgrade your plan to continue syncing your files:\n\nhttps://dropbox-login.com/upgrade",
121125
isPhishing: true,
122126
},
123127
{
@@ -131,7 +135,7 @@ export class PhishingEmail extends Task {
131135
sender: "support@irs.gov",
132136
recipient: playerRecipient,
133137
subject: "Urgent: Tax Refund Notification",
134-
body: "You are eligible for a tax refund. Click the link below to claim your refund:\n\nhttps://fake-irs.com/claim-refund",
138+
body: "You are eligible for a tax refund. Click the link below to claim your refund:\n\nhttps://irs-tax-us.com/claim-refund",
135139
isPhishing: true,
136140
},
137141
{
@@ -145,7 +149,7 @@ export class PhishingEmail extends Task {
145149
sender: "support@paypal.com",
146150
recipient: playerRecipient,
147151
subject: "Your Account Has Been Limited",
148-
body: "We have limited your account due to suspicious activity. Click the link below to resolve this issue:\n\nhttps://fake-paypal.com/resolve-issue",
152+
body: "We have limited your account due to suspicious activity. Click the link below to resolve this issue:\n\nhttps://paypal-secure.com/resolve-issue",
149153
isPhishing: true,
150154
},
151155
{
@@ -159,7 +163,7 @@ export class PhishingEmail extends Task {
159163
sender: "security@amazon.com",
160164
recipient: playerRecipient,
161165
subject: "Suspicious Activity Detected on Your Account",
162-
body: "We detected unusual activity on your Amazon account. Click the link below to secure your account:\n\nhttps://fake-amazon.com/secure-account",
166+
body: "We detected unusual activity on your Amazon account. Click the link below to secure your account:\n\nhttps://amazon.security.com/secure-account",
163167
isPhishing: true,
164168
},
165169
{
@@ -191,9 +195,15 @@ export class PhishingEmail extends Task {
191195
while (this.emailsSeen.has(randomEmailIndex)) {
192196
randomEmailIndex = Math.floor(Math.random() * this.emails.length);
193197
}
194-
const currentEmail = this.emails[randomEmailIndex];
198+
let currentEmail = this.emails[randomEmailIndex];
195199
this.emailsSeen.add(randomEmailIndex);
196200

201+
const effectChance = this.getEffectProbability();
202+
if (this.shouldApplyEffect(effectChance)) {
203+
console.log("Applying effect to email");
204+
currentEmail = this.obfuscateEmailDetails(currentEmail);
205+
}
206+
197207
const emailContent = `
198208
From: ${currentEmail.sender}
199209
To: ${currentEmail.recipient}
@@ -268,4 +278,28 @@ export class PhishingEmail extends Task {
268278
this.fail();
269279
}
270280
}
281+
282+
private obfuscateEmailDetails(email: Email): Email {
283+
// replaces letters with *
284+
const obscure = (text: string) => text.replace(/[a-zA-Z]/g, () => "*");
285+
286+
const emailCopy = { ...email };
287+
const fields: ObfuscatableEmailField[] = ["sender", "subject", "body"];
288+
const chosen = Phaser.Utils.Array.GetRandom(fields);
289+
console.log("Obfuscating field:", chosen);
290+
291+
// don't mind that emoji
292+
emailCopy[chosen] = obscure(emailCopy[chosen] + "😈");
293+
return emailCopy;
294+
}
295+
296+
private shouldApplyEffect(probability: number): boolean {
297+
return Math.random() < probability;
298+
}
299+
300+
private getEffectProbability(): number {
301+
const cap = 0.8;
302+
const round = (this.scene.registry.get("round") as number) || 1;
303+
return Math.min(0.2 + round * 0.1, cap);
304+
}
271305
}

0 commit comments

Comments
 (0)