You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Log_Forging.java 815 B

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package Log_Forging;
  2. import java.util.logging.Logger;
  3. import javax.servlet.http.HttpServletRequest;
  4. public class Log_Forging {
  5. static final Logger log = Logger.getLogger("logger");
  6. public void bad(HttpServletRequest request) {
  7. String val = request.getParameter("val");
  8. try {
  9. int value = Integer.parseInt(val);
  10. if(value != 0){
  11. log.info("parse ok");
  12. }
  13. }
  14. catch (NumberFormatException e) {
  15. log.info("Failed to parse val = " + val); // bad 日志伪造
  16. }
  17. }
  18. public void good(HttpServletRequest request) {
  19. String val = "1";
  20. try {
  21. int value = Integer.parseInt(val);
  22. if(value != 0){
  23. log.info("parse ok");
  24. }
  25. }
  26. catch (NumberFormatException e) {
  27. log.info("Failed to parse val = " + val); // good 日志伪造
  28. }
  29. }
  30. }

No Description

Contributors (1)