Path Manipulation安全漏洞处理方法

2023-03-07,,

 1 public static String pathManipulation(String path) {
2 HashMap<String, String> map = new HashMap<String, String>();
3 map.put("a", "a");
4 map.put("b", "b");
5 map.put("c", "c");
6 map.put("d", "d");
7 map.put("e", "e");
8 map.put("f", "f");
9 map.put("g", "g");
10 map.put("h", "h");
11 map.put("i", "i");
12 map.put("j", "j");
13 map.put("k", "k");
14 map.put("l", "l");
15 map.put("m", "m");
16 map.put("n", "n");
17 map.put("o", "o");
18 map.put("p", "p");
19 map.put("q", "q");
20 map.put("r", "r");
21 map.put("s", "s");
22 map.put("t", "t");
23 map.put("u", "u");
24 map.put("v", "v");
25 map.put("w", "w");
26 map.put("x", "x");
27 map.put("y", "y");
28 map.put("z", "z");
29
30 map.put("A", "A");
31 map.put("B", "B");
32 map.put("C", "C");
33 map.put("D", "D");
34 map.put("E", "E");
35 map.put("F", "F");
36 map.put("G", "G");
37 map.put("H", "H");
38 map.put("I", "I");
39 map.put("J", "J");
40 map.put("K", "K");
41 map.put("L", "L");
42 map.put("M", "M");
43 map.put("N", "N");
44 map.put("O", "O");
45 map.put("P", "P");
46 map.put("Q", "Q");
47 map.put("R", "R");
48 map.put("S", "S");
49 map.put("T", "T");
50 map.put("U", "U");
51 map.put("V", "V");
52 map.put("W", "W");
53 map.put("X", "X");
54 map.put("Y", "Y");
55 map.put("Z", "Z");
56
57 map.put(":", ":");
58 map.put("/", "/");
59 map.put("\\", "\\");
60 map.put(".", ".");
61 map.put("-", "-");
62 map.put("_", "_");
63
64 map.put("0", "0");
65 map.put("1", "1");
66 map.put("2", "2");
67 map.put("3", "3");
68 map.put("4", "4");
69 map.put("5", "5");
70 map.put("6", "6");
71 map.put("7", "7");
72 map.put("8", "8");
73 map.put("9", "9");
74
75 String temp = "";
76 for (int i = 0; i < path.length(); i++) {
77 if (map.get(path.charAt(i) + "") != null) {
78 temp += map.get(path.charAt(i) + "");
79 }
80 }
81 return temp;
82 }

Path Manipulation安全漏洞处理方法的相关教程结束。

《Path Manipulation安全漏洞处理方法.doc》

下载本文的Word格式文档,以方便收藏与打印。