Strength bar

This commit is contained in:
PhilippeSteinbach 2018-12-04 13:53:00 +01:00 committed by Nanne Baars
parent 44a9a776bf
commit 06a8bd8b0e
2 changed files with 9 additions and 1 deletions

View File

@ -28,6 +28,7 @@ public class CrossSiteScriptingLesson3 extends AssignmentEndpoint {
public AttackResult completed(@RequestParam String editor) { public AttackResult completed(@RequestParam String editor) {
//https://github.com/OWASP/owasp-java-encoder //https://github.com/OWASP/owasp-java-encoder
//maybe better idea for assignment //maybe better idea for assignment
//<e:forHtml value="${param.title}" />
String line1 =""; String line1 ="";
String line2 =""; String line2 ="";

View File

@ -42,7 +42,14 @@ public class SecurePasswordsAssignment extends AssignmentEndpoint {
output.append("<b>Your Password: </b>" + password + "</br>"); output.append("<b>Your Password: </b>" + password + "</br>");
output.append("<b>Length: </b>" + password.length()+ "</br>"); output.append("<b>Length: </b>" + password.length()+ "</br>");
output.append("<b>Estimated guesses needed to crack your password: </b>" + df.format(strength.getGuesses())+ "</br>"); output.append("<b>Estimated guesses needed to crack your password: </b>" + df.format(strength.getGuesses())+ "</br>");
output.append("<b>Score: </b>" + strength.getScore()+ "/5 </br>"); output.append("<b>Score: </b>" + strength.getScore()+ "/5");
if(strength.getScore()<=1){
output.append("<div style=\"background-color:red;width: 200px;\">&nbsp;</div></br>");
} else if(strength.getScore()<=3){
output.append("<div style=\"background-color:orange;width: 200px;\">&nbsp;</div></br>");
} else{
output.append("<div style=\"background-color:green;width: 200px;\">&nbsp;</div></br>");
}
output.append("<b>Estimated cracking time in seconds: </b>" + calculateTime((long) strength.getCrackTimeSeconds().getOnlineNoThrottling10perSecond())); output.append("<b>Estimated cracking time in seconds: </b>" + calculateTime((long) strength.getCrackTimeSeconds().getOnlineNoThrottling10perSecond()));
if(strength.getScore() >= 4) if(strength.getScore() >= 4)