Skip to content

Instantly share code, notes, and snippets.

@lostkagamine
Last active February 17, 2018 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lostkagamine/b0d69e635871848857d222eaed9bf3f6 to your computer and use it in GitHub Desktop.
Save lostkagamine/b0d69e635871848857d222eaed9bf3f6 to your computer and use it in GitHub Desktop.
A quick hackmud access log scraper I put together
function(context, args)
{
var alogrg = /(?:Connection from|Breach attempt from|(?:sys\..*) execution from) (.*\..*)/; // alicegex
var logwriterrg = /sys.write_log execution from (?:.*\..*)/;
var alogs = #ls.sys.access_log();
var locs = [];
var logw = false;
for (var i=alogs.length-1; i >= 0; i--) {
if (logw) {
logw = false;
continue;
}
var m = alogs[i];
if (!alogrg.test(m.msg)) {
continue;
}
var foundloc = m.msg.match(alogrg)[1];
if (logwriterrg.test(m.msg)) {
logw = true;
if (locs.indexOf(foundloc) == -1) {
locs.push(foundloc);
continue;
}
}
if (locs.indexOf(foundloc) == -1) {
locs.push(foundloc)
}
}
return locs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment