Last active
May 3, 2024 16:02
-
-
Save rsmudge/e15c2a1bd47c3be1ad7b429beec9eac4 to your computer and use it in GitHub Desktop.
Revisions
-
rsmudge revised this gist
Aug 11, 2020 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # search for and reproduce output that matches a specific regex. alias search { local('$regex $regex2 $entry $event $bid $out $when'); # take all of the args, without processing/parsing as normal. if (strlen($0) > 7) { @@ -13,11 +13,14 @@ alias search { btask($1, "Search log with\cE $regex $+ \o"); # transform our regex to make it multi-line and ismatch friendly. $regex2 = "(?ms).* $+ $regex $+ .*?"; # query our beacon log and walk *everything* foreach $entry (data_query("beaconlog")) { ($event, $bid, $out, $when) = $entry; if ($bid eq $1 && $event eq "beacon_output" && "Output at*matches*:*" !iswm $out && $out ismatch $regex2) { blog($1, "Output at\cE " . dstamp($when) . " \omatches\cB $regex $+ \cE:\o\n\n $+ $out"); } } } -
rsmudge created this gist
Aug 11, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ # search for and reproduce output that matches a specific regex. alias search { local('$regex $entry $event $bid $out'); # take all of the args, without processing/parsing as normal. if (strlen($0) > 7) { $regex = substr($0, 7); } else { berror($1, "search [regex]"); return; } btask($1, "Search log with\cE $regex $+ \o"); # query our beacon log and walk *everything* foreach $entry (data_query("beaconlog")) { ($event, $bid, $out, $when) = $entry; if ($bid eq $1 && $event eq "beacon_output" && $out hasmatch $regex) { blog($1, "Output at\cE " . dstamp($when) . " \omatches\cB $regex $+ \cE:\o\n\n $+ $out"); } } }