逆向流水账(4): ACGP
最近蝗虫群突然玩起日本页游,聊到这个代理服务,重点是便宜和不能翻墙。好奇用什么线路,于是有了这篇。
结论是:来自Sakura和Kagoya的数台IIJ线路服务器,深圳、上海阿里云BGP,香港阿里云。具体怎么分配路由的懒得看。
按惯例拆完APK发现dex里没有什么东西,.so大部分没什么东西,有一个libmonodroid_bundle_app.so
处理过,symbol特别少。
从里面的mkbundle
顺藤摸瓜到这篇,改了改让python3用。
from elftools.elf.elffile import ELFFile
from zipfile import ZipFile
from io import BytesIO
import gzip, string
data = open('libmonodroid_bundle_app.so', "rb").read()
f = BytesIO(data)
elffile = ELFFile(f)
section = elffile.get_section_by_name('.dynsym')
for symbol in section.iter_symbols():
if symbol['st_shndx'] != 'SHN_UNDEF' and symbol.name.startswith('assembly_data_'):
print(symbol.name)
dll_data = data[symbol['st_value']:symbol['st_value']+symbol['st_size']]
dll_data = gzip.GzipFile(fileobj=BytesIO(dll_data)).read()
outfile = open(symbol.name[14:].replace('_dll', '.dll'), 'wb')
outfile.write(dll_data)
outfile.close()
从上述.so里解出一大堆文件,
dotPeek打开JPProxy_APower.dll
,从JPProxy.Power
里翻到一个url和可疑函数:
// url必须藏起来
string str = "$wo-bu-gao-su-ni-route-url.json";
// 大括号我给删不换行了
public static string StrDecrypt(string str) {
return Encoding.UTF8.GetString((byte[]) Enumerable.ToArray<byte>((IEnumerable<M0>) Enumerable.Select<byte, byte>((IEnumerable<M0>) Convert.FromBase64String(str), (Func<M0, M1>) (b => ~b))));
}
看着吓人,其实先进的CSharp可以这么用:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Program {
static string cred = "$json-body";
public static string StrDecrypt(string str) {
var b64arr = Convert.FromBase64String(str);
var b64arrcomp = Enumerable.Select(b64arr, (b => (byte)~b));
var arr = Enumerable.ToArray(b64arrcomp);
return Encoding.UTF8.GetString((byte[])arr);
}
public static void Main() {
Console.WriteLine(StrDecrypt(cred));
}
}
就这么搞定了。