diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/WebGoat.java b/webgoat-container/src/main/java/org/owasp/webgoat/WebGoat.java index 009f36180..4f5c0dd1b 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/WebGoat.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/WebGoat.java @@ -1,38 +1,39 @@ /** - ************************************************************************************************* - * - * + * ************************************************************************************************ + *
+ *
* This file is part of WebGoat, an Open Web Application Security Project utility. For details, * please see http://www.owasp.org/ - * + *
* Copyright (c) 2002 - 20014 Bruce Mayhew - * + *
* This program is free software; you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + *
* You should have received a copy of the GNU General Public License along with this program; if * not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. - * + *
* Getting Source ============== - * + *
* Source for this application is maintained at https://github.com/WebGoat/WebGoat, a repository for free software
* projects.
*
* @author WebGoat
- * @since October 28, 2003
* @version $Id: $Id
+ * @since October 28, 2003
*/
package org.owasp.webgoat;
import org.owasp.webgoat.plugins.PluginClassLoader;
import org.owasp.webgoat.plugins.PluginsLoader;
import org.owasp.webgoat.session.Course;
+import org.owasp.webgoat.session.UserTracker;
import org.owasp.webgoat.session.WebSession;
import org.owasp.webgoat.session.WebgoatContext;
import org.owasp.webgoat.session.WebgoatProperties;
@@ -94,11 +95,18 @@ public class WebGoat extends SpringBootServletInitializer {
}
@Bean
- public Course course(PluginsLoader pluginsLoader, WebgoatContext webgoatContext, ServletContext context, WebgoatProperties webgoatProperties, LessonEndpointProvider endpointProvider) {
+ public Course course(PluginsLoader pluginsLoader, WebgoatContext webgoatContext, ServletContext context, WebgoatProperties webgoatProperties,
+ LessonEndpointProvider endpointProvider) {
Course course = new Course(webgoatProperties);
course.loadCourses(webgoatContext, context, "/");
course.loadLessonFromPlugin(pluginsLoader.loadPlugins());
endpointProvider.registerEndpoints();
return course;
}
+
+ @Bean
+ public UserTracker userTracker() {
+ UserTracker userTracker = UserTracker.instance();
+ return userTracker;
+ }
}
diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/controller/StartLesson.java b/webgoat-container/src/main/java/org/owasp/webgoat/controller/StartLesson.java
index 491e781c8..ff14a025d 100644
--- a/webgoat-container/src/main/java/org/owasp/webgoat/controller/StartLesson.java
+++ b/webgoat-container/src/main/java/org/owasp/webgoat/controller/StartLesson.java
@@ -33,8 +33,6 @@ package org.owasp.webgoat.controller;
import org.owasp.webgoat.lessons.AbstractLesson;
import org.owasp.webgoat.lessons.RandomLessonAdapter;
import org.owasp.webgoat.plugins.YmlBasedLesson;
-import org.owasp.webgoat.session.LessonTracker;
-import org.owasp.webgoat.session.UserTracker;
import org.owasp.webgoat.session.WebSession;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
@@ -88,37 +86,9 @@ public class StartLesson {
Optional
+ * Copyright (c) 2002 - 20014 Bruce Mayhew
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if
+ * not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Getting Source ==============
+ *
+ * Source for this application is maintained at https://github.com/WebGoat/WebGoat, a repository for free software
+ * projects.
+ *
+ *
+ * @author WebGoat
+ * @version $Id: $Id
+ * @since August 13, 2016
+ */
+public class AttackResult {
+
+ private boolean lessonCompleted;
+ private String feedback;
+ private String output;
+
+ public static AttackResult success() {
+ AttackResult attackResult = new AttackResult();
+ attackResult.lessonCompleted = true;
+ attackResult.feedback = "Congratulations";
+ return attackResult;
+ }
+
+ public boolean isLessonCompleted() {
+ return lessonCompleted;
+ }
+
+ public String getFeedback() {
+ return feedback;
+ }
+
+ public String getOutput() {
+ return output;
+ }
+}
diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/plugins/YmlBasedLesson.java b/webgoat-container/src/main/java/org/owasp/webgoat/plugins/YmlBasedLesson.java
index f1d53228d..6d712a2ab 100644
--- a/webgoat-container/src/main/java/org/owasp/webgoat/plugins/YmlBasedLesson.java
+++ b/webgoat-container/src/main/java/org/owasp/webgoat/plugins/YmlBasedLesson.java
@@ -50,7 +50,7 @@ public class YmlBasedLesson extends LessonAdapter {
this.hints = hints;
this.title = title;
this.id = id;
- createAttack(attack);
+ // createAttack(attack);
}
diff --git a/webgoat-container/src/main/resources/application.properties b/webgoat-container/src/main/resources/application.properties
index bbe09b1dd..ea1a8fd24 100644
--- a/webgoat-container/src/main/resources/application.properties
+++ b/webgoat-container/src/main/resources/application.properties
@@ -6,6 +6,7 @@ server.port=8080
logging.level.org.springframework=WARN
spring.thymeleaf.cache=false
+spring.thymeleaf.content-type=text/html
security.enable-csrf=false
diff --git a/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js b/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js
index 7fef6a602..97214eddd 100644
--- a/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js
+++ b/webgoat-container/src/main/resources/static/js/goatApp/view/LessonContentView.js
@@ -40,28 +40,10 @@ define(['jquery',
// The current LessonAdapter#getLink() generates a hash-mark link. It will not match the mask below.
// Besides, the new MVC code registers an event handler that will reload the lesson according to the route.
$('form').submit(function(event){
- var url = this.baseURI;
- url = url.replace('start.mvc#lesson', '');
- url = url + '.attack';
- $.get(url)
+ $.get(this.action, "json")
.done(self.reLoadView.bind(self))
.fail(function() { alert("failed to GET " + url); });
});
- //
- //
- // $.each($('a[href^="*.attack"]'),function(i,el) { //FIXME: need to figure out what to do here ...
- // var url = $(el).attr('href');
- // $(el).unbind('click').attr('href','#').attr('link',url);
- // //TODO pull currentMenuId
- // $(el).click(function(event) {
- // event.preventDefault();
- // var _url = $(el).attr('link');
- // console.log("About to GET " + _url);
- // $.get(_url)
- // .done(self.reLoadView.bind(self))
- // .fail(function() { alert("failed to GET " + _url); });
- // });
- // });
},
onAttackExecution: function(feedback) {