Search between two strings?
I have an XML file with tons of content like:
Code:
<Group id="V-29437">
<title>Complex passwords must be created Alpha check</title>
<description><GroupDescription></GroupDescription></description>
<Rule id="SV-38603r1_rule" severity="medium" weight="10.0">
<version>OSX00036 M6</version>
<title>Complex passwords must contain Alphabetic Character.</title>
<description><VulnDiscussion>Configure the local system to verify newly created passwords conform to DoD password complexity policy. Passwords must contain 1 character from the following 4 classes: English uppercase letters, English lowercase letters, Westernized Arabic numerals, and non-alphanumeric characters. Sites are responsible for installing password complexity software complying with the current DoD requirements.</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SecurityOverrideGuidance></SecurityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility>System Administrator</Responsibility><IAControls>IAIA-1</IAControls></description>
<fixtext fixref="F-33021r1_fix">Open a terminal session and run the following command.
sudo pwpolicy -n -setglobalpolicy "requiresAlpha=1"
For non managed systems the path /Local/Default would need to be added to the command, an example would be: sudo pwpolicy -n /Local/Default -setglobalpolicy "requiresAlpha=1"</fixtext>
<fix id="F-33021r1_fix"/>
<check system="C-37774r1_chk">
<check-content-ref name="M" href="VMS_XCCDF_Benchmark_MACOSX_10.6.xml"/>
<check-content>Open a terminal session and run the following command.
pwpolicy -n -getglobalpolicy | tr " " "\n" | grep requiresAlpha
If the value of requiresAlpha is not set to 1, this is a finding.
NOTE: If the command returns a response of: password server is not configured, the system is not managed. Add the path /Local/Default to the above command, an example would be: pwpolicy -n /Local/Default -getglobalpolicy | tr " " "\n" | grep requiresAlpha</check-content>
</check>
</Rule>
</Group>
<Group id="V-29439">
<title>Complex passwords must be created symbol check</title>
<description><GroupDescription></GroupDescription></description>
<Rule id="SV-38607r1_rule" severity="medium" weight="10.0">
<version>OSX00038 M6</version>
<title>Complex passwords must contain a Symbolic Character.</title>
<description><VulnDiscussion>Configure the local system to verify newly created passwords conform to the DoD password complexity policy. Passwords must contain 1 character from the following 4 classes: English uppercase letters, English lowercase letters, Westernized Arabic numerals, and non-alphanumeric characters. Sites are responsible for installing password complexity software that complies with current DoD requirements.</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SecurityOverrideGuidance></SecurityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility>System Administrator</Responsibility><IAControls>IAIA-1</IAControls></description>
<fixtext fixref="F-33023r1_fix">Open a terminal session and run the following command.
sudo pwpolicy -n -setglobalpolicy "requiresSymbol=1"
For non managed systems the path /Local/Default would need to be added to the command, an example would be: sudo pwpolicy -n /Local/Default -setglobalpolicy "requiresSymbol=1"</fixtext>
<fix id="F-33023r1_fix"/>
<check system="C-37776r1_chk">
<check-content-ref name="M" href="VMS_XCCDF_Benchmark_MACOSX_10.6.xml"/>
<check-content>Open a terminal session and run the following command.
pwpolicy -n -getglobalpolicy | tr " " "\n" | grep requiresSymbol
If the value of requireSymbol is not set to 1, this is a finding.
NOTE: If the command returns a response of password server is not configured, the system is not managed. Add the path /Local/Default to the above commands, an example would be: pwpolicy -n /Local/Default -getglobalpolicy | tr " " "\n" | grep requiresSymbol </check-content>
</check>
</Rule>
</Group>
I'd like to iterate through it, taking "<Group id=" through "</Group> and performing operations on each chunk in turn. I'm just coming up with a blank...