Merge branch 'react2' of Karl/BBLBTV_DNS into master

This commit is contained in:
Karl 2021-02-27 05:00:55 -06:00 committed by Gogs
commit 49b2fb30f8
68 changed files with 30523 additions and 268 deletions

19
.dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM node:12-alpine
LABEL version="1.0"
LABEL description="DNS BACKEND"
# LABEL maintainer = ["danielmurph8@gmail.com", "dylanedwards290@gmail.com"]
WORKDIR /app
COPY ["package.json", "package-lock.json", "./"]
RUN ls
RUN npm i
RUN apk --no-cache add curl
COPY . .
EXPOSE 3001
CMD ["node", "bin/www"]

19
.vscode/launch.json vendored
View File

@ -4,6 +4,14 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "React",
"type": "chrome",
"request": "launch",
"url": "http://localhost:6969",
// "webRoot": "${workspaceRoot}/react-backend/client/src"
"port": 9223
},
{
"type": "node",
"request": "launch",
@ -11,7 +19,7 @@
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/app.js"
"program": "${workspaceFolder}/bin/www"
},
{
"type": "node",
@ -21,6 +29,15 @@
"<node_internals>/**"
],
"program": "${workspaceFolder}/checker.js"
},
{
"type": "node",
"request": "launch",
"name": "password",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/lib/addAccounts.js"
}
]
}

55
SQL/streams.sql Normal file
View File

@ -0,0 +1,55 @@
-- 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');

25
SQL/userAccounts.sql Normal file
View File

@ -0,0 +1,25 @@
-- 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);

13
SQL/users.sql Normal file
View File

@ -0,0 +1,13 @@
-- 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');

116
app.js
View File

@ -1,73 +1,65 @@
fs = require('fs');
var tableify = require('tableify');
const express = require('express')
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const { getUsers } = require('./lib/getUsers')
var indexRouter = require('./routes/index');
var streamsRouter = require('./routes/getStreams');
var getUserAccounts = require('./routes/getUserAccounts')
var singleUserCheck = require('./routes/singleCheck')
var addAccount = require('./routes/addAccount')
var readCookie = require('./routes/readCookie')
var getStreamNames = require('./routes/getStreamNames')
var login = require('./routes/login')
var app = express();
const basicAuth = require('express-basic-auth')
const app = express()
const port = 6969
let DNSArray = require('./DNSArray.json')
let streamArrays = require('./streamArray.json')
const otherDNS = require('./otherDNS.json')
const { gotRequest } = require('./gotRequest')
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
function writeFile(streamArrays) {
fs.writeFileSync('streamArray.json', JSON.stringify(streamArrays), function (err) {
if (err) return console.log(err);
});
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()
const users = {
users: usersList,
challenge: true,
realm: 'foo',
}
function splitToArray(DNS) {
DNS = DNS.split(',')
return DNS
}
app.use('/', indexRouter);
app.use('/login', basicAuth(users), login)
app.use('/getStreams', streamsRouter);
app.use('/getUserAccounts', getUserAccounts);
app.use('/singleCheck', basicAuth(users), singleUserCheck)
app.use('/addAccount', addAccount)
app.use('/readCookie', readCookie)
app.use('/getStreamNames', getStreamNames)
function mapToStream(DNSList) {
console.log('---Updated URLS---')
DNSList.unshift(...otherDNS)
for (let index = 0; index < streamArrays.length; index++) {
let element = streamArrays[index];
element.StreamURL = DNSList[index]
console.log(element.StreamName + ' ' + element.StreamURL)
}
writeFile(streamArrays)
console.log('---Updated URLS---')
return streamArrays
}
async function main() {
let requestData
let jointArray = []
for (let index = 0; index < DNSArray.length; index++) {
const url = DNSArray[index];
requestData = await gotRequest(url)
let DNSList = JSON.parse(requestData.body)
DNSList = splitToArray(DNSList.su)
DNSList.forEach(url => {
jointArray.push(url)
});
}
await mapToStream(jointArray)
return streamArrays
}
// catch 404 and forward to error handler
app.use(function (req, res, next) {
next(createError(404));
});
function arrayToTable(array) {
return tableify(array)
}
// error handler
app.use(function (err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
app.use(basicAuth({
users: { 'BBLBTV': 'BBLBTV' },
challenge: true,
realm: 'foo',
}))
app.get('/', async (req, res) => {
let fullStreamArray = await main()
let fullStreamHTML = await arrayToTable(fullStreamArray)
res.send(fullStreamHTML)
})
app.listen(port, () => {
console.log(`DNS Logger listening at http://localhost:${port}`)
})
// render the error page
res.status(err.status || 500);
res.render('error');
});
module.exports = app;

90
bin/www Normal file
View File

@ -0,0 +1,90 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('react-backend:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3001');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

View File

@ -1,36 +0,0 @@
let streamArrays = require('./streamArray.json')
let users = require('./logins.json')
const { gotRequest } = require('./gotRequest')
const delay = ms => new Promise(res => setTimeout(res, ms));
async function main() {
for (let index = 0; index < users.length; index++) {
const user = users[index];
console.log('Trying ' + user.username)
for (let index = 0; index < streamArrays.length; index++) {
await delay(500);
const stream = streamArrays[index];
process.stdout.write('.')
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
let t = await gotRequest(url)
let body = t.body
if (t.statusCode == 200 && body !== "") {
body = JSON.parse(body)
if (body.user_info.auth) {
var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB')
process.stdout.write('\n')
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + date)
break
}
}
}
process.stdout.write('\nEnd Of Streams\n\n')
}
console.log('Finished')
}
main()

