Path Manipulation安全漏洞处理方法
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 }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构