Skip to content

Commit d3727d7

Browse files
zema1ReaJason
authored andcommitted
feat: remove uneeded code
1 parent 1515011 commit d3727d7

File tree

9 files changed

+0
-927
lines changed

9 files changed

+0
-927
lines changed

generator/src/main/java/com/reajason/javaweb/memshell/shelltool/suo5v2/Suo5v2ControllerHandler.java

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -988,109 +988,6 @@ private String randomString(int length) {
988988
return new String(randomChars);
989989
}
990990

991-
private int toOffset(byte[] bs) {
992-
if (bs == null || bs.length != 4) {
993-
return 0;
994-
}
995-
try {
996-
bs = base64UrlDecode(new String(bs));
997-
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
998-
} catch (Exception e) {
999-
1000-
return 0;
1001-
}
1002-
}
1003-
1004-
private String getOffset(HttpServletRequest request) {
1005-
String cookieValue = request.getHeader("Cookie");
1006-
if (cookieValue != null && cookieValue.length() > 0) {
1007-
ArrayList cookieVals = cookieValues(cookieValue);
1008-
for (int i = 0; i < cookieVals.size(); i++) {
1009-
String val = (String) cookieVals.get(i);
1010-
if (val.length() >= 12) {
1011-
if (is_valid(val.substring(val.length() - 8), 430) != null) {
1012-
return val;
1013-
}
1014-
}
1015-
}
1016-
}
1017-
1018-
Enumeration headerNames = request.getHeaderNames();
1019-
while (headerNames != null && headerNames.hasMoreElements()) {
1020-
String headerName = (String) headerNames.nextElement();
1021-
String val = request.getHeader(headerName);
1022-
if (val.length() >= 12) {
1023-
if (is_valid(val.substring(val.length() - 8), 430) != null) {
1024-
return val;
1025-
}
1026-
}
1027-
}
1028-
1029-
return null;
1030-
}
1031-
1032-
private byte[] is_valid(String data, int sum) {
1033-
try {
1034-
byte[] result = base64UrlDecode(data);
1035-
if (result.length < 6) {
1036-
return null;
1037-
} else {
1038-
int i = result.length - 2;
1039-
int j = result.length - 3;
1040-
int p = result.length - 5;
1041-
int q = result.length - 6;
1042-
boolean valid = isOdd(result[i]) && isOdd(result[j]) && !isOdd(result[p]) && !isOdd(result[q]) && toUInt(result[i]) + toUInt(result[j]) + toUInt(result[p]) + toUInt(result[q]) == sum;
1043-
return valid ? result : null;
1044-
}
1045-
} catch (Exception var8) {
1046-
return null;
1047-
}
1048-
}
1049-
1050-
private boolean isOdd(int i) {
1051-
return (i & 1) == 1;
1052-
}
1053-
1054-
private int toUInt(byte x) {
1055-
return x & 255;
1056-
}
1057-
1058-
public static String md5(byte[] content) {
1059-
MessageDigest md = null;
1060-
try {
1061-
md = MessageDigest.getInstance("MD5");
1062-
} catch (NoSuchAlgorithmException e) {
1063-
throw new RuntimeException(e);
1064-
}
1065-
byte[] md5Bytes = md.digest(content);
1066-
// no String.format in java1.4
1067-
StringBuffer sb = new StringBuffer();
1068-
for (int i = 0; i < md5Bytes.length; i++) {
1069-
byte b = md5Bytes[i];
1070-
int value = b & 0xFF;
1071-
if (value < 16) {
1072-
sb.append('0');
1073-
}
1074-
sb.append(Integer.toHexString(value));
1075-
}
1076-
return sb.toString();
1077-
}
1078-
1079-
private ArrayList cookieValues(String cookieValue) {
1080-
ArrayList values = new ArrayList();
1081-
String[] cookiePairs = cookieValue.split(";");
1082-
1083-
for (int i = 0; i < cookiePairs.length; i++) {
1084-
String pair = cookiePairs[i];
1085-
String[] keyValue = pair.split("=", 2);
1086-
if (keyValue.length >= 2) {
1087-
values.add(keyValue[1].trim());
1088-
}
1089-
}
1090-
1091-
return values;
1092-
}
1093-
1094991
public boolean verify(String hostname, SSLSession session) {
1095992
return true;
1096993
}

