Replies: 3 comments
-
附上私钥的两种格式,方便使用 PKCS#1
PKCS#8
测试 |
Beta Was this translation helpful? Give feedback.
0 replies
-
再附网页实现<script src="https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/8.0.20/jsrsasign-all-min.js"></script>
<script>
const msg = "hello world";
const privateKey = String.raw`-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAmPJHFrper/FwjJtu+5jexwns3eCzK66EdkjGOHicHgagYVzD
9XK5kG1tYRzKhCKZFXy2VbQ/dWgdwH507dSuIxG/MObND8H1hYrSMdf5fU/2LDkT
gZJxh/4s7APYzWrM35DP60tmJIXCDbZRbo1yUQO2fjnVQTjgxS4tmHNp6rULkseK
WaYrpdSoIPbtVw9itKxs4/cs7HJ57GFuZmvVa/eyPEfvJnKgVpy2rBR+vYZhJ5Hf
2n20Taf6tGfswo1zLt3PfcsWq8HIUDdIB4v2d9GfQ/g3cLWMJ1lMY2Y0fh5au5Eo
4/WTAPc5bXxKPpKUVjDour6XghebClxcol4tbwIDAQABAoIBADf3wIfSnz+nDFaH
sm8jG7KeMS1oQmhjrllSfCbCC+744ct/FL5GwxzUzkfRL1J3DqnMPzTRhr9B4FFG
dSdqwmZW4i3U54kyotPBXvWaYNO4ZQ79u+OYYS8wleOv7LAOuvW8mjkyGCiZQc+e
veHEpOZ8g1VheGYrmCTPpyO4aDPYh3qeGZRLPkbTPz/CwBhxK8XKhX2Y+3rbB6ie
34FP7HxGxt2anZKDyKAj139y8YdR/BSQ4GGRqU2WYnBU4UpJoEyRRsES4IuSM1Xl
qRcL7embhkgiEQwa9rPl/f6f3VXoySZ+unhX7i2FhYn57YXao3RTyqNo0g9i29PU
HlegLyECgYEAzepuPPhJG5+y2JHYFy20w1QnEVxTKW7SxNrVF4xgi3FKDj36oauB
0VnMpM/6WM0hqrvuv9UxzBco/2UyzXOi76UJ/hvSmu4uGWUJ7wGDwFROE/xYtFMU
jTBH1x6HMEZ9MX7FRE+yIxLiv32Bex+4OB64+xJfBK5bSzVpt7CXk2kCgYEAviWn
E2mjZxCDT/xoYvgWaLvZrHw8LiYALfPIEsm9QmBv6E6lJIUnC4j80mVPRrqTsAKA
uJ79cF2cge5EdIW7PXe/wbraFgGRDDFibts8swQX90S3QuqalSCQXBdw9gW8HS7K
5ogncVLUrFPFsn5N3hiFHKf5NYc7KB1dieXFlxcCgYB/OzDuP0N87AonwsXQXI9q
eZ7CHVfNLArTU5uDN1uYDWICts0cA8rsvh2yYEeBgw4gXorAwUxJnK3aUH85bw/o
HwOznSFeVXjqfAHNShRMTEsKEkwE76itLH3XL6e8bnGAmaHt+YhKH6s3Qqc0mn7L
PkBx8gH/9HO4XsJ5m4WssQKBgECvoHn7KwqJ1JImZQCeM0ln9nI2RWbRqKf5UewK
U2c8VXWrI4UcAx9qd8+/hUujd1CeWVn1RHSwc+jDvOgDAqKzlTl7rmtkFwsV1c2u
qaSg1OJarxmFpBbtYA7kLpqTct5ep8nrMbfcnNsPGKdTTnwqzUXlYuMx4Q8Rhlu+
Hgz7AoGBALQDWJyjYJwemSCPDx4RWPnYlxGt3VaVXiHI/QRe27J2y1bcdQkDEZ89
r2Qcx7J0L0AIO7CcTmRjJtSoFgU9jq/wAB1iqk6Po0skocbapf5XpE4mKnLztYfv
JOJYGUxuH+d4e7cOBUXaaJHmuvb/7vLJwwZDPSsVIO9lJSTa8mjC
-----END RSA PRIVATE KEY-----`;
function dododo() {
var sig = new KJUR.crypto.Signature({ "alg": "SHA256withRSA" });
sig.init(privateKey);
sig.updateString(palin.value);
let signatureHex = sig.sign();
console.log(signatureHex);
signResult.value = btoa(String.fromCharCode.apply(null, signatureHex.match(/.{2}/g).map(a=>"0x"+a)));
}
</script>
<textarea rows="10" cols="100" id="palin">os:Android|version:4.4.10|action:/api/vod/getSactionV2.action|time:1655617802236|appToken:xxx|privateKey:e1be6b4cf4021b3d181170d1879a530a9e4130b69032144d5568abfd6cd6c1c2|data:action=playUrl&checkVodTicket=2&issueVodTicketInfo=0&sactionUuid=ff808081816c058301816fd962aa02c6&</textarea><br><br>
<button onclick="dododo();">点击sign</button><br><br>
<textarea rows="10" cols="100" id="signResult"></textarea><br><br> |
Beta Was this translation helpful? Give feedback.
0 replies
-
大佬,能否逆向下番茄的app加密 m.fqfilm.com |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
抓包
略
定位函数
用
jadx-gui
打开apk,然后搜索相关关键字定位函数位置通过
frida
hook这个方法,先看看传入的都是些什么可以看到新版APP已经使用了
getSactionV2.action
,观察函数可知,程序会调用onlySign()
方法点进
onlySign()
方法,继续进行hook播放视频,得到hook结果
记录sign的输入和输入,方便后续在程序中测试
出于隐私考虑,这里隐藏了appToken
os:Android|version:4.4.10|action:/api/vod/getSactionV2.action|time:1655617802236|appToken:xxx|privateKey:e1be6b4cf4021b3d181170d1879a530a9e4130b69032144d5568abfd6cd6c1c2|data:action=playUrl&checkVodTicket=2&issueVodTicketInfo=0&sactionUuid=ff808081816c058301816fd962aa02c6&
g9iNZ6RRxwCePdE3hS6QXcZi0pl3JzVpPV3mZZybDUX5wK8y/MFk8x49bPsKuqu+yVLGmbcZM3aBjyZZyqmMDCcIFsqmYpCA/1pCIOD6g9QL2576o85Y5sIJagK27553gQrAJgfI0+wL4Z7OhGRJ9T4j0yYYAJ9F9w4IgCXdNQPZ2ra8rW33VQAhJXlbIGnl6Mk6Y8jVqHUKfIuu+vSctyUI+puh4Ih5AlgjbsQ2OmHybIhSrPPWxUtLQcU0XLWFeUw1YYFdnc0o66bRHzB6BM45NtZb20foGjIqroVqwd/DHBIObPKMPowC3ozk5lhn5Xvx9jpWPD635xuBtihe2g==
onlySign
方法获取
getSignType()
返回值从最简单的入手
getSignType() 调用了native方法
没有搞过Jni的hook,我就通过
Unidbg
调用libmdds.so,可以得到返回值点击展开
到这里可知其实就是
SHA256withRSA
的签名算法,接下来只要拿到私钥就可以进行签名了获取
getM1()
返回值可以看到,返回的是PrivateKey对象,由于比较简单,可以通过得到
getXMaa()
、getYMbb()
和getKeyType()
的值来自行生成与上文同理,可得:
a.a().c
返回值点进去
我到这里才突然反应过来,由于a.a().c 的参数是固定字符串,所以我们hook拿到函数返回值直接用就行了。。
getXMaa()
和getYMbb()
都不重要。。得到HEX结果:
a.a().g
这个函数目测就是Base64 Encode而已
最终Java实现
Beta Was this translation helpful? Give feedback.
All reactions