Skip to content

Commit 14ddf66

Browse files
authored
Fixed regex
ChangeLog 1.2 [x] Fixed regex
1 parent 23fd8a6 commit 14ddf66

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

rr_parseomater.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
Twitter: @DavidPany
1616
1717
Current Version
18-
1.1
18+
1.2
1919
2020
ChangeLog
21-
1.1
22-
[x] Minor bug where user account name was very long in file header
23-
[x] MasterTimeline extension changed to .xls (it's a TSV file)
21+
1.2
22+
[x] Fixed regex
2423
2524
Description
2625
rr_parseomater.py wraps around RegRipper's (https://github.com/keydet89/RegRipper2.8)
@@ -105,17 +104,17 @@ def RunTimelinePy(FilePath,file,ReportDir,username=None):
105104

106105
def GetRegUsername(filename):
107106
#Extract username from partial file path in beginning of reg files if available
108-
usernameMO = re.compile("([^a-z0-9\ \.]*)(\\\\NTUSER)", re.IGNORECASE)
107+
usernameMO = re.compile("([\!\@\#\$\%\^\&\(\)\-\_\=\+\[\]\{\}\'\~\;\.\,a-z0-9]{1,30})(\\\\NTUSER)", re.IGNORECASE)
109108

110109
handle = open(filename)
111110
string = handle.read(300).replace("\x00","")
111+
handle.close()
112112

113-
usernameMatch = re.search(usernameMO, string)
114113
try:
115-
return usernameMatch.groups()[0]
116-
except AttributeError:
117-
return None
118-
handle.close()
114+
username_match = re.search(usernameMO, string)
115+
return username_match.groups()[0]
116+
except:
117+
return None
119118

120119
def CleanFile(filename):
121120
#Remove "no finding" plugin results from the ouput text files

0 commit comments

Comments
 (0)