20
client/.dockerfile Normal file
View File

@ -0,0 +1,20 @@
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 Normal file
View File

@ -0,0 +1,23 @@
# 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*

70
client/README.md Normal file
View File

@ -0,0 +1,70 @@
# 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 Normal file

File diff suppressed because it is too large Load Diff

40
client/package.json Normal file
View File

@ -0,0 +1,40 @@
{
"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"
]
}
}

BIN
client/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

22
client/public/index.html Normal file
View File

@ -0,0 +1,22 @@
<!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>

BIN
client/public/logo192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
client/public/logo512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -0,0 +1,25 @@
{
"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"
}

3
client/public/robots.txt Normal file
View File

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

53
client/src/App.css Normal file
View File

@ -0,0 +1,53 @@
/* 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%;
}

21
client/src/App.js Normal file
View File

@ -0,0 +1,21 @@
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;

8
client/src/App.test.js Normal file
View File

@ -0,0 +1,8 @@
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();
});

16
client/src/checkAuth.js Normal file
View File

@ -0,0 +1,16 @@
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

@ -0,0 +1,15 @@
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

@ -0,0 +1,126 @@
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

@ -0,0 +1,17 @@
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

@ -0,0 +1,53 @@
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

@ -0,0 +1,60 @@
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

@ -0,0 +1,56 @@
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

@ -0,0 +1,70 @@
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

@ -0,0 +1,91 @@
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

@ -0,0 +1,7 @@
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"

13
client/src/index.css Normal file
View File

@ -0,0 +1,13 @@
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;
}

17
client/src/index.js Normal file
View File

@ -0,0 +1,17 @@
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();

81
client/src/old.js Normal file
View File

@ -0,0 +1,81 @@
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

@ -0,0 +1,13 @@
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;

5
client/src/setupTests.js Normal file
View File

@ -0,0 +1,5 @@
// 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';

11392
client/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

15
docker-compose-db.yml Normal file
View File

@ -0,0 +1,15 @@
version: "3"
services:
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
ports:
- 3306:3306
adminer:
image: adminer
restart: always
ports:
- 8080:8080

31
docker-compose.yml Normal file
View File

@ -0,0 +1,31 @@
version: "3"
services:
backend:
build:
context: .
dockerfile: .dockerfile
image: "karl0ss/bblbtv_dns-backend"
ports:
- "3001:3001"
frontend:
build:
context: ./client
dockerfile: .dockerfile
image: "karl0ss/bblbtv_dns-frontend"
ports:
- "6969:6969"
environment:
- PORT=6969
links:
- "backend:be"
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
adminer:
image: adminer
restart: always
ports:
- 8080:8080

View File

@ -1,18 +0,0 @@
FROM node:12-alpine
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
CMD [ "node", "app.js" ]

47
lib/addAccounts.js Normal file
View File

@ -0,0 +1,47 @@
const Cryptr = require('cryptr');
const cryptr = new Cryptr('BBLBTV-DNS-PASSWORDS');
const sql = require('./mysql')
function storeAccountToDB(accountDetails) {
const encryptedPassword = cryptr.encrypt(accountDetails.password);
const result = sql.query(`INSERT userAccounts (username, password, stream, userID) VALUES ("${accountDetails.username}", "${encryptedPassword}", "${accountDetails.stream}", ${accountDetails.userId})`);
return result
}
function retrievePasswordFromDB(user, userAccUser) {
let userId
try {
userId = sql.query(`SELECT u.idusers FROM users u WHERE u.userName = '${user}'`);
userId = userId[0].idusers
} catch (error) {
console.log('User not found')
return (error)
}
let accountPassword
accountPassword = sql.query(`SELECT DISTINCT
userAccounts.username,
userAccounts.password,
userAccounts.userID
FROM users,
userAccounts,
streams
WHERE userAccounts.userID = ${userId} AND userAccounts.username = '${userAccUser}'`)
if (accountPassword == 0) {
throw new Error('Account ' + userAccUser + ' not found for user ' + user)
} else {
const decryptedString = cryptr.decrypt(accountPassword[0].password);
console.log(decryptedString)
}
}
retrievePasswordFromDB('Karl', 'Karl2903')
module.exports = {
storeAccountToDB,
retrievePasswordFromDB
}

65
lib/checker.js Normal file
View File

@ -0,0 +1,65 @@
let streamArrays = require('./streamArray.json')
let users = require('./logins.json')
const { gotRequest } = require('./gotRequest')
const delay = ms => new Promise(res => setTimeout(res, ms));
async function singleCheck(username) {
let user = users.find(user => user.username === username)
for (let index = 0; index < streamArrays.length; index++) {
await delay(500);
const stream = streamArrays[index];
process.stdout.write('.')
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
let 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 user = users[index];
console.log('Trying ' + user.username)
for (let index = 0; index < streamArrays.length; index++) {
await delay(500);
const stream = streamArrays[index];
process.stdout.write('.')
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
let t = await gotRequest(url)
let body = t.body
if (t.statusCode == 200 && body !== "") {
body = JSON.parse(body)
if (body.user_info.auth) {
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB')
process.stdout.write('\n')
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + body.user_info.exp_date)
break
}
}
}
process.stdout.write('\nEnd Of Streams\n\n')
}
console.log('Finished')
}
// main()
module.exports = {
singleCheck,
main
}

16
lib/getStreamNames.js Normal file
View File

@ -0,0 +1,16 @@
const sql = require('./mysql')
function getStreamNames() {
let data = sql.query(`SELECT idstreams, streamName FROM BBLB_DNS.streams`)
// console.log(data)
if (data.length == 0) {
return 'StreamsFailed'
} else {
return data
}
}
module.exports = {
getStreamNames
}

26
lib/getUser.js Normal file
View File

@ -0,0 +1,26 @@
const sql = require('./mysql')
function getUserAccounts(user) {
let data = sql.query(`SELECT
userAccounts.username,
streams.streamName,
streams.streamURL,
userAccounts.expiaryDate
FROM users
INNER JOIN userAccounts
ON users.idusers = userAccounts.userID
INNER JOIN streams
ON userAccounts.stream = streams.streamName
WHERE users.idusers = '${user}'`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
return data
}
}
module.exports = {
getUserAccounts
}

37
lib/getUsers.js Normal file
View File

@ -0,0 +1,37 @@
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 idusers = ${userId}
`)
// console.log(data)
if (data.length == 0) {
return 'User Not Found'
} else {
return data[0].userName
}
}
module.exports = {
getUsers, getUserName
}

62
lib/logins.json Normal file
View File

@ -0,0 +1,62 @@
[
{
"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"
}
]

12
lib/mysql.js Normal file
View File

@ -0,0 +1,12 @@
var mysql = require('sync-mysql');
var connection = new mysql({
host: 'localhost',
port: 3306,
user: 'root',
password: 'example',
database: 'BBLB_DNS',
insecureAuth: true
})
module.exports = connection;

18
lib/passwordEncrypt.js Normal file
View File

@ -0,0 +1,18 @@
const bcrypt = require('bcrypt');
const saltRounds = 10;
const myPlaintextPassword = 's0/\/\P4$$w0rD';
const someOtherPlaintextPassword = 'not_bacon';
function hashPassword() {
const hash = bcrypt.hashSync(myPlaintextPassword, saltRounds);
return hash
}
async function checkPassword(h) {
let t = bcrypt.compareSync(myPlaintextPassword, h); // true
let b = bcrypt.compareSync(someOtherPlaintextPassword, h); // false
console.log(t, b)
}
let a = hashPassword()
checkPassword(a)

1
lib/streamArray.json Normal file
View File

@ -0,0 +1 @@
[{"StreamName":"Insanity","StreamURL":"https://trippy.pro:443"},{"StreamName":"PremPlus","StreamURL":"https://itty.in:443"},{"StreamName":"GunSlinger","StreamURL":"http://gunslingertv.org:8080"},{"StreamName":"VIP","StreamURL":"http://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":"??"}]

View File

@ -1,30 +0,0 @@
[
{
"username": "Karl2903",
"password": "kcshkzex"
},
{
"username": "Karl2802",
"password": "hgChnj8Fks"
},
{
"username": "Karl0704",
"password": "CJXENz4vxy"
},
{
"username": "Karl24",
"password": "3vpfS48hHF"
},
{
"username": "Karl2206",
"password": "913TpVzp3F"
},
{
"username": "Darren1706",
"password": "IqEoN5RjN5"
},
{
"username": "Dazg3012",
"password": "tXrD5tUvZB"
}
]

1839
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,28 @@
{
"name": "bblbtv_dns",
"version": "1.0.0",
"description": "",
"main": "index.js",
"name": "react-backend",
"version": "0.0.0",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node ./bin/www"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"axios": "^0.21.1",
"bcrypt": "^5.0.0",
"cookie-parser": "^1.4.5",
"cryptr": "^6.0.2",
"debug": "~2.6.9",
"express": "~4.16.1",
"express-basic-auth": "^1.2.0",
"fs": "0.0.1-security",
"got": "^11.8.1",
"http": "0.0.1-security",
"tableify": "^1.1.0"
"http-errors": "~1.6.3",
"jade": "~1.11.0",
"material-table": "^1.69.2",
"morgan": "~1.9.1",
"mysql": "^2.18.1",
"react-router-dom": "^5.2.0",
"sync-mysql": "^3.0.1"
}
}

View File

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

21
routes/addAccount.js Normal file
View File

@ -0,0 +1,21 @@
var express = require('express');
var router = express.Router();
const { storeAccountToDB } = require('../lib/addAccounts')
const { getUserName } = require('../lib/getUsers')
/* POST postUser page. */
router.post('/', async function (req, res, next) {
let postData = req.body
postData.userId = Number(req.signedCookies.user)
let userName = await getUserName(req.signedCookies.user)
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)
}
});
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.signedCookies.user === undefined) {
res.send('Cookie Not Set')
} else {
let data = await getStreamNames()
res.send(data)
}
});
module.exports = router;