generator/src/main/java/com/reajason/javaweb/memshell/shelltool/suo5v2/Suo5v2Filter.java

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -993,109 +993,6 @@ private String randomString(int length) {
993993
return new String(randomChars);
994994
}
995995

996-
private int toOffset(byte[] bs) {
997-
if (bs == null || bs.length != 4) {
998-
return 0;
999-
}
1000-
try {
1001-
bs = base64UrlDecode(new String(bs));
1002-
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
1003-
} catch (Exception e) {
1004-
1005-
return 0;
1006-
}
1007-
}
1008-
1009-
private String getOffset(HttpServletRequest request) {
1010-
String cookieValue = request.getHeader("Cookie");
1011-
if (cookieValue != null && cookieValue.length() > 0) {
1012-
ArrayList cookieVals = cookieValues(cookieValue);
1013-
for (int i = 0; i < cookieVals.size(); i++) {
1014-
String val = (String) cookieVals.get(i);
1015-
if (val.length() >= 12) {
1016-
if (is_valid(val.substring(val.length() - 8), 430) != null) {
1017-
return val;
1018-
}
1019-
}
1020-
}
1021-
}
1022-
1023-
Enumeration headerNames = request.getHeaderNames();
1024-
while (headerNames != null && headerNames.hasMoreElements()) {
1025-
String headerName = (String) headerNames.nextElement();
1026-
String val = request.getHeader(headerName);
1027-
if (val.length() >= 12) {
1028-
if (is_valid(val.substring(val.length() - 8), 430) != null) {
1029-
return val;
1030-
}
1031-
}
1032-
}
1033-
1034-
return null;
1035-
}
1036-
1037-
private byte[] is_valid(String data, int sum) {
1038-
try {
1039-
byte[] result = base64UrlDecode(data);
1040-
if (result.length < 6) {
1041-
return null;
1042-
} else {
1043-
int i = result.length - 2;
1044-
int j = result.length - 3;
1045-
int p = result.length - 5;
1046-
int q = result.length - 6;
1047-
boolean valid = isOdd(result[i]) && isOdd(result[j]) && !isOdd(result[p]) && !isOdd(result[q]) && toUInt(result[i]) + toUInt(result[j]) + toUInt(result[p]) + toUInt(result[q]) == sum;
1048-
return valid ? result : null;
1049-
}
1050-
} catch (Exception var8) {
1051-
return null;
1052-
}
1053-
}
1054-
1055-
private boolean isOdd(int i) {
1056-
return (i & 1) == 1;
1057-
}
1058-
1059-
private int toUInt(byte x) {
1060-
return x & 255;
1061-
}
1062-
1063-
public static String md5(byte[] content) {
1064-
MessageDigest md = null;
1065-
try {
1066-
md = MessageDigest.getInstance("MD5");
1067-
} catch (NoSuchAlgorithmException e) {
1068-
throw new RuntimeException(e);
1069-
}
1070-
byte[] md5Bytes = md.digest(content);
1071-
// no String.format in java1.4
1072-
StringBuffer sb = new StringBuffer();
1073-
for (int i = 0; i < md5Bytes.length; i++) {
1074-
byte b = md5Bytes[i];
1075-
int value = b & 0xFF;
1076-
if (value < 16) {
1077-
sb.append('0');
1078-
}
1079-
sb.append(Integer.toHexString(value));
1080-
}
1081-
return sb.toString();
1082-
}
1083-
1084-
private ArrayList cookieValues(String cookieValue) {
1085-
ArrayList values = new ArrayList();
1086-
String[] cookiePairs = cookieValue.split(";");
1087-
1088-
for (int i = 0; i < cookiePairs.length; i++) {
1089-
String pair = cookiePairs[i];
1090-
String[] keyValue = pair.split("=", 2);
1091-
if (keyValue.length >= 2) {
1092-
values.add(keyValue[1].trim());
1093-
}
1094-
}
1095-
1096-
return values;
1097-
}
1098-
1099996
public boolean verify(String hostname, SSLSession session) {
1100997
return true;
1101998
}

generator/src/main/java/com/reajason/javaweb/memshell/shelltool/suo5v2/Suo5v2Interceptor.java

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,109 +1005,6 @@ private String randomString(int length) {
10051005
return new String(randomChars);
10061006
}
10071007

1008-
private int toOffset(byte[] bs) {
1009-
if (bs == null || bs.length != 4) {
1010-
return 0;
1011-
}
1012-
try {
1013-
bs = base64UrlDecode(new String(bs));
1014-
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
1015-
} catch (Exception e) {
1016-
1017-
return 0;
1018-
}
1019-
}
1020-
1021-
private String getOffset(HttpServletRequest request) {
1022-
String cookieValue = request.getHeader("Cookie");
1023-
if (cookieValue != null && cookieValue.length() > 0) {
1024-
ArrayList cookieVals = cookieValues(cookieValue);
1025-
for (int i = 0; i < cookieVals.size(); i++) {
1026-
String val = (String) cookieVals.get(i);
1027-
if (val.length() >= 12) {
1028-
if (is_valid(val.substring(val.length() - 8), 430) != null) {
1029-
return val;
1030-
}
1031-
}
1032-
}
1033-
}
1034-
1035-
Enumeration headerNames = request.getHeaderNames();
1036-
while (headerNames != null && headerNames.hasMoreElements()) {
1037-
String headerName = (String) headerNames.nextElement();
1038-
String val = request.getHeader(headerName);
1039-
if (val.length() >= 12) {
1040-
if (is_valid(val.substring(val.length() - 8), 430) != null) {
1041-
return val;
1042-
}
1043-
}
1044-
}
1045-
1046-
return null;
1047-
}
1048-
1049-
private byte[] is_valid(String data, int sum) {
1050-
try {
1051-
byte[] result = base64UrlDecode(data);
1052-
if (result.length < 6) {
1053-
return null;
1054-
} else {
1055-
int i = result.length - 2;
1056-
int j = result.length - 3;
1057-
int p = result.length - 5;
1058-
int q = result.length - 6;
1059-
boolean valid = isOdd(result[i]) && isOdd(result[j]) && !isOdd(result[p]) && !isOdd(result[q]) && toUInt(result[i]) + toUInt(result[j]) + toUInt(result[p]) + toUInt(result[q]) == sum;
1060-
return valid ? result : null;
1061-
}
1062-
} catch (Exception var8) {
1063-
return null;
1064-
}
1065-
}
1066-
1067-
private boolean isOdd(int i) {
1068-
return (i & 1) == 1;
1069-
}
1070-
1071-
private int toUInt(byte x) {
1072-
return x & 255;
1073-
}
1074-
1075-
public static String md5(byte[] content) {
1076-
MessageDigest md = null;
1077-
try {
1078-
md = MessageDigest.getInstance("MD5");
1079-
} catch (NoSuchAlgorithmException e) {
1080-
throw new RuntimeException(e);
1081-
}
1082-
byte[] md5Bytes = md.digest(content);
1083-
// no String.format in java1.4
1084-
StringBuffer sb = new StringBuffer();
1085-
for (int i = 0; i < md5Bytes.length; i++) {
1086-
byte b = md5Bytes[i];
1087-
int value = b & 0xFF;
1088-
if (value < 16) {
1089-
sb.append('0');
1090-
}
1091-
sb.append(Integer.toHexString(value));
1092-
}
1093-
return sb.toString();
1094-
}
1095-
1096-
private ArrayList cookieValues(String cookieValue) {
1097-
ArrayList values = new ArrayList();
1098-
String[] cookiePairs = cookieValue.split(";");
1099-
1100-
for (int i = 0; i < cookiePairs.length; i++) {
1101-
String pair = cookiePairs[i];
1102-
String[] keyValue = pair.split("=", 2);
1103-
if (keyValue.length >= 2) {
1104-
values.add(keyValue[1].trim());
1105-
}
1106-
}
1107-
1108-
return values;
1109-
}
1110-
11111008
public boolean verify(String hostname, SSLSession session) {
11121009
return true;
11131010
}

0 commit comments

Comments
 (0)