Compare commits

...

48 Commits

Author SHA1 Message Date
1e6391db2f Merge branch 'removeUI' of Karl/BBLBTV_DNS into master 2021-11-19 09:46:35 -06:00
e8a5a1b17e working latest bits 2021-11-19 15:45:10 +00:00
bbe88b1d94 dotenv 2021-11-19 14:44:08 +00:00
185b357010 new working 2021-11-19 14:25:42 +00:00
e97e8d4462 working but slow new way 2021-11-19 13:12:48 +00:00
7e4bb69b48 working 2021-11-19 11:52:28 +00:00
cded4b8c55 working with restart 2021-11-17 10:11:54 +00:00
cf88b5f3e5 latest update 2021-11-16 17:37:04 +00:00
a315c3e6b7 working apache logic 2021-11-16 17:36:39 +00:00
bc63d15636 updates 2021-09-24 11:34:49 +00:00
334ccf268e latest 2021-09-23 17:25:44 +00:00
d2b90240da working 2021-09-23 15:40:15 +00:00
b024cacfe8 working with tor 2021-09-23 15:26:24 +00:00
bd5e0fd4f8 working 2021-09-23 13:54:01 +00:00
d4a025fadd update 2021-09-21 15:59:29 +00:00
340fccdf46 update 2021-09-21 13:37:32 +00:00
1863addb17 working 2021-09-21 13:26:03 +00:00
6e235425f9 latest 2021-09-20 19:30:47 +00:00
51e9d71d72 as it stands "working" 2021-09-20 16:30:41 +00:00
ee6696dbf8 trytocleanRemoveUI 2021-09-20 16:19:16 +00:00
53d150b64e working at the moment 2021-09-20 16:03:43 +00:00
6eb118ca87 speed increase 2021-09-20 10:57:49 +00:00
813a8296e2 udpated 2021-09-19 10:29:56 +00:00
649b4e9e19 updates with password 2021-09-15 15:33:40 +00:00
10a9f9da52 working with app 2021-09-14 13:05:07 +00:00
karl.hudgell
f7826664a9 updates 2021-03-27 15:22:32 +00:00
karl.hudgell
b7d4aae21c udpates 2021-03-26 12:42:13 +00:00
karl.hudgell
3a9cbc76eb Merge branch 'react2' of http://kithub.ga/Karl/BBLBTV_DNS into react2 2021-03-18 10:51:37 +00:00
karl.hudgell
cda23389dc new urls 2021-03-18 10:51:11 +00:00
4cbd6dafde latest 2021-03-18 10:50:15 +00:00
74aecb9101 updates 2021-03-12 18:44:42 +00:00
karl.hudgell
d05d37e4f9 latest 2021-03-12 13:56:26 +00:00
karl.hudgell
c8e3fb4f6f updates 2021-03-06 09:35:05 +00:00
karl.hudgell
4dc25d1c54 working updates 2021-03-06 09:24:10 +00:00
49b2fb30f8 Merge branch 'react2' of Karl/BBLBTV_DNS into master 2021-02-27 05:00:55 -06:00
karl.hudgell
507d822522 Merge branch 'master' into react2 2021-02-27 11:00:37 +00:00
karl.hudgell
7e4aaf925c working 2021-02-27 10:56:38 +00:00
karl.hudgell
f33f424920 current place 2021-02-26 20:50:08 +00:00
karl.hudgell
0ec19dedd2 working updates 2021-02-26 17:22:11 +00:00
karl.hudgell
0ad12aad0a updates 2021-02-22 11:15:14 +00:00
karl.hudgell
4fb8db3d53 working cookie authentication 2021-02-21 14:50:25 +00:00
karl.hudgell
f32a949f25 working stream table 2021-02-21 11:22:57 +00:00
karl.hudgell
c4700137f4 commiting some changes 2021-02-21 10:04:25 +00:00
karl.hudgell
3af8ded3d6 update stream array 2021-02-19 11:46:01 +00:00
2fe7017ef5 new streams mapped 2021-02-19 11:45:07 +00:00
karl.hudgell
e5dc2d2082 cleanup 2021-02-18 09:05:37 +00:00
karl.hudgell
486c68accc working react router 2021-02-17 20:06:36 +00:00
f3c893a99c add mustardsubs 2021-02-06 18:47:31 +00:00
69 changed files with 1687 additions and 28655 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

