-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flag/config for "lastModifiedWithin" #94
Comments
last modified date is already being collected - can you not do your filtering on the log file? |
Are there efficiencies to be made in pulling file metadata, then only proceeding to pull / parse / pilfer if the file was last modified within the last |
yeah actually there would be. If you want to take a swing at implementing this, here's roughly what you'd need to do: Add a thing to handle a ClassifierRule.MatchLocation using the modified date into: Then (assuming you want to be able to pass the date as an argument) you'd need to add a thing to parse that arg, generate a discard rule using that modified date, and insert it into the ruleset at runtime. If you don't wanna try it yourself, I'll probably get to it eventually, but probably not soon. |
As a horrible hack, add / update / overwrite / merge this horror into SnaffCore TreeWalker.cs around line 38:
|
I created a hack/workaround for implementing a timeframe so that Snaffler only reports files within a specified window of time. I originally was filtering through the data manually in logs, but figured that since so much data was being sent that I didn't want, it would be more OPSEC and efficient by transmitting only the files that we care about. The sample code shown below was a modification to "SnaffleRunner.cs" in the ProcessMessage() function. The rest just requires minor tweaks to Config.cs and Options.cs. case SnafflerMessageType.FileResult:
...
if (Options.TimeFrame != null)
{
String[] dateParts = (Options.TimeFrame).split(',');
DateTime after;
DateTime before;
if (DateTime.TryParse(dataParts[0], out after) && DateTime.TryParse(dataParts[1], out before))
{
DateTime modifiedStamp = message.FileResult.FileInfo.LastWriteTime.ToUniversalTime();
if (after > modifiedStamp || modifiedStamp > before)
{
break;
}
}
else
{
Console.WriteLine("Check your date format. Exiting...");
Environment.Exit(1);
}
}
... |
It'd be nice to have a config item to only pilfer files e.g last modified in the last 4 years, which will help reduce noise of creds that have since been rolled.
It could very well already exist but don't see such an option in the README/sample config.
The text was updated successfully, but these errors were encountered: