working with tor
This commit is contained in:
parent
bd5e0fd4f8
commit
b024cacfe8
39
.vscode/launch.json
vendored
39
.vscode/launch.json
vendored
@ -4,14 +4,6 @@
|
|||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
|
||||||
"name": "React",
|
|
||||||
"type": "chrome",
|
|
||||||
"request": "launch",
|
|
||||||
"url": "http://localhost:6969",
|
|
||||||
// "webRoot": "${workspaceRoot}/react-backend/client/src"
|
|
||||||
"port": 9223
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
@ -43,37 +35,6 @@
|
|||||||
"DATABASE": "BBLB_DNS",
|
"DATABASE": "BBLB_DNS",
|
||||||
"DBPORT": "3306",
|
"DBPORT": "3306",
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "AddAcccount",
|
|
||||||
"skipFiles": [
|
|
||||||
"<node_internals>/**"
|
|
||||||
],
|
|
||||||
"program": "${workspaceFolder}/lib/addAccounts.js",
|
|
||||||
"env": {
|
|
||||||
"DBHOST": "vps.k-world.me.uk",
|
|
||||||
"DBUSER": "root",
|
|
||||||
"DBPASS": "Grd555269",
|
|
||||||
"DATABASE": "BBLB_DNS",
|
|
||||||
"DBPORT": "3306",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "password",
|
|
||||||
"skipFiles": [
|
|
||||||
"<node_internals>/**"
|
|
||||||
],
|
|
||||||
"program": "${workspaceFolder}/lib/addAccounts.js",
|
|
||||||
"env": {
|
|
||||||
"HOST": "localhost",
|
|
||||||
"DBUSER": "root",
|
|
||||||
"DBPASS": "example",
|
|
||||||
"DATABASE": "BBLB_DNS"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
251
lib/checker.js
251
lib/checker.js
@ -1,25 +1,18 @@
|
|||||||
const { getStreamsNew } = require('../routes/getStreams')
|
const { getStreamsNew } = require('../routes/getStreams')
|
||||||
|
|
||||||
const { updateStreamData } = require('./updateStreams')
|
const { updateStreamData } = require('./updateStreams')
|
||||||
|
|
||||||
|
|
||||||
const { decryptPassword } = require('./password')
|
const { decryptPassword } = require('./password')
|
||||||
|
const { getUserAccountsCheck } = require('./getUser')
|
||||||
const { getAllUserAccounts, getUserAccountsCheck } = require('./getUser')
|
const { storeAccountToDB } = require('../lib/Accounts')
|
||||||
|
|
||||||
|
|
||||||
const { removeAccountFromDB, storeAccountToDB } = require('../lib/Accounts')
|
|
||||||
|
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const { wrapper } = require('axios-cookiejar-support')
|
const tor_axios = require('tor-axios');
|
||||||
// import { wrapper } from 'axios-cookiejar-support';
|
const tor = tor_axios.torSetup({
|
||||||
const { CookieJar } = require('tough-cookie')
|
ip: 'localhost',
|
||||||
// import { CookieJar } from 'tough-cookie';
|
port: 9050,
|
||||||
|
controlPort: '9051',
|
||||||
|
controlPassword: 'KarlMax',
|
||||||
|
})
|
||||||
|
|
||||||
const jar = new CookieJar();
|
|
||||||
const client = wrapper(axios.create({ jar }));
|
|
||||||
|
|
||||||
// axios.defaults.timeout = 5000;
|
|
||||||
|
|
||||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||||
|
|
||||||
@ -80,6 +73,31 @@ async function addNewAccount(userAccount, data, url) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function urlChecker(userAccounts, urlList) {
|
||||||
|
let ip = await tor.get('http://api.ipify.org')
|
||||||
|
console.log(ip.data);
|
||||||
|
await Promise.all(urlList.map(async (url) => {
|
||||||
|
try {
|
||||||
|
const response = await tor.get(url)
|
||||||
|
if (response.status == 200 && response.data !== "") {
|
||||||
|
try {
|
||||||
|
let data = response.data
|
||||||
|
if (data.user_info.auth) {
|
||||||
|
console.log(url)
|
||||||
|
updateAccounts(userAccounts, data, url)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
})).then((values) => {
|
||||||
|
endresponse = values
|
||||||
|
});
|
||||||
|
return endresponse
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function userCheck(accountData) {
|
async function userCheck(accountData) {
|
||||||
console.log(Date.now())
|
console.log(Date.now())
|
||||||
@ -102,190 +120,24 @@ async function userCheck(accountData) {
|
|||||||
urlList.push(await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped))
|
urlList.push(await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userAccounts
|
|
||||||
urlList
|
|
||||||
|
|
||||||
await Promise.all(urlList.map(async (url) => {
|
|
||||||
try {
|
values = await urlChecker(userAccounts, urlList)
|
||||||
const response = await axios({
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'User-Agent': 'PostmanRuntime/7.28.4',
|
|
||||||
'Accept': '*/*'
|
|
||||||
},
|
|
||||||
url: url,
|
|
||||||
})
|
|
||||||
console.log(url)
|
|
||||||
if (response.status == 200 && response.data !== "") {
|
|
||||||
try {
|
|
||||||
let data = response.data
|
|
||||||
if (data.user_info.auth) {
|
|
||||||
console.log(url)
|
|
||||||
updateAccounts(userAccounts, data, url)
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})).then((values) => {
|
|
||||||
console.log(values)
|
|
||||||
if (values.includes(true)) {
|
if (values.includes(true)) {
|
||||||
let count = values.filter(function (value) {
|
let updatedCount = values.filter(function (value) {
|
||||||
return value === true;
|
return value === true;
|
||||||
}).length
|
}).length
|
||||||
let count2 = values.filter(function (value) {
|
console.log('true ' + updatedCount)
|
||||||
return value === false;
|
return endresponse = {
|
||||||
}).length
|
"update": true,
|
||||||
console.log('true ' + count)
|
"count": updatedCount
|
||||||
console.log('fail ' + count2)
|
|
||||||
t = count + count2
|
|
||||||
console.log(t)
|
|
||||||
endresponse = true
|
|
||||||
} else {
|
|
||||||
console.log('true ' + count)
|
|
||||||
console.log('fail ' + count2)
|
|
||||||
t = count + count2
|
|
||||||
console.log(t)
|
|
||||||
endresponse = false
|
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
return endresponse
|
return endresponse = false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// async function newCheck() {
|
|
||||||
// streamURLS = await getStreamsNew()
|
|
||||||
// let userAccounts = await getAllUserAccounts()
|
|
||||||
// userAccounts = userAccounts.map(async user => {
|
|
||||||
// user.passwordDecryped = decryptPassword(user.password)
|
|
||||||
// return user
|
|
||||||
// })
|
|
||||||
// for (let userAccount of userAccounts) {
|
|
||||||
// if (userAccount.expiaryDate != 123 && Math.round(Date.now() / 1000) > userAccount.expiaryDate) {
|
|
||||||
// setExpired(userAccount)
|
|
||||||
// } else {
|
|
||||||
// for (let streamURL of streamURLS) {
|
|
||||||
// process.stdout.write('.')
|
|
||||||
// let url = await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped)
|
|
||||||
// let t = await gotRequest(url)
|
|
||||||
// let body = t.body
|
|
||||||
// if (t.statusCode == 200 && body !== "") {
|
|
||||||
// try {
|
|
||||||
// body = JSON.parse(body)
|
|
||||||
// if (body.user_info.auth) {
|
|
||||||
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
|
||||||
// // process.stdout.write('\n')
|
|
||||||
// console.log(`${userAccount.username} - ${userAccount.stream} - ${streamURL} - Expires ${date}.`)
|
|
||||||
// await updateStreamData(userAccount, streamURL, body.user_info.exp_date)
|
|
||||||
// break
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// async function updateAccountDNS(userAccount, streamURLS) {
|
|
||||||
// // return new Promise(async (resolve, reject) => {
|
|
||||||
// await Promise.all(streamURLS.map(async (streamURL) => {
|
|
||||||
// process.stdout.write('.')
|
|
||||||
// let url = await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped)
|
|
||||||
// // console.log('tested url ' + url)
|
|
||||||
// let t = await gotRequest(url)
|
|
||||||
// let body = t.body
|
|
||||||
// if (t.statusCode == 200 && body !== "") {
|
|
||||||
// try {
|
|
||||||
// body = JSON.parse(body)
|
|
||||||
// if (body.user_info.auth) {
|
|
||||||
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
|
||||||
// // process.stdout.write('\n')
|
|
||||||
// console.log(`${userAccount.username} - ${userAccount.stream} - ${streamURL} - Expires ${date}.`)
|
|
||||||
// await updateStreamData(userAccount, streamURL, body.user_info.exp_date)
|
|
||||||
// resolve(true)
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// }
|
|
||||||
// }));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async function updateAccounts(userAccount, streamURLS) {
|
|
||||||
// return new Promise(async (resolve, reject) => {
|
|
||||||
// await streamURLS.forEach(async streamURL => {
|
|
||||||
// process.stdout.write('.')
|
|
||||||
// let url = await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped)
|
|
||||||
// console.log('tested url ' + url)
|
|
||||||
// let t = await gotRequest(url)
|
|
||||||
// let body = t.body
|
|
||||||
// if (t.statusCode == 200 && body !== "") {
|
|
||||||
// try {
|
|
||||||
// body = JSON.parse(body)
|
|
||||||
// if (body.user_info.auth) {
|
|
||||||
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
|
||||||
// // process.stdout.write('\n')
|
|
||||||
// console.log(`${userAccount.username} - ${userAccount.stream} - ${streamURL} - Expires ${date}.`)
|
|
||||||
// await updateStreamData(userAccount, streamURL, body.user_info.exp_date)
|
|
||||||
// resolve(true)
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// reject(userAccount)
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// async function singleCheck(accountData) {
|
|
||||||
// streamURLS = await getStreamsNew()
|
|
||||||
// let userAccounts = await getUserAccountsCheck(accountData.userId)
|
|
||||||
// userAccounts = userAccounts.map(user => {
|
|
||||||
// user.userId = accountData.userId
|
|
||||||
// user.passwordDecryped = decryptPassword(user.password)
|
|
||||||
// return user
|
|
||||||
// })
|
|
||||||
// userAccounts = userAccounts.filter(obj => {
|
|
||||||
// return obj.username === accountData.username && obj.passwordDecryped === accountData.password && obj.stream === accountData.stream
|
|
||||||
// })
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// for (let i = 0; i < userAccounts.length; ++i) {
|
|
||||||
// const userAccount = userAccounts[i];
|
|
||||||
// if (userAccount.expiaryDate != 123 && Math.round(Date.now() / 1000) > userAccount.expiaryDate) {
|
|
||||||
// setExpired(userAccount)
|
|
||||||
// } else {
|
|
||||||
// await updateAccounts(userAccount, streamURLS)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// console.log(Date.now())
|
|
||||||
// return true
|
|
||||||
// } catch (userAccount) {
|
|
||||||
// console.log('notfoundincatch')
|
|
||||||
// // console.error(error);
|
|
||||||
// removeAccountFromDB({
|
|
||||||
// "user": userAccount.username,
|
|
||||||
// "stream": userAccount.stream,
|
|
||||||
// "userId": accountData.userId
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
async function singleAccountCheck(accountData) {
|
async function singleAccountCheck(accountData) {
|
||||||
let endresponse
|
let endresponse
|
||||||
@ -302,9 +154,14 @@ async function singleAccountCheck(accountData) {
|
|||||||
|
|
||||||
await Promise.all(urlList.map(async (url) => {
|
await Promise.all(urlList.map(async (url) => {
|
||||||
try {
|
try {
|
||||||
// console.log(url)
|
const response = await axios.get({
|
||||||
const response = await axios.get(url)
|
method: 'GET',
|
||||||
// console.log(response)
|
headers: {
|
||||||
|
'User-Agent': 'GoldPlayer',
|
||||||
|
'Accept': '*/*'
|
||||||
|
},
|
||||||
|
url: url,
|
||||||
|
})
|
||||||
if (response.status == 200 && response.data !== "") {
|
if (response.status == 200 && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
let data = response.data
|
let data = response.data
|
||||||
@ -312,7 +169,7 @@ async function singleAccountCheck(accountData) {
|
|||||||
addNewAccount(accountData, data, url)
|
addNewAccount(accountData, data, url)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
97
package-lock.json
generated
97
package-lock.json
generated
@ -497,6 +497,19 @@
|
|||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"es6-promise": {
|
||||||
|
"version": "4.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||||
|
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
|
||||||
|
},
|
||||||
|
"es6-promisify": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
|
||||||
|
"integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
|
||||||
|
"requires": {
|
||||||
|
"es6-promise": "^4.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"escape-html": {
|
"escape-html": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||||
@ -815,11 +828,21 @@
|
|||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
|
"ip": {
|
||||||
|
"version": "1.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
||||||
|
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
|
||||||
|
},
|
||||||
"ipaddr.js": {
|
"ipaddr.js": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
|
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
|
||||||
},
|
},
|
||||||
|
"is-buffer": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ=="
|
||||||
|
},
|
||||||
"is-fullwidth-code-point": {
|
"is-fullwidth-code-point": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||||
@ -1297,6 +1320,39 @@
|
|||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
|
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
|
||||||
},
|
},
|
||||||
|
"smart-buffer": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
|
||||||
|
},
|
||||||
|
"socks": {
|
||||||
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==",
|
||||||
|
"requires": {
|
||||||
|
"ip": "1.1.5",
|
||||||
|
"smart-buffer": "^4.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"socks-proxy-agent": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==",
|
||||||
|
"requires": {
|
||||||
|
"agent-base": "~4.2.1",
|
||||||
|
"socks": "~2.3.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"agent-base": {
|
||||||
|
"version": "4.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
|
||||||
|
"integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==",
|
||||||
|
"requires": {
|
||||||
|
"es6-promisify": "^5.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"sqlstring": {
|
"sqlstring": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||||
@ -1391,6 +1447,47 @@
|
|||||||
"promise": "^7.1.1"
|
"promise": "^7.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tor-axios": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/tor-axios/-/tor-axios-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-JFBkpV7essVA7sB2Xwm5MhfJ5CwA4dLZSyOaQTl14hl9K+Q0wHWEOqtFoME2qPRmYIbIHJIIxZTPVQjB3aV8gw==",
|
||||||
|
"requires": {
|
||||||
|
"axios": "^0.18.1",
|
||||||
|
"socks-proxy-agent": "^4.0.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": {
|
||||||
|
"version": "0.18.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",
|
||||||
|
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "1.5.10",
|
||||||
|
"is-buffer": "^2.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.5.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
||||||
|
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
|
||||||
|
"requires": {
|
||||||
|
"debug": "=3.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"tough-cookie": {
|
"tough-cookie": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"http-errors": "~1.6.3",
|
"http-errors": "~1.6.3",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"sync-mysql": "^3.0.1",
|
"sync-mysql": "^3.0.1",
|
||||||
|
"tor-axios": "^1.0.9",
|
||||||
"tough-cookie": "^4.0.0"
|
"tough-cookie": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,13 @@ router.get('/', async function (req, res, next) {
|
|||||||
let postData = req.body
|
let postData = req.body
|
||||||
postData.userId = getUserId(req.auth.user)
|
postData.userId = getUserId(req.auth.user)
|
||||||
// postData.userId = 5
|
// postData.userId = 5
|
||||||
a = await userCheck(postData)
|
let response = await userCheck(postData)
|
||||||
console.log(Date.now())
|
console.log(Date.now())
|
||||||
if (a) {
|
if (response.update) {
|
||||||
res.sendStatus(200)
|
res.json({ "updatedAccounts": response.count })
|
||||||
} else {
|
} else {
|
||||||
res.sendStatus(500);
|
res.sendStatus(500);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
21
test.js
Normal file
21
test.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const tor_axios = require('tor-axios');
|
||||||
|
const tor = tor_axios.torSetup({
|
||||||
|
ip: 'localhost',
|
||||||
|
port: 9050,
|
||||||
|
controlPort: '9051',
|
||||||
|
controlPassword: 'KarlMax',
|
||||||
|
})
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
let response = await tor.get('http://api.ipify.org');
|
||||||
|
let ip = response.data;
|
||||||
|
console.log(await tor.get('http://api.ipify.org'));
|
||||||
|
|
||||||
|
await tor.torNewSession(); //change tor ip
|
||||||
|
|
||||||
|
response = await tor.get('http://api.ipify.org');
|
||||||
|
ip = response.data;
|
||||||
|
console.log(ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
Loading…
x
Reference in New Issue
Block a user