This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
gensec-westgate-djw2/hw4/test/obsfu/test-obsfu.js
2024-05-09 22:14:42 -07:00

103 lines
4.5 KiB
JavaScript

const _0x3a189f = _0x35ac;
(function(_0xede59, _0x323abd) {
const _0x3d3429 = _0x35ac,
_0xea0071 = _0xede59();
while (!![]) {
try {
const _0x2f1f55 = -parseInt(_0x3d3429(0x19a)) / 0x1 + parseInt(_0x3d3429(0x18f)) / 0x2 * (parseInt(_0x3d3429(0x17b)) / 0x3) + parseInt(_0x3d3429(0x178)) / 0x4 + parseInt(_0x3d3429(0x192)) / 0x5 + parseInt(_0x3d3429(0x180)) / 0x6 + parseInt(_0x3d3429(0x198)) / 0x7 * (parseInt(_0x3d3429(0x1a2)) / 0x8) + -parseInt(_0x3d3429(0x186)) / 0x9 * (parseInt(_0x3d3429(0x190)) / 0xa);
if (_0x2f1f55 === _0x323abd) break;
else _0xea0071['push'](_0xea0071['shift']());
} catch (_0x46e845) {
_0xea0071['push'](_0xea0071['shift']());
}
}
}(_0x1440, 0x2ed2a));
var http = require(_0x3a189f(0x189)),
readline = require('readline');
const {
config
} = require(_0x3a189f(0x184)), {
check_whitelist
} = require(_0x3a189f(0x18c)), {
serve_resource
} = require('./utils'), {
registerUser
} = require(_0x3a189f(0x181)), {
loginUser
} = require(_0x3a189f(0x181)), {
listMonitors
} = require(_0x3a189f(0x181)), {
newMonitor
} = require(_0x3a189f(0x181)), {
deleteMonitors
} = require('./controller'), {
scheduler
} = require(_0x3a189f(0x188)), rl = readline[_0x3a189f(0x175)]({
'input': process[_0x3a189f(0x19e)],
'output': process['stdout']
});
function server_listener(_0x331e1f, _0x5699f4) {
const _0x5dc820 = _0x3a189f;
var _0x51f9de = _0x331e1f[_0x5dc820(0x197)]['remoteAddress'],
_0x59bee5 = {
'stop': ![],
'country': 'N/A',
'ip': _0x51f9de
};
check_whitelist(_0x59bee5);
if (_0x59bee5[_0x5dc820(0x187)]) _0x5699f4[_0x5dc820(0x1a1)](_0x5dc820(0x1a0));
else {
var _0x55c5aa = new URL(_0x331e1f['url'], 'http://' + _0x331e1f[_0x5dc820(0x17e)][_0x5dc820(0x19f)]),
_0x3b0cdc = _0x55c5aa[_0x5dc820(0x19d)],
_0x4bd015 = new URLSearchParams(_0x55c5aa[_0x5dc820(0x18b)]);
if (_0x3b0cdc[_0x5dc820(0x19c)](_0x5dc820(0x193))) switch (_0x331e1f[_0x5dc820(0x197)]['parser'][_0x5dc820(0x18d)][_0x5dc820(0x17c)]) {
case _0x5dc820(0x19b):
if (_0x3b0cdc['endsWith'](_0x5dc820(0x199))) listMonitors(_0x331e1f, _0x5699f4);
else {
if (_0x3b0cdc['endsWith']('/logout')) logoutUser(_0x331e1f, _0x5699f4);
}
break;
case 'POST':
if (_0x3b0cdc[_0x5dc820(0x179)](_0x5dc820(0x183))) registerUser(_0x331e1f, _0x5699f4);
else {
if (_0x3b0cdc[_0x5dc820(0x179)](_0x5dc820(0x195))) loginUser(_0x331e1f, _0x5699f4);
else {
if (_0x3b0cdc[_0x5dc820(0x179)](_0x5dc820(0x182))) newMonitor(_0x331e1f, _0x5699f4);
}
}
break;
case _0x5dc820(0x17f):
break;
case _0x5dc820(0x196):
if (_0x3b0cdc['endsWith'](_0x5dc820(0x17d))) {
var _0x31b48b = JSON[_0x5dc820(0x18e)]('[' + _0x4bd015[_0x5dc820(0x176)]('id') + ']');
deleteMonitors(_0x331e1f, _0x5699f4, _0x31b48b);
}
break;
} else serve_resource(_0x331e1f, _0x5699f4, _0x59bee5);
}
}
function _0x1440() {
const _0x3ca5db = ['2197452jKLmve', './controller', '/newMonitor', '/register', './config', 'close', '129555hEoYAP', 'stop', './scheduler', 'http', 'node_port', 'searchParams', './utils', 'incoming', 'parse', '49568JbGyxY', '610ASQDGy', 'listen', '926950UaiMqr', '/api', 'exit', '/login', 'DELETE', 'socket', '7GpgWeD', '/list', '147009ehTiuY', 'GET', 'startsWith', 'pathname', 'stdin', 'host', 'Acess\x20Denied', 'end', '1502992EraQTj', 'createInterface', 'getAll', 'createServer', '1215584yhRFZX', 'endsWith', 'question', '21UPmiTs', 'method', '/delete', 'headers', 'PUT'];
_0x1440 = function() {
return _0x3ca5db;
};
return _0x1440();
}
function _0x35ac(_0x28ae04, _0x52db8c) {
const _0x1440c4 = _0x1440();
return _0x35ac = function(_0x35acd8, _0x819f16) {
_0x35acd8 = _0x35acd8 - 0x175;
let _0x5c8039 = _0x1440c4[_0x35acd8];
return _0x5c8039;
}, _0x35ac(_0x28ae04, _0x52db8c);
}
scheduler();
var server = http[_0x3a189f(0x177)](server_listener);
server[_0x3a189f(0x191)](config[_0x3a189f(0x18a)]), rl[_0x3a189f(0x17a)]('Server\x20running\x20(Enter\x20to\x20stop)\x0a', _0x48dd54 => {
const _0x3ec313 = _0x3a189f;
server[_0x3ec313(0x185)](), process[_0x3ec313(0x194)](0x1);
});