Provide a user-accessible mechanism for skipping stages

Initially, this is only available when in debug mode
i.e. add &debug=true to the URL or set the flag in web.xml


git-svn-id: http://webgoat.googlecode.com/svn/trunk@146 4033779f-a91e-0410-96ef-6bf7bf53c507
This commit is contained in:
rogan.dawes 2007-07-10 11:54:12 +00:00
parent 51cc4fb0b4
commit 3c2e63636c
2 changed files with 20 additions and 1 deletions

View File

@ -905,7 +905,12 @@ public class WebSession
eatCookies();
hintNum = -1;
}
else if (myParser.getRawParameter( STAGE, null ) != null)
{
int stage = myParser.getIntParameter(STAGE, getCurrentLesson().getStage(this));
if (stage > 0 && stage <= getCurrentLesson().getStageCount())
getCurrentLesson().setStage(this, stage);
}
// else update global variables for the current screen
else
{

View File

@ -196,6 +196,20 @@ StringBuffer buildList = new StringBuffer();
<br/>
<a href="javascript:toggle('lessonPlans')" target="_top" onclick="MM_nbGroup('down','group1','plans','',1)">Close this Window</a>
</div>
<%
if (webSession.isDebug()&& webSession.getCurrentLesson().getStageCount() > 1) {
%><form method="post" action="attack?menu=<%=webSession.getCurrentMenu()%>">
<select name="<%= WebSession.STAGE %>" onchange="this.form.submit();">
<%
int stages = webSession.getCurrentLesson().getStageCount();
int stage = webSession.getCurrentLesson().getStage(webSession);
for (int i=1; i<=stages;i++) {
%><option <% if (i == stage) out.print("selected"); %> value="<%= i %>">Stage <%= i %></option>
<%
}
%></select></form><%
}
%>
<div id="lessonContent"><%=webSession.getInstructions()%></div>
<div id="message" class="info"><%=webSession.getMessage()%></div>