Merge branch 'removeUI' of Karl/BBLBTV_DNS into master

This commit is contained in:
Karl 2021-11-19 09:46:35 -06:00 committed by Gogs
commit 1e6391db2f
76 changed files with 1555 additions and 29769 deletions

View File

@ -2,7 +2,6 @@ FROM node:12-alpine
LABEL version="1.0" LABEL version="1.0"
LABEL description="DNS BACKEND" LABEL description="DNS BACKEND"
# LABEL maintainer = ["danielmurph8@gmail.com", "dylanedwards290@gmail.com"]
WORKDIR /app WORKDIR /app
@ -10,7 +9,7 @@ COPY ["package.json", "package-lock.json", "./"]
RUN ls RUN ls
RUN npm i RUN npm i
RUN apk --no-cache add curl # RUN apk --no-cache add curl
COPY . . COPY . .

View File

@ -1,2 +1,4 @@
node_modules node_modules
npm-debug.log npm-debug.log
client
SQL

2
.gitignore vendored
View File

@ -1 +1,3 @@
node_modules node_modules
test2.js
.env

51
.vscode/launch.json vendored
View File

@ -5,12 +5,22 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "React", "name": "Launch Program",
"type": "chrome", "program": "${workspaceFolder}/lib/apache_functions.js",
"request": "launch", "request": "launch",
"url": "http://localhost:6969", "skipFiles": [
// "webRoot": "${workspaceRoot}/react-backend/client/src" "<node_internals>/**"
"port": 9223 ],
"type": "pwa-node",
"env": {
"DBHOST": "vps.k-world.me.uk",
"DBUSER": "root",
"DBPASS": "Grd555269",
"DATABASE": "BBLB_DNS",
"DBPORT": "3306",
"TORSSRV": "localhost",
"TORSPWD": "KarlMax",
}
}, },
{ {
"type": "node", "type": "node",
@ -19,7 +29,16 @@
"skipFiles": [ "skipFiles": [
"<node_internals>/**" "<node_internals>/**"
], ],
"program": "${workspaceFolder}/bin/www" "program": "${workspaceFolder}/bin/www",
"env": {
"DBHOST": "vps.k-world.me.uk",
"DBUSER": "root",
"DBPASS": "Grd555269",
"DATABASE": "BBLB_DNS",
"DBPORT": "3306",
"TORSSRV": "localhost",
"TORSPWD": "KarlMax",
}
}, },
{ {
"type": "node", "type": "node",
@ -28,16 +47,16 @@
"skipFiles": [ "skipFiles": [
"<node_internals>/**" "<node_internals>/**"
], ],
"program": "${workspaceFolder}/checker.js" "program": "${workspaceFolder}/lib/checker.js",
}, "env": {
{ "DBHOST": "vps.k-world.me.uk",
"type": "node", "DBUSER": "root",
"request": "launch", "DBPASS": "Grd555269",
"name": "password", "DATABASE": "BBLB_DNS",
"skipFiles": [ "DBPORT": "3306",
"<node_internals>/**" "TORSSRV": "localhost",
], "TORSPWD": "KarlMax",
"program": "${workspaceFolder}/lib/addAccounts.js" }
} }
] ]
} }

2
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,2 @@
{
}

96
SQL/build.sql Normal file
View File

