#!/usr/bin/perl #: computersecuritystudent.com #: Very generic program to parse the results from the user-info.php script. #Load the file we previous created into an array @ARRAY = `cat lesson7.txt`; foreach my $line (@ARRAY) { #Use
as the delimter to establish a new line. #E.g., admin, adminpass and root each with
#Username=admin #Password=adminpass #Signature=root @ELEMENT = split(/<\/span>/,$line); foreach my $element (@ELEMENT) { #If exists, remove all end of line characters (e.g., \n, \r, etc) chomp($element); #Extract Text from HTML Tags $element =~ s/<[^>]*>//gs; #Remove all spacesfrom the start of the line $element =~ s/^\s+//g; #Remove all spaces from the end of the line $element =~ s/\s+$//g; print "Element: $element\n"; if($element =~ m/Signature/) { print "---------------------------\n"; } } }