Last active
February 17, 2018 15:29
-
-
Save lostkagamine/b0d69e635871848857d222eaed9bf3f6 to your computer and use it in GitHub Desktop.
A quick hackmud access log scraper I put together
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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