@ -0,0 +1,96 @@
-- Adminer 4.7.8 MySQL dump
SET NAMES utf8;
SET time_zone
= '+00:00';
SET foreign_key_checks
= 0;
SET sql_mode
= 'NO_AUTO_VALUE_ON_ZERO';
DROP DATABASE IF EXISTS `BBLB_DNS`;
CREATE DATABASE `BBLB_DNS` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */;
USE `BBLB_DNS`;
DROP TABLE IF EXISTS `streams`;
CREATE TABLE `streams`
(
`id` int
(11) NOT NULL AUTO_INCREMENT,
`streamName` varchar
(255) COLLATE utf8_bin NOT NULL,
`streamURL` varchar
(255) COLLATE utf8_bin NOT NULL,
PRIMARY KEY
(`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `userAccounts`;
CREATE TABLE `userAccounts`
(
`id` int
(11) NOT NULL AUTO_INCREMENT,
`username` varchar
(255) COLLATE utf8_bin NOT NULL,
`password` varchar
(255) COLLATE utf8_bin NOT NULL,
`stream` varchar
(255) COLLATE utf8_bin NOT NULL,
`userId` int
(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;
INSERT INTO userAccounts (
username
, password, stream, userId, expiaryDate) VALUES
('Karl2903', '436e09390f77663091780c2796418f095a74ae0a9b181b69cc51575ec3bcd3a1c8b5a47d1af288b25dd757c27e74319d7457b8a37859e7a248e71f0f9ef5b23304dbf784d26ec2accf9ce6b612c0008387086289527dfaf10d8368c811a853d5402e09815226d6dc', 'Gold', 1, 1617100032),
('Karl2802', 'bf8605f7c3386f5857a6df3c15be0a3de9cfb32179cb2f0454cf1f46844b4ae2b24a4d6e2705e78dcf3e019a3b7f3b9d90e9f3bf279f8950ae187de96d19c50989e921b6a4c1fe3d1cf189474db05933c505e7eea91ef18a25bdc7f74274e63af4ce8c01da69aeab83fe', 'PremiumPlus', 1, 1614504315),
('Karl0704', '89e8e131570896ee1f83bf97fc2a73a61f448cfe379cef9c8af8489f21a5aa7c0309de4350c443f7d5bbc15162ef5c6115db6c58ac510d9a982414f8725246cb6c801fe526d0eac98c198f25b7e1b17c38647cfce3cf8ba4e6276d081ac6522cfc0778d71796294e3f97', 'VIP', 1, 1617787739),
('Karl24', '482899bc267eaa17c97ff9440588717feccfd591aa7501d0c16eb0a9667204f6a35c39a098330efef2d167d918ad5a49c3917b85a3dd4e8af7e391e0cb47beff7276dccb3f6a450ee7dafedcbe3a1593c4569509c32b8e8cbbb26bd8db31fe2f214f928d61bf09e8744b', 'Insanity', 1, 1624444437),
('Karl2206', 'a047fa4d67f78d94b7eb3834055d9ae6af398c448e59701e2e4a52f9e36f72c59529674acb2cb1f334b9eba88b154638f43ab5865c85ed77f1300ed11bcab337e7457a854dd9d1e8f484ddda960d7864448fd12b117690350c19c2a0d583391a279465b6f9e356ab4104', 'GunSlinger', 1, 1624301605),
('Darren1706', 'cfe5a6be558d12daf878e0570a84bfb96ff02a2b436e9edb8ddd258fc1311522305139f3758e345b905c5b15f3d41fc06f2f5006dee50975342a5eadc2b48f30b106b3c75510e1201f131235f23716edfc61250972018233532f72a537bf4762776ff1bd0e39d4f6017d', 'Technoid', 2, 1624005116),
('Dazg3012', '476dd5316a78251fe26cea0a2d2786e8ddaeb8da99f99bfff9e1e34267eb3d0e79f0549cb102edcacd9a1685ee940347f43343c0314fca3816f81d9ec7b9370670e4ec7dddd695795752ad188c56207eb1ef6464d0e8690d4a44084a0918ec12ba6ca01c0d613463886f', 'Old Premium', 2, 1640885178),
('Martin1607', '33db85e33346ac83bc72c2feac294873edab0ec43bba6da5830275af7dbca539a445d3667874ba3cb64b9861a52f9aaa452140d92a3df0e6f87cb8d2eb6eceb9d0c0faaf284164beacb0bca8f3870794c2acd1f29ef310c150b4b1ff2b6e007b249b33c9144688eac57f', 'GunSlinger', 3, 2147483647),
('Martin2204', '8c7e61d5131661fbb246ad7dad0eb05e481235fa5574707b287619331c77da16643ca1c94fb82fd4290a4bc79c7773428a56673e5c3b20c5d13753d66693da69326c3a5be854fefe8b9829e8e6f4e8775e949959cd4caa8d0d063870a8d0da35167566cb575d459a7594', 'Gold', 3, 1619089223),
('Karl2404', 'c5ee1fa1168da4abdf5cd12697258141f0c68d50269d8f229c422e9af2f79662daabca432d9a1de40ef907cfdbcb42d8e3b98620a221a17020abb0c0552f50859d10baef6f06482d6fcba91d975034bb99c3428e78921f5c155467090a587a5d6cd0783b9051a06283cb', 'Gold', 1, 1619272032),
('Karl2804', 'a2d35b98846ade449e1fb07f65627b9a219f5c755418cd3da5c51f6467f99e70e4a0f444899b355df7724c972ec88624298e8efb777005590d4053749d596c09abe96c1fc4ff38237e0d7583edc0aca8516dd54ac09d81bab7d0b55fcae5095db9385e6e8530bd9ef4b1', 'Gold', 1, 1619627584),
('Karl2904', '55dfce0674e85eeef328c1ea86a9f4d1c661468c18cc1d4d60457e5bec45e19621d7e8a57367ba8d31a7461712bef8e5c05518b72194ffde95a5deed34a3bc3f68f48c1546a79a7a19dc260030c9b4cc5f4fef9544665846e50f5212a921a5053a5ee237895718db9e67', 'Gold', 1, 1619717072),
('Karl150520', 'dc4c407fda600e361db82323cef5fc51c9c9cf67fbd67711b38a49f4c5b10b3dbf62d8b7a531252b35222b0186c876fbdfea39414484916765aabab08bbd828d67b6e668f89927f95a3e08f3b45206658ea516711a65c5c4e28d98b9236e5fd8a1317b78626e49572f83', 'Gold', 1, 1621103874),
('Karl1505', '7bfdf1ab7d86e07a3eb6c5614578c41c571ae6f3faaf836233a9b6f33538c6ea1125dab202d99325a92cd35856191fc495b7e5ec6cb2765d5bafa2af18f43c94f3392425a65a14e0e712d1c5de04f662fb84dc14b37151796db7f0eaec8b34351adfd2a93961125b04d9', 'Gold', 1, 1621103852),
('Karloss0403', '71f8993c61b41ece3e3a7e8b50ec956670998b9930e667e9f2881ce508effc5b98bac9ddc3579f0455111203e092713bc7375ddd552f0cd7a33c698c147a6d9eea623099c3f993ff8634ef42975c6f8f0e28fb5f81ab1fa3e17a9729388c4b9779e3e9e16204fa570bcb', 'KDB', 1, 1646394742),
('Karloss0403', '364cafa40eb896ffc220975d3b52431723a6d715a17c13f12296d62fa1e5f31f71ba2809e3fb9120231de8c388a736eec9064494a187fa7cf10357425d5b8c9d545487e5fed49407afad377f0225d935ea08e867dd803f5c12472a3e70cca7bd233a314a8c747e8ec751', 'DIAZ', 1, 1646394794),
('Karl0ss1703', 'b96aaf626027d671a0d0b3975bdc498631e33f9a177700b006db2edd1b31d3fc35bbc0812b6ee86e0693a76d358309ce1a070a7d35117cfd3fde8a6d7763766d42c35702b5cc0e933069a955ebd36c00349eedc2c9b80e5c493dcf69e9cfa62afdd81c0d9eadd67b405b', 'KDB', 1, 1647549531),
('Karl0ss1703', '2cfaf0ebd2aa3fc2f8b750cc24bdd54e3f2ea53ba7204e77ab35b85cb24a801fcaabffb74c7f755ab79646fcb36cd45cd3ce4de10148d006ede36154e86a839defc6d3f473e27f4cd520de11b179a1df445cb34cb9857128d440632c59c154a2118f46555d9b48afdc09', 'Titan', 1, 1647549703);
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users`
(
`id` int
(11) NOT NULL AUTO_INCREMENT,
`userName` varchar
(255) COLLATE utf8_bin NOT NULL,
`password` varchar
(255) COLLATE utf8_bin NOT NULL,
PRIMARY KEY
(`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO users (
userName
, password) VALUES
('Karl', 'TEST'),
('Darren', 'bla'),
('Duly', 'Blda')
ON DUPLICATE KEY
UPDATE `id` = VALUES
(`id`), `userName` = VALUES
(`userName`), `password` = VALUES
(`password`);
-- 2021-02-28 10:28:08

View File

@ -1,55 +0,0 @@
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
-- Product home page: http://www.devart.com/dbforge/mysql/studio
-- Script date 19/02/2021 15:07:06
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
-- Client version: 4.1
SET NAMES 'utf8';
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(1, 'Gold', 'http://catenamode.cf:8090');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(2, 'Insanity', 'https://trippy.pro:443');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(3, 'PremiumPlus', 'https://itty.in:443');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(4, 'GunSlinger', 'http://gunslingertv.org:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(5, 'VIP', 'http://oven-cleaner.com:8080/');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(6, 'Technoid', 'http://capoisagod2021.org:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(7, 'Old Premium', 'https://caporeds.online:443');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(8, 'New Premium', 'http://fckbrexit.link:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(9, 'Sol', 'http://tv.realot.xyz:35001');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(10, 'Bluemoon', 'http://www.tvxclnt.com:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(11, 'AIRWOLF', 'http://iptv.satplex.co.uk:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(12, 'Gambler', 'http://37723998.to:2052');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(13, 'Liveclub', 'http://apkdns.store:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(14, 'Opplex', 'http://opplex.tv:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(15, 'Shark', 'http://faithhosting.xyz:25461');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(16, 'USA', 'http://pimptv.dnsabr.com:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(17, 'VIPER', 'http://tavaratv.xyz:2095');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(18, 'SUNBED', 'http://cms-tan.media:8880');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(19, 'Knightrider', 'http://streamknighttv.xyz:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(20, 'Simple', 'http://covidsucks.xyz:8080');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(21, 'KDB', 'http://mytv.digital:8080/');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(22, 'PYTHON', 'http://foxmedia.bounceme.net:8282');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(23, 'KEANO', 'http://ip365.cx:80');
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
(24, 'FODEN', 'http://ac.mustardsubs.tk:8880');

View File

@ -1,25 +0,0 @@
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
-- Product home page: http://www.devart.com/dbforge/mysql/studio
-- Script date 19/02/2021 15:07:08
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
-- Client version: 4.1
SET NAMES 'utf8';
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(12, 'Karl2903', '436e09390f77663091780c2796418f095a74ae0a9b181b69cc51575ec3bcd3a1c8b5a47d1af288b25dd757c27e74319d7457b8a37859e7a248e71f0f9ef5b23304dbf784d26ec2accf9ce6b612c0008387086289527dfaf10d8368c811a853d5402e09815226d6dc', 'Gold', '1', 1617100032);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(16, 'Karl2802', 'bf8605f7c3386f5857a6df3c15be0a3de9cfb32179cb2f0454cf1f46844b4ae2b24a4d6e2705e78dcf3e019a3b7f3b9d90e9f3bf279f8950ae187de96d19c50989e921b6a4c1fe3d1cf189474db05933c505e7eea91ef18a25bdc7f74274e63af4ce8c01da69aeab83fe', 'PremiumPlus', '1', 1614504315);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(17, 'Karl0704', '89e8e131570896ee1f83bf97fc2a73a61f448cfe379cef9c8af8489f21a5aa7c0309de4350c443f7d5bbc15162ef5c6115db6c58ac510d9a982414f8725246cb6c801fe526d0eac98c198f25b7e1b17c38647cfce3cf8ba4e6276d081ac6522cfc0778d71796294e3f97', 'VIP', '1', 1617787739);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(18, 'Karl24', '482899bc267eaa17c97ff9440588717feccfd591aa7501d0c16eb0a9667204f6a35c39a098330efef2d167d918ad5a49c3917b85a3dd4e8af7e391e0cb47beff7276dccb3f6a450ee7dafedcbe3a1593c4569509c32b8e8cbbb26bd8db31fe2f214f928d61bf09e8744b', 'Insanity', '1', 1624444437);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(19, 'Karl2206', 'a047fa4d67f78d94b7eb3834055d9ae6af398c448e59701e2e4a52f9e36f72c59529674acb2cb1f334b9eba88b154638f43ab5865c85ed77f1300ed11bcab337e7457a854dd9d1e8f484ddda960d7864448fd12b117690350c19c2a0d583391a279465b6f9e356ab4104', 'GunSlinger', '1', 1624301605);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(20, 'Darren1706', 'cfe5a6be558d12daf878e0570a84bfb96ff02a2b436e9edb8ddd258fc1311522305139f3758e345b905c5b15f3d41fc06f2f5006dee50975342a5eadc2b48f30b106b3c75510e1201f131235f23716edfc61250972018233532f72a537bf4762776ff1bd0e39d4f6017d', 'Technoid', '2', 1624005116);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(21, 'Dazg3012', '476dd5316a78251fe26cea0a2d2786e8ddaeb8da99f99bfff9e1e34267eb3d0e79f0549cb102edcacd9a1685ee940347f43343c0314fca3816f81d9ec7b9370670e4ec7dddd695795752ad188c56207eb1ef6464d0e8690d4a44084a0918ec12ba6ca01c0d613463886f', 'Old Premium', '2', 1640885178);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(22, 'Martin1607', '33db85e33346ac83bc72c2feac294873edab0ec43bba6da5830275af7dbca539a445d3667874ba3cb64b9861a52f9aaa452140d92a3df0e6f87cb8d2eb6eceb9d0c0faaf284164beacb0bca8f3870794c2acd1f29ef310c150b4b1ff2b6e007b249b33c9144688eac57f', 'GunSlinger', '3', 2147483647);
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
(23, 'Martin2204', '8c7e61d5131661fbb246ad7dad0eb05e481235fa5574707b287619331c77da16643ca1c94fb82fd4290a4bc79c7773428a56673e5c3b20c5d13753d66693da69326c3a5be854fefe8b9829e8e6f4e8775e949959cd4caa8d0d063870a8d0da35167566cb575d459a7594', 'Gold', '3', 1619089223);

View File

@ -1,13 +0,0 @@
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
-- Product home page: http://www.devart.com/dbforge/mysql/studio
-- Script date 19/02/2021 15:07:09
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
-- Client version: 4.1
SET NAMES 'utf8';
INSERT INTO BBLB_DNS.users(idusers, userName, password) VALUES
(1, 'Karl', 'TEST');
INSERT INTO BBLB_DNS.users(idusers, userName, password) VALUES
(2, 'Darren', 'bla');
INSERT INTO BBLB_DNS.users(idusers, userName, password) VALUES
(3, 'Duly', 'Blda');

View File

@ -1,4 +1,4 @@
docker stop bblbtv_dns &&\ docker stop ktvmanager &\
docker rm --force bblbtv_dns &&\ docker rm --force ktvmanager &\
docker build -t bblbtv_dns . &&\ docker build -t ktvmanager . &&\
docker run -p 6969:6969 -v ${PWD}/logs:/usr/src/app/logs -d --name bblbtv_dns bblbtv_dns:latest docker run -p 6969:6969 -v ${PWD}/logs:/usr/src/app/logs -d --name kTvManager ktvmanager:latest

35
app.js
View File

@ -1,50 +1,31 @@
var createError = require('http-errors');
var express = require('express'); var express = require('express');
var path = require('path'); const basicAuth = require('express-basic-auth')
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const { getUsers } = require('./lib/getUsers') const { getUsers } = require('./lib/getUsers')
var indexRouter = require('./routes/index'); var indexRouter = require('./routes/index');
var streamsRouter = require('./routes/getStreams');
var getUserAccounts = require('./routes/getUserAccounts') var getUserAccounts = require('./routes/getUserAccounts')
var singleUserCheck = require('./routes/singleCheck') var singleUserCheck = require('./routes/singleCheck')
var addAccount = require('./routes/addAccount') var addAccount = require('./routes/addAccount')
var readCookie = require('./routes/readCookie') var deleteAccount = require('./routes/deleteAccount')
var getStreamNames = require('./routes/getStreamNames')
var login = require('./routes/login') var login = require('./routes/login')
var app = express(); var app = express();
const basicAuth = require('express-basic-auth')
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser('82e4e438a0705fabf61f9854e3b575af'));
app.use(express.static(path.join(__dirname, 'public')));
let usersList = getUsers() let usersList = getUsers()
const users = { const users = {
users: usersList, users: usersList,
challenge: true, challenge: true
realm: 'foo',
} }
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use('/', indexRouter); app.use('/', indexRouter);
app.use('/login', basicAuth(users), login) app.use('/login', basicAuth(users), login)
app.use('/getStreams', streamsRouter); app.use('/getUserAccounts', basicAuth(users), getUserAccounts);
app.use('/getUserAccounts', getUserAccounts);
app.use('/singleCheck', basicAuth(users), singleUserCheck) app.use('/singleCheck', basicAuth(users), singleUserCheck)
app.use('/addAccount', addAccount) app.use('/addAccount', basicAuth(users), addAccount)
app.use('/readCookie', readCookie) app.use('/deleteAccount', basicAuth(users), deleteAccount)
app.use('/getStreamNames', getStreamNames)
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use(function (req, res, next) { app.use(function (req, res, next) {

View File

@ -4,6 +4,8 @@
* Module dependencies. * Module dependencies.
*/ */
require('dotenv').config()
var app = require('../app'); var app = require('../app');
var debug = require('debug')('react-backend:server'); var debug = require('debug')('react-backend:server');
var http = require('http'); var http = require('http');

View File

@ -1,20 +0,0 @@
FROM node:12-alpine
LABEL version="1.0"
LABEL description="FRONTEND"
# LABEL maintainer = ["danielmurph8@gmail.com", "dylanedwards290@gmail.com"]
WORKDIR /app
COPY ["package.json", "package-lock.json", "./"]
ENV PORT=6969
RUN apk --no-cache add curl
RUN npm install --production
COPY . .
EXPOSE 6969
CMD ["npm", "start"]

23
client/.gitignore vendored
View File

@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,70 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `yarn build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

15654
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-dropdown": "^1.9.2",
"react-scripts": "4.0.2",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "set PORT=6969 && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:3001",
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
/>
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -1,25 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -1,3 +0,0 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@ -1,53 +0,0 @@
/* Pen-specific styles */
* {
box-sizing: border-box;
}
body {
font-size: 1.25rem;
font-family: sans-serif;
line-height: 150%;
text-shadow: 0 2px 2px #1b1917;
}
section {
color: #fff;
text-align: center;
}
div {
height: 100%;
}
article {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
padding: 20px;
}
h1 {
font-size: 1.75rem;
margin: 0 0 0.75rem 0;
}
/* Pattern styles */
.container {
display: table;
width: 100%;
}
.left-half {
background-color: #060b4d9f;
position: absolute;
left: 0px;
width: 50%;
}
.right-half {
background-color: #060b4d9f;
position: absolute;
right: 0px;
width: 50%;
}

View File

@ -1,21 +0,0 @@
import React from "react";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import { Navigation, Footer, Home, Accounts, ServerList, AddAccount } from "./components";
function App() {
return (
<div className="App">
<Router>
<Navigation />
<Switch>
<Route path="/" exact component={() => <Home />} />
<Route path="/Accounts" exact component={() => <Accounts />} />
<Route path="/ServerList" exact component={() => <ServerList />} />
<Route path="/AddAccount" exact component={() => <AddAccount />} />
</Switch>
<Footer />
</Router>
</div>
);
}
export default App;

View File

@ -1,8 +0,0 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@ -1,16 +0,0 @@
import axios from "axios";
async function readCookie() {
try {
const res = await axios.get("/readCookie");
if (res.data === "No Cookie Set") {
document.location = "/";
}
} catch (e) {
console.log(e);
}
};
export default readCookie;

View File

@ -1,15 +0,0 @@
import React from "react";
import MTable from "./accountTable";
import readCookie from "../checkAuth";
function Accounts() {
readCookie();
return (
<div style={{ padding: "30px" }}>
<MTable />
</div>
);
}
export default Accounts;

View File

@ -1,126 +0,0 @@
import React, { Component } from "react";
import axios from "axios";
import Dropdown from "react-dropdown";
import "react-dropdown/style.css";
import readCookie from "../checkAuth"
let arr = [];
class AddAccount extends Component {
constructor() {
readCookie();
super();
this.state = {
username: "",
password: "",
stream: "",
};
}
componentDidMount() {
this.fetchOptions();
}
fetchOptions() {
fetch("/getStreamNames")
.then((res) => {
return res.json();
})
.then((json) => {
json.forEach((account) => {
arr.push(account.streamName);
});
this.setState({ options: arr });
});
}
_onSelect = (e) => {
/*
Because we named the inputs to match their
corresponding values in state, it's
super easy to update the state
*/
this.setState({ stream: e.value });
};
onChange = (e) => {
/*
Because we named the inputs to match their
corresponding values in state, it's
super easy to update the state
*/
this.setState({ [e.target.name]: e.target.value });
};
onSubmit = (e) => {
e.preventDefault();
// get our form data out of state
const { username, password, stream } = this.state;
console.log({ username, password, stream });
axios
.post(`/addAccount`, {
username,
password,
stream,
})
.then((res) => {
console.log(res);
console.log(res.data);
if (res.data.includes("Added successfully")) {
document.location = "/accounts";
} else {
document.location = "/AddAccount";
}
});
};
render() {
const { username, password } = this.state;
return (
<section class="container">
<div class="left-half">
<article>
<h1>Add An Account</h1>
<p>
<form onSubmit={this.onSubmit}>
<p>
UserName -
<input
type="text"
name="username"
value={username}
onChange={this.onChange}
/>
</p>
<p>
Password -
<input
type="text"
name="password"
value={password}
onChange={this.onChange}
/>
</p>
<p>
Stream Name -
<Dropdown
options={arr}
onChange={this._onSelect}
value={arr[0]}
placeholder="Select an option"
/>
</p>
<br />
<button type="submit">Add Account</button>
</form>
</p>
</article>
</div>
</section>
);
}
}
export default AddAccount;

View File

@ -1,17 +0,0 @@
import React from "react";
function Footer() {
return (
<div className="footer">
<footer class="py-5 bg-dark fixed-bottom">
<div class="container">
<p class="m-0 text-center text-white">
Copyright &copy; 2021
</p>
</div>
</footer>
</div>
);
}
export default Footer;

View File

@ -1,53 +0,0 @@
import React, { useState, useEffect } from "react";
import ReactDOM from "react-dom";
import axios from "axios";
function App() {
const deleteCookie = async () => {
try {
await axios.get("/readCookie/clear");
} catch (e) {
console.log(e);
}
};
const [username, setUsername] = useState();
const [password, setPassword] = useState();
const auth = async () => {
try {
const res = await axios.get("/login", {
auth: { username, password },
});
if (res.data.auth === "Success") {
document.location = "/accounts";
}
} catch (e) {
console.log(e);
}
};
return (
<div className="App">
<div>
<label>Username: </label>
<br />
<input type="text" onChange={(e) => setUsername(e.target.value)} />
<br />
<label>Password: </label>
<br />
<input type="password" onChange={(e) => setPassword(e.target.value)} />
<br />
<button onClick={auth}>Login</button> -
<button onClick={deleteCookie}>Logout</button>
</div>
</div>
);
}
export default App;
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

View File

@ -1,60 +0,0 @@
import React from "react";
import { Link, withRouter } from "react-router-dom";
function Navigation(props) {
return (
<div className="navigation">
<nav class="navbar navbar-expand navbar-dark bg-dark">
<div class="container">
<Link class="navbar-brand" to="/">
BBLB_DNS
</Link>
<div>
<ul class="navbar-nav ml-auto">
<li
class={`nav-item ${
props.location.pathname === "/" ? "active" : ""
}`}
>
<Link class="nav-link" to="/">
Home
<span class="sr-only">(current)</span>
</Link>
</li>
<li
class={`nav-item ${
props.location.pathname === "/accounts" ? "active" : ""
}`}
>
<Link class="nav-link" to="/accounts">
Accounts
</Link>
</li>
{/* <li
class={`nav-item ${
props.location.pathname === "/ServerList" ? "active" : ""
}`}
>
<Link class="nav-link" to="/ServerList">
Server List
</Link>
</li> */}
<li
class={`nav-item ${
props.location.pathname === "/AddAccount" ? "active" : ""
}`}
>
<Link class="nav-link" to="/AddAccount">
Add Account
</Link>
</li>
</ul>
</div>
</div>
</nav>
</div>
);
}
export default withRouter(Navigation);

View File

@ -1,56 +0,0 @@
import React, { Component } from "react";
class ServerList extends Component {
constructor() {
super();
this.state = {
fname: "",
lname: "",
streams: [],
};
}
componentDidMount() {
fetch("/getStreams")
.then((res) => res.json())
.then((streams) => this.setState({ streams }));
}
onChange = (e) => {
/*
Because we named the inputs to match their
corresponding values in state, it's
super easy to update the state
*/
this.setState({ [e.target.name]: e.target.value });
};
onSubmit = (e) => {
e.preventDefault();
// get our form data out of state
const { fname, lname } = this.state;
console.log({ fname, lname });
};
render() {
return (
<div className="contact">
<div class="container">
<div class="row align-items-center my-5">
<div class="col-lg-7">
<h1>Stream Details</h1>
</div>
<div class="col-lg-5">
{this.state.streams.map((stream) => (
<div key={stream.StreamName}>
{stream.StreamName} - {stream.StreamURL}
</div>
))}
</div>
</div>
</div>
</div>
);
}
}
export default ServerList;

View File

@ -1,70 +0,0 @@
import React from "react";
import Dropdown from "react-dropdown";
import "react-dropdown/style.css";
var values;
let arr = [];
class DropDown extends React.Component {
constructor() {
super();
this.state = {
options: [],
};
}
componentDidMount() {
this.fetchOptions();
}
fetchOptions() {
fetch("/getStreamNames")
.then((res) => {
return res.json();
})
.then((json) => {
values = json;
values.forEach((element) => {
arr.push(element.streamName);
});
this.setState({ options: arr });
});
}
handleChange = (event) => {
this.setState({
value: event.target.value,
});
};
_onSelect = (e) => {
/*
Because we named the inputs to match their
corresponding values in state, it's
super easy to update the state
*/
this.setState({ stream: e.value });
};
onChange = (e) => {
/*
Because we named the inputs to match their
corresponding values in state, it's
super easy to update the state
*/
this.setState({ [e.target.name]: e.target.value });
};
render() {
return (
<Dropdown
options={arr}
onChange={this._onSelect}
value={arr[0]}
placeholder="Select an option"
/>
);
}
}
export default DropDown;

View File

@ -1,91 +0,0 @@
import React, { Component } from "react";
import axios from "axios"; // npm instal axios
import { forwardRef } from "react";
import MaterialTable from "material-table";
import ArrowDownward from "@material-ui/icons/ArrowDownward";
import ChevronLeft from "@material-ui/icons/ChevronLeft";
import ChevronRight from "@material-ui/icons/ChevronRight";
import Clear from "@material-ui/icons/Clear";
import FilterList from "@material-ui/icons/FilterList";
import FirstPage from "@material-ui/icons/FirstPage";
import LastPage from "@material-ui/icons/LastPage";
import Search from "@material-ui/icons/Search";
const tableIcons = {
// DetailPanel: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />),
Filter: forwardRef((props, ref) => <FilterList {...props} ref={ref} />),
FirstPage: forwardRef((props, ref) => <FirstPage {...props} ref={ref} />),
LastPage: forwardRef((props, ref) => <LastPage {...props} ref={ref} />),
NextPage: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />),
PreviousPage: forwardRef((props, ref) => (
<ChevronLeft {...props} ref={ref} />
)),
ResetSearch: forwardRef((props, ref) => <Clear {...props} ref={ref} />),
Search: forwardRef((props, ref) => <Search {...props} ref={ref} />),
SortArrow: forwardRef((props, ref) => <ArrowDownward {...props} ref={ref} />),
};
export default class MatDataTable extends Component {
constructor(props) {
super(props);
this.state = { person: [] };
}
componentDidMount(prevProps) {
const url = `/getUserAccounts`;
axios.get(url).then((results) => {
console.log(results);
console.log(results.data);
this.setState({ person: results.data });
var newArr = results.data.map(function (val) {
let date = new Date(val.expiaryDate * 1000);
let d = date.toGMTString();
return {
username: val.username,
streamName: val.streamName,
streamURL: val.streamURL,
expiaryDate: d,
};
});
console.log(results.data.results);
this.setState(
{
tableArray: newArr, //set state of the weather5days
},
() => {
console.log(this.state.tableArray);
console.log("this.tableArray ", this.state.tableArray);
}
);
});
}
render() {
return (
<div
style={{ maxWidth: "100%", marginLeft: "50px", marginRight: "50px" }}
>
<MaterialTable
icons={tableIcons}
options={{
grouping: false,
}}
columns={[
{
title: "Username",
field: "username",
type: "numeric",
align: "left",
},
{ title: "Stream Name", field: "streamName" },
{ title: "Stream URL", field: "streamURL" },
{ title: "Expiry Date", field: "expiaryDate", type: "numeric" },
]}
data={this.state.tableArray}
title="Stream Details"
/>
</div>
);
}
}

View File

@ -1,7 +0,0 @@
export { default as Navigation } from "./Navigation";
export { default as Footer } from "./Footer";
export { default as Home } from "./Home";
export { default as Accounts } from "./Accounts";
export { default as ServerList } from "./ServerList";
export { default as AddAccount } from "./AddAccount"
export {default as DropDown } from "./accountDropDown"

View File

@ -1,13 +0,0 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@ -1,17 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

@ -1,81 +0,0 @@
import React, { Component } from 'react';
import axios from 'axios';
import './App.css';
class App extends Component {
constructor() {
super();
this.state = {
fname: '',
lname: '',
streams: []
};
}
componentDidMount() {
fetch('/getStreams')
.then(res => res.json())
.then(streams => this.setState({ streams }));
}
onChange = (e) => {
/*
Because we named the inputs to match their
corresponding values in state, it's
super easy to update the state
*/
this.setState({ [e.target.name]: e.target.value });
}
onSubmit = (e) => {
e.preventDefault();
// get our form data out of state
const { fname, lname } = this.state;
console.log({ fname, lname })
}
render() {
const { fname, lname } = this.state;
return (
<section class="container">
<div class="left-half">
<article>
<h1>User Login</h1>
<p>
<form onSubmit={this.onSubmit}>
<p>UserName
<input
type="text"
name="fname"
value={fname}
onChange={this.onChange}
/>
</p>
<p>Password
<input
type="text"
name="lname"
value={lname}
onChange={this.onChange}
/>
</p>
<br />
<button type="submit">Login</button>
</form>
</p>
</article>
</div>
<div class="right-half">
<article>
<h1>Stream Details</h1>
{this.state.streams.map(stream =>
<div key={stream.StreamName}>{stream.StreamName} - {stream.StreamURL}</div>
)}
</article>
</div>
</section>
);
}
}
export default App;

View File

@ -1,13 +0,0 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

File diff suppressed because it is too large Load Diff

View File

@ -5,27 +5,31 @@ services:
build: build:
context: . context: .
dockerfile: .dockerfile dockerfile: .dockerfile
image: "karl0ss/bblbtv_dns-backend" image: "karl0ss/ktvmanager"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./SQL/:/docker-entrypoint-initdb.d
ports: ports:
- "3001:3001" - "3001:3001"
frontend:
build:
context: ./client
dockerfile: .dockerfile
image: "karl0ss/bblbtv_dns-frontend"
ports:
- "6969:6969"
environment: environment:
- PORT=6969 - DBHOST=vps.k-world.me.uk
links: - DBUSER=root
- "backend:be" - DBPASS=Grd555269
db: - DATABASE=BBLB_DNS
image: mariadb - DBPORT=3306
restart: always - TORSSRV=host.docker.internal
environment: - TORSPWD=KarlMax
MYSQL_ROOT_PASSWORD: example # frontend:
adminer: # build:
image: adminer # context: ./client
restart: always # dockerfile: Dockerfile.prod
ports: # # dockerfile: .dockerfile
- 8080:8080 # image: "karl0ss/bblbtv_dns-frontend"
# ports:
# - "6969:6969"
# environment:
# - URL=vps.k-world.me.uk
# - PORT=6969
# links:
# - "backend"

View File

@ -1,19 +1,29 @@
const Cryptr = require('cryptr'); const Cryptr = require('cryptr');
const cryptr = new Cryptr('BBLBTV-DNS-PASSWORDS'); const cryptr = new Cryptr('BBLBTV-DNS-PASSWORDS');
const sql = require('./mysql') const sql = require('./mysql')
function storeAccountToDB(accountDetails) { function storeAccountToDB(accountDetails) {
const encryptedPassword = cryptr.encrypt(accountDetails.password); const encryptedPassword = cryptr.encrypt(accountDetails.password);
const result = sql.query(`INSERT userAccounts (username, password, stream, userID) VALUES ("${accountDetails.username}", "${encryptedPassword}", "${accountDetails.stream}", ${accountDetails.userId})`); const result = sql.query(`INSERT userAccounts (username, password, stream, userID, expiaryDate, streamURL, maxConnections) VALUES ("${accountDetails.username}", "${encryptedPassword}", "${accountDetails.streamName}", ${accountDetails.userId}, ${accountDetails.expiryDate}, "${accountDetails.streamURL}", ${accountDetails.maxConnections})`);
return result return result
} }
function removeAccountFromDB(accountDetails) {
const result = sql.query(`DELETE FROM userAccounts WHERE
username = '${accountDetails.user}' AND
stream = '${accountDetails.stream}' AND
userId = ${accountDetails.userId} `);
return result
}
function retrievePasswordFromDB(user, userAccUser) { function retrievePasswordFromDB(user, userAccUser) {
let userId let userId
try { try {
userId = sql.query(`SELECT u.idusers FROM users u WHERE u.userName = '${user}'`); userId = sql.query(`SELECT u.id FROM users u WHERE u.userName = '${user}'`);
userId = userId[0].idusers userId = userId[0].id
} catch (error) { } catch (error) {
console.log('User not found') console.log('User not found')
return (error) return (error)
@ -35,12 +45,24 @@ WHERE userAccounts.userID = ${userId} AND userAccounts.username = '${userAccUser
} else { } else {
const decryptedString = cryptr.decrypt(accountPassword[0].password); const decryptedString = cryptr.decrypt(accountPassword[0].password);
console.log(decryptedString) console.log(decryptedString)
return decryptedString
} }
} }
retrievePasswordFromDB('Karl', 'Karl2903') // accountDetails = {
// "username": "Darren110921",
// "password" :"saD2V2kjyNqH",
// "stream": "Badger",
// "userId" : "2"
// }
// retrievePasswordFromDB('Karl', 'Maxine2206')
// storeAccountToDB(accountDetails)
module.exports = { module.exports = {
removeAccountFromDB,
storeAccountToDB, storeAccountToDB,
retrievePasswordFromDB retrievePasswordFromDB
} }

View File

@ -1,4 +1,5 @@
[ [
"http://webservgroup.xyz/smarters4567891/api/home.php?action=dns", "http://apppanel.co.uk/panel/capo/smarters/api//home.php?action=dns",
"https://webservgroup.xyz/lippy/api/home.php?action=dns" "http://panelhost.xyz/cli3nts/Funky/Smarters/api/home.php?action=dns"
] ]

5
lib/DNSArray_old.json Normal file
View File

@ -0,0 +1,5 @@
[
"http://webservgroup.xyz/smarters4567891/api/home.php?action=dns",
"http://panelhost.xyz/cli3nts/Funky/Smarters/api/home.php?action=dns",
"http://panelhost.xyz/cli3nts/smartersv3/funky/api/home.php?action=dns"
]

150
lib/apache_functions.js Executable file
View File

@ -0,0 +1,150 @@
const { configs } = require('apache-api');
const { getStreamsNew } = require('../routes/getStreams')
const { getURLandStreams } = require('./getStreamNames')
const { allUserCheck } = require('./checker')
apache_config = 'tv.k-world'
const { exec } = require("child_process");
function restart() {
exec("sudo service apache2 reload", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`no issues`);
});
}
function makeid() {
var result = '';
var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < 5; i++) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
return result;
}
async function get_config() {
return await configs.readConfig(apache_config, true, true)
}
async function split_streams(siteList) {
const notUndefined = anyValue => typeof anyValue !== 'undefined'
final_array = siteList.map(function (item) {
if (item.content.includes('Redirect')) {
var cleanString = item.content.replace(/^(.*?)\//g, "");
cleanString = cleanString.split(' ')
cleanString[1] = cleanString[1].replace(/"/g, "")
return cleanString
}
}).filter(notUndefined)
return final_array
}
async function updateStream(updatedStreams) {
config = await get_config()
updatedStreams.forEach(async stream => {
config.children[0].children.map(async function (item) {
if (item.content.includes(stream[1])) {
return item.content = `Redirect 302 /${stream[0]} "${stream[2]}"`
}
})
try {
await configs.saveConfig(apache_config, config, true, true)
console.log(stream[0] + ' url updated')
} catch (error) {
console.log(stream[0] + ' url failed to update')
console.log(error)
}
})
}
async function updateStreamCheck(streamsFromKtvDB, streamsFromConfig) {
updatedStreams = []
streamsFromConfig.forEach(sfc => {
streamsFromKtvDB.forEach(sfktv => {
if (sfc[0] == sfktv.stream) {
sfc[0]
sfktv.stream
if (sfc[1] != sfktv.streamURL) {
console.log(sfc[0] + ' url changed')
updatedStreams.push([sfc[0], sfc[1], sfktv.streamURL])
} else {
// console.log(sfc[0] + ' not updated')
}
}
});
});
return updatedStreams
}
async function checkExists(fullStreamList, mappedStreams) {
newstreams = mappedStreams.map(function (s) {
return s[1]
})
myArray = fullStreamList.filter(function (el) {
return newstreams.indexOf(el) < 0;
});
if (myArray.length == 0) {
console.log('No new streams')
} else {
console.log('New streams ' + myArray)
}
return myArray
}
async function addNewStreams(config, streamList) {
streamList.forEach(stream => {
config.children[0].children.push({ "tagName": '$rule', "content": `Redirect 302 /${makeid()} "${stream}"` })
})
try {
await configs.saveConfig(apache_config, config, true, true)
} catch (error) {
console.log(error)
}
}
async function syncApache() {
// console.log('Updating all user account from ktv')
// await allUserCheck()
// console.log('Update complete')
console.log('Comparing streams from ktv and apache')
streams = await getStreamsNew()
config = await get_config()
streamsFromConfig = await split_streams(config.children[0].children)
streamsFromKtvDB = await getURLandStreams()
updatedStreams = await updateStreamCheck(streamsFromKtvDB, streamsFromConfig)
await updateStream(updatedStreams)
console.log('Complete')
console.log('Adding any missing streams to apache')
streams = await getStreamsNew()
config = await get_config()
streamsFromConfig = await split_streams(config.children[0].children)
missingStreamsInApache = await checkExists(streams, streamsFromConfig)
resultOfAddStreams = await addNewStreams(config, missingStreamsInApache)
console.log('Complete')
console.log('Restarting Apache')
await restart()
console.log('Complete')
}
module.exports = {
syncApache
}

View File

@ -1,65 +1,236 @@
const { getStreamsNew } = require('../routes/getStreams')
const { updateStreamData, updateOtherURLs } = require('./updateStreams')
const { decryptPassword } = require('./password')
const { getUserAccountsCheck, getAllUniqueAccounts, getAllUserAccounts, getUserUniqueAccounts } = require('./getUser')
const { storeAccountToDB } = require('../lib/Accounts')
const { syncApache } = require('./apache_functions')
let streamArrays = require('./streamArray.json')
let users = require('./logins.json') const axios = require('axios')
const tor_axios = require('tor-axios');
const tor = tor_axios.torSetup({
ip: process.env.TORSSRV,
port: 9050,
controlPort: 9051,
controlPassword: process.env.TORSPWD,
})
const { gotRequest } = require('./gotRequest') axios.defaults.timeout = 3000;
tor.defaults.timeout = 3000
const delay = ms => new Promise(res => setTimeout(res, ms)); const inst = axios.create({
httpAgent: tor.httpAgent(),
httpsagent: tor.httpsAgent(),
});
async function singleCheck(username) { let axiosOptions = {
let user = users.find(user => user.username === username) headers: {
for (let index = 0; index < streamArrays.length; index++) { 'User-Agent': 'IPTV Smarters Pro'
await delay(500);
const stream = streamArrays[index];
process.stdout.write('.')
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + 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)
process.stdout.write('\n')
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + date)
stream.username = user.username
stream.expiaryDate = date.toLocaleDateString('en-GB')
return (stream)
}
}
} }
process.stdout.write('\nEnd Of Streams\n\n')
} }
async function main() {
for (let index = 0; index < users.length; index++) { // const delay = ms => new Promise(res => setTimeout(res, ms));
const user = users[index];
console.log('Trying ' + user.username)
for (let index = 0; index < streamArrays.length; index++) { async function buildURL(streamURL, username, password) {
await delay(500); let url = streamURL + "/player_api.php?username=" + username + "&password=" + password
const stream = streamArrays[index]; return url
process.stdout.write('.') }
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
let t = await gotRequest(url) async function splitURL(url) {
let body = t.body try {
if (t.statusCode == 200 && body !== "") { let extractedURL = url.match(/[^/]*\/\/[^/]*/)[0]
body = JSON.parse(body) let extractedUserPass = url.match(/\/player_api\.php\?username=([\s\S]*)$/)[1]
if (body.user_info.auth) { let UserPass = extractedUserPass.split('&password=')
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB') return {
process.stdout.write('\n') "extractedUrl": extractedURL,
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + body.user_info.exp_date) "username": UserPass[0],
"password": UserPass[1]
}
} catch {
}
}
async function updateAccounts(userAccounts, data, url) {
let urlData = await splitURL(url)
let account = userAccounts.filter(account => account.username == urlData.username && account.passwordDecryped == urlData.password)[0]
await updateStreamData({
"username": account.username,
"password": account.password,
"userId": account.userId
}, urlData.extractedUrl, data.user_info.exp_date)
console.log(`${urlData.extractedUrl}.`)
await updateOtherURLs(account.stream, urlData.extractedUrl)
}
async function addNewAccount(userAccount, data, url) {
try {
let URL = await splitURL(url)
await storeAccountToDB({
"username": userAccount.username,
"password": userAccount.password,
"userId": userAccount.userId,
"streamName": userAccount.stream,
"streamURL": URL.extractedUrl,
"expiryDate": data.user_info.exp_date,
"maxConnections": data.user_info.max_connections
}, URL.extractedUrl, data.user_info.exp_date)
var date = new Date(data.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
console.log(`${userAccount.username} - ${URL.extractedUrl} - Expires ${date}.`)
} catch (error) {
}
}
async function urlChecker(userAccounts) {
let ip = await inst.get('http://api.ipify.org')
console.log(ip.data);
let updateCount = 0
for (let index = 0; index < userAccounts.length; index++) {
const userAccount = userAccounts[index];
let count = index + 1
console.log(count + ' of ' + userAccounts.length + ' ' + userAccount.username)
for (let index2 = 0; index2 < userAccount.urls.length; index2++) {
const url = userAccount.urls[index2];
// console.log('url ' + index2 + 1 + ' of ' + userAccount.urls.length)
// console.log('.')
try {
let response = await inst.get(url, axiosOptions)
if (response.data.user_info.auth) {
await updateAccounts(userAccounts, response.data, url)
updateCount++
break break
} }
} catch (error) {
try {
if (error.response.status == 403) {
let response2 = await axios.get(url, axiosOptions)
if (response2.data.user_info.auth) {
try {
await updateAccounts(userAccounts, response2.data, url)
updateCount++
break
} catch (error) {
continue
}
}
}
} catch (error) {
continue
}
} }
} }
process.stdout.write('\nEnd Of Streams\n\n')
} }
console.log('Finished') syncApache()
return {
"updatedCount": updateCount,
"totalAccounts": userAccounts.length
}
} }
// main() async function userCheck(accountData) {
let start = Date.now()
console.log(start)
streamURLS = await getStreamsNew()
let userAccounts = await getUserUniqueAccounts(accountData.userId)
userAccounts = userAccounts.map(user => {
user.userId = accountData.userId
user.passwordDecryped = decryptPassword(user.password)
return user
})
urlList = []
for (let index = 0; index < userAccounts.length; index++) {
let userAccount = userAccounts[index];
userAccount.urls = []
for (let index = 0; index < streamURLS.length; index++) {
const streamURL = streamURLS[index];
userAccount.urls.push(await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped))
urlList.push(await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped))
}
userAccount.urls = userAccount.urls.filter(function (e) { return !e.includes('stormtv') && !e.includes('megaott') })
}
values = await urlChecker(userAccounts)
if (values.updatedCount > 0) {
return {
"update": true,
"count": values.updatedCount
}
}
else {
return endresponse = false
}
}
async function accountChecker(accountData, urlList) {
let ip = await inst.get('http://api.ipify.org')
console.log(ip.data);
for (let index = 0; index < urlList.length; index++) {
const url = urlList[index];
console.log(index + 1 + ' of ' + urlList.length + ' urls checked')
try {
let response = await inst.get(url, axiosOptions)
if (response.data.user_info.auth) {
addNewAccount(accountData, data, url)
console.log('New Account Added')
syncApache()
return true
}
} catch (error) {
try {
if (error.response.status == 403) {
let response2 = await axios.get(url, axiosOptions)
if (response2.data.user_info.auth) {
try {
await addNewAccount(accountData, response2.data, url)
console.log('New Account Added')
syncApache()
return true
} catch (error) {
continue
}
}
}
} catch (error) {
continue
}
}
}
return false
}
async function singleAccountCheck(accountData) {
streamURLS = await getStreamsNew()
urlList = []
for (let index = 0; index < streamURLS.length; index++) {
const streamURL = streamURLS[index];
urlList.push(await buildURL(streamURL, accountData.username, accountData.password))
}
urlList
return await accountChecker(accountData, urlList)
}
module.exports = { module.exports = {
singleCheck, userCheck,
main singleAccountCheck,
} }
// singleAccountCheck({ "username": "Karl0ss01", "password": "YqQjYH9Nzw", "userId": 1, "stream": "Badger" })