56
routes/getStreams.js Normal file
View File

@ -0,0 +1,56 @@
var express = require('express');
var router = express.Router();
const fs = require('fs');
let DNSArray = require('../lib/DNSArray.json')
let streamArrays = require('../lib/streamArray.json')
const otherDNS = require('../lib/otherDNS.json')
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) {
DNS = DNS.split(',')
return DNS
}
function mapToStream(DNSList) {
console.log('---Updated URLS---')
DNSList.unshift(...otherDNS)
for (let index = 0; index < streamArrays.length; index++) {
let element = streamArrays[index];
element.StreamURL = DNSList[index]
console.log(element.StreamName + ' ' + element.StreamURL)
}
writeFile(streamArrays)
console.log('---Updated URLS---')
return streamArrays
}
async function main() {
let requestData
let jointArray = []
for (let index = 0; index < DNSArray.length; index++) {
const url = DNSArray[index];
requestData = await gotRequest(url)
let DNSList = JSON.parse(requestData.body)
DNSList = splitToArray(DNSList.su)
DNSList.forEach(url => {
jointArray.push(url)
});
}
await mapToStream(jointArray)
return streamArrays
}
/* GET users listing. */
router.get('/', async function (req, res, next) {
let fullStreamArray = await main()
res.send(fullStreamArray)
});
module.exports = router;

16
routes/getUserAccounts.js Normal file
View File

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

9
routes/index.js Normal file
View File

@ -0,0 +1,9 @@
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;

26
routes/login.js Normal file
View File

@ -0,0 +1,26 @@
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function (req, res, next) {
const options = {
httpOnly: true,
signed: 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;

17
routes/readCookie.js Normal file
View File

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

14
routes/singleCheck.js Normal file
View File

@ -0,0 +1,14 @@
var express = require('express');
var router = express.Router();
const { singleCheck } = require('../lib/checker')
/* POST postUser page. */
router.post('/', async function (req, res, next) {
let postedUsername = req.body.username
let data = await singleCheck(postedUsername)
res.send(data);
});
module.exports = router;

6
views/error.jade Normal file
View File

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

5
views/index.jade Normal file
View File

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

7
views/layout.jade Normal file
View File

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