Trying to use the python re package to look for filenames with a certain pattern. Got a wee test script which just has all values hardcoded in but this isn't the normal use:
#!/usr/bin/env python
try:
import re2 as re
except ImportError:
import re
filepath1 = "C:\Users\Administrator\AppData\Local\Temp\77ce4ba2a605e22b8699eef874d075fb585d259ed6cade2e503e6dbf58020aa0.exe:Zone.Identifier"
filepath2 = "C:\Users\Administrator\AppData\Local\Temp\svchost.exe:Zone.Identifier"
re_pattern = re.compile("C\:\\\\Users\\\\[^\\\\]*\\\\AppData\\\\Local\\\\Temp\\\\[^.]*\.exe\:Zone\.Identifier")
print "1: " + str(re_pattern.search(filepath1))
print "2: " + str(re_pattern.search(filepath2))
For some reason this returns None for 1 and a match for 2, but as far as I can work out they should both be matching. Probably just a stupid mistake but if someone can spot it that would be awesome.
Basically the pattern should match any .exe with a Zone ID in the %TEMP% directory, regardless of username