View File

@ -1,7 +1,18 @@
const sql = require('./mysql') const sql = require('./mysql')
function getStreamNames() { function getStreamNames() {
let data = sql.query(`SELECT idstreams, streamName FROM BBLB_DNS.streams`) let data = sql.query(`SELECT id, streamName FROM BBLB_DNS.streams`)
// console.log(data)
if (data.length == 0) {
return 'StreamsFailed'
} else {
return data
}
}
function getURLandStreams() {
let data = sql.query(`SELECT DISTINCT stream, streamURL FROM BBLB_DNS.userAccounts`)
// console.log(data) // console.log(data)
if (data.length == 0) { if (data.length == 0) {
return 'StreamsFailed' return 'StreamsFailed'
@ -11,6 +22,7 @@ function getStreamNames() {
} }
module.exports = { module.exports = {
getStreamNames getStreamNames,
getURLandStreams
} }

View File

@ -1,26 +1,102 @@
const sql = require('./mysql') const sql = require('./mysql')
function getUserAccounts(user) { function getUserAccounts(user) {
let data = sql.query(`SELECT let data = sql.query(`SELECT
userAccounts.username, userAccounts.username,
streams.streamName, userAccounts.stream,
streams.streamURL, userAccounts.streamURL,
userAccounts.expiaryDate userAccounts.expiaryDate,
FROM users userAccounts.password
INNER JOIN userAccounts FROM users
ON users.idusers = userAccounts.userID INNER JOIN userAccounts
INNER JOIN streams ON users.id = userAccounts.userID
ON userAccounts.stream = streams.streamName WHERE users.id = '${user}'`)
WHERE users.idusers = '${user}'`) // console.log(data)
// console.log(data) if (data.length == 0) {
if (data.length == 0) { return 'User Not Found'
return 'User Not Found' } else {
} else { return data
return data }
}
} }
function getUserAccountsCheck(user) {
let data = sql.query(`SELECT
userAccounts.username,
userAccounts.stream,
userAccounts.streamURL,
userAccounts.expiaryDate,
userAccounts.password
FROM users
INNER JOIN userAccounts
ON users.id = userAccounts.userID
WHERE users.id = '${user}'`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
return data
}
}
function getAllUserAccounts() {
let data = sql.query(`SELECT
userAccounts.username,
userAccounts.password,
userAccounts.expiaryDate,
userAccounts.stream
FROM userAccounts
WHERE userAccounts.expiaryDate != '0'
ORDER BY userAccounts.id DESC
`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
return data
}
}
function getAllUniqueAccounts() {
let data = sql.query(`SELECT DISTINCT(userAccounts.stream), userAccounts.username, userAccounts.password, userAccounts.stream FROM userAccounts
WHERE userAccounts.expiaryDate != '0'
GROUP BY userAccounts.stream;`)
if (data.length == 0) {
return 'User Not Found'
} else {
return data
}
}
function getUserUniqueAccounts(userid) {
let data = sql.query(`SELECT DISTINCT(userAccounts.streamURL), userAccounts.username, userAccounts.password, userAccounts.stream , userAccounts.streamURL FROM userAccounts
WHERE userAccounts.expiaryDate != '0' AND
userAccounts.userId = ${userid}
GROUP BY userAccounts.stream
ORDER BY userAccounts.stream ASC;`)
if (data.length == 0) {
return 'User Not Found'
} else {
return data
}
}
function getUserId(user) {
let data = sql.query(`SELECT id FROM users WHERE userName = '${user}'`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
return data[0].id
}
}
module.exports = { module.exports = {
getUserAccounts getUserAccounts,
getAllUserAccounts,
getUserId,
getUserAccountsCheck,
getUserUniqueAccounts,
getAllUniqueAccounts
} }

View File

@ -2,6 +2,7 @@ const sql = require('./mysql')
function getUsers() { function getUsers() {
let data = sql.query(`SELECT let data = sql.query(`SELECT
userName, userName,
password password
FROM users FROM users
@ -21,7 +22,7 @@ function getUserName(userId) {
let data = sql.query(`SELECT let data = sql.query(`SELECT
userName userName
FROM users FROM users
WHERE idusers = ${userId} WHERE id = ${userId}
`) `)
// console.log(data) // console.log(data)
if (data.length == 0) { if (data.length == 0) {

View File

@ -2,20 +2,24 @@ const got = require('got')
const gotRequest = async (url) => { const gotRequest = async (url) => {
let returnResponse = {}; let returnResponse = {};
let options = {} let options = {
await got(url, options) timeout: 2000
.then((response) => { }
returnResponse = response; return new Promise(async (resolve, reject) => {
}) await got(url, options)
.catch((error) => { .then((response) => {
returnResponse = typeof error.response !== 'undefined' ? error.response : error; returnResponse = response;
})
.catch((error) => {
returnResponse = typeof error.response !== 'undefined' ? error.response : error;
if (typeof returnResponse.body === 'string' && returnResponse.body.substring(0, 1) === '{') { if (typeof returnResponse.body === 'string' && returnResponse.body.substring(0, 1) === '{') {
returnResponse.body = JSON.parse(returnResponse.body); returnResponse.body = JSON.parse(returnResponse.body);
} }
}); });
return returnResponse; resolve(returnResponse);
})
}; };
module.exports = { module.exports = {

View File

@ -1,62 +0,0 @@
[
{
"username": "Karl2903",
"password": "kcshkzex"
},
{
"username": "Karl2404",
"password": "pkrcbobqau"
},
{
"username": "Karl2804",
"password": "ckazebawsk"
},
{
"username": "Karl2904",
"password": "peyofdjtau"
},
{
"username": "Karl150520",
"password": "snqqfndtpn"
},
{
"username": "Karl1505",
"password": "upfjwtouwc"
},
{
"username": "Karl2802",
"password": "hgChnj8Fks"
},
{
"username": "Karl0704",
"password": "CJXENz4vxy"
},
{
"username": "Karl24",
"password": "3vpfS48hHF"
},
{
"username": "Karl2206",
"password": "913TpVzp3F"
},
{
"username": "Darren1706",
"password": "IqEoN5RjN5"
},
{
"username": "Dazg3012",
"password": "tXrD5tUvZB"
},
{
"username": "Martin1607",
"password": "7Fw698gY7b"
},
{
"username": "Martin2204",
"password": "jpruheknsf"
},
{
"username": "Darren1607",
"password": "x5WJtSygdA"
}
]

View File

@ -1,11 +1,11 @@
var mysql = require('sync-mysql'); var mysql = require('sync-mysql');
var connection = new mysql({ var connection = new mysql({
host: 'localhost', host: process.env.DBHOST,
port: 3306, port: process.env.DBPORT,
user: 'root', user: process.env.DBUSER,
password: 'example', password: process.env.DBPASS,
database: 'BBLB_DNS', database: process.env.DATABASE,
insecureAuth: true insecureAuth: true
}) })

View File

@ -1,4 +0,0 @@
[
"https://trippy.pro:443",
"https://itty.in:443"
]

14
lib/otherURLs.json Normal file
View File

@ -0,0 +1,14 @@
{
"using": [
],
"notUsing": [
"https://blackpud475.xyz",
"https://trippy.pro:443",
"https://itty.in:443",
"http://sting.ltd:25461",
"http://37723998.to:2052",
"https://tictacs.win"
]
}

13
lib/password.js Normal file
View File

@ -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
}

17
lib/setExpired.js Normal file
View File

@ -0,0 +1,17 @@
const sql = require('./mysql')
function setExpired(userAccount) {
console.log(userAccount.username + ' ' + userAccount.stream + ' Expired on ' + userAccount.expiaryDate.toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }))
let result
try {
result = sql.query(`UPDATE userAccounts SET expiaryDate = "0" WHERE username = "${userAccount.username}" AND password = "${userAccount.password}"; `);
} catch (error) {
console.log(error)
}
return result
}
module.exports = {
setExpired
}

View File

@ -1 +0,0 @@
[{"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://oven-cleaner.com: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://theonlinemedia.network:2052"},{"StreamName":"??","StreamURL":"http://toastthehost.live:8080"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"Gold","StreamURL":"http://ip365.cx:80"},{"StreamName":"??","StreamURL":"http://stream.streamhubtv.xyz:8080"},{"StreamName":"??","StreamURL":"http://foxmedia.bounceme.net:8282"},{"StreamName":"Foden","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"Shark","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"Keano","StreamURL":"http://pimptv.dnsabr.com:8080"},{"StreamName":"??","StreamURL":"http://tavaratv.xyz:2095"},{"StreamName":"Python","StreamURL":"http://cms-tan.media:8880"},{"StreamName":"??","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://faithhosting.xyz:25461"},{"StreamName":"??"},{"StreamName":"??"},{"StreamName":"Gambler"},{"StreamName":"??"},{"StreamName":"??"},{"StreamName":"??"}]

30
lib/updateStreams.js Normal file
View File

@ -0,0 +1,30 @@
const sql = require('./mysql')
async function updateStreamData(userAccount, streamURL, expiaryDate) {
// let result
try {
let result = sql.query(`UPDATE userAccounts SET streamURL = "${streamURL}", expiaryDate = ${expiaryDate} WHERE username = "${userAccount.username}" AND password = "${userAccount.password}"; `);
return result
} catch (error) {
console.log(error)
}
}
async function updateOtherURLs(streamName, newUrl) {
// let result
try {
let result = sql.query(`update userAccounts
set userAccounts.streamURL = '${newUrl}'
WHERE userAccounts.stream ='${streamName}'`);
return result
} catch (error) {
console.log(error)
}
}
module.exports = {
updateStreamData,
updateOtherURLs
}

1861
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,23 +6,23 @@
"start": "node ./bin/www" "start": "node ./bin/www"
}, },
"dependencies": { "dependencies": {
"@material-ui/core": "^4.11.3", "apache-api": "^1.2.5",
"@material-ui/icons": "^4.11.2", "axios": "^0.21.4",
"axios": "^0.21.1", "axios-cookiejar-support": "^2.0.0",
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
"cookie-parser": "^1.4.5",
"cryptr": "^6.0.2", "cryptr": "^6.0.2",
"debug": "~2.6.9", "deepdash": "^5.3.9",
"dotenv": "^10.0.0",
"express": "~4.16.1", "express": "~4.16.1",
"express-basic-auth": "^1.2.0", "express-basic-auth": "^1.2.0",
"fs": "0.0.1-security",
"got": "^11.8.1", "got": "^11.8.1",
"http-errors": "~1.6.3", "http-errors": "~1.6.3",
"jade": "~1.11.0", "lodash": "^4.17.21",
"material-table": "^1.69.2", "obj-traverse": "^1.0.0",
"morgan": "~1.9.1", "request": "^2.88.2",
"mysql": "^2.18.1", "sync-mysql": "^3.0.1",
"react-router-dom": "^5.2.0", "tor-axios": "^1.0.9",
"sync-mysql": "^3.0.1" "tough-cookie": "^4.0.0",
"yourls": "git+https://github.com/karl0ss/node-yourls.git"
} }
} }

View File

@ -1,8 +0,0 @@
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}

View File

@ -1,21 +1,28 @@
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
const { storeAccountToDB } = require('../lib/addAccounts') const { getUserId } = require('../lib/getUser')
const { getUserName } = require('../lib/getUsers') const { singleAccountCheck } = require('../lib/checker')
/* POST postUser page. */ /* POST postUser page. */
router.post('/', async function (req, res, next) { router.post('/', async function (req, res, next) {
let postData = req.body let postData = req.body
postData.userId = Number(req.signedCookies.user) for (var key in postData) {
let userName = await getUserName(req.signedCookies.user) postData[key] = postData[key].trim();
let result = await storeAccountToDB(postData)
console.log(result)
if (result.affectedRows < 1) {
res.send('Adding account failed')
} else {
res.send('Account ' + postData.username + ' Added successfully to ' + userName)
} }
if (postData.username.includes('KarlOss')) {
postData.username = postData.username.replace("O", "0")
}
postData.userId = getUserId(req.auth.user)
a = await singleAccountCheck(postData)
if (a) {
res.send('Account ' + postData.username + ' Added successfully to ' + req.auth.user)
} else {
res.sendStatus(500);
}
// }
}); });
module.exports = router; module.exports = router;

22
routes/deleteAccount.js Normal file
View File

@ -0,0 +1,22 @@
var express = require('express');
var router = express.Router();
const { removeAccountFromDB } = require('../lib/Accounts')
const { getUserId } = require('../lib/getUser')
/* POST postUser page. */
router.post('/', async function (req, res, next) {
let postData = req.body
postData.userId = getUserId(req.auth.user)
let userName = req.auth.user
let result = await removeAccountFromDB(postData)
console.log(result)
if (result.affectedRows < 1) {
res.sendStatus(500)
} else {
res.send('Account ' + postData.username + ' Deleted from ' + userName)
}
});
module.exports = router;

View File

@ -5,7 +5,7 @@ const { getStreamNames } = require('../lib/getStreamNames')
/* POST postUser page. */ /* POST postUser page. */
router.get('/', async function (req, res, next) { router.get('/', async function (req, res, next) {
if (req.signedCookies.user === undefined) { if (req.cookies.user === undefined) {
res.send('Cookie Not Set') res.send('Cookie Not Set')
} else { } else {
let data = await getStreamNames() let data = await getStreamNames()

View File

@ -3,49 +3,40 @@ var router = express.Router();
const fs = require('fs'); const fs = require('fs');
let DNSArray = require('../lib/DNSArray.json') let DNSArray = require('../lib/DNSArray.json')
let streamArrays = require('../lib/streamArray.json') const otherURLs = require('../lib/otherURLs.json')
const otherDNS = require('../lib/otherDNS.json')
const { gotRequest } = require('../lib/gotRequest') 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);
});
}
function splitToArray(DNS) { function splitToArray(DNS) {
DNS = DNS.split(',') DNS = DNS.split(',')
return DNS return DNS
} }
function mapToStream(DNSList) { async function getStreamsNew() {
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)
}
writeFile(streamArrays)
console.log('---Updated URLS---')
return streamArrays
}
async function main() {
let requestData let requestData
let jointArray = [] let jointArray = []
for (let index = 0; index < DNSArray.length; index++) { for (let index = 0; index < DNSArray.length; index++) {
const url = DNSArray[index]; const url = DNSArray[index];
requestData = await gotRequest(url) requestData = await gotRequest(url)
let DNSList = JSON.parse(requestData.body) let DNSList = requestData.body
DNSList = splitToArray(DNSList.su) if (typeof DNSList === 'string' || DNSList instanceof String) {
DNSList.forEach(url => { try {
jointArray.push(url) DNSList = JSON.parse(DNSList)
}); } catch (error) {
jointArray.unshift(...otherURLs.using)
jointArray = [...new Set(jointArray)]
return jointArray
}
}
DNSList = splitToArray(DNSList.su)
DNSList.forEach(url => {
jointArray.push(url)
});
} }
await mapToStream(jointArray) jointArray.unshift(...otherURLs.using)
return streamArrays jointArray = [...new Set(jointArray)]
return jointArray
} }
/* GET users listing. */ /* GET users listing. */
router.get('/', async function (req, res, next) { router.get('/', async function (req, res, next) {
@ -53,4 +44,6 @@ router.get('/', async function (req, res, next) {
res.send(fullStreamArray) res.send(fullStreamArray)
}); });
module.exports = router; module.exports = {
router, getStreamsNew
}

View File

@ -1,16 +1,39 @@
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
const { getUserAccounts } = require('../lib/getUser') const { getUserAccounts, getUserId } = require('../lib/getUser')
const { getStreamsNew } = require('../routes/getStreams')
const { decryptPassword } = require('../lib/password')
/* POST postUser page. */ /* POST postUser page. */
router.get('/', async function (req, res, next) { router.get('/', async function (req, res, next) {
if (req.signedCookies.user === undefined) { let userId = await getUserId(req.auth.user)
res.send('Cookie Not Set') let data = await getUserAccounts(userId)
} else { for (let index = 0; index < data.length; index++) {
let data = await getUserAccounts(req.signedCookies.user) let element = data[index];
element.password = await decryptPassword(element.password)
}
res.send(data) res.send(data)
});
router.get('/count', async function (req, res, next) {
try {
let data = await getUserAccounts(await getUserId(req.auth.user))
res.json({ "streamCount": data.length })
} catch (error) {
res.sendStatus(500)
} }
}); });
router.get('/streams', async function (req, res, next) {
try {
let data = await getStreamsNew()
res.json(data)
} catch (error) {
res.sendStatus(500)
}
});
module.exports = router; module.exports = router;

View File

@ -4,8 +4,12 @@ var router = express.Router();
/* GET home page. */ /* GET home page. */
router.get('/', function (req, res, next) { router.get('/', function (req, res, next) {
const options = { const options = {
httpOnly: true, domain: 'vps.k-world.me.uk',
signed: true, httpOnly: false,
sameSite: false,
signed: false,
path: '/'
// overwrite: true
} }
try { try {
if (req.auth.user === 'Karl') { if (req.auth.user === 'Karl') {

View File

@ -3,10 +3,12 @@ var router = express.Router();
/* POST postUser page. */ /* POST postUser page. */
router.get('/', async function (req, res, next) { router.get('/', async function (req, res, next) {
if (req.signedCookies.user === undefined) {
console.log('cookie value=! ' + req.cookies.user)
if (req.cookies.user === undefined) {
res.send('No Cookie Set'); res.send('No Cookie Set');
} else { } else {
res.send(req.signedCookies); res.send(req.cookies);
} }
}); });

View File

@ -1,14 +1,21 @@
var express = require('express'); var express = require('express');
var router = express.Router(); var router = express.Router();
const { singleCheck } = require('../lib/checker') const { getUserId } = require('../lib/getUser')
const { userCheck } = require('../lib/checker')
/* POST postUser page. */ /* POST postUser page. */
router.post('/', async function (req, res, next) { router.get('/', async function (req, res, next) {
let postedUsername = req.body.username let postData = req.body
postData.userId = getUserId(req.auth.user)
let data = await singleCheck(postedUsername) // postData.userId = 5
let response = await userCheck(postData)
res.send(data); console.log(Date.now())
if (response.update) {
res.json({ "updatedAccounts": response.count })
} else {
res.sendStatus(500);
}
}); });
module.exports = router; module.exports = router;

View File

@ -1,138 +0,0 @@
[
{
"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://oven-cleaner.com: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://sulu.xyz:2086"
},
{
"StreamName": "??",
"StreamURL": "http://bigbox.me.uk:2086"
},
{
"StreamName": "??",
"StreamURL": "http://beautifilm.xyz:8080"
},
{
"StreamName": "??",
"StreamURL": "https://hulks.xyz:443"
},
{
"StreamName": "??",
"StreamURL": "http://mytv.digital:8080/"
},
{
"StreamName": "??",
"StreamURL": "http://theonlinemedia.network:2052"
},
{
"StreamName": "Gold",
"StreamURL": "http://server1.jforbes.club:8090"
},
{
"StreamName": "??",
"StreamURL": "http://ths.viewdns.net:8080"
},
{
"StreamName": "??",
"StreamURL": "http://toastthehost.live:8080"
},
{
"StreamName": "Foden",
"StreamURL": "http://ac.mustardsubs.tk:8880"
},
{
"StreamName": "Shark",
"StreamURL": "http://faithhosting.xyz:25461"
},
{
"StreamName": "Keano",
"StreamURL": "http://ip365.cx:80"
},
{
"StreamName": "??",
"StreamURL": "http://stream.streamhubtv.xyz:8080"
},
{
"StreamName": "Python",
"StreamURL": "http://foxmedia.bounceme.net:8282"
},
{
"StreamName": "??",
"StreamURL": "http://g132.caporeds.online:8080/"
},
{
"StreamName": "??",
"StreamURL": "http://theonlinemedia.network:2052"
},
{
"StreamName": "??",
"StreamURL": "http://beautifilm.xyz:8080"
},
{
"StreamName": "??",
"StreamURL": "http://pimptv.dnsabr.com:8080"
},
{
"StreamName": "??",
"StreamURL": "http://tavaratv.xyz:2095"
},
{
"StreamName": "??",
"StreamURL": "http://cms-tan.media:8880"
},
{
"StreamName": "??",
"StreamURL": "http://streamknighttv.xyz:8080"
},
{
"StreamName": "??",
"StreamURL": "http://covidsucks.xyz:8080"
},
{
"StreamName": "Gambler",
"StreamURL": "http://fckbrexit.link:8080"
},
{
"StreamName": "??",
"StreamURL": "http://tv.realot.xyz:35001"
},
{
"StreamName": "??",
"StreamURL": "http://www.tvxclnt.com:8080"
},
{
"StreamName": "??",
"StreamURL": "http://iptv.satplex.co.uk:8080"
}
]

21
test.js Normal file
View 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()

View File

@ -1,6 +0,0 @@
extends layout
block content
h1= message
h2= error.status
pre #{error.stack}

View File

@ -1,5 +0,0 @@
extends layout
block content
h1= title
p Welcome to #{title}

View File

@ -1,7 +0,0 @@
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content