feat: 提交项目代码

This commit is contained in:
super_liu
2021-05-31 14:56:05 +08:00
parent d50bb875cb
commit 3ed9ca235a
234 changed files with 27792 additions and 0 deletions
@@ -0,0 +1,31 @@
package com.adc.da.xss;
import com.adc.da.exception.AdcDaBaseException;
import org.apache.commons.lang3.StringUtils;
public class SQLFilter {
public static String sqlInject(String str) {
if (StringUtils.isBlank(str)) {
return null;
} else {
String checkStr= str;
checkStr = StringUtils.replace(checkStr, "\\", "");
checkStr = checkStr.toLowerCase();
String[] keywords = new String[]{"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"};
String[] arr$ = keywords;
int len$ = keywords.length;
for(int i$ = 0; i$ < len$; ++i$) {
String keyword = arr$[i$];
if (checkStr.indexOf(keyword) != -1) {
throw new AdcDaBaseException("包含非法字符");
}
}
return str;
}
}
}