<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Fogo,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You may want to try running through the rest of your classes and calling Scene.v().loadClass(…) for each one.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Eric Ortega<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Soot-list <soot-list-bounces@CS.McGill.CA> on behalf of Fogo Tunde-Onadele <oatundeo@ncsu.edu><br>
<b>Date: </b>Monday, February 1, 2021 at 5:06 AM<br>
<b>To: </b>"soot-list@cs.mcgill.ca" <soot-list@cs.mcgill.ca><br>
<b>Subject: </b>[Soot-list] Soot not finding class without a main for call graph<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">Good day,</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">I have been trying to get Soot working on analyzing the call graph of external libraries/apps. Specifically, I want to get the call graph of a class, ‘DefaultServlet’, within a Tomcat
jar file, ‘catalina.jar’. First, I followed tutorials that analyze a simple class/file with a main method. However, the classes I want to analyze don’t typically have main methods. So I found and followed examples that utilize entrypoints but Soot is still
unable to find the class. Please, I would appreciate some help. Here is the latest main piece of code I have tried.</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black"><br>
<br>
</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">```</span><o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">public class IFDSDataFlowTransformer extends SceneTransformer {<br>
<br>
static LinkedList<String> excludeList;<br>
static String mainclass = "DefaultServlet";<br>
static String mainmethod = "doGet"; // "doPut";<br>
<br>
public static void main(String[] args) {<br>
<br>
// Set Soot's internal classpath<br>
String javapath = System.getProperty("java.class.path");<br>
String jredir = System.getProperty("java.home")+"/lib/rt.jar";<br>
String path = javapath+File.pathSeparator+jredir;<br>
Options.v().set_soot_classpath(path);<br>
<br>
// Enable whole-program mode<br>
Options.v().set_whole_program(true);<br>
Options.v().set_app(true);<br>
<br>
// Call-graph options<br>
Options.v().setPhaseOption("cg", "safe-newinstance:true");<br>
Options.v().setPhaseOption("cg.cha","enabled:false");<br>
<br>
// Enable SPARK call-graph construction<br>
Options.v().setPhaseOption("cg.spark","enabled:true");<br>
Options.v().setPhaseOption("cg.spark","verbose:true");<br>
Options.v().setPhaseOption("cg.spark","on-fly-cg:true");<br>
<br>
Options.v().set_allow_phantom_refs(true);<br>
<br>
// Set the main class of the application to be analysed<br>
Options.v().set_main_class(mainclass);<br>
<br>
// Load the main class<br>
SootClass c = Scene.v().loadClass(mainclass, SootClass.BODIES);<br>
c.setApplicationClass();<br>
<br>
// Load the "main" method of the main class and set it as a Soot entry point<br>
// SootMethod entryPoint = c.getMethodByName("main");<br>
SootMethod entryPoint = c.getMethodByName(mainmethod);<br>
List<SootMethod> entryPoints = new ArrayList<SootMethod>();<br>
entryPoints.add(entryPoint);<br>
Scene.v().setEntryPoints(entryPoints);<br>
<br>
PackManager.v().getPack("wjtp").add(new Transform("wjtp.herosifds", new IFDSDataFlowTransformer()));<br>
<br>
// soot.Main.main();<br>
//start working<br>
PackManager.v().runPacks();<br>
} <o:p></o:p></p>
</blockquote>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">```</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black"><br>
<br>
</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">I am using Soot 3.3.1, Java 1.8 and I have exported my eclipse project in a zip below (project structure in photo). The files, IFDSDataFlowTransformer and TestSootCallGraph, start
two separate trials. </span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">Do I have to create a new class with a main that would start a request (e.g. http or curl request) to the Tomcat application? If so, that would require including more Tomcat jars/files
in the project. However, I figured that Soot did not need specific inputs or </span>
all files in an application<span style="font-family:"Arial",sans-serif;color:black"> to statically analyze code.
</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">Thank you,</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black">Fogo</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black"><br>
<br>
</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Arial",sans-serif;color:black;border:none windowtext 1.0pt;padding:0in"><img width="224" height="207" style="width:2.3333in;height:2.1562in" id="_x0000_i1025" src="https://lh4.googleusercontent.com/myNBBJpNbGtDcY6ocwqBdwVvaloz9gb28mDgJxKrlbxcKQRDtTOozzCUaKqnC0MZH-Z1Zfv6qKWcUXIfzBHC_wYp_PKdl-2CTUp4Yn5EmjK5cpDds7tHwMo85CgbCeg6vKi8JQt0"></span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">--<o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:#888888">Fogo Tunde-Onadele <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">PhD student<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">Computer Science<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">North Carolina State University<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>