package Main;
import com.thoughtworks.qdox.JavaProjectBuilder;
import com.thoughtworks.qdox.library.JavaClassContext;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaMethod;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public class JavaParser {
public static void main(String[] args) {
JavaProjectBuilder builder = new JavaProjectBuilder();
builder.addSourceTree(new File("C:\\Users\\rooooot\\Desktop\\s01\\CWE89_SQL_Injection__connect_tcp_execute_01.java"));
Collection<JavaClass> classes = builder.getClasses();
Iterator<JavaClass> it = classes.iterator();
while(it.hasNext()) {
JavaClass cls = builder.getClassByName(it.next().getCanonicalName());
List<JavaMethod> methods = cls.getMethods();
for(JavaMethod method : methods){
System.out.println(method.getCodeBlock());
}
}
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30