As I don't have a GitHub account and mentioned thread isn't the place to discuss that: especially for @SparkyZ a new thread ..I hope you'll take a look at my first Git Hub project and give me some feedback.
I did a quick-scan of half of your code (well documented, btw) and have some remarks. Not all may be accurate, but maybe it can help you anyway
Everything instance
You mentioned that it wasn't possible to "talk to" an Everything instance using the SDK.
I guess there has to be a way as ES.exe - command-line tool to query the Everything database - has an -instance option to , well, talk to an Everything instance.
Regex
You convert the filepatterns from the json file to regex queries.
That is not necessary. You can also use (example) wfn:"*.id-*.[admin@fentex.net].money"
(wfn: is the whole file name macro; see Search sytax help page)
Combining patterns
I couldn't find in the code what query you are "feeding" Everything, but you can combine multiple queries.
Using the wfn: synatx:
wfn:<"*.id-*.[admin@fentex.net].money"|"*.LOCKED_PAY">
I guess that will make querying faster
Order of execution
I would use this order to optimize waiting time:\
- Start Everything
- do your pattern chacks/manipulations
- Wait for/check if Everything available
- Start querying
Running Everything
Everything will try to re-use a running Everything.exe. Even when you spoecify the -admin option, it will re-use an Everything that is running under restricted user credentials ( IIRC for some tests I did a while ago).
False positives
The pattern list generates quite a few (80+) false positives on my system. Mostly Miscrosoft-signed files and a lot of *.info files.
I haven't actually tested your code, but wrot a quick-and-dirty script to demonstrate the stuff I mentioned earlier:
(that makes it probably more clear than my textual explanation)
FSRM.ps1
Code: Select all
#__________________________________________________________
#
# SETTINGS
#__________________________________________________________
#
# How many patterns at once?
# Max length is (probably) 8191 so with 200: average pattern length 40 allowed
$bulk = 200
# Where can the pattern list be downloaded
$download = 'https://fsrm.experiant.ca/api/v1/combined'
#__________________________________________________________
#
# Action!
#__________________________________________________________
#
$jsonfile = (Invoke-WebRequest $download).Content
$jsonobject = ConvertFrom-Json $jsonfile
$patterns = $jsonobject.filters
# debug
$patterns | out-file ".\patterns.txt"
$start = 0
$end = $bulk -1
While ($start -le $patterns.Count)
{
$query = ""
# lazy mode: leave the lonely "|" at the beginning as wfn: will nullify that.
$patterns[$start..$end] | % {$query = "$query|`"$_`""}
$query = "wfn:<$query>"
# ES.exe is assumed to be in the %PATH%; otherwise: specify full path
ES.exe $query
$start = $start + $bulk
$end = $end + $bulk
}