Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

考虑添加Gzip.并提供相应代码 #21

Open
friddle opened this issue Sep 20, 2021 · 2 comments
Open

考虑添加Gzip.并提供相应代码 #21

friddle opened this issue Sep 20, 2021 · 2 comments

Comments

@friddle
Copy link

friddle commented Sep 20, 2021

我已经尝试改下。已经成功。
https://github.com/friddle/OkHttpLogger-Frida/blob/master/okhttp_poker_gzip.js
但是不是很熟悉frida的写法。代码质量不行。所以没有pull request。只提供参考下

@friddle
Copy link
Author

friddle commented Sep 20, 2021

        var charset = defChatset
        var mediaType = responseBody[M_rspBody_contentType]()
        logString.append("| Response Body,Encoding:").append(encoding).append("\n")
        var source = OkioGzipSource.$new(responseBody[M_rspBody_source]())
        var buffer=Java.use("okio.Okio").buffer(Java.cast(source,Java.use("okio.Source")))
        var byteArrayString=buffer.readByteString()
        var rspString=byteArrayString.string(charset)
        var newBody = ResponseBodyWapper[M_rspBody_create](mediaType,byteArrayString)
        var newBuilder = null;
        if ("" == M_rsp_newBuilder) {
            var ResponseBuilderClazz = response.class.getDeclaredClasses()[0]
            newBuilder = Java.use(ResponseBuilderClazz.getName()).$new(response)
        } else {
            newBuilder = response[M_rsp_newBuilder]()
            newBuilder.removeHeader(EncodingKey)
        }
        var bodyField = newBuilder.class.getDeclaredField(F_rsp$builder_body)
        bodyField.setAccessible(true)
        bodyField.set(newBuilder, newBody)
        newResponse = newBuilder[M_rsp$builder_build]()
        logString.append(splitLine(rspString, "|   ")).append("\n")
        logString.append("|" + "<-- END HTTP RESPONSE").append("\n");

@friddle
Copy link
Author

friddle commented Sep 20, 2021

在京东下已经跑成功

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant