Skip to content

Commit fdd4bf4

Browse files
committed
fix #2 #3 #5
1 parent b8d65ba commit fdd4bf4

File tree

14 files changed

+56
-14
lines changed

14 files changed

+56
-14
lines changed
122 KB
Binary file not shown.
0 Bytes
Binary file not shown.
100 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
782 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

.gradle/file-system.probe

0 Bytes
Binary file not shown.

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ Options:
1717
--allow-phantom Allow phantom classes.
1818
-d <directory> Specify where to generate output fact files.
1919
-i <archive> Find classes in <archive>.
20+
-i-dir <directory> Find classes/jar in <directory>.
2021
-l <archive> Find library classes in <archive>.
2122
-ld <archive> Find dependency classes in <archive>.
23+
-ld-dir <directory> Find dependency classes/jar in <directory>.
2224
-lsystem Find classes in default system classes.
2325
--facts-subset <subset> Produce facts only for a subset of the given classes [APP, APP_N_DEPS, PLATFORM].
2426
--ignore-factgen-errors Continue with the analysis even if fact generation fails.
@@ -50,7 +52,11 @@ java -jar soot-fact-generator.jar -i input.jar -l /usr/lib/jvm/java-8-oracle/jr
5052
其中
5153
- `-i` 指定待分析的jar包
5254
- `-l` 指定依赖库
53-
- `--generate-jimple` 表示生成中间语言jimple
54-
- `--allow-phantom` 大概是允许解析依赖不存在的类
55-
- `--full` 表示对所有class进行解析
56-
- `-d` 指定输出目录
55+
- `--generate-jimple` 表示生成中间语言jimple
56+
- `--allow-phantom` 大概是允许解析依赖不存在的类
57+
- `--full` 表示对所有class进行解析
58+
- `-d` 指定输出目录
59+
60+
另外还额外增加了
61+
- `-i-dir` 指定待分析的jar目录
62+
- `-ld-dir` 指定待分析的依赖目录

src/main/java/org/clyze/doop/common/BasicJavaSupport.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,27 @@ else if ((isJar || isAar || isZip || isWar) && entryName.endsWith(".xml")) {
8686
XMLFactGenerator.processFile(xmlTmpFile, db, "", parameters._debug);
8787
}
8888
};
89+
8990
if (isWar) {
9091
System.out.println("Processing WAR: " + filename);
9192
// Process WAR inputs.
9293
parameters.processFatArchives(tmpDirs);
93-
}
94-
95-
if (isSpringBoot) {
94+
}else if (isSpringBoot) {
9695
System.out.println("Processing springBoot: " + filename);
9796
parameters.processSpringBootArchives(tmpDirs, filename);
98-
}
99-
100-
if (isJar || isApk || isZip || isWar)
97+
parameters.getInputs().forEach(file -> {
98+
try{
99+
// System.out.println(file);
100+
artScanner.processArchive(file, classSet::add, gProc);
101+
}catch (Exception e){
102+
e.printStackTrace();
103+
}
104+
});
105+
artScanner.processArchive(filename, classSet::add, gProc);
106+
}else if (isJar || isApk || isZip || isWar)
107+
{
101108
artScanner.processArchive(filename, classSet::add, gProc);
102-
else if (isClass) {
109+
} else if (isClass) {
103110
File f = new File(filename);
104111
try (FileInputStream fis = new FileInputStream(f)) {
105112
artScanner.processClass(fis, f, classSet::add);

src/main/java/org/clyze/doop/common/Parameters.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ protected int processNextArg(String[] args, int i) throws DoopErrorCodeException
161161
i = shift(args, i);
162162
_inputs.add(args[i]);
163163
break;
164-
case "-idir":
164+
case "-i-dir":
165165
i = shift(args, i);
166166
File inputDir = new File(args[i]);
167167
File[] files = inputDir.listFiles();
168168
if (files != null) {
169169
for (File file : files) {
170-
if (file.getName().endsWith(".jar")) {
170+
if (file.getName().endsWith(".jar") || file.getName().endsWith(".class")) {
171171
try{
172172
_inputs.add(file.getCanonicalPath());
173173
}catch (Exception e){
@@ -191,6 +191,22 @@ protected int processNextArg(String[] args, int i) throws DoopErrorCodeException
191191
i = shift(args, i);
192192
_dependencies.add(args[i]);
193193
break;
194+
case "-ld-dir":
195+
i = shift(args, i);
196+
File dependencyDir = new File(args[i]);
197+
File[] dependencies = dependencyDir.listFiles();
198+
if (dependencies != null) {
199+
for (File file : dependencies) {
200+
if (file.getName().endsWith(".jar") || file.getName().endsWith(".class")) {
201+
try{
202+
_dependencies.add(file.getCanonicalPath());
203+
}catch (Exception e){
204+
e.printStackTrace();
205+
}
206+
}
207+
}
208+
}
209+
break;
194210
case "-d":
195211
i = shift(args, i);
196212
setOutputDir(args[i]);

0 commit comments

Comments
 (0)