diff --git a/.vscode/launch.json b/.vscode/launch.json index bffc3c2..82b8256 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -34,7 +34,13 @@ "skipFiles": [ "/**" ], - "program": "${workspaceFolder}/checker.js" + "program": "${workspaceFolder}/lib/checker.js", + "env": { + "HOST": "localhost", + "DBUSER": "root", + "DBPASS": "example", + "DATABASE":"BBLB_DNS" + } }, { "type": "node", @@ -43,7 +49,13 @@ "skipFiles": [ "/**" ], - "program": "${workspaceFolder}/lib/addAccounts.js" + "program": "${workspaceFolder}/lib/addAccounts.js", + "env": { + "HOST": "localhost", + "DBUSER": "root", + "DBPASS": "example", + "DATABASE":"BBLB_DNS" + } } ] } \ No newline at end of file diff --git a/SQL/build.sql b/SQL/build.sql index 7c56937..08b70d0 100644 --- a/SQL/build.sql +++ b/SQL/build.sql @@ -28,9 +28,9 @@ CREATE TABLE `streams` INSERT INTO streams ( streamName , streamURL) VALUES -('Gold', 'http://catenamode.cf:8090'), +('Gold', 'http://SERVER1.cheesywotsit.gq:8090'), ('Insanity', 'https://trippy.pro:443'), -('PremiumPlus', 'https://itty.in:443'), +('PremiumPlus', 'http://kibb.link:8080'), ('GunSlinger', 'http://gunslingertv.org:8080'), ('VIP', 'http://shark.brokenwarrior.xyz:8080'), ('Technoid', 'http://capoisagod2021.org:8080'), @@ -51,7 +51,8 @@ streamName ('KDB', 'http://mytv.digital:8080/'), ('PYTHON', 'http://foxmedia.bounceme.net:8282'), ('KEANO', 'http://ip365.cx:80'), -('FODEN', 'http://ac.mustardsubs.tk:8880') +('FODEN', 'http://ac.mustardsubs.tk:8880'), +('Titan', 'http://titanmedia.tech:8080'); ON DUPLICATE KEY UPDATE `streamName` = VALUES (`streamName`), `streamURL` = VALUES @@ -72,6 +73,8 @@ CREATE TABLE `userAccounts` (11) NOT NULL, `expiaryDate` int (11) NOT NULL, +`streamURL` varchar +(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -94,8 +97,9 @@ username ('Karl150520', 'dc4c407fda600e361db82323cef5fc51c9c9cf67fbd67711b38a49f4c5b10b3dbf62d8b7a531252b35222b0186c876fbdfea39414484916765aabab08bbd828d67b6e668f89927f95a3e08f3b45206658ea516711a65c5c4e28d98b9236e5fd8a1317b78626e49572f83', 'Gold', 1, 1621103874), ('Karl1505', '7bfdf1ab7d86e07a3eb6c5614578c41c571ae6f3faaf836233a9b6f33538c6ea1125dab202d99325a92cd35856191fc495b7e5ec6cb2765d5bafa2af18f43c94f3392425a65a14e0e712d1c5de04f662fb84dc14b37151796db7f0eaec8b34351adfd2a93961125b04d9', 'Gold', 1, 1621103852), ('Karloss0403', '71f8993c61b41ece3e3a7e8b50ec956670998b9930e667e9f2881ce508effc5b98bac9ddc3579f0455111203e092713bc7375ddd552f0cd7a33c698c147a6d9eea623099c3f993ff8634ef42975c6f8f0e28fb5f81ab1fa3e17a9729388c4b9779e3e9e16204fa570bcb', 'KDB', 1, 1646394742), -('Karloss0403', '364cafa40eb896ffc220975d3b52431723a6d715a17c13f12296d62fa1e5f31f71ba2809e3fb9120231de8c388a736eec9064494a187fa7cf10357425d5b8c9d545487e5fed49407afad377f0225d935ea08e867dd803f5c12472a3e70cca7bd233a314a8c747e8ec751', 'DIAZ', 1, 1646394794); - +('Karloss0403', '364cafa40eb896ffc220975d3b52431723a6d715a17c13f12296d62fa1e5f31f71ba2809e3fb9120231de8c388a736eec9064494a187fa7cf10357425d5b8c9d545487e5fed49407afad377f0225d935ea08e867dd803f5c12472a3e70cca7bd233a314a8c747e8ec751', 'DIAZ', 1, 1646394794), +('Karl0ss1703', 'b96aaf626027d671a0d0b3975bdc498631e33f9a177700b006db2edd1b31d3fc35bbc0812b6ee86e0693a76d358309ce1a070a7d35117cfd3fde8a6d7763766d42c35702b5cc0e933069a955ebd36c00349eedc2c9b80e5c493dcf69e9cfa62afdd81c0d9eadd67b405b', 'KDB', 1, 1647549531), +('Karl0ss1703', '2cfaf0ebd2aa3fc2f8b750cc24bdd54e3f2ea53ba7204e77ab35b85cb24a801fcaabffb74c7f755ab79646fcb36cd45cd3ce4de10148d006ede36154e86a839defc6d3f473e27f4cd520de11b179a1df445cb34cb9857128d440632c59c154a2118f46555d9b48afdc09', 'Titan', 1, 1647549703); DROP TABLE IF EXISTS `users`; CREATE TABLE `users` diff --git a/client/src/components/AddAccount.jsx b/client/src/components/AddAccount.jsx index b91d7b2..1464823 100644 --- a/client/src/components/AddAccount.jsx +++ b/client/src/components/AddAccount.jsx @@ -2,12 +2,12 @@ import React, { Component } from "react"; import axios from "axios"; import Dropdown from "react-dropdown"; import "react-dropdown/style.css"; -import readCookie from "../checkAuth" +import readCookie from "../checkAuth"; let arr = []; class AddAccount extends Component { constructor() { - readCookie(); + // readCookie(); super(); this.state = { @@ -22,16 +22,21 @@ class AddAccount extends Component { } fetchOptions() { - fetch("http://vps.k-world.me.uk:3001/getStreamNames") - .then((res) => { - return res.json(); - }) - .then((json) => { - json.forEach((account) => { - arr.push(account.streamName); + try { + fetch("http://vps.k-world.me.uk:3001/getStreamNames", + { withCredentials: true}) + .then((res) => { + return res.json(); + }) + .then((json) => { + json.forEach((account) => { + arr.push(account.streamName); + }); + this.setState({ options: arr }); }); - this.setState({ options: arr }); - }); + } catch (error) { + console.log(error); + } } _onSelect = (e) => { @@ -60,11 +65,15 @@ class AddAccount extends Component { console.log({ username, password, stream }); axios - .post("http://vps.k-world.me.uk:3001/addAccount", { - username, - password, - stream, - }, { withCredentials: true }) + .post( + "http://vps.k-world.me.uk:3001/addAccount", + { + username, + password, + stream, + }, + { withCredentials: true } + ) .then((res) => { console.log(res); console.log(res.data); diff --git a/lib/addAccounts.js b/lib/addAccounts.js index 00915f8..bb6babe 100644 --- a/lib/addAccounts.js +++ b/lib/addAccounts.js @@ -13,7 +13,7 @@ function retrievePasswordFromDB(user, userAccUser) { let userId try { userId = sql.query(`SELECT u.id FROM users u WHERE u.userName = '${user}'`); - userId = userId[0].idusers + userId = userId[0].id } catch (error) { console.log('User not found') return (error) @@ -35,9 +35,12 @@ WHERE userAccounts.userID = ${userId} AND userAccounts.username = '${userAccUser } else { const decryptedString = cryptr.decrypt(accountPassword[0].password); console.log(decryptedString) + return decryptedString } } + + // retrievePasswordFromDB('Karl', 'Karl2903') module.exports = { diff --git a/lib/checker.js b/lib/checker.js index 970c49e..1e51e33 100644 --- a/lib/checker.js +++ b/lib/checker.js @@ -3,17 +3,31 @@ let streamArrays = require('./streamArray.json') let users = require('./logins.json') +const { getStreamsNew } = require('../routes/getStreams') + +const { updateStreamData } = require('./updateStreams') + const { gotRequest } = require('./gotRequest') +const { decryptPassword } = require('./password') + +const { getAllUserAccounts } = require('./getUser') + const delay = ms => new Promise(res => setTimeout(res, ms)); +async function buildURL(streamURL, username, password) { + let url = streamURL + "/player_api.php?username=" + username + "&password=" + password + return url +} + async function singleCheck(username) { let user = users.find(user => user.username === username) for (let index = 0; index < streamArrays.length; index++) { await delay(500); const stream = streamArrays[index]; process.stdout.write('.') - let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password + // let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password + let url = await buildURL(stream.streamURL, user.username, user.password) let t = await gotRequest(url) let body = t.body if (t.statusCode == 200 && body !== "") { @@ -39,16 +53,19 @@ async function main() { await delay(500); const stream = streamArrays[index]; process.stdout.write('.') - let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password + let url = await buildURL(stream.streamURL, user.username, user.password) let t = await gotRequest(url) let body = t.body if (t.statusCode == 200 && body !== "") { - body = JSON.parse(body) - if (body.user_info.auth) { - // var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB') - process.stdout.write('\n') - console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + body.user_info.exp_date) - break + try { + body = JSON.parse(body) + if (body.user_info.auth) { + // var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB') + process.stdout.write('\n') + console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + body.user_info.exp_date) + break + } + } catch (error) { } } } @@ -57,9 +74,49 @@ async function main() { console.log('Finished') } +async function newCheck() { + streamURLS = await getStreamsNew() + let userAccounts = await getAllUserAccounts() + userAccounts = userAccounts.map(user => { + user.passwordDecryped = decryptPassword(user.password) + return user + }) + for (let userAccount of userAccounts) { + console.log(userAccount.username) + 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('en-GB') + process.stdout.write('\n') + console.log('Match - ' + userAccount.username + ' - ' + streamURL + ' - Expires - ' + body.user_info.exp_date) + await updateStreamData(userAccount, streamURL, body.user_info.exp_date) + break + } + } catch (error) { + console.log('Error - ' + userAccount.username + ' - ' + streamURL + ' - Expires - ' + body.user_info.exp_date) + } + } + } + } + + // } + + // console.log(userAccounts) + // retrievePasswordFromDB() +} + // main() +// singleCheck('Karl2903') +newCheck() module.exports = { + newCheck, singleCheck, main } \ No newline at end of file diff --git a/lib/getUser.js b/lib/getUser.js index 2c36125..b086545 100644 --- a/lib/getUser.js +++ b/lib/getUser.js @@ -20,7 +20,22 @@ function getUserAccounts(user) { } } -module.exports = { - getUserAccounts +function getAllUserAccounts() { + let data = sql.query(`SELECT + userAccounts.username, + userAccounts.password +FROM userAccounts + `) + // console.log(data) + if (data.length == 0) { + return 'User Not Found' + } else { + return data + } +} + +module.exports = { + getUserAccounts, + getAllUserAccounts } diff --git a/lib/gotRequest.js b/lib/gotRequest.js index 956d2e8..65a2239 100644 --- a/lib/gotRequest.js +++ b/lib/gotRequest.js @@ -2,7 +2,9 @@ const got = require('got') const gotRequest = async (url) => { let returnResponse = {}; - let options = {} + let options = { + timeout: 2000 + } await got(url, options) .then((response) => { returnResponse = response; diff --git a/lib/logins.json b/lib/logins.json index 43c89e8..6dec584 100644 --- a/lib/logins.json +++ b/lib/logins.json @@ -66,5 +66,13 @@ { "username": "Karloss0403", "password": "4V5t4M2DS3" + }, + { + "username": "Karl0ss1703", + "password": "xSZYpDWHo7" + }, + { + "username": "Karl0ss1703", + "password": "HTS4QUTV9V" } ] \ No newline at end of file diff --git a/lib/password.js b/lib/password.js new file mode 100644 index 0000000..2a497a2 --- /dev/null +++ b/lib/password.js @@ -0,0 +1,13 @@ +const Cryptr = require('cryptr'); +const cryptr = new Cryptr('BBLBTV-DNS-PASSWORDS'); + +function decryptPassword(password) { + const decryptedString = cryptr.decrypt(password); + // console.log(decryptedString) + return decryptedString +} + +module.exports = { + decryptPassword +} + diff --git a/lib/streamArray.json b/lib/streamArray.json index cee74fe..454b0f8 100644 --- a/lib/streamArray.json +++ b/lib/streamArray.json @@ -1 +1 @@ -[{"StreamName":"Insanity","StreamURL":"https://trippy.pro:443"},{"StreamName":"PremPlus","StreamURL":"https://itty.in:443"},{"StreamName":"GunSlinger","StreamURL":"http://gunslingertv.org:8080"},{"StreamName":"VIP","StreamURL":"http://shark.brokenwarrior.xyz:8080"},{"StreamName":"Technoid","StreamURL":"http://capoisagod2021.org:8080"},{"StreamName":"Old Premium","StreamURL":"https://caporeds.online:443"},{"StreamName":"??","StreamURL":"http://screamstreams.info:8080"},{"StreamName":"Gold","StreamURL":"http://catenamode.cf:8090"},{"StreamName":"??","StreamURL":"http://bigbox.me.uk:2086"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"http://mytv.digital:8080/"},{"StreamName":"??","StreamURL":"http://v2servers.tk:2052"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"??","StreamURL":"http://ip365.cx:80"},{"StreamName":"Gold","StreamURL":"http://stream.streamhubtv.xyz:8080"},{"StreamName":"??","StreamURL":"http://foxmedia.bounceme.net:8282"},{"StreamName":"??","StreamURL":"http://gold.mypsx.net:8880"},{"StreamName":"Foden","StreamURL":"https://rushem.in:443"},{"StreamName":"Shark","StreamURL":"http://pimptv.dnsabr.com:25461"},{"StreamName":"Keano","StreamURL":"http://tavaratv.xyz:2095"},{"StreamName":"??","StreamURL":"http://tanmedia.watch:8880"},{"StreamName":"Python","StreamURL":"http://streamknighttv.xyz:8080"},{"StreamName":"??","StreamURL":"http://covidsucks.xyz:8080"},{"StreamName":"??","StreamURL":"http://fckbrexit.link:8080"},{"StreamName":"??","StreamURL":"http://tv.realot.xyz:35001"},{"StreamName":"??","StreamURL":"http://iptv.satplex.co.uk:8080"},{"StreamName":"??","StreamURL":"http://sting.ltd:25461"},{"StreamName":"??","StreamURL":"http://gold.mypsx.net:8880"},{"StreamName":"??","StreamURL":"http://titanmedia.tech:8080"},{"StreamName":"??"},{"StreamName":"Gambler"},{"StreamName":"??"},{"StreamName":"??"},{"StreamName":"??"}] \ No newline at end of file +[{"StreamName":"Insanity","StreamURL":"https://trippy.pro:443"},{"StreamName":"PremPlus","StreamURL":"https://itty.in:443"},{"StreamName":"GunSlinger","StreamURL":"http://gunslingertv.org:8080"},{"StreamName":"VIP","StreamURL":"http://shark.brokenwarrior.xyz:8080"},{"StreamName":"Technoid","StreamURL":"http://capoisagod2021.org:8080"},{"StreamName":"Old Premium","StreamURL":"https://caporeds.online:443"},{"StreamName":"??","StreamURL":"http://screamstreams.info:8080"},{"StreamName":"Gold","StreamURL":"http://bigbox.me.uk:2086"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"http://mytv.digital:8080/"},{"StreamName":"??","StreamURL":"http://v2servers.tk:2052"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"??","StreamURL":"http://ip365.cx:80"},{"StreamName":"??","StreamURL":"http://stream.streamhubtv.xyz:8080"},{"StreamName":"Gold","StreamURL":"http://foxmedia.bounceme.net:8282"},{"StreamName":"??","StreamURL":"http://gold.mypsx.net:8880"},{"StreamName":"??","StreamURL":"http://SERVER1.cheesywotsit.gq:8090"},{"StreamName":"Foden","StreamURL":"http://kibb.link:8080"},{"StreamName":"Shark","StreamURL":"http://pimptv.dnsabr.com:25461"},{"StreamName":"Keano","StreamURL":"http://tavaratv.xyz:2095"},{"StreamName":"??","StreamURL":"http://tanmedia.watch:8880"},{"StreamName":"Python","StreamURL":"http://streamknighttv.xyz:8080"},{"StreamName":"??","StreamURL":"http://covidsucks.xyz:8080"},{"StreamName":"??","StreamURL":"http://fckbrexit.link:8080"},{"StreamName":"??","StreamURL":"http://tv.realot.xyz:35001"},{"StreamName":"??","StreamURL":"http://iptv.satplex.co.uk:8080"},{"StreamName":"??","StreamURL":"http://sting.ltd:25461"},{"StreamName":"??","StreamURL":"http://gold.mypsx.net:8880"},{"StreamName":"??","StreamURL":"http://titanmedia.tech:8080"},{"StreamName":"??"},{"StreamName":"Gambler"},{"StreamName":"??"},{"StreamName":"??"},{"StreamName":"??"}] \ No newline at end of file diff --git a/lib/updateStreams.js b/lib/updateStreams.js new file mode 100644 index 0000000..266407b --- /dev/null +++ b/lib/updateStreams.js @@ -0,0 +1,16 @@ +const sql = require('./mysql') + +function updateStreamData(userAccount, streamURL, expiaryDate) { + let result + try { + result = sql.query(`UPDATE userAccounts SET streamURL = "${streamURL}", expiaryDate = ${expiaryDate} WHERE username = "${userAccount.username}" AND password = "${userAccount.password}"; `); + } catch (error) { + console.log(error) + } + return result +} + +module.exports = { + updateStreamData +} + diff --git a/routes/getStreams.js b/routes/getStreams.js index 75e2ec2..9af2401 100644 --- a/routes/getStreams.js +++ b/routes/getStreams.js @@ -10,7 +10,7 @@ const { gotRequest } = require('../lib/gotRequest') function writeFile(streamArrays) { fs.writeFileSync(__dirname + '/../lib/streamArray.json', JSON.stringify(streamArrays), function (err) { - if (err) return console.log(err); + if (err) return console.log(err); }); } @@ -23,36 +23,52 @@ function mapToStream(DNSList) { console.log('---Updated URLS---') DNSList.unshift(...otherDNS) for (let index = 0; index < streamArrays.length; index++) { - let element = streamArrays[index]; - element.StreamURL = DNSList[index] - console.log(element.StreamName + ' ' + element.StreamURL) + let element = streamArrays[index]; + element.StreamURL = DNSList[index] + console.log(element.StreamName + ' ' + element.StreamURL) } writeFile(streamArrays) console.log('---Updated URLS---') return streamArrays } -async function main() { +async function getStreams() { let requestData let jointArray = [] for (let index = 0; index < DNSArray.length; index++) { - const url = DNSArray[index]; - requestData = await gotRequest(url) - let DNSList = JSON.parse(requestData.body) - DNSList = splitToArray(DNSList.su) - DNSList.forEach(url => { - jointArray.push(url) - }); + const url = DNSArray[index]; + requestData = await gotRequest(url) + let DNSList = JSON.parse(requestData.body) + DNSList = splitToArray(DNSList.su) + DNSList.forEach(url => { + jointArray.push(url) + }); } await mapToStream(jointArray) return streamArrays } + +async function getStreamsNew() { + let requestData + let jointArray = [] + for (let index = 0; index < DNSArray.length; index++) { + const url = DNSArray[index]; + requestData = await gotRequest(url) + let DNSList = JSON.parse(requestData.body) + DNSList = splitToArray(DNSList.su) + DNSList.forEach(url => { + jointArray.push(url) + }); + } + return jointArray +} /* GET users listing. */ router.get('/', async function (req, res, next) { let fullStreamArray = await main() res.send(fullStreamArray) }); -// main() - -module.exports = router; \ No newline at end of file +module.exports = { + router, getStreams, getStreamsNew +} + ; \ No newline at end of file