readlines and break apart based on letters

rtilley rtilley at vt.edu
Mon Feb 13 15:23:38 EST 2006


Hi,

While trying to better understand security descriptors on Windows. I've 
been examining text-based security descriptors. I have the security 
descriptors on individual lines stored in a text file. I want to break 
these lines apart based on owner, group, dacl and sacl. These areas are 
demarcated by O: G: D: and S:

There are no spaces in the lines. How can I read each line so that each 
area is broken out? I'd like output like this:

O: details
G: details or NONE
D: details or NONE
S: details or NONE

Here is an example SD:
O:owner_sidG:group_sidD:dacl_flags(string_ace1)(string_ace2)...(string_acen)S:sacl_flags(string_ace1)(string_ace2)...(string_acen)

I want to read this and break it apart like this:
O:owner_sid
G:group_sid
D:dacl_flags(string_ace1)(string_ace2)...(string_acen)
S:sacl_flags(string_ace1)(string_ace2)...(string_acen)

Any tips?
Brad




More information about the Python-list mailing list