Skip to content

Instantly share code, notes, and snippets.

@mridang
Created March 29, 2015 09:44
Show Gist options
  • Save mridang/cee8a98244f732dee8ef to your computer and use it in GitHub Desktop.
Save mridang/cee8a98244f732dee8ef to your computer and use it in GitHub Desktop.
Enables HTTP debug logging to any decompiled APK
.method public static dhcout()V
.locals 2
.prologue
.line 63
const-string v0, "org.apache.http.wire"
invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
move-result-object v0
sget-object v1, Ljava/util/logging/Level;->FINEST:Ljava/util/logging/Level;
invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->setLevel(Ljava/util/logging/Level;)V
.line 64
const-string v0, "org.apache.http.headers"
invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
move-result-object v0
sget-object v1, Ljava/util/logging/Level;->FINEST:Ljava/util/logging/Level;
invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->setLevel(Ljava/util/logging/Level;)V
.line 65
return-void
.end method
@mridang
Copy link
Author

mridang commented Mar 29, 2015

Add that piece of code to the class where the DefaultHttpClient is being initialized. Right before the constructor call, add this bit of Smali to invoke the method:

`invoke-static {}, Lshared/Web/Private/CWebRequestThread;->dhcout()V``

You would need to update the namespace to correctly invoke the static method. Once you've done this, rebuilt and installed your APK, you'll need to enable HTTP debug logging to the logcat output. This can be done by running:

adb shell setprop log.tag.org.apache.http VERBOSE
adb shell setprop log.tag.org.apache.http.wire VERBOSE
adb shell setprop log.tag.org.apache.http.headers VERBOSE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment