SO逆向入门实战教程六:s
Posted Gendan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SO逆向入门实战教程六:s相关的知识,希望对你有一定的参考价值。
package com.lession6;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
public class utils {
private static final char[] f14934c = "0123456789ABCDEF".toCharArray();
public static final String KEY_VALUE_DELIMITER = "=";
public static final String FIELD_DELIMITER = "&";
private static boolean a(char c2, String str) {
return (c2 >= \'A\' && c2 <= \'Z\') || (c2 >= \'a\' && c2 <= \'z\') || !((c2 < \'0\' || c2 > \'9\') && "-_.~".indexOf(c2) == -1 && (str == null || str.indexOf(c2) == -1));
}
static String r(Map<String, String> map) {
String str;
if (!(map instanceof SortedMap)) {
map = new TreeMap(map);
}
StringBuilder sb = new StringBuilder(256);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
if (!key.isEmpty()) {
sb.append(b(key));
sb.append(KEY_VALUE_DELIMITER);
String value = entry.getValue();
if (value == null) {
str = "";
} else {
str = b(value);
}
sb.append(str);
sb.append(FIELD_DELIMITER);
}
}
int length = sb.length();
if (length > 0) {
sb.deleteCharAt(length - 1);
}
if (length == 0) {
return null;
}
return sb.toString();
}
static String b(String str) {
return c(str, null);
}
static String c(String str, String str2) {
StringBuilder sb = null;
if (str == null) {
return null;
}
int length = str.length();
int i2 = 0;
while (i2 < length) {
int i3 = i2;
while (i3 [期货](https://www.gendan5.com/futures.html)< length && a(str.charAt(i3), str2)) {
i3++;
}
if (i3 != length) {
if (sb == null) {
sb = new StringBuilder();
}
if (i3 > i2) {
sb.append((CharSequence) str, i2, i3);
}
i2 = i3 + 1;
while (i2 < length && !a(str.charAt(i2), str2)) {
i2++;
}
byte[] bytes = str.substring(i3, i2).getBytes(StandardCharsets.UTF_8);
int length2 = bytes.length;
for (int i4 = 0; i4 < length2; i4++) {
sb.append(\'%\');
sb.append(f14934c[(bytes[i4] & 240) >> 4]);
sb.append(f14934c[bytes[i4] & 15]);
}
} else if (i2 == 0) {
return str;
} else {
sb.append((CharSequence) str, i2, length);
return sb.toString();
}
}
return sb == null ? str : sb.toString();
}
}
补其实现
@Override
public DvmObject<?> callStaticObjectMethod(BaseVM vm, DvmClass dvmClass, String signature, VarArg varArg) {
switch (signature){
case "com/bilibili/nativelibrary/SignedQuery->r(Ljava/util/Map;)Ljava/lang/String;":{
DvmObject<?> mapObject = varArg.getObjectArg(0);
TreeMap<String, String> mymap = (TreeMap<String, String>) mapObject.getValue();
String result = utils.r(mymap);
return new StringObject(vm, result);
}
}
return super.callStaticObjectMethod(vm, dvmClass, signature, varArg);
}
以上是关于SO逆向入门实战教程六:s的主要内容,如果未能解决你的问题,请参考以下文章
朴实无华 Python JS逆向实战:某8同城JS逆向,淦就完事了~~~
朴实无华 Python JS逆向实战:某8同城JS逆向,淦就完事了~~~