50
.vscode/launch.json vendored
View File

@ -5,11 +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>/**"
],
"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",
@ -18,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",
@ -27,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,21 +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 17/02/2021 10:52:02
-- 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');

View File

@ -1,7 +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 17/02/2021 10:52:03
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
-- Client version: 4.1
SET NAMES 'utf8';

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 17/02/2021 10:52:01
-- 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 17/02/2021 10:52:04
-- 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

37
app.js
View File

@ -1,38 +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')
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 deleteAccount = require('./routes/deleteAccount')
var login = require('./routes/login')
var app = express(); var app = express();
// const basicAuth = require('express-basic-auth')
// view engine setup let usersList = getUsers()
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(logger('dev')); const users = {
users: usersList,
challenge: true
}
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({ extended: false })); app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter); app.use('/', indexRouter);
app.use('/getStreams', streamsRouter); app.use('/login', basicAuth(users), login)
app.use('/getUserAccounts', getUserAccounts); app.use('/getUserAccounts', basicAuth(users), getUserAccounts);
app.use('/singleCheck', singleUserCheck) app.use('/singleCheck', basicAuth(users), singleUserCheck)
app.use('/addAccount', addAccount) app.use('/addAccount', basicAuth(users), addAccount)
// app.use(basicAuth({ app.use('/deleteAccount', basicAuth(users), deleteAccount)
// users: { 'BBLBTV': 'BBLBTV' },
// challenge: true,
// realm: 'foo',
// }))
// 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)

15641
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +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-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,43 +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="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</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,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,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,60 +0,0 @@
import React, { Component } from 'react';
import axios from 'axios';
class UserForm extends Component {
constructor() {
super();
this.state = {
fname: '',
lname: '',
email: '',
};
}
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, email } = this.state;
axios.post('/', { fname, lname, email })
.then((result) => {
//access the results here....
});
}
render() {
const { fname, lname, email } = this.state;
return (
<form onSubmit={this.onSubmit}>
<input
type="text"
name="fname"
value={fname}
onChange={this.onChange}
/>
<input
type="text"
name="lname"
value={lname}
onChange={this.onChange}
/>
<input
type="text"
name="email"
value={email}
onChange={this.onChange}
/>
<button type="submit">Submit</button>
</form>
);
}
}

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,99 +0,0 @@
import React, { useState, useEffect } from 'react';
import ReactDOM from "react-dom";
import axios from 'axios';
function View (props) {
const { screen, setScreen } = props;
const [data, setData] = useState();
const deleteCookie = async () => {
try {
await axios.get('/clear-cookie');
setScreen('auth');
} catch (e) {
console.log(e);
}
};
const getData = async () => {
try {
const res = await axios.get('/get-data');
console.log(res.data)
setData(res.data);
} catch (e) {
console.log(e);
}
}
return (
<div>
<p>{screen}</p>
<p>{data}</p>
<button onClick={getData}>Get Data</button>
<button onClick={deleteCookie}>Logout</button>
</div>
);
}
function App() {
const [screen, setScreen] = useState('auth');
const [username, setUsername] = useState();
const [password, setPassword] = useState();
const auth = async () => {
try {
const res = await axios.get('/authenticate', { auth: { username, password } });
if (res.data.screen !== undefined) {
setScreen(res.data.screen);
}
} catch (e) {
console.log(e);
}
};
const readCookie = async () => {
try {
const res = await axios.get('/read-cookie');
if (res.data.screen !== undefined) {
setScreen(res.data.screen);
}
} catch (e) {
setScreen('auth');
console.log(e);
}
};
useEffect(() => {
readCookie();
}, []);
return (
<div className="App">
{screen === 'auth'
? <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>
</div>
: <View screen={screen} setScreen={setScreen} />
}
</div>
);
}
export default App;
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

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" })

28
lib/getStreamNames.js Normal file
View File

@ -0,0 +1,28 @@
const sql = require('./mysql')
function getStreamNames() {
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)
if (data.length == 0) {
return 'StreamsFailed'
} else {
return data
}
}
module.exports = {
getStreamNames,
getURLandStreams
}

View File

@ -1,25 +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,
FROM users userAccounts.expiaryDate,
INNER JOIN userAccounts userAccounts.password
ON users.idusers = userAccounts.userID FROM users
INNER JOIN streams INNER JOIN userAccounts
ON userAccounts.stream = streams.streamName ON users.id = userAccounts.userID
WHERE users.username = '${user}'`) WHERE users.id = '${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
} }

38
lib/getUsers.js Normal file
View File

@ -0,0 +1,38 @@
const sql = require('./mysql')
function getUsers() {
let data = sql.query(`SELECT
userName,
password
FROM users
`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
var object = data.reduce(
(obj, item) => Object.assign(obj, { [item.userName]: item.password }), {});
return object
}
}
function getUserName(userId) {
let data = sql.query(`SELECT
userName
FROM users
WHERE id = ${userId}
`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
return data[0].userName
}
}
module.exports = {
getUsers, getUserName
}

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,58 +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"
}
]

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","username":"Dazg3012","expiaryDate":"12/30/2021"},{"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://vpsuk.store:8080"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"??","StreamURL":"http://faithhosting.xyz:25461"},{"StreamName":"??","StreamURL":"http://ip365.cx:80"},{"StreamName":"??","StreamURL":"https://trippy.pro:443"},{"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"}]

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
}

1325
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,20 +6,23 @@
"start": "node ./bin/www" "start": "node ./bin/www"
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.1", "apache-api": "^1.2.5",
"axios": "^0.21.4",
"axios-cookiejar-support": "^2.0.0",
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
"cookie-parser": "~1.4.4",
"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",
"morgan": "~1.9.1", "obj-traverse": "^1.0.0",
"mysql": "^2.18.1", "request": "^2.88.2",
"react-router-dom": "^5.2.0", "sync-mysql": "^3.0.1",
"sync-mysql": "^3.0.1" "tor-axios": "^1.0.9",
"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,19 +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 { 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
let result = await storeAccountToDB(postData) for (var key in postData) {
console.log(result) postData[key] = postData[key].trim();
if (result.affectedRows < 1) {
res.send('Adding account failed')
} else {
res.send('Account ' + postData.username + ' Added successfully')
} }
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;

16
routes/getStreamNames.js Normal file
View File

@ -0,0 +1,16 @@
var express = require('express');
var router = express.Router();
const { getStreamNames } = require('../lib/getStreamNames')
/* POST postUser page. */
router.get('/', async function (req, res, next) {
if (req.cookies.user === undefined) {
res.send('Cookie Not Set')
} else {
let data = await getStreamNames()
res.send(data)
}
});
module.exports = router;

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,13 +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) {
let data = await getUserAccounts(req.body.username) let userId = await getUserId(req.auth.user)
res.send(data) let data = await getUserAccounts(userId)
for (let index = 0; index < data.length; index++) {
let element = data[index];
element.password = await decryptPassword(element.password)
}
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;

30
routes/login.js Normal file
View File

@ -0,0 +1,30 @@
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function (req, res, next) {
const options = {
domain: 'vps.k-world.me.uk',
httpOnly: false,
sameSite: false,
signed: false,
path: '/'
// overwrite: true
}
try {
if (req.auth.user === 'Karl') {
res.cookie('user', 1, options)
}
else if (req.auth.user === 'Darren') {
res.cookie('user', 2, options)
}
else if (req.auth.user === 'Duly') {
res.cookie('user', 3, options)
}
} catch (error) {
res.send({ auth: 'Fail' });
}
res.send({ auth: 'Success' });
});
module.exports = router;

19
routes/readCookie.js Normal file
View File

@ -0,0 +1,19 @@
var express = require('express');
var router = express.Router();
/* POST postUser page. */
router.get('/', async function (req, res, next) {
console.log('cookie value=! ' + req.cookies.user)
if (req.cookies.user === undefined) {
res.send('No Cookie Set');
} else {
res.send(req.cookies);
}
});
router.get('/clear', (req, res) => {
res.clearCookie('user').end();
});
module.exports = router;

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;

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