-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtextverified.js
144 lines (121 loc) · 4.1 KB
/
textverified.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
const axios = require('axios')
const cheerio = require('cheerio')
const fs = require('fs')
const simpleAuthURL = 'https://www.textverified.com/Api/SimpleAuthentication'
const baseURL = 'https://www.textverified.com/api'
const simpleAccessToken = ''
const gmailID = 33
const nikeID = ''
async function sleep(time) {
return new Promise(resolve => setTimeout(resolve, time))
}
async function Auth() {
const authHeaders = {
headers:{
"X-SIMPLE-API-ACCESS-TOKEN": simpleAccessToken,
"Accept-Encoding": "*",
}
}
const req = await axios.post(simpleAuthURL, null, authHeaders)
return req.data
}
async function getTarget(){
const authData = await Auth()
const bearer_token = authData.bearer_token
const req = await axios.get(baseURL + '/targets', {headers:{
'Authorization': `Bearer ${bearer_token}`,
"Accept-Encoding": "*",
}})
console.log(req.data)
return req.data
}
async function gmailCode(gmailID){
const data = {
'id': Number(gmailID),
}
const authData = await Auth()
const bearer_token = authData.bearer_token
const req = await axios.post(baseURL + '/Verifications', data, {
headers: {
'Authorization': `Bearer ${bearer_token}`,
"Accept-Encoding": "*",
}
})
return req.data
}
async function checkAccountInfo(){
const authData = await Auth()
const bearer_token = authData.bearer_token
const req = await axios.get(baseURL + '/Users', {headers:{
'Authorization': `Bearer ${bearer_token}`,
"Accept-Encoding": "*",
}})
console.log(req.data)
return req.data
}
async function getID(){
const authData = await Auth()
const bearer_token = authData.bearer_token
const req = await axios.get(baseURL + '/Verifications/Pending', {headers:{
'Authorization': `Bearer ${bearer_token}`,
"Accept-Encoding": "*",
}})
return req.data.id
}
async function getCodeInfo(codeID){
const authData = await Auth()
const bearer_token = authData.bearer_token
const req = await axios.get(baseURL + `/Verifications/${codeID}`, {headers:{
'Authorization': `Bearer ${bearer_token}`,
"Accept-Encoding": "*",
}})
return req.data
}
async function cancelCode(codeID){
const authData = await Auth()
const bearer_token = authData.bearer_token
const req = axios.post(baseURL + `/Verifications/${codeID}/Cancel'`, null, {
headers: {
'Authorization': `Bearer ${bearer_token}`,
"Accept-Encoding": "*",
}
})
return req.data
}
async function test(){
let getPhoneNumber = await gmailCode(gmailID)
await sleep(2222)
console.log('Phone Number Info: ', getPhoneNumber)
let phoneID = getPhoneNumber.id
let phoneNumber = getPhoneNumber.number
let verificationLink = getPhoneNumber.verification_uri
let cancelLink = getPhoneNumber.cancel_uri
let reportLink = getPhoneNumber.report_uri
console.log('PhoneID', phoneID)
//await sleep(1111)
while(true){
let getInfo = await getCodeInfo(phoneID)
console.log('getInfo: ', getInfo)
if(getInfo.code == null){
let getInfo = await getCodeInfo(phoneID)
await sleep(3333)
console.log(`SMS for Number -- ${getInfo.number} -- is: ${getInfo.status}`)
console.log('SMS Code: ',getInfo.code)
console.log('Time Remaining: ', getInfo.time_remaining)
} else {
let getInfo = await getCodeInfo(phoneID)
await sleep(3333)
console.log('Status is: ',getInfo.status)
console.log(getInfo.sms)
console.log('Code: ',getInfo.code)
return
}
}
// async function test(){
// console.log('testing')
// }
//checkAccountInfo()
//test()
//test()
//checkAccountInfo()
module.exports = {Auth, gmailCode, checkAccountInfo, getID, getCodeInfo, cancelCode,getTarget, test}