I was getting an empty string and a ".svn" file in the "Help File" drop-down box. Modified parseResults() to ensure that the file is not an empty string and the file ends with ".help"
git-svn-id: http://webgoat.googlecode.com/svn/trunk@65 4033779f-a91e-0410-96ef-6bf7bf53c507
This commit is contained in:
parent
a90d292239
commit
f6d5fbfc50
@ -4,6 +4,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.ecs.Element;
|
||||
import org.apache.ecs.ElementContainer;
|
||||
@ -216,8 +217,21 @@ public class CommandInjection extends LessonAdapter
|
||||
|
||||
private String parseResults(String results)
|
||||
{
|
||||
return results.replaceAll("(?s).*Output...\\s", "").replaceAll(
|
||||
"(?s)Returncode.*", "");
|
||||
results.replaceAll("(?s).*Output...\\s", "").replaceAll("(?s)Returncode.*", "");
|
||||
StringTokenizer st = new StringTokenizer(results, "\n");
|
||||
StringBuffer modified = new StringBuffer();
|
||||
|
||||
while(st.hasMoreTokens())
|
||||
{
|
||||
String s = (String)st.nextToken().trim();
|
||||
|
||||
if(s.length() > 0 && s.endsWith(".help"))
|
||||
{
|
||||
modified.append(s + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
return modified.toString();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user