Skip to content

Instantly share code, notes, and snippets.

@ExcaliburZero
Created November 28, 2018 23:55
Show Gist options
  • Save ExcaliburZero/edf859bfce82622007e02ad8d591dbf9 to your computer and use it in GitHub Desktop.
Save ExcaliburZero/edf859bfce82622007e02ad8d591dbf9 to your computer and use it in GitHub Desktop.
Printing out the methods in a class using Soot
import soot.Scene
import scala.collection.JavaConverters._
object SootPrintMethods {
def main(args: Array[String]): Unit = {
Scene.v().loadClassAndSupport("java.lang.Object")
val a = Scene.v().getSootClass("java.lang.Object")
Scene.v().loadNecessaryClasses()
a.getMethods.asScala.foreach(m => {
try {
println(m.retrieveActiveBody())
} catch {
case _: java.lang.RuntimeException =>
println(m.getSignature)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment