├── .gitignore
├── DataCollect-1.0-SNAPSHOT.jar
├── Dockerfile
├── Jasmine.pdf
├── LICENSE
├── LICENSE.html
├── README.md
├── build.gradle
├── demo
└── target-demo-0.0.1
│ ├── BOOT-INF
│ ├── classes
│ │ ├── application.properties
│ │ ├── bean.xml
│ │ └── com
│ │ │ └── example
│ │ │ └── demo
│ │ │ ├── DemoApplication.class
│ │ │ ├── annotation
│ │ │ └── Permission.class
│ │ │ ├── aop
│ │ │ ├── AfterLog.class
│ │ │ └── BeforeLog.class
│ │ │ ├── aspect
│ │ │ ├── AOPAspectA.class
│ │ │ ├── AOPAspectB.class
│ │ │ ├── AopXmlAspect.class
│ │ │ ├── EntryPointAspect.class
│ │ │ ├── GetFieldAspect.class
│ │ │ ├── InfoLeakAspect.class
│ │ │ └── PermissionAspect.class
│ │ │ ├── config
│ │ │ ├── ConfigClass.class
│ │ │ └── StudentConfig.class
│ │ │ ├── controller
│ │ │ ├── AOPController.class
│ │ │ ├── EntryPointController.class
│ │ │ ├── EntryPointWithAOPController.class
│ │ │ ├── GetFieldController.class
│ │ │ ├── GetFieldWithAOPController.class
│ │ │ ├── InfoLeakController.class
│ │ │ ├── PermissionController.class
│ │ │ ├── PrototypeDIController.class
│ │ │ ├── SSMController.class
│ │ │ └── SingletonDIController.class
│ │ │ ├── mapper
│ │ │ └── UserMapper.class
│ │ │ ├── model
│ │ │ ├── AopXmlTestBean.class
│ │ │ ├── ModelOne.class
│ │ │ ├── Student.class
│ │ │ ├── User.class
│ │ │ ├── XmlBaseBean.class
│ │ │ └── XmlDIServiceProvider.class
│ │ │ ├── service
│ │ │ ├── AOPService.class
│ │ │ ├── EntryPointService.class
│ │ │ ├── GetFieldService.class
│ │ │ ├── InfoLeakService.class
│ │ │ ├── PermissionService.class
│ │ │ ├── PrototypeDIServiceC.class
│ │ │ ├── PrototypeDIServiceD.class
│ │ │ ├── SSMService.class
│ │ │ ├── SingletonDIServiceA.class
│ │ │ ├── SingletonDIServiceB.class
│ │ │ ├── XmlDIService.class
│ │ │ └── impl
│ │ │ │ ├── AOPServiceImpl.class
│ │ │ │ ├── EntryPointServiceImpl.class
│ │ │ │ ├── GetFieldServiceImpl.class
│ │ │ │ ├── GetFieldWithAOPServiceImpl.class
│ │ │ │ ├── InfoLeakServiceImpl.class
│ │ │ │ ├── PermissionServiceImpl.class
│ │ │ │ ├── PrototypeDIServiceCImpl.class
│ │ │ │ ├── PrototypeDIServiceDImpl.class
│ │ │ │ ├── SSMServiceImpl.class
│ │ │ │ ├── SingletonDIServiceAImpl.class
│ │ │ │ ├── SingletonDIServiceBImpl.class
│ │ │ │ └── XmlDIServiceImpl.class
│ │ │ ├── tag
│ │ │ ├── AOPCheckTag.class
│ │ │ ├── EntryPointTag.class
│ │ │ ├── HasPermissionTag.class
│ │ │ ├── InfoLeakTag.class
│ │ │ ├── NULLPointTag.class
│ │ │ ├── PrototypeDITag.class
│ │ │ └── SingletonDITag.class
│ │ │ └── utils
│ │ │ └── PrintStack.class
│ ├── classpath.idx
│ ├── layers.idx
│ └── lib
│ │ ├── HikariCP-4.0.3.jar
│ │ ├── aspectjweaver-1.9.6.jar
│ │ ├── byte-buddy-1.10.22.jar
│ │ ├── classmate-1.5.1.jar
│ │ ├── guava-20.0.jar
│ │ ├── jackson-annotations-2.12.3.jar
│ │ ├── jackson-core-2.12.3.jar
│ │ ├── jackson-databind-2.12.3.jar
│ │ ├── jackson-datatype-jdk8-2.12.3.jar
│ │ ├── jackson-datatype-jsr310-2.12.3.jar
│ │ ├── jackson-module-parameter-names-2.12.3.jar
│ │ ├── jakarta.annotation-api-1.3.5.jar
│ │ ├── jsqlparser-1.2.jar
│ │ ├── jul-to-slf4j-1.7.30.jar
│ │ ├── log4j-api-2.14.1.jar
│ │ ├── log4j-to-slf4j-2.14.1.jar
│ │ ├── logback-classic-1.2.3.jar
│ │ ├── logback-core-1.2.3.jar
│ │ ├── mapstruct-1.2.0.Final.jar
│ │ ├── mybatis-3.4.6.jar
│ │ ├── mybatis-plus-3.0.5.jar
│ │ ├── mybatis-plus-annotation-3.0.5.jar
│ │ ├── mybatis-plus-boot-starter-3.0.5.jar
│ │ ├── mybatis-plus-core-3.0.5.jar
│ │ ├── mybatis-plus-extension-3.0.5.jar
│ │ ├── mybatis-plus-generator-3.0.5.jar
│ │ ├── mybatis-spring-1.3.2.jar
│ │ ├── mysql-connector-java-8.0.25.jar
│ │ ├── slf4j-api-1.7.30.jar
│ │ ├── snakeyaml-1.28.jar
│ │ ├── spring-aop-5.3.7.jar
│ │ ├── spring-beans-5.3.7.jar
│ │ ├── spring-boot-2.5.0.jar
│ │ ├── spring-boot-autoconfigure-2.5.0.jar
│ │ ├── spring-boot-jarmode-layertools-2.5.0.jar
│ │ ├── spring-context-5.3.7.jar
│ │ ├── spring-core-5.3.7.jar
│ │ ├── spring-expression-5.3.7.jar
│ │ ├── spring-jcl-5.3.7.jar
│ │ ├── spring-jdbc-5.3.7.jar
│ │ ├── spring-plugin-core-1.2.0.RELEASE.jar
│ │ ├── spring-plugin-metadata-1.2.0.RELEASE.jar
│ │ ├── spring-tx-5.3.7.jar
│ │ ├── spring-web-5.3.7.jar
│ │ ├── spring-webmvc-5.3.7.jar
│ │ ├── springfox-core-2.9.2.jar
│ │ ├── springfox-schema-2.9.2.jar
│ │ ├── springfox-spi-2.9.2.jar
│ │ ├── springfox-spring-web-2.9.2.jar
│ │ ├── springfox-swagger-common-2.9.2.jar
│ │ ├── springfox-swagger-ui-2.9.2.jar
│ │ ├── springfox-swagger2-2.9.2.jar
│ │ ├── swagger-annotations-1.5.20.jar
│ │ ├── swagger-models-1.5.20.jar
│ │ ├── tomcat-embed-core-9.0.46.jar
│ │ ├── tomcat-embed-el-9.0.46.jar
│ │ └── tomcat-embed-websocket-9.0.46.jar
│ ├── META-INF
│ ├── MANIFEST.MF
│ └── maven
│ │ └── com.example
│ │ └── demo
│ │ ├── pom.properties
│ │ └── pom.xml
│ └── org
│ └── springframework
│ └── boot
│ └── loader
│ ├── ClassPathIndexFile.class
│ ├── ExecutableArchiveLauncher.class
│ ├── JarLauncher.class
│ ├── LaunchedURLClassLoader.class
│ ├── Launcher.class
│ ├── MainMethodRunner.class
│ ├── PropertiesLauncher.class
│ ├── WarLauncher.class
│ ├── archive
│ ├── Archive.class
│ ├── ExplodedArchive.class
│ └── JarFileArchive.class
│ ├── data
│ ├── RandomAccessData.class
│ └── RandomAccessDataFile.class
│ ├── jar
│ ├── AbstractJarFile.class
│ ├── AsciiBytes.class
│ ├── Bytes.class
│ ├── CentralDirectoryEndRecord.class
│ ├── CentralDirectoryFileHeader.class
│ ├── CentralDirectoryParser.class
│ ├── CentralDirectoryVisitor.class
│ ├── FileHeader.class
│ ├── Handler.class
│ ├── JarEntry.class
│ ├── JarEntryCertification.class
│ ├── JarEntryFilter.class
│ ├── JarFile.class
│ ├── JarFileEntries.class
│ ├── JarFileWrapper.class
│ ├── JarURLConnection.class
│ ├── StringSequence.class
│ └── ZipInflaterInputStream.class
│ ├── jarmode
│ ├── JarMode.class
│ ├── JarModeLauncher.class
│ └── TestJarMode.class
│ └── util
│ └── SystemPropertyUtils.class
└── src
└── main
├── java
├── ParserSpringMain.java
├── analysis
│ ├── AOPAnalysis.java
│ ├── AOPParser.java
│ ├── AnnotationAnalysis.java
│ ├── CreateEdge.java
│ ├── ForwardTransformer.java
│ ├── IOCParser.java
│ └── SpringAnnotationTag.java
├── bean
│ ├── AOPTargetModel.java
│ ├── AopXMLResultBean.java
│ ├── AspectModel.java
│ ├── ConstructorArgBean.java
│ └── InsertMethod.java
├── enums
│ ├── AdviceEnum.java
│ └── EnumMessage.java
├── mock
│ ├── GenerateSyntheticClass.java
│ ├── GenerateSyntheticClassImpl.java
│ ├── MockObject.java
│ └── MockObjectImpl.java
└── utils
│ ├── BaseJimpleUtils.java
│ ├── ConfigUtil.java
│ ├── EnumUtils.java
│ ├── FileUtils.java
│ ├── GenJimpleUtil.java
│ ├── JimpleUtils.java
│ └── XMLDocumentHolder.java
└── resources
└── config.properties
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .gradle
3 | build
4 | gradle
5 | gradle.properties
6 | settings.gradle
7 | gradlew.bat
8 | gradlew
9 | sootOutput
10 | .DS_Store
11 |
--------------------------------------------------------------------------------
/DataCollect-1.0-SNAPSHOT.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/DataCollect-1.0-SNAPSHOT.jar
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # Version 1.0
2 | FROM ubuntu:16.04
3 |
4 | LABEL maintainer = "SpringJasmine"
5 |
6 | RUN apt-get update && apt install software-properties-common -y && add-apt-repository ppa:openjdk-r/ppa \
7 | && apt-get update && apt-get install vim -y && apt-get install wget -y
8 |
9 | RUN apt-get install unzip -y && apt-get install openjdk-8-jdk -y \
10 | && apt-get install -y \
11 | bison \
12 | build-essential \
13 | clang \
14 | cmake \
15 | doxygen \
16 | flex \
17 | g++ \
18 | git \
19 | libffi-dev \
20 | libncurses5-dev \
21 | libsqlite3-dev \
22 | make \
23 | mcpp \
24 | python \
25 | sqlite \
26 | zlib1g-dev
27 |
28 | RUN wget https://services.gradle.org/distributions/gradle-6.4-bin.zip \
29 | && unzip -d /usr/local/ gradle-6.4-bin.zip \
30 | && wget https://github.com/souffle-lang/souffle/releases/download/1.5.1/souffle_1.5.1-1_amd64.deb \
31 | && dpkg -i souffle_1.5.1-1_amd64.deb \
32 | && git clone https://github.com/SpringJasmine/Doop_Jasmine.git \
33 | && git clone https://bitbucket.org/yanniss/doop-benchmarks.git \
34 | && wget https://github.com/SpringJasmine/Doop_Jasmine/raw/main/doop/doop.tar.gz
35 |
36 | RUN mv /Doop_Jasmine/0610newtest/ /root && tar -zxvf doop.tar.gz && mv /newdoop/ /root && mv /doop-benchmarks/ /root \
37 | && mv /Doop_Jasmine/DataCollect-1.0-SNAPSHOT.jar /root && mv /Doop_Jasmine/bashDir/* /root/ \
38 | && mv /Doop_Jasmine/spring-sources-and-sinks.dl /root/newdoop/souffle-logic/addons/information-flow/ \
39 | && rm -rf /Doop_Jasmine && rm -rf doop.tar.gz && rm -rf gradle-6.4-bin.zip && rm -rf souffle_1.5.1-1_amd64.deb
40 |
41 | RUN touch /root/newdoop/souffle-logic/analyses/context-insensitive/../../main/main-declarations.dl \
42 | && echo 'process_project_name = mall-admin\n\
43 | Jasmine_CallGraph_Path = /data/doop/out/jasminemall-admin/database/CallGraphEdge.csv\n\
44 | JackEE_CallGraph_Path = /data/doop/out/jackeemall-admin/database/CallGraphEdge.csv\n\
45 | Jasmine_ReachableMethod_Path = /data/doop/out/jasminemall-admin/database/Stats_Simple_Application_ReachableMethod.csv\n\
46 | JackEE_ReachableMethod_Path = /data/doop/out/jackeemall-admin/database/Stats_Simple_Application_ReachableMethod.csv\n\
47 | resultPath = /root/output/' >> /root/config.properties \
48 | && sed -i 70d /root/newdoop/runjackee.py && sed -i 70d /root/newdoop/runjasmine.py \
49 | && sed -i 352d /root/newdoop/src/main/groovy/org/clyze/doop/core/DoopAnalysisFactory.groovy \
50 | && sed -i 380d /root/newdoop/src/main/groovy/org/clyze/doop/core/DoopAnalysisFactory.groovy \
51 | && sed -i 411d /root/newdoop/src/main/groovy/org/clyze/doop/core/DoopAnalysisFactory.groovy \
52 | && find . -name "*DS_Store" | xargs rm -r
53 |
54 | ENV GRADLE_HOME=/usr/local/gradle-6.4 PATH="/usr/local/gradle-6.4/bin:${PATH}" DOOP_HOME=/root/newdoop DOOP_OUT=/data/doop/out \
55 | DOOP_CACHE=/data/doop/cache DOOP_TMP=/data/doop/tmp DOOP_LOG=/data/doop/log JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 \
56 | DOOP_PLATFORMS_LIB=/root/doop-benchmarks
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Jasmine.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/Jasmine.pdf
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 SpringJasmine
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LICENSE.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Third-Party Library List
4 |
5 |
6 |
7 | Third-Party Library List
8 |
9 | This folder includes third-party libraries that are used by the FlowDroid_Jasmine.
10 | Please refer to the detailed license information as shown below:
11 |
12 |
13 |
14 | Library Name |
15 | License |
16 |
17 |
18 |
19 | Soot |
20 | LGPL-2.1 License |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The code, analysis scripts and results for ASE 2022 Artifact Evaluation
2 |
3 | Version: 1.1
4 | Paper: Jasmine: A Static Analysis Framework for Spring Core Technologies (#175)
5 |
6 | This document is to help users reproduce the results we reported in our submission. It contains the following descriptions
7 |
8 | ## 0. Artifact Expectation
9 |
10 | The code and scripts for the tools we build are published in this repository as well as other repositories for SpringJasmine users. **All the experiments were carried out on a Docker environment which deployed on an Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz (4 x 12 core) and 128GB of RAM.** Both can be executed using Docker 20.10.8. We hope that users can reproduce our experiments using this version or a later version of Docker. Doop framework related experiments are run on Docker 19.03.12, Soot and FlowDroid related experiments are run on IntelliJ Idea.
11 |
12 | ## 1. Environment Setup
13 |
14 | Pull Jasmine from GitHub.
15 |
16 | ```sh
17 | $ git clone https://github.com/SpringJasmine/Doop_Jasmine.git
18 | ```
19 |
20 | ### 1.1. Docker
21 |
22 | Execute the Dockerfile in the [Jasmine repository](https://github.com/SpringJasmine/Jasmine) to generate a docker container, ```/localdata``` is the folder path of your machine. Please change it according to the actual situation.
23 |
24 | ```sh
25 | $ cd Jasmine
26 | $ docker build -t jasmine:v1 .
27 | $ docker run -it -h Jasmine.gt --privileged=True -e "container=docker" -v /localdata:/data --net=host --name="Jasmine" jasmine:v1 bash
28 | # /localdata is your local folder path
29 | ```
30 |
31 | ### 1.2 IntelliJ IDEA
32 |
33 | Some experiment uses **maven and IntelliJ IDEA**, the maven version is 3.6.1, and the Java version is Java 8.
34 |
35 | ## 2. Tab Section 5.2
36 |
37 | This table mainly shows the improvement of Jasmine's detection ability of JackEE, including TABLE II and Fig.4.
38 |
39 | ### 2.1 Doop version comparison
40 |
41 | #### 2.1.1 JackEE, Default and Jasmine use context-insensitive analysis (corresponding to ID-1-EntryPoint, ID-4-SpringAOP, ID-7-Reachable Methods, ID-8-Application Edges)
42 |
43 | * Run the following command.
44 |
45 | ```sh
46 | # JackEE
47 | $ bash /root/JackEEforSpringDemo.bash
48 |
49 | # Defalut
50 | $ bash /root/DefaultforSpringDemo.bash
51 |
52 | # Jasmine
53 | $ bash /root/JasmineforSpringDemo.bash
54 | ```
55 |
56 | #### 2.1.2 JackEE, Default and Jasmine use context-insensitive analysis and taint analysis (corresponding to ID-2-DI(Singleton), ID-3-DI(Prototype), ID-5-InfoLeak)
57 |
58 | * Run the following command.
59 |
60 | ```sh
61 | # JackEE
62 | $ bash /root/JackEEforInfoSpringDemo.bash
63 |
64 | # Defalut
65 | $ bash /root/DefaultforInfoSpringDemo.bash
66 |
67 | # Jasmine
68 | $ bash /root/JasmineforInfoSpringDemo.bash
69 | ```
70 |
71 | ### 2.2 Soot version comparison
72 |
73 | This project mainly uses maven and IntelliJ IDEA, the maven version is 3.6.1, and the Java version is Java 8.
74 |
75 | #### 2.2.1 CHA, SPARK and Jasmine(corresponding to ID-1-EntryPoint, ID-4-SpringAOP, ID-7-Reachable Methods, ID-8-Application Edges)
76 |
77 | * Open the project with IntelliJ IDEA.
78 |
79 | * Modify ```src/main/resources/config.properties```
80 |
81 | ```properties
82 | # Modify bean_xml_paths to the absolute path where the corresponding file
83 | bean_xml_paths = /User/Jasmine/demo/target-demo-0.0.1/BOOT-INF/classes/bean.xml
84 | ```
85 |
86 |
87 |
88 |
89 | * Modify```ParserSpringMain```
90 |
91 | ```java
92 | //When the following three lines are not commented, jasmine is turned on
93 | 29: CreateEdge createEdge = new CreateEdge();
94 | 30: String path = "config.properties"; // Modify field to the path of config.properties in resources
95 | 31: createEdge.initCallGraph(path);
96 | ...
97 | 74: // turn on SPARK and Jasmine
98 | Options.v().setPhaseOption("cg.spark", "on");
99 | Options.v().setPhaseOption("cg.spark", "verbose:true");
100 | Options.v().setPhaseOption("cg.spark", "enabled:true");
101 | Options.v().setPhaseOption("cg.spark", "propagator:worklist");
102 | Options.v().setPhaseOption("cg.spark", "simple-edges-bidirectional:false");
103 | Options.v().setPhaseOption("cg.spark", "on-fly-cg:true");
104 | // Options.v().setPhaseOption("cg.spark", "pre-jimplify:true");
105 | Options.v().setPhaseOption("cg.spark", "double-set-old:hybrid");
106 | Options.v().setPhaseOption("cg.spark", "double-set-new:hybrid");
107 | Options.v().setPhaseOption("cg.spark", "set-impl:double");
108 | Options.v().setPhaseOption("cg.spark", "apponly:true");
109 | Options.v().setPhaseOption("cg.spark", "simple-edges-bidirectional:false");
110 | 87: Options.v().set_verbose(true);
111 | 88:
112 | 89: // turn on CHA
113 | // Options.v().setPhaseOption("cg.cha", "on");
114 | // Options.v().setPhaseOption("cg.cha", "enabled:true");
115 | // Options.v().setPhaseOption("cg.cha", "verbose:true");
116 | // Options.v().setPhaseOption("cg.cha", "apponly:true");
117 | 94: // Options.v().set_verbose(true);
118 | ```
119 |
120 |
121 |
122 | * Execute the main method in ```ParserSpringMain```
123 |
124 |
125 |
126 | #### 2.2.2 SPARK, Jasmine context-sensitive(corresponding to ID-2-DI(Singleton), ID-3-DI(Prototype))
127 |
128 | * Download TURNER
129 |
130 | ```sh
131 | $ wget http://www.cse.unsw.edu.au/~corg/turner/Turner-src-v1.0.tar.xz
132 | ```
133 |
134 | * Open the project with IntelliJ IDEA.
135 | * Create a libs folder under the project directory and add **PointerAnalysis-1.0-SNAPSHOT.jar **to libs.
136 | * Add add **PointerAnalysis-1.0-SNAPSHOT.jar** in the dist directory as a project dependency
137 |
138 | * Add Jasmine in ```driver.Main```
139 |
140 | ```java
141 | 24: public static PTA run(String[] args) {
142 | 25: PTA pta;
143 | 26: new PTAOption().parseCommandLine(args);
144 | 27: setupSoot();
145 | // Modify field to the path of config.properties in section 1.2.1
146 | CreateEdge createEdge = new CreateEdge(); //add
147 | createEdge.initCallGraph("config.properties"); // add
148 | ```
149 |
150 | * Execute the main method in ```driver.Main```
151 |
152 | ## 3.Tab Section 5.3
153 |
154 | This tab shows the improvement of Jasmine's detection ability of JackEE, including TABLE III, TABLE IV, Fig.5, and Fig.6. Due to differences in the performance of the relevant machines, there may be some minor differences in the correlation results.
155 |
156 | ### 3.2 Run Jasmine and JackEE
157 |
158 | The result of **TABLE III, Fig.5 and Fig.6** can be counted by executing the following commands.
159 |
160 | ```sh
161 | $ cd /root/newdoop
162 | # Jas_JackEE
163 | $ bash /root/TurnOnJasmine.bash
164 | $ python3 /root/newdoop/runjasmine.py
165 | # JackEE
166 | $ bash /root/TurnOffJasmine.bash
167 | $ python3 /root/newdoop/runjackee.py
168 | ```
169 |
170 | ### 3.3 Run data processing scripts
171 |
172 | Dockerfile generates ```config.properties``` in ```/root```. Please modify items according to the output items under``` /data/doop/out/```.
173 |
174 | ```properties
175 | # config.properties
176 | process_project_name = mall-admin
177 | Jasmine_CallGraph_Path = /data/doop/out/jasminemall-admin/database/CallGraphEdge.csv
178 | JackEE_CallGraph_Path = /data/doop/out/jackeemall-admin/database/CallGraphEdge.csv
179 | Jasmine_ReachableMethod_Path = /data/doop/out/jasminemall-admin/database/Stats_Simple_Application_ReachableMethod.csv
180 | JackEE_ReachableMethod_Path = /data/doop/out/jackeemall-admin/database/Stats_Simple_Application_ReachableMethod.csv
181 | resultPath = /root/output/
182 | ```
183 | 
184 |
185 | The results of **TABLE III and TABLE IV** can be counted by executing the following commands.
186 |
187 | ```sh
188 | $ java -jar /root/DataCollect-1.0-SNAPSHOT.jar -c /root/config.properties
189 | ```
190 | 
191 |
192 | ## 4. Tab Section 5.4
193 |
194 | This table mainly shows the improvement of Jasmine's detection ability of FlowDroid, including the acquisition of all data and charts in Section 5.4 of the paper, mainly including TABLE V. This project mainly uses maven and IntelliJ IDEA, the maven version is 3.6.1, and the Java version is Java 8.
195 |
196 | ### 4.1 Environment
197 |
198 | * The first step is to pull the FlowDroid_Jasmine project and the benchmark to the local.
199 |
200 | ```sh
201 | $ git clone https://github.com/SpringJasmine/FlowDroid_Jasmine.git
202 | $ git clone https://github.com/SpringJasmine/Benchmark_FlowDroid
203 | $ cd Benchmark_FlowDroid
204 | $ pwd # Copy the absolute path of Benchmark_FlowDroid
205 | ```
206 |
207 | * The second step is to open the project with IntelliJ IDEA.
208 |
209 | * The third step is to modify the relevant configuration under the **dataleak** Module
210 |
211 | ```java
212 | // com.taint.analysis.utils.BenchmarksConfig
213 | public class BenchmarksConfig {
214 | // Modify "/users/flowdroidplus/demo" to the absolute path of Benchmark_Flowdroid
215 | private static String basePath = "/Users/FlowDroidPlus/demo";
216 | ...
217 | ```
218 |
219 |
220 |
221 | ```java
222 | // com.taint.analysis.Main
223 | // Modify the field of benchmark to project name and the field of analysisalgorithm to the detection algorithm (cha, spark, Jasmine)
224 | 13: public static String benchmark = "mall-admin";
225 | 14: public static String analysisAlgorithm = "cha";
226 | ```
227 |
228 |
229 |
230 | * The fourth step is to add PointerAnalysis-1.0-SNAPSHOT.jar in the dist directory as a project dependency
231 |
232 | * The fifth step is to modify the content of ```../FlowDroidPlus/dataleak/src/main/resources/config.json``` according to the actual environment
233 |
234 | ```json
235 | // Modify "source" and "edge_config" to the path of the corresponding file
236 | {
237 | "source": "/Users/FlowDroidPlus/dataleak/src/main/resources/source.json",
238 | "main_class": "com.ruoyi.RuoYiApplication",
239 | "edge_config": "/Users/FlowDroidPlus/dataleak/src/main/resources/config.properties"
240 | }
241 | ```
242 |
243 |
244 |
245 | ### 4.2 run FlowDroid
246 |
247 | * First, modify the relevant configuration under the **soot-infoflow** Module
248 |
249 | ```java
250 | // soot.jimple.infoflow.Infoflow
251 | // Modify the value of analysisAlgorithm according to step 4 (cha, spark, jasmine)
252 | 269: String analysisAlgorithm = "cha";
253 | 270: if (analysisAlgorithm.equals("cha")) {
254 | 271: config.setCallgraphAlgorithm(CallgraphAlgorithm.CHA);
255 | 272: } else {
256 | 273: config.setCallgraphAlgorithm(CallgraphAlgorithm.SPARK);
257 | 274: }
258 | ```
259 |
260 | * Execute the main method in ```com.taint.analysis.Main``` under the **dataleak** Module
261 |
262 |
263 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'java'
3 | }
4 |
5 | group 'org.example'
6 | version '1.0-SNAPSHOT'
7 |
8 | repositories {
9 | jcenter()
10 | mavenCentral()
11 | maven {
12 | url 'https://repo1.maven.org/maven2/'
13 | }
14 | maven {
15 | url 'https://soot-build.cs.uni-paderborn.de/nexus/repository/soot-snapshot/'
16 | }
17 | maven {
18 | url 'https://soot-build.cs.uni-paderborn.de/nexus/repository/soot-release/'
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation 'org.soot-oss:soot:4.2.0'
24 | implementation ('org.slf4j:slf4j-nop:1.7.5')
25 | implementation 'org.graphstream:gs-core:1.3'
26 | implementation 'org.graphstream:gs-ui:1.3'
27 | implementation('log4j:log4j:1.2.15') {
28 | exclude group: 'javax.jms', module: 'jms'
29 | exclude group: 'com.sun.jdmk', module: 'jmxtools'
30 | exclude group: 'com.sun.jmx', module: 'jmxri'
31 | }
32 | implementation group: 'junit', name: 'junit', version: '4.12'
33 | implementation group: 'org.dom4j', name: 'dom4j', version: '2.0.3'
34 | implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.73'
35 | // compile fileTree(dir: "libs", include: ['*.jar'])
36 | implementation group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.6'
37 | // https://mvnrepository.com/artifact/org.springframework/spring-webmvc
38 | implementation group: 'org.springframework', name: 'spring-webmvc', version: '5.2.12.RELEASE'
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8080
2 | server.tomcat.uri-encoding=utf-8
3 |
4 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
5 | spring.datasource.url=jdbc:mysql://localhost:3306/mybatisplus?serverTimezone=GMT%2B8
6 | spring.datasource.username=root
7 | spring.datasource.password=123456
8 |
9 | mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
10 | mybatis-plus.mapper-locations=classpath:com/example/demo/mapper/impl/*.xml
11 | # userbean\u7684\u914D\u7F6E
12 | userbean.username=snow
13 | userbean.password=skye
14 | socket.port=8068
15 | # tokenBean \u7684\u914D\u7F6E\u6587\u4EF6\u9ED8\u8BA4\u914D\u7F6E
16 | tokenBean.token=mytoken
17 | tokenBean.password=mypassword
18 | tokenBean.id=myid
19 |
20 | #httpClient
21 | http.maxTotal = 100
22 | http.defaultMaxPerRoute = 20
23 | http.connectTimeout=1000
24 | http.connectionRequestTimeout=500
25 | http.socketTimeout=10000
26 | http.staleConnectionCheckEnabled=true
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/bean.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 1
34 |
35 |
36 | aopxmltestName
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/DemoApplication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/DemoApplication.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/annotation/Permission.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/annotation/Permission.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aop/AfterLog.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aop/AfterLog.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aop/BeforeLog.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aop/BeforeLog.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/AOPAspectA.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/AOPAspectA.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/AOPAspectB.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/AOPAspectB.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/AopXmlAspect.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/AopXmlAspect.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/EntryPointAspect.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/EntryPointAspect.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/GetFieldAspect.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/GetFieldAspect.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/InfoLeakAspect.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/InfoLeakAspect.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/PermissionAspect.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/aspect/PermissionAspect.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/config/ConfigClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/config/ConfigClass.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/config/StudentConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/config/StudentConfig.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/AOPController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/AOPController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/EntryPointController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/EntryPointController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/EntryPointWithAOPController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/EntryPointWithAOPController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/GetFieldController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/GetFieldController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/GetFieldWithAOPController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/GetFieldWithAOPController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/InfoLeakController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/InfoLeakController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/PermissionController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/PermissionController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/PrototypeDIController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/PrototypeDIController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/SSMController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/SSMController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/SingletonDIController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/controller/SingletonDIController.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/mapper/UserMapper.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/mapper/UserMapper.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/AopXmlTestBean.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/AopXmlTestBean.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/ModelOne.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/ModelOne.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/Student.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/Student.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/User.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/XmlBaseBean.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/XmlBaseBean.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/XmlDIServiceProvider.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/model/XmlDIServiceProvider.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/AOPService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/AOPService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/EntryPointService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/EntryPointService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/GetFieldService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/GetFieldService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/InfoLeakService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/InfoLeakService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/PermissionService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/PermissionService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/PrototypeDIServiceC.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/PrototypeDIServiceC.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/PrototypeDIServiceD.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/PrototypeDIServiceD.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/SSMService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/SSMService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/SingletonDIServiceA.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/SingletonDIServiceA.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/SingletonDIServiceB.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/SingletonDIServiceB.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/XmlDIService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/XmlDIService.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/AOPServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/AOPServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/EntryPointServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/EntryPointServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/GetFieldServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/GetFieldServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/GetFieldWithAOPServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/GetFieldWithAOPServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/InfoLeakServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/InfoLeakServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/PermissionServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/PermissionServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/PrototypeDIServiceCImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/PrototypeDIServiceCImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/PrototypeDIServiceDImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/PrototypeDIServiceDImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/SSMServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/SSMServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/SingletonDIServiceAImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/SingletonDIServiceAImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/SingletonDIServiceBImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/SingletonDIServiceBImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/XmlDIServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/service/impl/XmlDIServiceImpl.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/AOPCheckTag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/AOPCheckTag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/EntryPointTag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/EntryPointTag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/HasPermissionTag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/HasPermissionTag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/InfoLeakTag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/InfoLeakTag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/NULLPointTag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/NULLPointTag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/PrototypeDITag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/PrototypeDITag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/SingletonDITag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/tag/SingletonDITag.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/utils/PrintStack.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/classes/com/example/demo/utils/PrintStack.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/classpath.idx:
--------------------------------------------------------------------------------
1 | - "BOOT-INF/lib/spring-boot-2.5.0.jar"
2 | - "BOOT-INF/lib/spring-context-5.3.7.jar"
3 | - "BOOT-INF/lib/spring-boot-autoconfigure-2.5.0.jar"
4 | - "BOOT-INF/lib/logback-classic-1.2.3.jar"
5 | - "BOOT-INF/lib/logback-core-1.2.3.jar"
6 | - "BOOT-INF/lib/log4j-to-slf4j-2.14.1.jar"
7 | - "BOOT-INF/lib/log4j-api-2.14.1.jar"
8 | - "BOOT-INF/lib/jul-to-slf4j-1.7.30.jar"
9 | - "BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar"
10 | - "BOOT-INF/lib/spring-core-5.3.7.jar"
11 | - "BOOT-INF/lib/spring-jcl-5.3.7.jar"
12 | - "BOOT-INF/lib/snakeyaml-1.28.jar"
13 | - "BOOT-INF/lib/byte-buddy-1.10.22.jar"
14 | - "BOOT-INF/lib/jackson-databind-2.12.3.jar"
15 | - "BOOT-INF/lib/jackson-core-2.12.3.jar"
16 | - "BOOT-INF/lib/jackson-datatype-jdk8-2.12.3.jar"
17 | - "BOOT-INF/lib/jackson-datatype-jsr310-2.12.3.jar"
18 | - "BOOT-INF/lib/jackson-module-parameter-names-2.12.3.jar"
19 | - "BOOT-INF/lib/tomcat-embed-core-9.0.46.jar"
20 | - "BOOT-INF/lib/tomcat-embed-el-9.0.46.jar"
21 | - "BOOT-INF/lib/tomcat-embed-websocket-9.0.46.jar"
22 | - "BOOT-INF/lib/spring-web-5.3.7.jar"
23 | - "BOOT-INF/lib/spring-beans-5.3.7.jar"
24 | - "BOOT-INF/lib/spring-webmvc-5.3.7.jar"
25 | - "BOOT-INF/lib/spring-aop-5.3.7.jar"
26 | - "BOOT-INF/lib/spring-expression-5.3.7.jar"
27 | - "BOOT-INF/lib/aspectjweaver-1.9.6.jar"
28 | - "BOOT-INF/lib/mybatis-plus-boot-starter-3.0.5.jar"
29 | - "BOOT-INF/lib/mybatis-plus-3.0.5.jar"
30 | - "BOOT-INF/lib/mybatis-plus-extension-3.0.5.jar"
31 | - "BOOT-INF/lib/mybatis-plus-core-3.0.5.jar"
32 | - "BOOT-INF/lib/mybatis-plus-annotation-3.0.5.jar"
33 | - "BOOT-INF/lib/jsqlparser-1.2.jar"
34 | - "BOOT-INF/lib/mybatis-spring-1.3.2.jar"
35 | - "BOOT-INF/lib/mybatis-3.4.6.jar"
36 | - "BOOT-INF/lib/mybatis-plus-generator-3.0.5.jar"
37 | - "BOOT-INF/lib/HikariCP-4.0.3.jar"
38 | - "BOOT-INF/lib/spring-jdbc-5.3.7.jar"
39 | - "BOOT-INF/lib/spring-tx-5.3.7.jar"
40 | - "BOOT-INF/lib/springfox-swagger2-2.9.2.jar"
41 | - "BOOT-INF/lib/swagger-annotations-1.5.20.jar"
42 | - "BOOT-INF/lib/swagger-models-1.5.20.jar"
43 | - "BOOT-INF/lib/jackson-annotations-2.12.3.jar"
44 | - "BOOT-INF/lib/springfox-spi-2.9.2.jar"
45 | - "BOOT-INF/lib/springfox-core-2.9.2.jar"
46 | - "BOOT-INF/lib/springfox-schema-2.9.2.jar"
47 | - "BOOT-INF/lib/springfox-swagger-common-2.9.2.jar"
48 | - "BOOT-INF/lib/springfox-spring-web-2.9.2.jar"
49 | - "BOOT-INF/lib/guava-20.0.jar"
50 | - "BOOT-INF/lib/classmate-1.5.1.jar"
51 | - "BOOT-INF/lib/slf4j-api-1.7.30.jar"
52 | - "BOOT-INF/lib/spring-plugin-core-1.2.0.RELEASE.jar"
53 | - "BOOT-INF/lib/spring-plugin-metadata-1.2.0.RELEASE.jar"
54 | - "BOOT-INF/lib/mapstruct-1.2.0.Final.jar"
55 | - "BOOT-INF/lib/springfox-swagger-ui-2.9.2.jar"
56 | - "BOOT-INF/lib/mysql-connector-java-8.0.25.jar"
57 | - "BOOT-INF/lib/spring-boot-jarmode-layertools-2.5.0.jar"
58 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/layers.idx:
--------------------------------------------------------------------------------
1 | - "dependencies":
2 | - "BOOT-INF/lib/"
3 | - "spring-boot-loader":
4 | - "org/"
5 | - "snapshot-dependencies":
6 | - "application":
7 | - "BOOT-INF/classes/"
8 | - "BOOT-INF/classpath.idx"
9 | - "BOOT-INF/layers.idx"
10 | - "META-INF/"
11 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/HikariCP-4.0.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/HikariCP-4.0.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/aspectjweaver-1.9.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/aspectjweaver-1.9.6.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/byte-buddy-1.10.22.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/byte-buddy-1.10.22.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/classmate-1.5.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/classmate-1.5.1.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/guava-20.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/guava-20.0.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-annotations-2.12.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-annotations-2.12.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-core-2.12.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-core-2.12.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-databind-2.12.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-databind-2.12.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-datatype-jdk8-2.12.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-datatype-jdk8-2.12.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-datatype-jsr310-2.12.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-datatype-jsr310-2.12.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-module-parameter-names-2.12.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jackson-module-parameter-names-2.12.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jsqlparser-1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jsqlparser-1.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/jul-to-slf4j-1.7.30.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/jul-to-slf4j-1.7.30.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/log4j-api-2.14.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/log4j-api-2.14.1.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/log4j-to-slf4j-2.14.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/log4j-to-slf4j-2.14.1.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/logback-classic-1.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/logback-classic-1.2.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/logback-core-1.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/logback-core-1.2.3.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mapstruct-1.2.0.Final.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mapstruct-1.2.0.Final.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-3.4.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-3.4.6.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-3.0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-3.0.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-annotation-3.0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-annotation-3.0.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-boot-starter-3.0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-boot-starter-3.0.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-core-3.0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-core-3.0.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-extension-3.0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-extension-3.0.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-generator-3.0.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-plus-generator-3.0.5.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-spring-1.3.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mybatis-spring-1.3.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/mysql-connector-java-8.0.25.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/mysql-connector-java-8.0.25.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/slf4j-api-1.7.30.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/slf4j-api-1.7.30.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/snakeyaml-1.28.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/snakeyaml-1.28.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-aop-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-aop-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-beans-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-beans-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-boot-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-boot-2.5.0.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-boot-autoconfigure-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-boot-autoconfigure-2.5.0.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-boot-jarmode-layertools-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-boot-jarmode-layertools-2.5.0.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-context-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-context-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-core-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-core-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-expression-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-expression-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-jcl-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-jcl-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-jdbc-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-jdbc-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-plugin-core-1.2.0.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-plugin-core-1.2.0.RELEASE.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-plugin-metadata-1.2.0.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-plugin-metadata-1.2.0.RELEASE.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-tx-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-tx-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-web-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-web-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/spring-webmvc-5.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/spring-webmvc-5.3.7.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-core-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-core-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-schema-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-schema-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-spi-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-spi-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-spring-web-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-spring-web-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-swagger-common-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-swagger-common-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-swagger-ui-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-swagger-ui-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-swagger2-2.9.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/springfox-swagger2-2.9.2.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/swagger-annotations-1.5.20.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/swagger-annotations-1.5.20.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/swagger-models-1.5.20.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/swagger-models-1.5.20.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/tomcat-embed-core-9.0.46.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/tomcat-embed-core-9.0.46.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/tomcat-embed-el-9.0.46.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/tomcat-embed-el-9.0.46.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/BOOT-INF/lib/tomcat-embed-websocket-9.0.46.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/BOOT-INF/lib/tomcat-embed-websocket-9.0.46.jar
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Spring-Boot-Classpath-Index: BOOT-INF/classpath.idx
3 | Implementation-Title: demo
4 | Implementation-Version: 0.0.1-SNAPSHOT
5 | Spring-Boot-Layers-Index: BOOT-INF/layers.idx
6 | Start-Class: com.example.demo.DemoApplication
7 | Spring-Boot-Classes: BOOT-INF/classes/
8 | Spring-Boot-Lib: BOOT-INF/lib/
9 | Build-Jdk-Spec: 1.8
10 | Spring-Boot-Version: 2.5.0
11 | Created-By: Maven Jar Plugin 3.2.0
12 | Main-Class: org.springframework.boot.loader.JarLauncher
13 |
14 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/META-INF/maven/com.example/demo/pom.properties:
--------------------------------------------------------------------------------
1 | artifactId=demo
2 | groupId=com.example
3 | version=0.0.1-SNAPSHOT
4 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/META-INF/maven/com.example/demo/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.5.0
9 |
10 |
11 | com.example
12 | demo
13 | 0.0.1-SNAPSHOT
14 | jar
15 | demo
16 | Demo project for Spring Boot
17 |
18 | 1.8
19 |
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter
24 |
25 |
26 |
27 | org.projectlombok
28 | lombok
29 | true
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-test
34 | test
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-starter-web
44 |
45 |
46 | org.aspectj
47 | aspectjweaver
48 | 1.9.6
49 |
50 |
51 |
52 | com.baomidou
53 | mybatis-plus-boot-starter
54 | 3.0.5
55 |
56 |
57 |
58 | io.springfox
59 | springfox-swagger2
60 | 2.9.2
61 |
62 |
63 | io.springfox
64 | springfox-swagger-ui
65 | 2.9.2
66 |
67 |
68 |
69 | mysql
70 | mysql-connector-java
71 |
72 |
73 |
74 |
75 |
76 |
77 | org.springframework.boot
78 | spring-boot-maven-plugin
79 |
80 |
81 |
82 | org.projectlombok
83 | lombok
84 |
85 |
86 |
87 |
88 |
89 | org.apache.maven.plugins
90 | maven-surefire-plugin
91 | 2.22.2
92 |
93 | true
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/ClassPathIndexFile.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/ClassPathIndexFile.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/ExecutableArchiveLauncher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/ExecutableArchiveLauncher.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/JarLauncher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/JarLauncher.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/LaunchedURLClassLoader.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/LaunchedURLClassLoader.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/Launcher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/Launcher.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/MainMethodRunner.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/MainMethodRunner.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/PropertiesLauncher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/PropertiesLauncher.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/WarLauncher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/WarLauncher.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/archive/Archive.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/archive/Archive.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/archive/ExplodedArchive.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/archive/ExplodedArchive.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/archive/JarFileArchive.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/archive/JarFileArchive.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/data/RandomAccessData.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/data/RandomAccessData.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/data/RandomAccessDataFile.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/data/RandomAccessDataFile.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/AbstractJarFile.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/AbstractJarFile.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/AsciiBytes.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/AsciiBytes.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/Bytes.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/Bytes.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryFileHeader.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryParser.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryParser.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryVisitor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/CentralDirectoryVisitor.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/FileHeader.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/FileHeader.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/Handler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/Handler.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarEntry.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarEntry.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarEntryCertification.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarEntryCertification.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarEntryFilter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarEntryFilter.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarFile.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarFile.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarFileEntries.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarFileEntries.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarFileWrapper.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarFileWrapper.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarURLConnection.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/JarURLConnection.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/StringSequence.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/StringSequence.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/ZipInflaterInputStream.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jar/ZipInflaterInputStream.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jarmode/JarMode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jarmode/JarMode.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jarmode/JarModeLauncher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jarmode/JarModeLauncher.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/jarmode/TestJarMode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/jarmode/TestJarMode.class
--------------------------------------------------------------------------------
/demo/target-demo-0.0.1/org/springframework/boot/loader/util/SystemPropertyUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SpringJasmine/Jasmine/198dad7d671b4de477dfbc2efbb1fee23b056826/demo/target-demo-0.0.1/org/springframework/boot/loader/util/SystemPropertyUtils.class
--------------------------------------------------------------------------------
/src/main/java/ParserSpringMain.java:
--------------------------------------------------------------------------------
1 | import analysis.CreateEdge;
2 | import analysis.ForwardTransformer;
3 | import soot.*;
4 | import soot.options.Options;
5 | import soot.shimple.Shimple;
6 | import utils.GenJimpleUtil;
7 |
8 | import java.io.File;
9 | import java.util.ArrayList;
10 | import java.util.Iterator;
11 | import java.util.List;
12 | import java.util.Objects;
13 |
14 | /**
15 | * Test class for processing Spring framework
16 | */
17 | public class ParserSpringMain {
18 | // Obtain the path of the project and dependent packages to be tested
19 | public static String sourceDirectory = System.getProperty("user.dir") + File.separator + "demo"
20 | + File.separator + "target-demo-0.0.1" + File.separator + "BOOT-INF" + File.separator + "classes";
21 | public static String dependencyDirectory = System.getProperty("user.dir") + File.separator + "demo"
22 | + File.separator + "target-demo-0.0.1" + File.separator + "BOOT-INF" + File.separator + "lib";
23 |
24 | public static void main(String[] args) {
25 | long startTime = System.currentTimeMillis();
26 | initializeSoot(sourceDirectory);
27 |
28 | // processing Spring framework
29 | CreateEdge createEdge = new CreateEdge();
30 | String path = "config.properties";
31 | createEdge.initCallGraph(path);
32 | // print jimple
33 | Iterator iterator = Scene.v().getApplicationClasses().snapshotIterator();
34 | while (iterator.hasNext()) {
35 | SootClass applicationClass = iterator.next();
36 | for (SootMethod method : applicationClass.getMethods()) {
37 | if (!(method.isAbstract() || method.isNative())) {
38 | if (!method.hasActiveBody()) {
39 | method.retrieveActiveBody();
40 | }
41 | Body body = method.getActiveBody();
42 | try {
43 | body = Shimple.v().newBody(body);
44 | method.setActiveBody(body);
45 | } catch (Exception e) {
46 | System.err.println(method);
47 | System.err.println(body);
48 | System.err.println(e);
49 | }
50 | }
51 |
52 | }
53 | GenJimpleUtil.write(applicationClass);
54 | }
55 |
56 | Pack pack = PackManager.v().getPack("cg");
57 | pack.apply();
58 |
59 | pack = PackManager.v().getPack("wjtp");
60 | pack.add(new Transform("wjtp.ForwardTrans", new ForwardTransformer(sourceDirectory)));
61 | pack.apply();
62 |
63 | long endTime = System.currentTimeMillis();
64 | System.out.println("run time: " + (endTime - startTime) / (1000.0) + "s");
65 | }
66 |
67 | public static void initializeSoot(String sourceDirectory) {
68 | G.reset();
69 | List dir = new ArrayList<>();
70 | dir.add(sourceDirectory);
71 |
72 | System.out.println(dir);
73 | Options.v().set_process_dir(dir);
74 | // turn on SPARK and Jasmine
75 | Options.v().setPhaseOption("cg.spark", "on");
76 | Options.v().setPhaseOption("cg.spark", "verbose:true");
77 | Options.v().setPhaseOption("cg.spark", "enabled:true");
78 | Options.v().setPhaseOption("cg.spark", "propagator:worklist");
79 | Options.v().setPhaseOption("cg.spark", "simple-edges-bidirectional:false");
80 | Options.v().setPhaseOption("cg.spark", "on-fly-cg:true");
81 | // Options.v().setPhaseOption("cg.spark", "pre-jimplify:true");
82 | Options.v().setPhaseOption("cg.spark", "double-set-old:hybrid");
83 | Options.v().setPhaseOption("cg.spark", "double-set-new:hybrid");
84 | Options.v().setPhaseOption("cg.spark", "set-impl:double");
85 | Options.v().setPhaseOption("cg.spark", "apponly:true");
86 | Options.v().setPhaseOption("cg.spark", "simple-edges-bidirectional:false");
87 | Options.v().set_verbose(true);
88 |
89 | // turn on CHA
90 | // Options.v().setPhaseOption("cg.cha", "on");
91 | // Options.v().setPhaseOption("cg.cha", "enabled:true");
92 | // Options.v().setPhaseOption("cg.cha", "verbose:true");
93 | // Options.v().setPhaseOption("cg.cha", "apponly:true");
94 | // Options.v().set_verbose(true);
95 |
96 | Options.v().set_whole_program(true);
97 |
98 | Options.v().set_src_prec(Options.src_prec_class);
99 |
100 | Options.v().set_exclude(excludedPackages());
101 | Options.v().set_allow_phantom_refs(true);
102 | Options.v().set_no_bodies_for_excluded(true);
103 |
104 | Options.v().set_keep_line_number(true);
105 | Options.v().set_soot_classpath(getSootClassPath());
106 | Options.v().set_output_format(Options.output_format_jimple);
107 | Scene.v().loadNecessaryClasses();
108 | PhaseOptions.v().setPhaseOption("jb", "use-original-names:true");
109 | }
110 |
111 | private static String getSootClassPath() {
112 | String userdir = System.getProperty("user.dir");
113 | String javaHome = System.getProperty("java.home");
114 | if (javaHome == null || javaHome.equals(""))
115 | throw new RuntimeException("Could not get property java.home!");
116 |
117 | String sootCp = javaHome + File.separator + "lib" + File.separator + "rt.jar";
118 | sootCp += File.pathSeparator + javaHome + File.separator + "lib" + File.separator + "jce.jar";
119 |
120 | File file = new File(dependencyDirectory);
121 | File[] fs = file.listFiles();
122 | if(fs != null){
123 | for (File f : Objects.requireNonNull(fs)) {
124 | if (!f.isDirectory())
125 | sootCp += File.pathSeparator + dependencyDirectory + File.separator + f.getName();
126 | }
127 | }
128 | return sootCp;
129 | }
130 |
131 | private static List excludedPackages() {
132 | List excludedPackages = new ArrayList<>();
133 | excludedPackages.add("javax.swing.*");
134 | excludedPackages.add("java.awt.*");
135 | excludedPackages.add("sun.awt.*");
136 | excludedPackages.add("com.sun.java.swing.*");
137 | excludedPackages.add("reactor.*");
138 | excludedPackages.add("net.sf.cglib.*");
139 | excludedPackages.add("org.springframework.*");
140 | excludedPackages.add("org.apache.poi.*");
141 | excludedPackages.add("com.mysql.*");
142 | excludedPackages.add("org.ehcache.impl.internal.*");
143 | excludedPackages.add("ch.qos.*");
144 | excludedPackages.add("org.apache.*");
145 | excludedPackages.add("org.eclipse.*");
146 | excludedPackages.add("java.util.*");
147 | return excludedPackages;
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/src/main/java/analysis/AOPAnalysis.java:
--------------------------------------------------------------------------------
1 | package analysis;
2 |
3 | import bean.AOPTargetModel;
4 | import bean.AspectModel;
5 | import bean.InsertMethod;
6 | import enums.AdviceEnum;
7 | import mock.MockObject;
8 | import mock.MockObjectImpl;
9 | import soot.*;
10 | import soot.jimple.JimpleBody;
11 | import soot.jimple.internal.JIdentityStmt;
12 | import utils.JimpleUtils;
13 |
14 | import java.util.ArrayList;
15 | import java.util.HashMap;
16 | import java.util.List;
17 | import java.util.Map;
18 |
19 | /**
20 | * @ClassName AOPAnalysis
21 | * @Description Processing of AOP annotations
22 | **/
23 | public class AOPAnalysis {
24 |
25 | private final JimpleUtils jimpleUtils = new JimpleUtils();
26 | public static Map insertMethodMap = new HashMap<>();
27 | public static boolean newVersion = false;
28 |
29 | /**
30 | * Processing advice method and target method
31 | *
32 | * @param targetModel advice method and target method
33 | */
34 | public void processWeave(AOPTargetModel targetModel) {
35 | AOPParser ap = new AOPParser();
36 | // The target method is still used as the actual business logic
37 | SootMethod targetMethod = targetModel.getSootMethod();
38 | SootMethod proxyMethod = targetModel.getProxyMethod();
39 | modifyJimpleBody(proxyMethod);
40 | SootMethod currentMethod = proxyMethod;
41 | SootMethod preMethod = proxyMethod;
42 | AdviceEnum currentEnum = null;
43 |
44 |
45 |
46 | // Process advice method set of target method
47 | for (AspectModel aspectModel : targetModel.getAdvices()) {
48 | switch (aspectModel.getAnnotation()) {
49 | case AOP_AROUND:
50 | preMethod = currentMethod;
51 | SootMethod aroundMethod = ap.aroundParser(aspectModel, targetMethod);
52 | ap.insertAOPAround(currentMethod, aroundMethod);
53 | currentMethod = aroundMethod;
54 | currentEnum = AdviceEnum.AOP_AROUND;
55 | break;
56 | case AOP_BEFORE:
57 | ap.insertAOPBefore(currentMethod, aspectModel.getSootMethod());
58 | break;
59 | case AOP_AFTER:
60 | SootMethod insertTargetMethod;
61 | if (newVersion) {
62 | insertTargetMethod = currentMethod;
63 | } else {
64 | insertTargetMethod = preMethod;
65 | }
66 | ap.insertAOPAfter(insertTargetMethod, aspectModel.getSootMethod());
67 | break;
68 | case AOP_AFTER_RETURNING:
69 | if (newVersion) {
70 | insertTargetMethod = currentMethod;
71 | } else {
72 | insertTargetMethod = preMethod;
73 | }
74 | ap.insertAOPAfterReturning(insertTargetMethod, aspectModel.getSootMethod(), aspectModel.getPointcutExpressions());
75 | break;
76 | case AOP_AFTER_THROWING:
77 | break;
78 | }
79 | }
80 | ap.insertAOPTarget(currentMethod, targetMethod, currentEnum);
81 | }
82 |
83 | /**
84 | * construct function for proxy method
85 | *
86 | * @param method proxy method
87 | */
88 | public void modifyJimpleBody(SootMethod method) {
89 | MockObject mockObject = new MockObjectImpl();
90 | JimpleBody body = (JimpleBody) method.retrieveActiveBody();
91 | List returnList = new ArrayList<>();
92 | List insertPointList = new ArrayList<>();
93 | PatchingChain units = body.getUnits();
94 | units.removeIf(unit -> !(unit instanceof JIdentityStmt || unit.toString().contains("localTarget = this.")));
95 | mockObject.mockJoinPoint(body, units);
96 |
97 | Type returnType = method.getReturnType();
98 | if (returnType instanceof VoidType) {
99 | jimpleUtils.addVoidReturnStmt(units);
100 | } else {
101 | Local returnRef = null;
102 | for (Local local : body.getLocals()) {
103 | if(local.getName().equals("returnRef")){
104 | returnRef = local;
105 | break;
106 | }
107 | }
108 | if(returnRef == null){
109 | returnRef = jimpleUtils.addLocalVar("returnRef", returnType, body);
110 | }
111 | jimpleUtils.addCommonReturnStmt(returnRef, units);
112 | }
113 | returnList.add(units.size() - 1);
114 | insertPointList.add(units.size() - 1);
115 | insertMethodMap.put(method.toString(), new InsertMethod(method, returnList, insertPointList));
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/main/java/analysis/AnnotationAnalysis.java:
--------------------------------------------------------------------------------
1 | package analysis;
2 |
3 | import soot.*;
4 | import soot.tagkit.*;
5 | import soot.util.Chain;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashSet;
9 | import java.util.List;
10 | import java.util.Set;
11 |
12 | /**
13 | * @ClassName AnnotationAnalysis
14 | * @Description Processing of annotations
15 | **/
16 | public class AnnotationAnalysis {
17 | private static volatile AnnotationAnalysis INSTANCE = null;
18 | public static List autoMethodParams = new ArrayList<>();
19 | public static Set mapperPackages = new HashSet<>();
20 | public static Set controllers = new HashSet<>();
21 |
22 | public AnnotationAnalysis() {
23 | }
24 |
25 | public static AnnotationAnalysis getInstance() {
26 | if (INSTANCE == null) {
27 | synchronized (AnnotationAnalysis.class) {
28 | if (INSTANCE == null) {
29 | INSTANCE = new AnnotationAnalysis();
30 | }
31 | }
32 | }
33 | return INSTANCE;
34 | }
35 |
36 | /**
37 | * Getting and returning all the fields of this class according to the class name
38 | *
39 | * @param className class name
40 | * @return fields
41 | */
42 | public Chain getClassFields(String className) {
43 | SootClass sootClass = Scene.v().getSootClass(className);
44 | return sootClass.getFields();
45 | }
46 |
47 | /**
48 | * Getting all annotations on the field
49 | *
50 | * @param field field
51 | * @return the list of annotations on the field
52 | */
53 | public List getFieldTags(SootField field) {
54 | return field.getTags();
55 | }
56 |
57 | /**
58 | * Getting fields with inject annotations, such as @Autowired, etc.
59 | *
60 | * @param field field
61 | * @return If these special annotations are included, return the field. Otherwise,
62 | * return null
63 | */
64 | public SootField getFieldWithSpecialAnnos(SootField field, SootMethod initMethod, boolean ambiguous) {
65 | List fieldTags = getFieldTags(field);
66 | for (Tag fieldTag : fieldTags) {
67 | String strtag = fieldTag.toString();
68 | if (strtag.contains("Autowired")
69 | || strtag.contains("Qualifier")
70 | || strtag.contains("Resource")
71 | || strtag.contains("Inject")) {
72 | return field;
73 | }
74 | }
75 | if (autoMethodParams.contains(field.getType())) {
76 | return field;
77 | }
78 | if (!ambiguous && initMethod.getParameterTypes().contains(field.getType())) {
79 | return field;
80 | }
81 | return null;
82 | }
83 |
84 | public List getParamOfAutoWiredMethod(SootMethod method) {
85 | VisibilityAnnotationTag methodTag = (VisibilityAnnotationTag) method.getTag("VisibilityAnnotationTag");
86 | List parameterTypes = null;
87 | if (methodTag != null) {
88 | for (AnnotationTag annotation : methodTag.getAnnotations()) {
89 | if (annotation.getType().contains("Autowired")) {
90 | parameterTypes = method.getParameterTypes();
91 | break;
92 | }
93 | }
94 | }
95 | return parameterTypes;
96 | }
97 |
98 | /**
99 | * According to the @ComponentScan annotation, function scan those classes need
100 | * to be initialized.
101 | *
102 | * @param ApplicationClass The startup class of the Spring program
103 | */
104 | public void findComponents(SootClass ApplicationClass) {
105 | AnnotationTag annotationScan = hasSpecialAnnotation(ApplicationClass);
106 | if (annotationScan != null) {
107 | for (AnnotationElem elem : annotationScan.getElems()) {
108 | if (elem instanceof AnnotationArrayElem && elem.getName().equals("basePackages")) {
109 | AnnotationArrayElem arrayElem = (AnnotationArrayElem) elem;
110 | for (AnnotationElem value : arrayElem.getValues()) {
111 | if (value instanceof AnnotationStringElem) {
112 | AnnotationStringElem stringElem = (AnnotationStringElem) value;
113 | CreateEdge.componentPackages.add(stringElem.getValue());
114 | }
115 | }
116 | break;
117 | }
118 | }
119 | }
120 | }
121 |
122 | /**
123 | * Get the annotation information that will be included in all classes that need
124 | * to be initialized as Bean.
125 | *
126 | * @param sootClass Class represented by soot
127 | * @return Whether to include the corresponding annotations, 0 means not included,
128 | * 1 means the class is a bean, 1+2 means the class uses the prototype pattern Bean,
129 | * 1+4 (4) means a Mapper, 1+2+4 (2+4) Mapper for prototype pattern.
130 | */
131 | public Integer getAllComponents(SootClass sootClass) {
132 | VisibilityAnnotationTag annotationTags = (VisibilityAnnotationTag) sootClass.getTag("VisibilityAnnotationTag");
133 | int flag = 0;
134 | if (annotationTags != null) {
135 | for (AnnotationTag annotation : annotationTags.getAnnotations()) {
136 | switch (annotation.getType()) {
137 | case "Lorg/springframework/web/bind/annotation/RestController;":
138 | case "Lorg/springframework/web/bind/annotation/Controller;":
139 | case "Lorg/springframework/stereotype/Controller;":
140 | controllers.add(sootClass);
141 | if (!SpringAnnotationTag.isBean(flag)) {
142 | flag += SpringAnnotationTag.BEAN;
143 | }
144 | break;
145 | case "Lorg/apache/ibatis/annotations/Mapper;":
146 | case "Lorg/beetl/sql/core/annotatoin/SqlResource;":
147 | if (!SpringAnnotationTag.isMapper(flag)) {
148 | flag += SpringAnnotationTag.MAPPER;
149 | }
150 | case "Lorg/springframework/stereotype/Component;":
151 | case "Lorg/springframework/context/annotation/Configuration;":
152 | case "Lorg/springframework/stereotype/Repository;":
153 | case "Lorg/springframework/stereotype/Service;":
154 | if (!SpringAnnotationTag.isBean(flag)) {
155 | flag += SpringAnnotationTag.BEAN;
156 | }
157 | break;
158 | case "Lorg/springframework/context/annotation/Scope;":
159 | for (AnnotationElem elem : annotation.getElems()) {
160 | AnnotationStringElem stringElem = (AnnotationStringElem) elem;
161 | if (stringElem.getValue().equals("prototype") && !SpringAnnotationTag.isPrototype(flag)) {
162 | flag += SpringAnnotationTag.PROTOTYPE;
163 | }
164 | }
165 | break;
166 | case "Lorg/mybatis/spring/annotation/MapperScan;":
167 | for (AnnotationElem elem : annotation.getElems()) {
168 | AnnotationArrayElem arrayElem = (AnnotationArrayElem) elem;
169 | for (AnnotationElem value : arrayElem.getValues()) {
170 | AnnotationStringElem asElem = (AnnotationStringElem) value;
171 | mapperPackages.add(asElem.getValue());
172 | }
173 | }
174 | break;
175 | }
176 | }
177 | }
178 | return flag;
179 | }
180 |
181 | /**
182 | * Get all methods that contain @Bean annotations that need to be initialized as bean
183 | *
184 | * @param sootClass Class represented by soot
185 | * @return List of methods that need to be initialized as bean
186 | */
187 | public Set getAllBeans(SootClass sootClass) {
188 | Set allBeans = new HashSet<>();
189 | for (SootMethod method : sootClass.getMethods()) {
190 | VisibilityAnnotationTag annotationTags = (VisibilityAnnotationTag) method.getTag("VisibilityAnnotationTag");
191 | if (annotationTags != null) {
192 | for (AnnotationTag annotation : annotationTags.getAnnotations()) {
193 | if (annotation.getType().equals("Lorg/springframework/context/annotation/Bean;")) {
194 | allBeans.add(method);
195 | SootClass bean = Scene.v().getSootClass(method.getReturnType().toString());
196 | if (bean.isApplicationClass() && !bean.isAbstract()) {
197 | CreateEdge.singletonComponents.add(bean);
198 | CreateEdge.interfaceToBeans.put(bean.getName(), bean);
199 | }
200 | }
201 | }
202 | }
203 | }
204 | return allBeans;
205 | }
206 |
207 | /**
208 | * find whether there is a specified annotation on the specified domain (class, method, field)
209 | *
210 | * @param host Specify the domain (class, method, member variable)
211 | * @return Whether to have specified annotations
212 | */
213 | public AnnotationTag hasSpecialAnnotation(AbstractHost host) {
214 | VisibilityAnnotationTag annotationTags = (VisibilityAnnotationTag) host.getTag("VisibilityAnnotationTag");
215 | if (annotationTags == null) {
216 | return null;
217 | }
218 | for (AnnotationTag annotation : annotationTags.getAnnotations()) {
219 | if (satisfyAnnotation(annotation.getType())) {
220 | return annotation;
221 | }
222 | }
223 | return null;
224 | }
225 |
226 | /**
227 | * find whether the annotation meets the entry point condition---add conditions
228 | * as needed in the followup.
229 | */
230 | private static boolean satisfyAnnotation(String type) {
231 | switch (type) {
232 | case "Lorg/springframework/web/bind/annotation/RequestMapping;":
233 | case "Lorg/springframework/web/bind/annotation/PostMapping;":
234 | case "Lorg/springframework/web/bind/annotation/GetMapping;":
235 | case "Lorg/springframework/web/bind/annotation/PatchMapping;":
236 | case "Lorg/springframework/web/bind/annotation/DeleteMapping;":
237 | case "Lorg/springframework/web/bind/annotation/PutMapping;":
238 | case "Lorg/springframework/web/bind/annotation/RestController;":
239 | case "Lorg/springframework/web/bind/annotation/Controller;":
240 | case "Lorg/springframework/stereotype/Controller;":
241 | return true;
242 | default:
243 | return false;
244 | }
245 | }
246 |
247 |
248 | }
249 |
--------------------------------------------------------------------------------
/src/main/java/analysis/ForwardTransformer.java:
--------------------------------------------------------------------------------
1 | package analysis;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import soot.*;
5 | import soot.jimple.toolkits.callgraph.CallGraph;
6 | import soot.jimple.toolkits.callgraph.Edge;
7 | import soot.jimple.toolkits.callgraph.ReachableMethods;
8 |
9 | import java.util.HashSet;
10 | import java.util.Iterator;
11 | import java.util.Map;
12 | import java.util.Set;
13 |
14 | public class ForwardTransformer extends SceneTransformer {
15 | public static String jarLoc = null;
16 | public static CallGraph cg = null;
17 |
18 | public ForwardTransformer(String jarLoc) {
19 | ForwardTransformer.jarLoc = jarLoc;
20 | }
21 |
22 | @Override
23 | protected void internalTransform(String phaseName, Map map) {
24 |
25 | cg = Scene.v().getCallGraph();
26 | int count = 0;
27 | int clintnum = 0;
28 | Iterator iterator = cg.listener();
29 | while (iterator.hasNext()) {
30 | Edge edge = iterator.next();
31 | JSONObject jsonObject = new JSONObject();
32 |
33 | try {
34 | if (edge.getSrc().method().toString().contains("com.example")
35 | || edge.getTgt().method().toString().contains("com.example")
36 | || edge.getTgt().method().toString().contains("synthetic.method")
37 | || edge.getSrc().method().toString().contains("synthetic.method")) {
38 | jsonObject.put("srcMethod", edge.getSrc().method().toString());
39 | jsonObject.put("tgtMethod", edge.getTgt().method().toString());
40 | System.out.println(jsonObject);
41 | count++;
42 | if (edge.getSrc().method().toString().contains("")
43 | || edge.getTgt().method().toString().contains("")) {
44 | clintnum++;
45 | }
46 | }
47 | } catch (NullPointerException e) {
48 | e.printStackTrace();
49 |
50 | }
51 | }
52 |
53 | for (SootMethod modelFourServiceImpl : Scene.v().getSootClass("FieldFlow").getMethods()) {
54 |
55 | for (Local local : modelFourServiceImpl.retrieveActiveBody().getLocals()) {
56 | System.out.println(local);
57 | PointsToAnalysis points = Scene.v().getPointsToAnalysis();
58 | System.out.println(points.reachingObjects(local));
59 | }
60 | }
61 |
62 | JSONObject jsonObject = new JSONObject();
63 | ReachableMethods reachableMethods = Scene.v().getReachableMethods();
64 | System.out.println("total reachableMethods : " + reachableMethods.size());
65 | Iterator methodIterator = reachableMethods.listener();
66 | Set methods = new HashSet<>();
67 | while (methodIterator.hasNext()) {
68 | MethodOrMethodContext methodOrMethodContext = methodIterator.next();
69 | if (methodOrMethodContext.method().toString().contains("com.example") && !methodOrMethodContext.method().getName().contains("synthetic")) {
70 | methods.add(methodOrMethodContext.method().toString());
71 | }
72 | }
73 | System.out.println("real CG edge: " + count);
74 | System.out.println("clint edge: " + clintnum);
75 | jsonObject.put("ReachableMethods", methods);
76 | System.out.println("reachable Method : " + methods.size());
77 | System.out.println("cg size:" + cg.size());
78 | }
79 | }
--------------------------------------------------------------------------------
/src/main/java/analysis/IOCParser.java:
--------------------------------------------------------------------------------
1 | package analysis;
2 |
3 | import soot.*;
4 | import soot.jimple.JimpleBody;
5 | import soot.jimple.internal.JReturnStmt;
6 | import soot.jimple.internal.JReturnVoidStmt;
7 | import utils.JimpleUtils;
8 |
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 | import java.util.Set;
13 |
14 | public class IOCParser {
15 | private final JimpleUtils jimpleUtils = new JimpleUtils();
16 | private final Map initMap = new HashMap<>();
17 | private final Map potentialImpl = new HashMap<>();
18 |
19 | /**
20 | * classname All objects injected through annotations such as Autowired, and find their specific implementation classes,
21 | * then call the initIOCObject method to initialize these objects by new.
22 | *
23 | * @param sootClass The name of the class to be detected, such as the full class name of ModelOneController
24 | */
25 | public String getIOCObject(SootClass sootClass, Set allBeans) {
26 | AnnotationAnalysis annotationAnalysis = new AnnotationAnalysis();
27 | Hierarchy hierarchy = new Hierarchy();
28 | SootFieldRef sootFieldRef;
29 | String cName = null;
30 | String realType;
31 | String initStr = null;
32 | SootMethod initMethod = null;
33 | boolean ambiguous = false;
34 | try {
35 | initMethod = sootClass.getMethodByName("");
36 | } catch (AmbiguousMethodException amx) {
37 | ambiguous = true;
38 | }
39 | for (SootMethod method : sootClass.getMethods()) {
40 | List paramOfAutoWiredMethod = annotationAnalysis.getParamOfAutoWiredMethod(method);
41 | if (paramOfAutoWiredMethod != null) {
42 | AnnotationAnalysis.autoMethodParams.addAll(paramOfAutoWiredMethod);
43 | }
44 | if (ambiguous && method.getName().equals("")) {
45 | initMethod = method;
46 | break;
47 | }
48 | }
49 |
50 | for (SootField classField : sootClass.getFields()) {
51 | SootField field = annotationAnalysis.getFieldWithSpecialAnnos(classField, initMethod, ambiguous);
52 | if (field != null) {
53 | sootFieldRef = field.makeRef();
54 | cName = field.getDeclaringClass().getName();
55 | String vtype = field.getType().toString();
56 | SootClass aClass = CreateEdge.interfaceToBeans.getOrDefault(((RefType) field.getType()).getSootClass().getName(), null);
57 | if (aClass != null && !aClass.isInterface()) {
58 | // Generate dynamic proxy
59 | SootClass beanClass = AOPParser.proxyMap.getOrDefault(aClass.getName(), aClass);
60 | // The type of member variable declaration has an implementation class in the Application program
61 | realType = beanClass.getType().toString();
62 | initStr = mapInitMethod(beanClass, initMap);
63 | assert initMethod != null;
64 | if (beanClass != aClass || CreateEdge.prototypeComponents.contains(aClass)) {
65 | initIOCObjectByPrototype(sootFieldRef, initMethod, vtype, realType, initStr);
66 | continue;
67 | } else {
68 | initIOCObjectBySingleton(sootFieldRef, initMethod, vtype, aClass);
69 | continue;
70 | }
71 | } else {
72 | assert initMethod != null;
73 | SootClass fieldClass = ((RefType) field.getType()).getSootClass();
74 | if (fieldClass.isPhantom()) {
75 | System.out.println("can't find this bean: " + fieldClass.getName() + " in " + sootClass);
76 | continue;
77 | }
78 | if (filterBaseClass(fieldClass)) {
79 | continue;
80 | }
81 | if (!fieldClass.isInterface() && !fieldClass.isAbstract()) {
82 | initStr = mapInitMethod(fieldClass, initMap);
83 | initIOCObjectByPrototype(sootFieldRef, initMethod, vtype, fieldClass.getType().toString(), initStr);
84 | continue;
85 | }
86 | SootClass hierarchyClass = null;
87 | if (potentialImpl.containsKey(fieldClass)) {
88 | hierarchyClass = potentialImpl.get(fieldClass);
89 | } else {
90 | List hierarchyClasses = fieldClass.isInterface() ? hierarchy.getImplementersOf(fieldClass) : hierarchy.getSubclassesOf(fieldClass);
91 | if (hierarchyClasses.size() > 0) {
92 | hierarchyClass = hierarchyClasses.get(0);
93 | potentialImpl.put(fieldClass, hierarchyClass);
94 | }
95 | }
96 | if (hierarchyClass != null) {
97 | initStr = mapInitMethod(hierarchyClass, initMap);
98 | initIOCObjectByPrototype(sootFieldRef, initMethod, vtype, hierarchyClass.getType().toString(), initStr);
99 | continue;
100 | } else {
101 | System.out.println("can't find this bean: " + fieldClass.getName() + " in " + sootClass);
102 | }
103 | }
104 |
105 | // Dealing with methods annotated with @Bean
106 | for (SootMethod bean : allBeans) {
107 | PatchingChain units = bean.retrieveActiveBody().getUnits();
108 | RefType returnType = null;
109 | SootClass returnClass = null;
110 | if (!(bean.getReturnType() instanceof VoidType) && (field.getType().equals(bean.getReturnType())
111 | || ((RefType) bean.getReturnType()).getSootClass().getInterfaces()
112 | .contains(((RefType) bean.getReturnType()).getSootClass()))) {
113 | for (Unit unit : units) {
114 | if (unit instanceof JReturnStmt) {
115 | // Find the type of object actually returned by return, and use it as a member variable of the user to initialize the object
116 | returnType = (RefType) ((JReturnStmt) unit).getOpBox().getValue().getType();
117 | returnClass = returnType.getSootClass();
118 | break;
119 | }
120 | }
121 | assert initMethod != null;
122 | if (returnClass == null
123 | || returnClass.isInterface() || returnClass.isAbstract()
124 | || returnClass.getMethodUnsafe("void ()") == null) {
125 | initStr = bean.getDeclaringClass().getMethodByNameUnsafe("").toString();
126 | String callStr = bean.toString();
127 | initIOCObjectByPrototype(sootFieldRef, initMethod, vtype, bean.getDeclaringClass().toString(), initStr, callStr);
128 | break;
129 | }
130 | initStr = returnClass.getMethodUnsafe("void ()").toString();
131 | realType = returnType.toString();
132 | initIOCObjectByPrototype(sootFieldRef, initMethod, vtype, realType, initStr);
133 | break;
134 | }
135 | }
136 | }
137 | }
138 | return cName;
139 | }
140 |
141 | private boolean filterBaseClass(SootClass sc) {
142 | switch (sc.getName()) {
143 | // case "java.lang.Integer":
144 | // case "java.lang.Long":
145 | // case "java.lang.Float":
146 | // case "java.lang.Double":
147 | // case "java.lang.Boolean":
148 | // case "java.lang.Byte":
149 | case "java.lang.String":
150 | return true;
151 | default:
152 | return false;
153 | }
154 | }
155 |
156 | private String mapInitMethod(SootClass sootClass, Map initMap) {
157 | String initStr = null;
158 | if (initMap.containsKey(sootClass)) {
159 | initStr = initMap.get(sootClass);
160 | } else {
161 | try {
162 | initStr = sootClass.getMethod("void ()").toString();
163 | } catch (RuntimeException runtimeException) {
164 | try {
165 | initStr = sootClass.getMethodByName("").toString();
166 | } catch (AmbiguousMethodException ame) {
167 | for (SootMethod method : sootClass.getMethods()) {
168 | if (method.getName().equals("")) {
169 | initStr = method.toString();
170 | break;
171 | }
172 | }
173 | }
174 | }
175 | initMap.put(sootClass, initStr);
176 | }
177 | return initStr;
178 | }
179 |
180 | private void initIOCObjectByPrototype(SootFieldRef sootFieldRef, SootMethod initMethod, String vtype, String declType, String initStr, String callStr) {
181 | Local tmpRef = jimpleUtils.newLocalVar(vtype.substring(vtype.lastIndexOf(".") + 1).toLowerCase(), RefType.v(vtype));
182 | Local declRef = jimpleUtils.newLocalVar(declType.substring(declType.lastIndexOf(".") + 1).toLowerCase(), RefType.v(declType));
183 | JimpleBody body = (JimpleBody) initMethod.retrieveActiveBody();
184 | Local thisRef = body.getThisLocal();
185 | if (!body.getLocals().contains(tmpRef)) {
186 | body.getLocals().add(tmpRef);
187 | }
188 |
189 | if (!body.getLocals().contains(declRef)) {
190 | body.getLocals().add(declRef);
191 | }
192 | PatchingChain units = body.getUnits();
193 | units.removeIf(unit -> unit instanceof JReturnVoidStmt);
194 |
195 | jimpleUtils.createAssignStmt(declRef, jimpleUtils.createNewExpr(declType), units);
196 | units.add(jimpleUtils.specialCallStatement(declRef, initStr));
197 | SootMethod toCall2 = Scene.v().getMethod(callStr);
198 | jimpleUtils.createAssignStmt(tmpRef, jimpleUtils.createVirtualInvokeExpr(declRef, toCall2), units);
199 | if (!sootFieldRef.isStatic()) {
200 | jimpleUtils.createAssignStmt(jimpleUtils.createInstanceFieldRef(thisRef, sootFieldRef), tmpRef, units);
201 | }
202 | jimpleUtils.addVoidReturnStmt(units);
203 | }
204 |
205 | /**
206 | * It is used to use new in the method of the detected class to instantiate those objects constructed by injection (corresponding to the prototype mode in Spring).
207 | *
208 | * @param sootFieldRef Form the information of the constructed object
209 | * @param vtype The declared type, that is, the full class name of the interface
210 | * @param realType The real type, which is the full type name of the interface implementation class
211 | * @param initStr The init method of the real type. To instantiate this object, you need to call its init method
212 | */
213 | public void initIOCObjectByPrototype(SootFieldRef sootFieldRef, SootMethod initMethod, String vtype, String realType, String initStr) {
214 | JimpleBody body = (JimpleBody) initMethod.retrieveActiveBody();
215 | Local thisRef = body.getThisLocal();
216 | Local tmpRef = jimpleUtils.addLocalVar(vtype.substring(vtype.lastIndexOf(".") + 1).toLowerCase(),
217 | vtype,
218 | body);
219 | PatchingChain units = body.getUnits();
220 | units.removeIf(unit -> unit instanceof JReturnVoidStmt);
221 | jimpleUtils.createAssignStmt(tmpRef, jimpleUtils.createNewExpr(realType), units);
222 |
223 | units.add(jimpleUtils.specialCallStatement(tmpRef, initStr));
224 |
225 | if (!sootFieldRef.isStatic()) {
226 | jimpleUtils.createAssignStmt(jimpleUtils.createInstanceFieldRef(thisRef, sootFieldRef), tmpRef, units);
227 | jimpleUtils.addVoidReturnStmt(units);
228 | }
229 |
230 | }
231 |
232 | /**
233 | * Used in the method of the detected class, using the global singleton factory to construct objects (singleton mode) by injection.
234 | *
235 | * @param sootFieldRef Form the information of the constructed object
236 | * @param vtype The declared type, that is, the full class name of the interface
237 | */
238 | public void initIOCObjectBySingleton(SootFieldRef sootFieldRef, SootMethod initMethod, String vtype, SootClass fieldClass) {
239 | JimpleBody body = (JimpleBody) initMethod.retrieveActiveBody();
240 | Local thisRef = body.getThisLocal();
241 | Local tmpRef = jimpleUtils.addLocalVar(vtype.substring(vtype.lastIndexOf(".") + 1).toLowerCase(),
242 | vtype,
243 | body);
244 | PatchingChain units = body.getUnits();
245 | units.removeIf(unit -> unit instanceof JReturnVoidStmt);
246 |
247 | SootClass singletonFactory = Scene.v().getSootClass("synthetic.method.SingletonFactory");
248 | Value returnValue = jimpleUtils.createStaticInvokeExpr(singletonFactory.getMethod(fieldClass.getName() + " get" + fieldClass.getShortName() + "()"));
249 | jimpleUtils.createAssignStmt(tmpRef, returnValue, units);
250 | try {
251 | jimpleUtils.createAssignStmt(jimpleUtils.createInstanceFieldRef(thisRef, sootFieldRef), tmpRef, units);
252 | } catch (Exception e) {
253 | }
254 | jimpleUtils.addVoidReturnStmt(units);
255 | }
256 | }
257 |
--------------------------------------------------------------------------------
/src/main/java/analysis/SpringAnnotationTag.java:
--------------------------------------------------------------------------------
1 | package analysis;
2 |
3 | /**
4 | * @ClassName SpringAnnotationTag
5 | **/
6 | public class SpringAnnotationTag {
7 | public static final int BEAN = 1;
8 | public static final int PROTOTYPE = 2;
9 | public static final int MAPPER = 4;
10 |
11 | public SpringAnnotationTag() {
12 | }
13 |
14 | public static boolean isBean(int m) {
15 | return (m & 1) != 0;
16 | }
17 |
18 | public static boolean isPrototype(int m) {
19 | return (m & 2) != 0;
20 | }
21 |
22 | public static boolean isMapper(int m) {
23 | return (m & 4) != 0;
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/bean/AOPTargetModel.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import soot.SootClass;
4 | import soot.SootMethod;
5 |
6 | import java.util.ArrayList;
7 | import java.util.HashSet;
8 | import java.util.List;
9 | import java.util.Set;
10 |
11 | public class AOPTargetModel {
12 | private String className;
13 | private String methodName;
14 | private String proxyClassName;
15 | private String proxyMethodName;
16 | // target class
17 | private SootClass sootClass;
18 | // target method
19 | private SootMethod sootMethod;
20 | // proxy class
21 | private SootClass proxyClass;
22 | // proxy method
23 | private SootMethod proxyMethod;
24 | // advice
25 | private List advices = new ArrayList<>();
26 | // Pointcut
27 | private Set pointcuts = new HashSet<>();
28 |
29 | public AOPTargetModel() {
30 | }
31 |
32 | public String getClassName() {
33 | return className;
34 | }
35 |
36 | public void setClassName(String className) {
37 | this.className = className;
38 | }
39 |
40 | public String getMethodName() {
41 | return methodName;
42 | }
43 |
44 | public void setMethodName(String methodName) {
45 | this.methodName = methodName;
46 | }
47 |
48 | public SootClass getSootClass() {
49 | return sootClass;
50 | }
51 |
52 | public void setSootClass(SootClass sootClass) {
53 | this.sootClass = sootClass;
54 | }
55 |
56 | public SootMethod getSootMethod() {
57 | return sootMethod;
58 | }
59 |
60 | public void setSootMethod(SootMethod sootMethod) {
61 | this.sootMethod = sootMethod;
62 | }
63 |
64 | public List getAdvices() {
65 | return advices;
66 | }
67 |
68 | public void setAdvices(List advices) {
69 | this.advices = advices;
70 | }
71 |
72 | public void addAdvice(AspectModel method) {
73 | this.advices.add(method);
74 | }
75 |
76 | public Set getPointcuts() {
77 | return pointcuts;
78 | }
79 |
80 | public void setPointcuts(Set pointcuts) {
81 | this.pointcuts = pointcuts;
82 | }
83 |
84 | public void addPoint(SootMethod method) {
85 | this.pointcuts.add(method);
86 | }
87 |
88 | public SootClass getProxyClass() {
89 | return proxyClass;
90 | }
91 |
92 | public void setProxyClass(SootClass proxyClass) {
93 | this.proxyClass = proxyClass;
94 | }
95 |
96 | public SootMethod getProxyMethod() {
97 | return proxyMethod;
98 | }
99 |
100 | public void setProxyMethod(SootMethod proxyMethod) {
101 | this.proxyMethod = proxyMethod;
102 | }
103 |
104 | public String getProxyClassName() {
105 | return proxyClassName;
106 | }
107 |
108 | public void setProxyClassName(String proxyClassName) {
109 | this.proxyClassName = proxyClassName;
110 | }
111 |
112 | public String getProxyMethodName() {
113 | return proxyMethodName;
114 | }
115 |
116 | public void setProxyMethodName(String proxyMethodName) {
117 | this.proxyMethodName = proxyMethodName;
118 | }
119 |
120 | @Override
121 | public String toString() {
122 | return "AOPTargetModel{" +
123 | "className='" + className + '\'' +
124 | ", methodName='" + methodName + '\'' +
125 | ", proxyClassName='" + proxyClassName + '\'' +
126 | ", proxyMethodName='" + proxyMethodName + '\'' +
127 | ", sootClass=" + sootClass +
128 | ", sootMethod=" + sootMethod +
129 | ", proxyClass=" + proxyClass +
130 | ", proxyMethod=" + proxyMethod +
131 | ", advices=" + advices +
132 | ", pointcuts=" + pointcuts +
133 | '}';
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/src/main/java/bean/AopXMLResultBean.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | public class AopXMLResultBean {
4 | // aspect
5 | private String aopclass;
6 | // advice
7 | private String aopmethod;
8 | // advice type
9 | private String activetype;
10 | // pointcut expression
11 | private String exper;
12 | // order
13 | private int order;
14 |
15 | public int getOrder() {
16 | return order;
17 | }
18 |
19 | public void setOrder(int order) {
20 | this.order = order;
21 | }
22 |
23 | public AopXMLResultBean() {
24 | }
25 |
26 | public AopXMLResultBean(String aopclass, String aopmethod, String activetype, String exper, int order) {
27 | this.aopclass = aopclass;
28 | this.aopmethod = aopmethod;
29 | this.activetype = activetype;
30 | this.exper = exper;
31 | this.order = order;
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "AopXMLResultBean{" +
37 | "aopclass='" + aopclass + '\'' +
38 | ", aopmethod='" + aopmethod + '\'' +
39 | ", activetype='" + activetype + '\'' +
40 | ", exper='" + exper + '\'' +
41 | ", order=" + order +
42 | '}';
43 | }
44 |
45 | public String getAopclass() {
46 | return aopclass;
47 | }
48 |
49 | public void setAopclass(String aopclass) {
50 | this.aopclass = aopclass;
51 | }
52 |
53 | public String getAopmethod() {
54 | return aopmethod;
55 | }
56 |
57 | public void setAopmethod(String aopmethod) {
58 | this.aopmethod = aopmethod;
59 | }
60 |
61 | public String getActivetype() {
62 | return activetype;
63 | }
64 |
65 | public void setActivetype(String activetype) {
66 | this.activetype = activetype;
67 | }
68 |
69 | public String getExper() {
70 | return exper;
71 | }
72 |
73 | public void setExper(String exper) {
74 | this.exper = exper;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/bean/AspectModel.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import enums.AdviceEnum;
4 | import soot.SootClass;
5 | import soot.SootMethod;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 | import java.util.Objects;
10 |
11 | /**
12 | * entity class which contains to advices
13 | */
14 | public class AspectModel implements Comparable {
15 | // The aspect of advice
16 | private SootClass sootClass;
17 | // @Order value
18 | private int order;
19 | // pointcut expression
20 | private List pointcutExpressions = new ArrayList<>();
21 | // advice
22 | private SootMethod sootMethod;
23 | // the type of advice(@Around, @Before, @After)
24 | private AdviceEnum annotation;
25 |
26 | public AspectModel(SootClass sootClass, int order) {
27 | this.sootClass = sootClass;
28 | this.order = order;
29 | }
30 |
31 | public AspectModel(SootClass sootClass, int order, SootMethod sootMethod) {
32 | this.sootClass = sootClass;
33 | this.order = order;
34 | this.sootMethod = sootMethod;
35 | }
36 |
37 | public AspectModel() {
38 | }
39 |
40 | public SootClass getSootClass() {
41 | return sootClass;
42 | }
43 |
44 | public void setSootClass(SootClass sootClass) {
45 | this.sootClass = sootClass;
46 | }
47 |
48 | public int getOrder() {
49 | return order;
50 | }
51 |
52 | public void setOrder(int order) {
53 | this.order = order;
54 | }
55 |
56 | public void setPointcutExpressions(List pointcutExpressions) {
57 | this.pointcutExpressions = pointcutExpressions;
58 | }
59 |
60 | /**
61 | * add pointcut expression
62 | *
63 | * @param pointcutExpression pointcut expression
64 | */
65 | public void addPointcutExpressions(String pointcutExpression) {
66 | this.pointcutExpressions.add(pointcutExpression);
67 | }
68 |
69 | public List getPointcutExpressions() {
70 | return pointcutExpressions;
71 | }
72 |
73 | public SootMethod getSootMethod() {
74 | return sootMethod;
75 | }
76 |
77 | public void setSootMethod(SootMethod sootMethod) {
78 | this.sootMethod = sootMethod;
79 | }
80 |
81 | public AdviceEnum getAnnotation() {
82 | return annotation;
83 | }
84 |
85 | public void setAnnotation(AdviceEnum annotation) {
86 | this.annotation = annotation;
87 | }
88 |
89 | /**
90 | * According to the order value, sort from largest to smallest. The smaller
91 | * the order value, the higher the priority. If the order is the same, it
92 | * will be sorted by name, and then sorted by advice type.
93 | *
94 | * @param o Priority comparison object
95 | * @return
96 | */
97 | @Override
98 | public int compareTo(AspectModel o) {
99 | if (o.order - this.order > 0) {
100 | return -1;
101 | } else if (o.order - this.order < 0) {
102 | return 1;
103 | } else if (this.getSootClass().getName().compareTo(o.getSootClass().getName()) > 0) {
104 | return 1;
105 | } else if (this.getSootClass().getName().compareTo(o.getSootClass().getName()) < 0) {
106 | return -1;
107 | } else {
108 | return this.getAnnotation().ordinal() - o.getAnnotation().ordinal();
109 | }
110 | }
111 |
112 | @Override
113 | public String toString() {
114 | return "AspectModel{" +
115 | "sootClass=" + sootClass +
116 | ", order=" + order +
117 | ", pointcutExpression='" + pointcutExpressions + '\'' +
118 | ", sootMethod=" + sootMethod +
119 | ", annotation='" + annotation + '\'' +
120 | '}';
121 | }
122 |
123 | @Override
124 | public boolean equals(Object o) {
125 | if (this == o) return true;
126 | if (o == null || getClass() != o.getClass()) return false;
127 | AspectModel that = (AspectModel) o;
128 | return order == that.order &&
129 | Objects.equals(sootClass, that.sootClass) &&
130 | Objects.equals(pointcutExpressions, that.pointcutExpressions) &&
131 | Objects.equals(sootMethod, that.sootMethod) &&
132 | annotation == that.annotation;
133 | }
134 |
135 | @Override
136 | public int hashCode() {
137 | return Objects.hash(sootClass, order, pointcutExpressions, sootMethod, annotation);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/src/main/java/bean/ConstructorArgBean.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 |
4 | public class ConstructorArgBean {
5 | private String argName;
6 | private Integer argIndex;
7 | private String argType;
8 | private String refType;
9 | private String argValue;
10 | private String clazzName;
11 |
12 | @Override
13 | public String toString() {
14 | return "ConstructorArgBean{" +
15 | "argName='" + argName + '\'' +
16 | ", argIndex=" + argIndex +
17 | ", argType='" + argType + '\'' +
18 | ", refType='" + refType + '\'' +
19 | ", argValue='" + argValue + '\'' +
20 | ", clazzName='" + clazzName + '\'' +
21 | '}';
22 | }
23 |
24 | public String getArgName() {
25 | return argName;
26 | }
27 |
28 | public void setArgName(String argName) {
29 | this.argName = argName;
30 | }
31 |
32 | public Integer getArgIndex() {
33 | return argIndex;
34 | }
35 |
36 | public void setArgIndex(Integer argIndex) {
37 | this.argIndex = argIndex;
38 | }
39 |
40 | public String getArgType() {
41 | return argType;
42 | }
43 |
44 | public void setArgType(String argType) {
45 | this.argType = argType;
46 | }
47 |
48 | public String getRefType() {
49 | return refType;
50 | }
51 |
52 | public void setRefType(String refType) {
53 | this.refType = refType;
54 | }
55 |
56 | public String getArgValue() {
57 | return argValue;
58 | }
59 |
60 | public void setArgValue(String argValue) {
61 | this.argValue = argValue;
62 | }
63 |
64 | public String getClazzName() {
65 | return clazzName;
66 | }
67 |
68 | public void setClazzName(String clazzName) {
69 | this.clazzName = clazzName;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/bean/InsertMethod.java:
--------------------------------------------------------------------------------
1 | package bean;
2 |
3 | import soot.SootMethod;
4 |
5 | import java.util.List;
6 |
7 |
8 | public class InsertMethod {
9 | private SootMethod sootMethod;
10 | private List returnList;
11 | private List insertPointList;
12 | private List pjpList;
13 |
14 | public InsertMethod() {
15 | }
16 |
17 | public InsertMethod(SootMethod sootMethod, List returnList) {
18 | this.sootMethod = sootMethod;
19 | this.returnList = returnList;
20 | }
21 |
22 | public InsertMethod(SootMethod sootMethod, List returnList, List insertPointList) {
23 | this.sootMethod = sootMethod;
24 | this.returnList = returnList;
25 | this.insertPointList = insertPointList;
26 | }
27 |
28 | public InsertMethod(SootMethod sootMethod, List returnList, List insertPointList, List pjpList) {
29 | this.sootMethod = sootMethod;
30 | this.returnList = returnList;
31 | this.insertPointList = insertPointList;
32 | this.pjpList = pjpList;
33 | }
34 |
35 | public SootMethod getSootMethod() {
36 | return sootMethod;
37 | }
38 |
39 | public void setSootMethod(SootMethod sootMethod) {
40 | this.sootMethod = sootMethod;
41 | }
42 |
43 | public List getReturnList() {
44 | return returnList;
45 | }
46 |
47 | public void setReturnList(List returnList) {
48 | this.returnList = returnList;
49 | }
50 |
51 | public List getInsertPointList() {
52 | return insertPointList;
53 | }
54 |
55 | public void setInsertPointList(List insertPointList) {
56 | this.insertPointList = insertPointList;
57 | }
58 |
59 | public List getPjpList() {
60 | return pjpList;
61 | }
62 |
63 | public void setPjpList(List pjpList) {
64 | this.pjpList = pjpList;
65 | }
66 |
67 | @Override
68 | public String toString() {
69 | return "InsertMethod{" +
70 | "sootMethod=" + sootMethod +
71 | ", returnList=" + returnList +
72 | ", insertPointList=" + insertPointList +
73 | ", pjpList=" + pjpList +
74 | '}';
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/enums/AdviceEnum.java:
--------------------------------------------------------------------------------
1 | package enums;
2 |
3 | public enum AdviceEnum implements EnumMessage {
4 | AOP_AROUND("Lorg/aspectj/lang/annotation/Around;", "@Around"),
5 | AOP_BEFORE("Lorg/aspectj/lang/annotation/Before;", "@Before"),
6 | AOP_AFTER_RETURNING("Lorg/aspectj/lang/annotation/AfterReturning;", "@AfterReturning"),
7 | AOP_AFTER_THROWING("Lorg/aspectj/lang/annotation/AfterThrowing;", "@AfterThrowing"),
8 | AOP_AFTER("Lorg/aspectj/lang/annotation/After;", "@After");
9 |
10 |
11 | private String annotationClassName;
12 | private String annotation;
13 |
14 | AdviceEnum(String annotationClassName, String annotation) {
15 | this.annotationClassName = annotationClassName;
16 | this.annotation = annotation;
17 | }
18 |
19 | public String getAnnotationClassName() {
20 | return annotationClassName;
21 | }
22 |
23 | public void setAnnotationClassName(String annotationClassName) {
24 | this.annotationClassName = annotationClassName;
25 | }
26 |
27 | public String getAnnotation() {
28 | return annotation;
29 | }
30 |
31 | public void setAnnotation(String annotation) {
32 | this.annotation = annotation;
33 | }
34 |
35 |
36 | @Override
37 | public Object getValue() {
38 | return annotationClassName;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/enums/EnumMessage.java:
--------------------------------------------------------------------------------
1 | package enums;
2 |
3 | public interface EnumMessage {
4 | Object getValue();
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/mock/GenerateSyntheticClass.java:
--------------------------------------------------------------------------------
1 | package mock;
2 |
3 | import bean.ConstructorArgBean;
4 | import soot.SootClass;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 | import java.util.Set;
9 |
10 | /**
11 | * @ClassName GenerateSyntheticClass
12 | * @Description Generate synthetic classes for all interfaces or abstract classes for
13 | * which no concrete implementation class can be found
14 | **/
15 | public interface GenerateSyntheticClass {
16 | /**
17 | * Generate a custom JoinPoint implementation class
18 | *
19 | * @param abstractClass An abstract class that requires a concrete implementation class
20 | * @return Implementation class of the generated JoinPoint
21 | */
22 | SootClass generateJoinPointImpl(SootClass abstractClass);
23 |
24 | /**
25 | * Generate a custom Mapper implementation class
26 | *
27 | * @param interfaceClass Need to concretely implement the interface of the class
28 | * @return Implementation class of the generated Mapper
29 | */
30 | SootClass generateMapperImpl(SootClass interfaceClass);
31 |
32 | /**
33 | * Simulate Spring AOP mechanism to generate proxy for each target class
34 | *
35 | * @param sootClass The target class or interface that needs to generate the proxy
36 | * @return proxy class
37 | */
38 | SootClass generateProxy(SootClass sootClass);
39 |
40 | /**
41 | * Simulate a singleton factory in Spring
42 | *
43 | * @param beans the bean that need to generate with singleton
44 | */
45 | void generateSingletonBeanFactory(Set beans, Map> collect);
46 |
47 | /**
48 | * Simulate the implementation of HttpServlet
49 | * @param abstractClass The target class or interface that needs to generate the proxy
50 | * @return HttpServlet implementation class
51 | */
52 | SootClass generateHttpServlet(SootClass abstractClass);
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/mock/GenerateSyntheticClassImpl.java:
--------------------------------------------------------------------------------
1 | package mock;
2 |
3 | import analysis.CreateEdge;
4 | import bean.ConstructorArgBean;
5 | import soot.*;
6 | import soot.jimple.JimpleBody;
7 | import soot.jimple.internal.JIdentityStmt;
8 | import soot.util.Chain;
9 | import utils.JimpleUtils;
10 |
11 | import java.util.*;
12 |
13 | /**
14 | * @ClassName GenerateSyntheticClassImpl
15 | * @Description Generate synthetic classes for all interfaces or abstract classes for
16 | * which no concrete implementation class can be found
17 | **/
18 | public class GenerateSyntheticClassImpl implements GenerateSyntheticClass {
19 |
20 | private final JimpleUtils jimpleUtils = new JimpleUtils();
21 | private static final Map syntheticMethodImpls = new HashMap<>();
22 | private Map> classMethodsMap = new HashMap<>();
23 |
24 | /**
25 | * Generate a custom JoinPoint implementation class
26 | *
27 | * @param abstractClass An abstract class that requires a concrete implementation class
28 | * @return Implementation class of the generated JoinPoint
29 | */
30 | @Override
31 | public SootClass generateJoinPointImpl(SootClass abstractClass) {
32 | SootClass customImplClass;
33 | String implClassName = "synthetic.method." + abstractClass.getShortName() + "Impl";
34 | if (syntheticMethodImpls.containsKey(implClassName)) {
35 | customImplClass = syntheticMethodImpls.get(implClassName);
36 | } else {
37 | customImplClass = createSubClass(implClassName, abstractClass, Scene.v().getSootClass("java.lang.Object"));
38 | customImplClass.addInterface(Scene.v().getSootClass("org.aspectj.lang.JoinPoint"));
39 | Scene.v().addClass(customImplClass);
40 | // If this line is not added, it will cause spark analysis to ignore the corresponding custom class
41 | customImplClass.setApplicationClass();
42 | SootField field = new SootField("args", ArrayType.v(RefType.v("java.lang.Object"), 1));
43 | customImplClass.addField(field);
44 | SootMethod initMethod = jimpleUtils.genDefaultConstructor(customImplClass);
45 | customImplClass.addMethod(initMethod);
46 |
47 | for (SootClass anInterface : customImplClass.getInterfaces()) {
48 | implCommonMethod(customImplClass, anInterface);
49 | }
50 | for (SootClass abstractClassInterface : abstractClass.getInterfaces()) {
51 | implCommonMethod(customImplClass, abstractClassInterface);
52 | }
53 | customImplClass.addMethod(jimpleUtils.genCustomMethod(customImplClass,
54 | "setArgs_synthetic",
55 | Arrays.asList(new Type[]{ArrayType.v(RefType.v("java.lang.Object"), 1)}),
56 | VoidType.v()));
57 | syntheticMethodImpls.put(implClassName, customImplClass);
58 | }
59 | return customImplClass;
60 | }
61 |
62 | /**
63 | * Generate a custom Mapper implementation class
64 | *
65 | * @param interfaceClass Need to concretely implement the interface of the class
66 | * @return Implementation class of the generated Mapper
67 | */
68 | @Override
69 | public SootClass generateMapperImpl(SootClass interfaceClass) {
70 | SootClass mapperImplClass;
71 | String implClassName = "synthetic.method." + interfaceClass.getShortName() + "Impl";
72 | if (syntheticMethodImpls.containsKey(implClassName)) {
73 | mapperImplClass = syntheticMethodImpls.get(implClassName);
74 | } else {
75 | mapperImplClass = createSubClass(implClassName, interfaceClass, Scene.v().getSootClass("java.lang.Object"));
76 | Scene.v().addClass(mapperImplClass);
77 | mapperImplClass.setApplicationClass();
78 | SootMethod initMethod = jimpleUtils.genDefaultConstructor(mapperImplClass);
79 | mapperImplClass.addMethod(initMethod);
80 | implCommonMethod(mapperImplClass, interfaceClass);
81 | syntheticMethodImpls.put(implClassName, mapperImplClass);
82 | }
83 | return mapperImplClass;
84 | }
85 |
86 | /**
87 | * Simulate Spring AOP mechanism to generate proxy for each target class
88 | *
89 | * @param targetSootClass The target class or interface that needs to generate the proxy
90 | * @return proxy class
91 | */
92 | @Override
93 | public SootClass generateProxy(SootClass targetSootClass) {
94 | SootClass proxyClass;
95 | String proxyClassName = targetSootClass.getName() + "$$SpringCGLIB";// + targetSootClass.hashCode();
96 | if (syntheticMethodImpls.containsKey(proxyClassName)) {
97 | proxyClass = syntheticMethodImpls.get(proxyClassName);
98 | } else {
99 | boolean isInterface = targetSootClass.isInterface();
100 | if (isInterface) {
101 | proxyClass = createSubClass(proxyClassName, targetSootClass, Scene.v().getSootClass("java.lang.Object"));
102 | } else {
103 | proxyClass = createSubClass(proxyClassName, null, targetSootClass);
104 | }
105 | Scene.v().addClass(proxyClass);
106 | SootField field = new SootField("target", targetSootClass.getType());
107 | proxyClass.addField(field);
108 | proxyClass.setApplicationClass();
109 | SootMethod initMethod =null;
110 | if(CreateEdge.prototypeComponents.contains(proxyClass)){
111 | initMethod = jimpleUtils.genDefaultConstructor(proxyClass, field, false);
112 | }else {
113 | initMethod = jimpleUtils.genDefaultConstructor(proxyClass, field, true);
114 | }
115 |
116 | proxyClass.addMethod(initMethod);
117 | if (isInterface) {
118 | implCommonMethod(proxyClass, targetSootClass);
119 | } else {
120 | extendCommonMethod(proxyClass, targetSootClass);
121 | }
122 | syntheticMethodImpls.put(proxyClassName, proxyClass);
123 | }
124 | return proxyClass;
125 | }
126 |
127 | /**
128 | * Simulate a singleton factory in Spring
129 | *
130 | * @param beans the bean that need to generate with singleton
131 | */
132 | @Override
133 | public void generateSingletonBeanFactory(Set beans,Map> collect) {
134 | if(collect !=null && collect.size() > 0){
135 | for (String s : collect.keySet()) {
136 | beans.add(Scene.v().getSootClass(s));
137 | }
138 | }
139 | SootClass singletonFactory;
140 | String singletonFactoryName = "synthetic.method.SingletonFactory";
141 | singletonFactory = createSubClass(singletonFactoryName, null, Scene.v().getSootClass("java.lang.Object"));
142 | Scene.v().addClass(singletonFactory);
143 | singletonFactory.setApplicationClass();
144 | Set fields = new HashSet<>();
145 | for (SootClass bean : beans) {
146 | SootField field = new SootField(bean.getShortName(), bean.getType(), Modifier.PUBLIC + Modifier.STATIC);
147 | fields.add(field);
148 | singletonFactory.addField(field);
149 | singletonFactory.addMethod(jimpleUtils.genStaticCustomMethod(singletonFactory,
150 | "get" + bean.getShortName(),
151 | null,
152 | bean.getType(), field));
153 | }
154 | SootMethod initMethod = jimpleUtils.genDefaultConstructor(singletonFactory, null, false);
155 | singletonFactory.addMethod(initMethod);
156 |
157 | SootMethod clinitMethod = jimpleUtils.genDefaultClinit(singletonFactory, fields,collect);
158 | singletonFactory.addMethod(clinitMethod);
159 | }
160 |
161 | /**
162 | * Simulate the implementation of HttpServlet
163 | * @param abstractClass The target class or interface that needs to generate the proxy
164 | * @return HttpServlet implementation class
165 | */
166 | @Override
167 | public SootClass generateHttpServlet(SootClass abstractClass) {
168 | SootClass customImplClass;
169 | String implClassName = "synthetic.method." + abstractClass.getShortName() + "Impl";
170 | if (syntheticMethodImpls.containsKey(implClassName)) {
171 | customImplClass = syntheticMethodImpls.get(implClassName);
172 | } else {
173 | customImplClass = createSubClass(implClassName, abstractClass, Scene.v().getSootClass("java.lang.Object"));
174 | Scene.v().addClass(customImplClass);
175 | customImplClass.setApplicationClass();
176 | SootMethod initMethod = jimpleUtils.genDefaultConstructor(customImplClass);
177 | customImplClass.addMethod(initMethod);
178 | implCommonMethod(customImplClass, abstractClass);
179 | syntheticMethodImpls.put(implClassName, customImplClass);
180 | }
181 | return customImplClass;
182 | }
183 |
184 | /**
185 | * Initialize a custom class
186 | *
187 | * @param implClassName class name
188 | * @param interfaceClass the interface that need to implement
189 | * @return custom class
190 | */
191 | public SootClass createSubClass(String implClassName, SootClass interfaceClass, SootClass superClass) {
192 | SootClass customImplClass = new SootClass(implClassName);
193 | customImplClass.setResolvingLevel(SootClass.BODIES);
194 | if (interfaceClass != null) {
195 | customImplClass.addInterface(interfaceClass);
196 | }
197 | customImplClass.setModifiers(Modifier.PUBLIC);
198 | customImplClass.setSuperclass(superClass);
199 | return customImplClass;
200 | }
201 |
202 | /**
203 | * Implement interface methods in custom classes
204 | *
205 | * @param customImplClass custom class
206 | * @param interfaceClass the interface that need to implement
207 | */
208 | public void implCommonMethod(SootClass customImplClass, SootClass interfaceClass) {
209 | for (SootMethod method : interfaceClass.getMethods()) {
210 | try {
211 | customImplClass.addMethod(jimpleUtils.genCustomMethod(customImplClass,
212 | method.getName(),
213 | method.getParameterTypes(),
214 | method.getReturnType()));
215 | } catch (RuntimeException ignored) {}
216 | }
217 | for (SootClass superInterface : interfaceClass.getInterfaces()) {
218 | implCommonMethod(customImplClass, superInterface);
219 | }
220 | }
221 |
222 | /**
223 | * Method overridden in a custom class
224 | *
225 | * @param customSubClass custom class
226 | * @param superClass Concrete classes that need to be inherited
227 | */
228 | public void extendCommonMethod(SootClass customSubClass, SootClass superClass) {
229 | for (SootMethod superMethod : superClass.getMethods()) {
230 | if (superMethod.isStatic() || superMethod.isPrivate()
231 | || superMethod.isFinal() || superMethod.getName().contains("")
232 | || superMethod.getName().contains("")) {
233 | continue;
234 | }
235 | SootMethod subMethod = new SootMethod(superMethod.getName(),
236 | superMethod.getParameterTypes(),
237 | superMethod.getReturnType(),
238 | superMethod.getModifiers());
239 | customSubClass.addMethod(subMethod);
240 | JimpleBody subMethodBody = (JimpleBody) superMethod.retrieveActiveBody().clone();
241 | Chain locals = subMethodBody.getLocals();
242 | PatchingChain units = subMethodBody.getUnits();
243 | units.removeIf(unit -> !(unit instanceof JIdentityStmt && unit.toString().contains("@parameter")));
244 | subMethodBody.getTraps().clear();
245 | Set tmplocal = new HashSet<>();
246 | if (units.size() == 0) {
247 | locals.removeIf(Objects::nonNull);
248 | } else {
249 | for (Unit unit : units) {
250 | JIdentityStmt jstmt = (JIdentityStmt) unit;
251 | if(locals.contains(jstmt.getLeftOpBox().getValue())){
252 | tmplocal.add((Local) jstmt.getLeftOpBox().getValue());
253 | }
254 | }
255 | locals.removeIf(local -> !tmplocal.contains(local));
256 | }
257 | Local thisRef = jimpleUtils.addLocalVar("this", customSubClass.getType(), subMethodBody);
258 | jimpleUtils.createIdentityStmt(thisRef, jimpleUtils.createThisRef(customSubClass.getType()), units);
259 | Local returnRef = null;
260 | if (!(subMethod.getReturnType() instanceof VoidType)) {
261 | returnRef = jimpleUtils.addLocalVar("returnRef", subMethod.getReturnType(), subMethodBody);
262 | }
263 | for (SootField field : customSubClass.getFields()) {
264 | Local tmpRef = jimpleUtils.addLocalVar("localTarget", field.getType(), subMethodBody);
265 | jimpleUtils.createAssignStmt(tmpRef, jimpleUtils.createInstanceFieldRef(thisRef, field.makeRef()), units);
266 | if (!(superMethod.getReturnType() instanceof VoidType)) {
267 | Value returnValue = jimpleUtils.createVirtualInvokeExpr(tmpRef, superMethod, subMethodBody.getParameterLocals());
268 | jimpleUtils.createAssignStmt(returnRef, returnValue, units);
269 | } else {
270 | units.add(jimpleUtils.virtualCallStatement(tmpRef, superMethod.toString(), subMethodBody.getParameterLocals()));
271 | }
272 | }
273 |
274 | if (returnRef != null) {
275 | jimpleUtils.addCommonReturnStmt(returnRef, units);
276 | } else {
277 | jimpleUtils.addVoidReturnStmt(units);
278 | }
279 | subMethod.setActiveBody(subMethodBody);
280 | }
281 | }
282 | }
283 |
--------------------------------------------------------------------------------
/src/main/java/mock/MockObject.java:
--------------------------------------------------------------------------------
1 | package mock;
2 |
3 | import soot.*;
4 | import soot.jimple.JimpleBody;
5 |
6 | /**
7 | * @ClassName MockObject
8 | * @Description Simulate the initialization behavior of the class
9 | **/
10 | public interface MockObject {
11 | /**
12 | * Simulate the behavior of JoinPoint in the program
13 | *
14 | * @param body the method body which contains to JoinPoint initialized
15 | * @param units the method body which contains to JoinPoint initialized
16 | */
17 | void mockJoinPoint(JimpleBody body, PatchingChain units);
18 |
19 | /**
20 | * Simulate the initialization of the entity class in the program
21 | *
22 | * @param body the method body which contains to entity class initialized
23 | * @param units the method body which contains to entity class initialized
24 | * @param sootClass controller class
25 | * @param toCall controller method
26 | * @return Local variables of entity classes
27 | */
28 | Local mockBean(JimpleBody body, PatchingChain units, SootClass sootClass, SootMethod toCall);
29 |
30 | Local mockHttpServlet(JimpleBody body, PatchingChain units, SootClass sootClass, SootMethod toCall);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/mock/MockObjectImpl.java:
--------------------------------------------------------------------------------
1 | package mock;
2 |
3 | import soot.*;
4 | import soot.jimple.JimpleBody;
5 | import soot.jimple.StringConstant;
6 | import utils.JimpleUtils;
7 |
8 | import java.util.ArrayList;
9 | import java.util.Collections;
10 | import java.util.List;
11 |
12 | /**
13 | * @ClassName MockObjectImpl
14 | * @Description Simulate the initialization behavior of the class
15 | **/
16 | public class MockObjectImpl implements MockObject {
17 | private final JimpleUtils jimpleUtils = new JimpleUtils();
18 | GenerateSyntheticClass gsc = new GenerateSyntheticClassImpl();
19 |
20 | /**
21 | * Simulate the behavior of JoinPoint in the program
22 | *
23 | * @param body the method body which contains to JoinPoint initialized
24 | * @param units the method body which contains to JoinPoint initialized
25 | */
26 | @Override
27 | public void mockJoinPoint(JimpleBody body, PatchingChain units) {
28 | SootClass abstractClass = Scene.v().getSootClass("org.aspectj.lang.ProceedingJoinPoint");
29 | SootClass joinPointImpl = gsc.generateJoinPointImpl(abstractClass);
30 | Local joinPointLocal = jimpleUtils.addLocalVar(joinPointImpl.getShortName(), joinPointImpl.getName(), body);
31 | Local paramArray = jimpleUtils.addLocalVar("paramArray",
32 | ArrayType.v(RefType.v("java.lang.Object"), 1),
33 | body);
34 |
35 | int paramSize = body.getParameterLocals().size();
36 | jimpleUtils.createAssignStmt(joinPointLocal, joinPointImpl.getName(), units);
37 | Unit specialInit = jimpleUtils.specialCallStatement(joinPointLocal,
38 | joinPointImpl.getMethodByName("").toString());
39 | units.add(specialInit);
40 | jimpleUtils.createAssignStmt(paramArray,
41 | jimpleUtils.createNewArrayExpr("java.lang.Object", paramSize), units);
42 | for (int i = 0; i < paramSize; i++) {
43 | jimpleUtils.createAssignStmt(jimpleUtils.createArrayRef(paramArray, i), body.getParameterLocal(i), units);
44 | }
45 | units.add(jimpleUtils.virtualCallStatement(joinPointLocal,
46 | joinPointImpl.getMethodByName("setArgs_synthetic").toString(), Collections.singletonList(paramArray)));
47 | }
48 |
49 | /**
50 | * Simulate the initialization of the entity class in the program
51 | *
52 | * @param body the method body which contains to entity class initialized
53 | * @param units the method body which contains to entity class initialized
54 | * @param sootClass controller class
55 | * @param toCall controller method
56 | * @return Local variables of entity classes
57 | */
58 | @Override
59 | public Local mockBean(JimpleBody body, PatchingChain units, SootClass sootClass, SootMethod toCall) {
60 | Local paramRef = jimpleUtils.addLocalVar(toCall.getName() + sootClass.getShortName(), sootClass.getName(), body);
61 | jimpleUtils.createAssignStmt(paramRef, sootClass.getName(), units);
62 | String initStr = "";
63 | try {
64 | initStr = sootClass.getMethod("void ()").toString();
65 | } catch (RuntimeException runtimeException) {
66 | for (SootMethod method : sootClass.getMethods()) {
67 | if (method.getName().equals("")) {
68 | initStr = method.toString();
69 | break;
70 | }
71 | }
72 | }
73 | Unit specialInit = jimpleUtils.specialCallStatement(paramRef, initStr);
74 | units.add(specialInit);
75 | for (SootMethod beanMethod : sootClass.getMethods()) {
76 | if (beanMethod.getName().startsWith("set") && beanMethod.getParameterTypes().size() > 0) {
77 | List valueList = new ArrayList<>();
78 | valueList.add(StringConstant.v(""));
79 | units.add(jimpleUtils.virtualCallStatement(paramRef, beanMethod.toString(), valueList));
80 | }
81 | }
82 | return paramRef;
83 | }
84 |
85 | @Override
86 | public Local mockHttpServlet(JimpleBody body, PatchingChain units, SootClass sootClass, SootMethod toCall) {
87 | Local paramRef = jimpleUtils.addLocalVar(toCall.getName() + sootClass.getShortName(), sootClass.getName(), body);
88 | SootClass HttpServletImpl = gsc.generateHttpServlet(sootClass);
89 | jimpleUtils.createAssignStmt(paramRef, HttpServletImpl.getName(), units);
90 | Unit specialInit = jimpleUtils.specialCallStatement(paramRef,
91 | HttpServletImpl.getMethod("void ()").toString());
92 | units.add(specialInit);
93 | return paramRef;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/java/utils/BaseJimpleUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import soot.*;
4 | import soot.jimple.*;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @ClassName BaseJimpleUtils
10 | * @Description Encapsulate the original jimple statement according to
11 | * the function (basic statement) for convenient development
12 | **/
13 | public class BaseJimpleUtils {
14 | /**
15 | * New local variable
16 | *
17 | * @param localName local variable name
18 | * @param vtype local variable type
19 | * @return local variable
20 | */
21 | public Local newLocalVar(String localName, String vtype) {
22 | return Jimple.v().newLocal(localName, RefType.v(vtype));
23 | }
24 |
25 | /**
26 | * New local variable
27 | *
28 | * @param localName local variable name
29 | * @param vtype local variable type
30 | * @return local variable
31 | */
32 | public Local newLocalVar(String localName, Type vtype) {
33 | return Jimple.v().newLocal(localName, vtype);
34 | }
35 |
36 | /**
37 | * Add the local variable to the method body
38 | *
39 | * @param localName local variable name
40 | * @param vtype local variable type
41 | * @param body the body need to add local variable
42 | * @return local variable
43 | */
44 | public Local addLocalVar(String localName, String vtype, Body body) {
45 | Local local = newLocalVar(localName, vtype);
46 | body.getLocals().add(local);
47 | return local;
48 | }
49 |
50 | /**
51 | * Add the local variable to the method body
52 | *
53 | * @param localName local variable name
54 | * @param vtype local variable type
55 | * @param body the body need to add local variable
56 | * @return local variable
57 | */
58 | public Local addLocalVar(String localName, Type vtype, Body body) {
59 | Local local = newLocalVar(localName, vtype);
60 | body.getLocals().add(local);
61 | return local;
62 | }
63 |
64 | /**
65 | * Instantiate local variables
66 | * create an allocation statement:tmpRef = new com.demo.service.impl.ModelThreeServiceImpl;
67 | *
68 | * @param local local variable
69 | * @param realType the type of allocation
70 | * @return unit
71 | */
72 | public Unit createAssignStmt(Local local, String realType) {
73 | return Jimple.v().newAssignStmt(local, Jimple.v().newNewExpr(RefType.v(realType)));
74 | }
75 |
76 | /**
77 | * Instantiate local variables
78 | * create an allocation statement:tmpRef = new com.demo.service.impl.ModelThreeServiceImpl;
79 | *
80 | * @param local local variable
81 | * @param realType the type of allocation
82 | * @param units the body need to add statement
83 | */
84 | public void createAssignStmt(Local local, String realType, PatchingChain units) {
85 | units.add(Jimple.v().newAssignStmt(local, Jimple.v().newNewExpr(RefType.v(realType))));
86 | }
87 |
88 | /**
89 | * Instantiate variables
90 | *
91 | * @param var local variable
92 | * @param realvar the type of allocation
93 | * @return unit
94 | */
95 | public Unit createAssignStmt(Value var, Value realvar) {
96 | return Jimple.v().newAssignStmt(var, realvar);
97 | }
98 |
99 | /**
100 | * Instantiate variables
101 | *
102 | * @param left variable
103 | * @param right statement
104 | * @param units units
105 | */
106 | public void createAssignStmt(Value left, Value right, PatchingChain units) {
107 | units.add(Jimple.v().newAssignStmt(left, right));
108 | }
109 |
110 | /**
111 | * Create new statement
112 | *
113 | * @param declType The specific type that allocation
114 | * @return new statement
115 | */
116 | public NewExpr createNewExpr(String declType) {
117 | return Jimple.v().newNewExpr(RefType.v(declType));
118 | }
119 |
120 | /**
121 | * Create new statement
122 | *
123 | * @param declType The specific type that allocation
124 | * @return new statement
125 | */
126 | public NewExpr createNewExpr(RefType declType) {
127 | return Jimple.v().newNewExpr(declType);
128 | }
129 |
130 | /**
131 | * Create new type[] statement
132 | *
133 | * @param type array type
134 | * @param paramSize array dimension
135 | * @return array statement
136 | */
137 | public NewArrayExpr createNewArrayExpr(String type, int paramSize) {
138 | return Jimple.v().newNewArrayExpr(RefType.v(type), IntConstant.v(paramSize));
139 | }
140 |
141 | /**
142 | * Create special invoke statement
143 | *
144 | * @param localModel variable points to the instantiated object
145 | * @param calleeMethod callee Method
146 | * @return invoke statement
147 | */
148 | public SpecialInvokeExpr createSpecialInvokeExpr(Local localModel, SootMethod calleeMethod) {
149 | return Jimple.v().newSpecialInvokeExpr(localModel, calleeMethod.makeRef());
150 | }
151 |
152 | /**
153 | * Create special invoke statement
154 | *
155 | * @param localModel variable points to the instantiated object
156 | * @param calleeMethod callee Method
157 | * @param values the actual params of invoke statement
158 | * @return invoke statement
159 | */
160 | public SpecialInvokeExpr createSpecialInvokeExpr(Local localModel, SootMethod calleeMethod, List extends Value> values) {
161 | return Jimple.v().newSpecialInvokeExpr(localModel, calleeMethod.makeRef(), values);
162 | }
163 |
164 | /**
165 | * Create special call statement
166 | * for example: specialinvoke tmpRef.()>();
167 | *
168 | * @param localModel variable points to the instantiated object
169 | * @param methodSign method signature
170 | * @return unit
171 | */
172 | public Unit specialCallStatement(Local localModel, String methodSign) {
173 | SootMethod toCall = Scene.v().getMethod(methodSign);
174 | return Jimple.v().newInvokeStmt(createSpecialInvokeExpr(localModel, toCall));
175 | }
176 |
177 | /**
178 | * Create special call statement
179 | * for example: specialinvoke tmpRef.()>();
180 | *
181 | * @param localModel variable points to the instantiated object
182 | * @param calleeMethod method signature
183 | * @return unit
184 | */
185 | public Unit specialCallStatement(Local localModel, SootMethod calleeMethod) {
186 | return Jimple.v().newInvokeStmt(createSpecialInvokeExpr(localModel, calleeMethod));
187 | }
188 |
189 | /**
190 | * Create special call statement
191 | * for example: specialinvoke tmpRef.()>();
192 | *
193 | * @param localModel variable points to the instantiated object
194 | * @param values the actual params of invoke statement
195 | * @return unit
196 | */
197 | public Unit specialCallStatement(Local localModel, SootMethod calleeMethod, List values) {
198 | return Jimple.v().newInvokeStmt(createSpecialInvokeExpr(localModel, calleeMethod, values));
199 | }
200 |
201 | /**
202 | * Create special call statement
203 | * for example: specialinvoke tmpRef.()>();
204 | *
205 | * @param localModel variable points to the instantiated object
206 | * @param methodSign method signature
207 | * @param values the actual params of invoke statement
208 | * @return unit
209 | */
210 |
211 | public Unit specialCallStatement(Local localModel, String methodSign, List values) {
212 | SootMethod toCall = Scene.v().getMethod(methodSign);
213 | return Jimple.v().newInvokeStmt(createSpecialInvokeExpr(localModel, toCall, values));
214 | }
215 |
216 | /**
217 | * Create virtual call statement
218 | *
219 | * @param localModel variable points to the instantiated object
220 | * @param calleeMethod callee Method
221 | * @return invoke statement
222 | */
223 | public VirtualInvokeExpr createVirtualInvokeExpr(Local localModel, SootMethod calleeMethod) {
224 | return Jimple.v().newVirtualInvokeExpr(localModel, calleeMethod.makeRef());
225 | }
226 |
227 | /**
228 | * Create virtual call statement
229 | *
230 | * @param localModel variable points to the instantiated object
231 | * @param calleeMethod callee Method
232 | * @param values the actual params of invoke statement
233 | * @return invoke statement
234 | */
235 | public VirtualInvokeExpr createVirtualInvokeExpr(Local localModel, SootMethod calleeMethod, List extends Value> values) {
236 | return Jimple.v().newVirtualInvokeExpr(localModel, calleeMethod.makeRef(), values);
237 | }
238 |
239 | /**
240 | * Create virtual call statement
241 | *
242 | * @param localModel variable points to the instantiated object
243 | * @param methodSign method signature
244 | * @return unit
245 | */
246 | public Unit virtualCallStatement(Local localModel, String methodSign) {
247 | SootMethod toCall = Scene.v().getMethod(methodSign);
248 | return Jimple.v().newInvokeStmt(createVirtualInvokeExpr(localModel, toCall));
249 | }
250 |
251 | /**
252 | * Create virtual call statement
253 | *
254 | * @param localModel variable points to the instantiated object
255 | * @param methodSign method signature
256 | * @param values the actual params of invoke statement
257 | * @return unit
258 | */
259 | public Unit virtualCallStatement(Local localModel, String methodSign, List extends Value> values) {
260 | SootMethod toCall = Scene.v().getMethod(methodSign);
261 | return Jimple.v().newInvokeStmt(createVirtualInvokeExpr(localModel, toCall, values));
262 | }
263 |
264 | /**
265 | * Create virtual call statement
266 | *
267 | * @param localModel variable points to the instantiated object
268 | * @param calleeMethod callee Method
269 | * @return unit
270 | */
271 | public Unit virtualCallStatement(Local localModel, SootMethod calleeMethod) {
272 | return Jimple.v().newInvokeStmt(createVirtualInvokeExpr(localModel, calleeMethod));
273 | }
274 |
275 | /**
276 | * Create virtual call statement
277 | *
278 | * @param localModel variable points to the instantiated object
279 | * @param calleeMethod callee Method
280 | * @param values the actual params of invoke statement
281 | * @return unit
282 | */
283 | public Unit virtualCallStatement(Local localModel, SootMethod calleeMethod, List extends Value> values) {
284 | return Jimple.v().newInvokeStmt(createVirtualInvokeExpr(localModel, calleeMethod, values));
285 | }
286 |
287 | /**
288 | * Create static call statement
289 | *
290 | * @param calleeMethod callee Method
291 | * @return static invoke statement
292 | */
293 | public StaticInvokeExpr createStaticInvokeExpr(SootMethod calleeMethod) {
294 | return Jimple.v().newStaticInvokeExpr(calleeMethod.makeRef());
295 | }
296 |
297 | /**
298 | * Initialize the parameters and this pointer
299 | * this := @this: com.demo.targetdemo.infoleak.service.impl.UserServiceCGLIB;
300 | *
301 | * @param var the parameters and this pointer
302 | * @param identvar type
303 | * @return unit
304 | */
305 | public Unit createIdentityStmt(Value var, Value identvar) {
306 | return Jimple.v().newIdentityStmt(var, identvar);
307 | }
308 |
309 | /**
310 | * Initialize the parameters and this pointer
311 | * this := @this: com.demo.targetdemo.infoleak.service.impl.UserServiceCGLIB;
312 | *
313 | * @param var the parameters and this pointer
314 | * @param identvar type
315 | * @param units units
316 | */
317 | public void createIdentityStmt(Value var, Value identvar, PatchingChain units) {
318 | units.add(createIdentityStmt(var, identvar));
319 | }
320 |
321 | /**
322 | * Create parameter references
323 | * // @parameter0: com.demo.targetdemo.infoleak.service.impl.UserServiceCGLIB
324 | *
325 | * @param type The specific type of the parameter
326 | * @param index the index of params
327 | * @return ParameterRef
328 | */
329 | public ParameterRef createParamRef(Type type, int index) {
330 | return Jimple.v().newParameterRef(type, index);
331 | }
332 |
333 | /**
334 | * Create a reference to this pointer
335 | * // @this: com.demo.targetdemo.infoleak.service.impl.UserServiceCGLIB
336 | *
337 | * @param type The specific type of this
338 | * @return ThisRef
339 | */
340 | public ThisRef createThisRef(String type) {
341 | return createThisRef(RefType.v(type));
342 | }
343 |
344 | /**
345 | * Create a reference to this pointer
346 | * // @this: com.demo.targetdemo.infoleak.service.impl.UserServiceCGLIB
347 | *
348 | * @param type The specific type of this
349 | * @return ThisRef
350 | */
351 | public ThisRef createThisRef(RefType type) {
352 | return Jimple.v().newThisRef(type);
353 | }
354 |
355 | /**
356 | * Create array reference statement
357 | *
358 | * @param type The specific type of array
359 | * @param index the index of params
360 | * @return ArrayRef
361 | */
362 | public ArrayRef createArrayRef(Value type, int index) {
363 | return Jimple.v().newArrayRef(type, IntConstant.v(index));
364 | }
365 |
366 | /**
367 | * add return; statement
368 | *
369 | * @param units unit
370 | */
371 | public void addVoidReturnStmt(PatchingChain units) {
372 | units.add(Jimple.v().newReturnVoidStmt());
373 | }
374 |
375 | /**
376 | * add return local; statement
377 | *
378 | * @param returnRef return value
379 | * @param units unit
380 | */
381 | public void addCommonReturnStmt(Value returnRef, PatchingChain units) {
382 | units.add(Jimple.v().newReturnStmt(returnRef));
383 | }
384 |
385 |
386 | /**
387 | * Use the variable to call the field of the instance, for example:
388 | * this.;
389 | *
390 | * @param local local variable
391 | * @param sootFieldRef Reference to instance field
392 | * @return InstanceFieldRef
393 | */
394 | public InstanceFieldRef createInstanceFieldRef(Value local, SootFieldRef sootFieldRef) {
395 | return Jimple.v().newInstanceFieldRef(local, sootFieldRef);
396 | }
397 |
398 | /**
399 | * Use static field, for example:
400 | * ;
401 | *
402 | * @param sootFieldRef Reference to static field
403 | * @return StaticFieldRef
404 | */
405 | public StaticFieldRef createStaticFieldRef(SootFieldRef sootFieldRef) {
406 | return Jimple.v().newStaticFieldRef(sootFieldRef);
407 | }
408 |
409 | /**
410 | * Create a new body for the method
411 | *
412 | * @param sootMethod method
413 | * @return method body
414 | */
415 | public JimpleBody newMethodBody(SootMethod sootMethod) {
416 | return Jimple.v().newBody(sootMethod);
417 | }
418 | }
419 |
--------------------------------------------------------------------------------
/src/main/java/utils/ConfigUtil.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import java.io.*;
4 | import java.util.Properties;
5 |
6 | /**
7 | * @ClassName ConfigUtil
8 | * @Description read config
9 | */
10 | public class ConfigUtil {
11 | public static Properties getProperties(String configPath) {
12 | Properties p = null;
13 | if (configPath == null || "".equals(configPath)) {
14 | return p;
15 | }
16 | try {
17 | InputStream in = new BufferedInputStream(new FileInputStream(configPath));
18 | p = new Properties();
19 | p.load(in);
20 | } catch (IOException e) {
21 | e.printStackTrace();
22 | }
23 | return p;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/utils/EnumUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import enums.AdviceEnum;
4 |
5 | /**
6 | * @ClassName EnumUtils
7 | * @Description Enumeration of annotations
8 | */
9 | public class EnumUtils {
10 | public static AdviceEnum getEnumObject(Object value) {
11 | for (AdviceEnum adviceEnum : AdviceEnum.values()) {
12 | if (adviceEnum.getAnnotationClassName().equals(value)) {
13 | return adviceEnum;
14 | }
15 | }
16 | return null;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/utils/FileUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import java.io.FileWriter;
4 | import java.io.IOException;
5 | import java.io.PrintWriter;
6 | import java.util.Collections;
7 | import java.util.HashSet;
8 | import java.util.Set;
9 |
10 | /**
11 | * @ClassName FileUtils
12 | * @Description reading files
13 | */
14 | public class FileUtils {
15 |
16 | public static void writeFile(String filePath, String filename, String sets) {
17 | FileWriter fw = null;
18 | PrintWriter out = null;
19 | try {
20 | fw = new FileWriter(filePath + filename, true);
21 | out = new PrintWriter(fw);
22 | out.write(sets);
23 | out.println();
24 | } catch (IOException e) {
25 | e.printStackTrace();
26 | } finally {
27 | try {
28 | assert fw != null;
29 | fw.close();
30 | } catch (IOException e) {
31 | e.printStackTrace();
32 | }
33 | assert out != null;
34 | out.close();
35 | }
36 | }
37 |
38 | public static Set getBeanXmlPaths(String configPath, String keyname) {
39 | Set res = new HashSet<>();
40 | if(configPath == null || "".equals(configPath)){
41 | return res;
42 | }
43 | String property = ConfigUtil.getProperties(configPath).getProperty(keyname);
44 | if (property != null) {
45 | String[] split = property.split(",");
46 | Collections.addAll(res, split);
47 | }
48 | return res;
49 | }
50 |
51 | public static String getApplicationMain(String configPath, String keyname) {
52 | return ConfigUtil.getProperties(configPath).getProperty(keyname);
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/utils/GenJimpleUtil.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import soot.Printer;
4 | import soot.SootClass;
5 | import soot.SourceLocator;
6 | import soot.options.Options;
7 |
8 | import java.io.*;
9 |
10 | /**
11 | * @ClassName GenJimpleUtil
12 | * @Description new a file of Jimple
13 | */
14 | public class GenJimpleUtil {
15 | public static void write(SootClass sClass) {
16 | OutputStream streamOut = null;
17 | try {
18 | String filename = SourceLocator.v().getFileNameFor(sClass, Options.output_format_shimple);
19 | String processProjectName = "PointerAnalysis";
20 | filename = "ShimpleResult" + File.separator + processProjectName + File.separator + filename;
21 | int i = filename.lastIndexOf(File.separator);
22 | String f1 = filename.substring(0, i);
23 | File file1 = new File(f1);
24 | if (!file1.exists()) {
25 | file1.mkdirs();
26 | }
27 | File file2 = new File(filename);
28 | if (!file2.exists()) {
29 | file2.createNewFile();
30 | }
31 | File file3 = new File("sootOutput");
32 | if (file3.exists()) {
33 | file3.delete();
34 | }
35 | streamOut = new FileOutputStream(filename);
36 | PrintWriter writerOut = new PrintWriter(new OutputStreamWriter(streamOut));
37 | Printer.v().printTo(sClass, writerOut);
38 | writerOut.flush();
39 | writerOut.close();
40 | } catch (Exception e) {
41 | System.out.println(e.getMessage());
42 | } finally {
43 | if (streamOut != null)
44 | try {
45 | streamOut.close();
46 | } catch (IOException e) {
47 | System.out.println(e.getMessage());
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/utils/JimpleUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import bean.ConstructorArgBean;
4 | import mock.MockObject;
5 | import mock.MockObjectImpl;
6 | import soot.*;
7 | import soot.jimple.*;
8 | import soot.jimple.internal.JIdentityStmt;
9 | import soot.jimple.internal.JimpleLocal;
10 |
11 | import java.util.*;
12 |
13 | /**
14 | * @ClassName JimpleUtils
15 | * @Description Encapsulate the original jimple statement according to
16 | * the function for convenient development
17 | */
18 | public class JimpleUtils extends BaseJimpleUtils {
19 |
20 | public Map getImplType() {
21 | Map map = new HashMap<>();
22 | map.put(RefType.v("java.util.List"), RefType.v("java.util.ArrayList"));
23 | map.put(RefType.v("java.util.Map"), RefType.v("java.util.HashMap"));
24 | map.put(RefType.v("java.util.Set"), RefType.v("java.util.HashSet"));
25 | return map;
26 | }
27 |
28 | /**
29 | * Initialize a default constructor
30 | *
31 | * @param customImplClass the class of need to add the constructor
32 | * @return a default constructor
33 | */
34 | public SootMethod genDefaultConstructor(SootClass customImplClass) {
35 | return genDefaultConstructor(customImplClass, null, false);
36 | }
37 |
38 | /**
39 | * Initialize a default constructor
40 | *
41 | * @param customImplClass the class of need to add the constructor
42 | * @param field the field of need to init
43 | * @return a default constructor
44 | */
45 | public SootMethod genDefaultConstructor(SootClass customImplClass, SootField field, boolean singleton) {
46 | SootMethod initMethod = new SootMethod("",
47 | null,
48 | VoidType.v(), Modifier.PUBLIC);
49 | SootMethod signature = null;
50 | try {
51 | signature = customImplClass.getSuperclass().getMethod("void ()");
52 | } catch (Exception e) {
53 | for (SootMethod method : customImplClass.getSuperclass().getMethods()) {
54 | if (method.getName().contains("")) {
55 | signature = method;
56 | break;
57 | }
58 | }
59 | }
60 |
61 | JimpleBody initBody = createInitJimpleBody(initMethod, signature, customImplClass.getName(), field, singleton);
62 | initMethod.setActiveBody(initBody);
63 | return initMethod;
64 | }
65 |
66 | /**
67 | * Initialize a default method
68 | *
69 | * @param customImplClass the class of need to add the method
70 | * @param fields the field of need to init
71 | * @param collect
72 | * @return method
73 | */
74 | public SootMethod genDefaultClinit(SootClass customImplClass, Set fields, Map> collect) {
75 | SootMethod initMethod = new SootMethod("",
76 | null,
77 | VoidType.v(), Modifier.STATIC);
78 | JimpleBody initBody = createClinitJimpleBody(initMethod, customImplClass.getName(), fields, collect);
79 | initMethod.setActiveBody(initBody);
80 | return initMethod;
81 | }
82 |
83 | /**
84 | * Implementation of static methods
85 | *
86 | * @param customImplClass the class of need to add the method
87 | * @param methodName method name
88 | * @param parameterTypes parameter types
89 | * @param returnType return type
90 | * @param field field
91 | * @return static methods
92 | */
93 | public SootMethod genStaticCustomMethod(SootClass customImplClass, String methodName, List parameterTypes, Type returnType, SootField field) {
94 | SootMethod implMethod = new SootMethod(methodName,
95 | parameterTypes,
96 | returnType,
97 | Modifier.PUBLIC + Modifier.STATIC);
98 | JimpleBody body = createNewJimpleStaticBody(implMethod, customImplClass.getName(), field);
99 | implMethod.setActiveBody(body);
100 | return implMethod;
101 | }
102 |
103 |
104 | /**
105 | * Implementation of interface methods
106 | *
107 | * @param customImplClass the class of need to add the method
108 | * @param methodName method name
109 | * @param parameterTypes parameter types
110 | * @param returnType return type
111 | * @return methods
112 | */
113 | public SootMethod genCustomMethod(SootClass customImplClass, String methodName, List parameterTypes, Type returnType) {
114 | SootMethod implMethod = new SootMethod(methodName,
115 | parameterTypes,
116 | returnType,
117 | Modifier.PUBLIC);
118 | JimpleBody body = createNewJimpleBody(implMethod, new ArrayList<>(), customImplClass.getName());
119 | implMethod.setActiveBody(body);
120 | return implMethod;
121 | }
122 |
123 | /**
124 | * Construct method
125 | *
126 | * @param method method name
127 | * @param signature functions that need to be actively called in the sink point
128 | * @param cName class name of the field instance
129 | * @param field field that need to be initialized
130 | * @param singleton the field that needs to be initialized is singleton
131 | * @return method body
132 | */
133 | public JimpleBody createInitJimpleBody(SootMethod method, SootMethod signature, String cName, SootField field, boolean singleton) {
134 |
135 | JimpleBody body = newMethodBody(method);
136 | Local thisRef = addLocalVar("this", cName, body);
137 |
138 | PatchingChain units = body.getUnits();
139 | createIdentityStmt(thisRef, createThisRef(cName), units);
140 |
141 | SootMethod toCall = Scene.v().getMethod(signature.getSignature());
142 | units.add(specialCallStatement(thisRef, toCall.toString(), Collections.emptyList()));
143 |
144 | if (field != null) {
145 | String vtype = field.getType().toString();
146 | Local tmpRef = addLocalVar(vtype.substring(vtype.lastIndexOf(".") + 1).toLowerCase(), vtype, body);
147 | if (!singleton) {
148 | createAssignStmt(tmpRef, createNewExpr(field.getType().toString()), units);
149 | units.add(specialCallStatement(tmpRef, Scene.v().getSootClass(field.getType().toString()).getMethodByName("").toString()));
150 | } else {
151 | SootClass singletonFactory = Scene.v().getSootClass("synthetic.method.SingletonFactory");
152 | Value returnValue = createStaticInvokeExpr(singletonFactory.getMethod(((RefType) field.getType()).getSootClass().getName()
153 | + " get" + ((RefType) field.getType()).getSootClass().getShortName() + "()"));
154 | createAssignStmt(tmpRef, returnValue, units);
155 | }
156 | createAssignStmt(createInstanceFieldRef(thisRef, field.makeRef()), tmpRef, units);
157 | }
158 |
159 | addVoidReturnStmt(units);
160 | return body;
161 | }
162 |
163 | /**
164 | * Construct method
165 | *
166 | * @param method method name
167 | * @param cName class name of the field instance
168 | * @param collect
169 | * @return method body
170 | */
171 | public JimpleBody createClinitJimpleBody(SootMethod method, String cName, Set fields, Map> collect) {
172 | boolean hasargFlag = false;
173 | if (collect != null && collect.size() > 0) {
174 | hasargFlag = true;
175 | }
176 | JimpleBody body = newMethodBody(method);
177 | PatchingChain units = body.getUnits();
178 | for (SootField field : fields) {
179 | String vtype = field.getType().toString();
180 | Local tmpRef = addLocalVar(vtype.substring(vtype.lastIndexOf(".") + 1).toLowerCase(), vtype, body);
181 | createAssignStmt(tmpRef, createNewExpr(field.getType().toString()), units);
182 | if (hasargFlag && collect.containsKey(vtype)) {
183 | SootClass argClazz = Scene.v().getSootClass(vtype);
184 | List constructorArgBeans = collect.get(vtype);
185 | for (SootMethod argClazzMethod : argClazz.getMethods()) {
186 | if (argClazzMethod.getName().contains("") && argClazzMethod.getParameterCount() == constructorArgBeans.size()) {
187 | UnitPatchingChain argmethodunit = argClazzMethod.retrieveActiveBody().getUnits();
188 | List argunitlist = new LinkedList<>(argmethodunit);
189 | LinkedHashMap parammap = new LinkedHashMap<>();
190 | for (int i = 1; i <= argClazzMethod.getParameterCount(); i++) {
191 | if (argunitlist.get(i) instanceof JIdentityStmt) {
192 | JIdentityStmt stmt = (JIdentityStmt) argunitlist.get(i);
193 | JimpleLocal leftval = (JimpleLocal) stmt.leftBox.getValue();
194 | String key = leftval.getName();
195 | ParameterRef rightref = (ParameterRef) stmt.rightBox.getValue();
196 | String val = rightref.getType().toString();
197 | parammap.put(key, val);
198 | }
199 | }
200 | int index = 0;
201 | boolean flag = true;
202 | List parmas = new ArrayList<>();
203 | while (index < constructorArgBeans.size()) {
204 | ConstructorArgBean argBean = constructorArgBeans.get(index);
205 | if (argBean.getArgType() != null) {
206 | Type parameterType = argClazzMethod.getParameterType(index);
207 | if (!parameterType.toString().equals(argBean.getArgType())) {
208 | flag = false;
209 | break;
210 | } else {
211 | parmas.add(getConstant(argBean.getArgType(), argBean.getArgValue(), false));
212 | }
213 | } else if (argBean.getArgName() != null) {
214 | if (!parammap.containsKey(argBean.getArgName())) {
215 | flag = false;
216 | break;
217 | } else {
218 | parmas.add(getConstant(parammap.get(argBean.getArgName()), argBean.getArgValue(), false));
219 | }
220 | } else if (argBean.getRefType() != null) {
221 | if (!parammap.containsKey(argBean.getRefType())) {
222 | flag = false;
223 | break;
224 | } else {
225 | parmas.add(getConstant("", "", true));
226 | }
227 | }
228 | index++;
229 | }
230 | if (flag) {
231 | units.add(specialCallStatement(tmpRef, argClazzMethod.toString(), parmas));
232 | break;
233 | }
234 | }
235 | }
236 | } else {
237 | for (SootMethod sootMethod : Scene.v().getSootClass(field.getType().toString()).getMethods()) {
238 | if (sootMethod.getName().contains("")) {
239 | units.add(specialCallStatement(tmpRef, sootMethod.toString()));
240 | break;
241 | }
242 | }
243 | }
244 | createAssignStmt(createStaticFieldRef(field.makeRef()), tmpRef, units);
245 | }
246 | addVoidReturnStmt(units);
247 | return body;
248 | }
249 |
250 | private Constant getConstant(String typesign, String value, boolean isclazz) {
251 | String s = typesign.toLowerCase();
252 | if (isclazz) {
253 | return NullConstant.v();
254 | }
255 | if (s.contains("string")) {
256 | return StringConstant.v(value);
257 | } else if (s.contains("int")) {
258 | return IntConstant.v(Integer.parseInt(value));
259 | } else if (s.contains("double")) {
260 | return DoubleConstant.v(Double.parseDouble(value));
261 | } else if (s.contains("float")) {
262 | return FloatConstant.v(Float.parseFloat(value));
263 | } else if (s.contains("long")) {
264 | return LongConstant.v(Long.parseLong(value));
265 | }
266 | return null;
267 | }
268 |
269 | /**
270 | * create new method
271 | *
272 | * @param method method name
273 | * @param signatures functions that need to be actively called in the sink point
274 | * @param cName class name of the field instance
275 | * @return method body
276 | */
277 | public JimpleBody createNewJimpleBody(SootMethod method, List signatures, String cName) {
278 | List parameterValues = new ArrayList<>();
279 | JimpleBody body = newMethodBody(method);
280 | Local thisRef = addLocalVar("this", cName, body);
281 |
282 | PatchingChain units = body.getUnits();
283 | createIdentityStmt(thisRef, createThisRef(cName), units);
284 | // initialize the type parameters of the method
285 | for (int i = 0; i < method.getParameterCount(); i++) {
286 | Type parameterType = method.getParameterType(i);
287 | Local param = addLocalVar("param" + i, parameterType, body);
288 | createIdentityStmt(param, createParamRef(parameterType, i), units);
289 | parameterValues.add(param);
290 | }
291 |
292 | if (method.getName().equals("setArgs_synthetic")) {
293 | SootField sootField = Scene.v().getSootClass(cName).getFieldByName("args");
294 | Local param = body.getParameterLocal(0);
295 | createAssignStmt(createInstanceFieldRef(thisRef, sootField.makeRef()), param, units);
296 | }
297 |
298 | // call all methods in the signatures list
299 | for (int i = 0; i < signatures.size(); i++) {
300 | SootMethod toCall = Scene.v().getMethod(signatures.get(i).toString());
301 | int parameterCount = toCall.getParameterCount();
302 | List paramList = new ArrayList<>();
303 | for (int j = 0; j < parameterCount - parameterValues.size(); j++) {
304 | paramList.add(NullConstant.v());
305 | }
306 | paramList.addAll(parameterValues);
307 |
308 | String declaringClassName = signatures.get(i).getDeclaringClass().getName();
309 | if (!declaringClassName.equals(cName)
310 | && !declaringClassName.equals("java.lang.Object")
311 | && signatures.get(i).getReturnType() != null) {
312 | Local virtualRef = addLocalVar("virtual" + i, declaringClassName, body);
313 | createAssignStmt(virtualRef, declaringClassName, units);
314 | units.add(specialCallStatement(virtualRef,
315 | signatures.get(i).getDeclaringClass().getMethod("void ()").toString()));
316 | } else {
317 | if (signatures.get(i).getReturnType() instanceof VoidType || method.getName().equals("callEntry_synthetic")) {
318 | units.add(specialCallStatement(thisRef, toCall.toString(), paramList));
319 | }
320 | }
321 | }
322 |
323 | Type returnType = method.getReturnType();
324 | if (returnType instanceof RefType) {
325 | addCommonReturnStmt(NullConstant.v(), units);
326 | } else if (returnType instanceof VoidType) {
327 | addVoidReturnStmt(units);
328 | } else if (returnType instanceof IntType) {
329 | addCommonReturnStmt(IntConstant.v(0), units);
330 | } else if (returnType instanceof LongType) {
331 | addCommonReturnStmt(LongConstant.v(0), units);
332 | } else if (returnType instanceof DoubleType) {
333 | addCommonReturnStmt(DoubleConstant.v(0), units);
334 | } else if (returnType instanceof ArrayType) {
335 | if (Scene.v().getSootClass(cName).getFields().size() > 0) {
336 | SootField sootField = Scene.v().getSootClass(cName).getFieldByName("args");
337 | if (sootField != null && sootField.getType().equals(returnType) && method.getName().contains("getArgs")) {
338 | Local returnRef = addLocalVar("returnRef", returnType, body);
339 | createAssignStmt(returnRef, createInstanceFieldRef(thisRef, sootField.makeRef()), units);
340 | addCommonReturnStmt(returnRef, units);
341 | }
342 | } else {
343 | addCommonReturnStmt(NullConstant.v(), units);
344 | }
345 | } else if (returnType instanceof BooleanType) {
346 | addCommonReturnStmt(IntConstant.v(0) , units);
347 | }
348 | return body;
349 | }
350 |
351 | /**
352 | * create static method
353 | *
354 | * @param method method name
355 | * @param cName class name of the field instance
356 | * @return method body
357 | */
358 | public JimpleBody createNewJimpleStaticBody(SootMethod method, String cName, SootField field) {
359 | JimpleBody body = newMethodBody(method);
360 | PatchingChain units = body.getUnits();
361 | Local localRef = null;
362 | if (method.getName().equals("get" + field.getName())) {
363 | localRef = addLocalVar(field.getName().toLowerCase(), field.getType(), body);
364 | createAssignStmt(localRef, createStaticFieldRef(field.makeRef()), units);
365 | }
366 |
367 | Type returnType = method.getReturnType();
368 | if (returnType instanceof RefType) {
369 | if (localRef != null) {
370 | addCommonReturnStmt(localRef, units);
371 | } else {
372 | addCommonReturnStmt(NullConstant.v(), units);
373 | }
374 | }
375 | return body;
376 | }
377 |
378 | /**
379 | * create new method
380 | *
381 | * @param method method name
382 | * @param signatures functions that need to be actively called in the sink point
383 | * @param cName class name of the field instance
384 | * @return method body
385 | */
386 | public JimpleBody createJimpleBody(SootMethod method, List signatures, String cName) {
387 | Map hasMethods = new HashMap<>();
388 | MockObject mockObject = new MockObjectImpl();
389 | Value virtualCallWithReturn = null;
390 | JimpleBody body = newMethodBody(method);
391 | Local thisRef = addLocalVar("this", cName, body);
392 |
393 | PatchingChain units = body.getUnits();
394 | createIdentityStmt(thisRef, createThisRef(cName), units);
395 |
396 | for (int i = 0; i < signatures.size(); i++) {
397 | SootMethod toCall = Scene.v().getMethod(signatures.get(i).toString());
398 | List paramsLocal = toCall.retrieveActiveBody().getParameterLocals();
399 | int parameterCount = toCall.getParameterCount();
400 | List paramList = new ArrayList<>();
401 | for (int j = 0; j < parameterCount; j++) {
402 | if (isBaseTypes(toCall.getParameterType(j))) {
403 | paramList.add(NullConstant.v());
404 | continue;
405 | }
406 | SootClass sootClass = Scene.v().getSootClass(toCall.getParameterType(j).toString());
407 | if (!sootClass.isInterface() && !sootClass.isJavaLibraryClass()
408 | && !sootClass.isAbstract() && sootClass.getMethods().size() > 0) {
409 | try {
410 | Local paramRef = mockObject.mockBean(body, units, sootClass, toCall);
411 | paramList.add(paramRef);
412 | } catch (Exception e) {
413 | e.printStackTrace();
414 | paramList.add(NullConstant.v());
415 | }
416 | continue;
417 | } else if (sootClass.getName().contains("HttpServlet")) {
418 | Local paramRef = mockObject.mockHttpServlet(body, units, sootClass, toCall);
419 | paramList.add(paramRef);
420 | continue;
421 | } else if (sootClass.getName().equals("java.lang.String")) {
422 | String methodName = "get" + paramsLocal.get(j).getName();
423 | if (hasMethods.containsKey(methodName)) {
424 | paramList.add(hasMethods.get(methodName));
425 | } else {
426 | Local paramRef = addLocalVar(methodName, sootClass.getName(), body);
427 | SootMethod stringMethod = genCustomMethod(method.getDeclaringClass(), methodName, new ArrayList<>(), sootClass.getType());
428 | method.getDeclaringClass().addMethod(stringMethod);
429 | Value invokeStringMethod = createVirtualInvokeExpr(thisRef, stringMethod);
430 | units.add(createAssignStmt(paramRef, invokeStringMethod));
431 | hasMethods.put(methodName, paramRef);
432 | paramList.add(paramRef);
433 | }
434 | continue;
435 | }
436 | paramList.add(NullConstant.v());
437 | }
438 |
439 | String declaringClassName = signatures.get(i).getDeclaringClass().getName();
440 | if (!declaringClassName.equals(cName)
441 | && !declaringClassName.equals("java.lang.Object")
442 | && signatures.get(i).getReturnType() != null) {
443 | Local virtualRef = addLocalVar("virtual" + i, declaringClassName, body);
444 | createAssignStmt(virtualRef, declaringClassName, units);
445 | units.add(specialCallStatement(virtualRef,
446 | signatures.get(i).getDeclaringClass().getMethod("void ()").toString()));
447 | virtualCallWithReturn = createVirtualInvokeExpr(virtualRef, toCall, paramList);
448 | } else {
449 | if (!(signatures.get(i).getReturnType() instanceof VoidType) && !(method.getName().equals("callEntry_synthetic"))) {
450 | virtualCallWithReturn = createSpecialInvokeExpr(thisRef, toCall, paramList);
451 | } else {
452 | units.add(specialCallStatement(thisRef, toCall.toString(), paramList));
453 | }
454 | }
455 | }
456 |
457 | Type returnType = method.getReturnType();
458 | if (returnType instanceof RefType) {
459 | Local returnRef = addLocalVar("returnRef", returnType, body);
460 | if (((RefType) returnType).getSootClass().isInterface()) {
461 | returnType = getImplType().get(returnType);
462 | }
463 | if (virtualCallWithReturn != null) {
464 | createAssignStmt(returnRef, virtualCallWithReturn, units);
465 | } else {
466 | createAssignStmt(returnRef, createNewExpr((RefType) returnType), units);
467 | units.add(specialCallStatement(returnRef,
468 | ((RefType) returnType).getSootClass().getMethod("void ()")));
469 | }
470 | addCommonReturnStmt(returnRef, units);
471 | } else if (returnType instanceof VoidType) {
472 | addVoidReturnStmt(units);
473 | } else if (returnType instanceof IntType) {
474 | addCommonReturnStmt(LongConstant.v(0), units);
475 | } else if (returnType instanceof LongType) {
476 | addCommonReturnStmt(LongConstant.v(0), units);
477 | } else if (returnType instanceof DoubleType) {
478 | addCommonReturnStmt(DoubleConstant.v(0), units);
479 | }
480 | return body;
481 | }
482 |
483 | private boolean isBaseTypes(Type target) {
484 | return target instanceof LongType
485 | || target instanceof IntType
486 | || target instanceof DoubleType
487 | || target instanceof FloatType
488 | || target instanceof ArrayType
489 | || target instanceof BooleanType;
490 | }
491 | }
492 |
--------------------------------------------------------------------------------
/src/main/java/utils/XMLDocumentHolder.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import bean.AopXMLResultBean;
4 | import bean.ConstructorArgBean;
5 | import org.dom4j.Document;
6 | import org.dom4j.Element;
7 | import org.dom4j.io.SAXReader;
8 |
9 | import java.io.File;
10 | import java.util.ArrayList;
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 |
15 | /**
16 | * @ClassName XMLDocumentHolder
17 | * @Description the parser of XML document
18 | */
19 | public class XMLDocumentHolder {
20 |
21 | //Create a HashMap to store strings and documents
22 | private Map docs = new HashMap();
23 | private Map elements = new HashMap<>();
24 | private List argConstructors = new ArrayList<>();
25 |
26 | public Document getDocument(String filePath) {
27 | // Use HashMap to get the document according to the path
28 | Document doc = this.docs.get(filePath);
29 | if (doc == null) {
30 | this.docs.put(filePath, readDocument(filePath));
31 | }
32 | return this.docs.get(filePath);
33 | }
34 |
35 | /**
36 | * read document according to path
37 | *
38 | * @param filePath file path
39 | * @return Document
40 | */
41 | private Document readDocument(String filePath) {
42 | Document doc = null;
43 | try {
44 | SAXReader reader = new SAXReader();
45 | File xmlFile = new File(filePath);
46 | if (xmlFile.exists()) {
47 | doc = reader.read(xmlFile);
48 | }
49 | } catch (Exception e) {
50 | e.printStackTrace();
51 | }
52 | return doc;
53 | }
54 |
55 |
56 | public void addElements(Document doc) {
57 | @SuppressWarnings("unchecked")
58 | List eles = doc.getRootElement().elements("bean");
59 | for (Element e : eles) {
60 | String id = e.attributeValue("id");
61 | elements.put(id, e);
62 | }
63 | }
64 |
65 |
66 | public String getCustomMapperAnnotationClazz(Document doc) {
67 | List eles = doc.getRootElement().elements("bean");
68 | for (Element ele : eles) {
69 | if ("org.mybatis.spring.mapper.MapperScannerConfigurer".equals(ele.attribute("class").getValue())) {
70 | List properties = ele.elements("property");
71 | for (Element property : properties) {
72 | if ("annotationClass".equals(property.attribute("name").getValue())) {
73 | return property.attribute("value").getValue();
74 | }
75 | }
76 | }
77 | }
78 | return "";
79 | }
80 |
81 |
82 | /**
83 | * Analyze and construct injected beans with parameters
84 | *
85 | * @param doc
86 | */
87 | public void hasArgConstructorBean(Document doc) {
88 | List eles = doc.getRootElement().elements("bean");
89 | for (Element ele : eles) {
90 | List elelist = ele.elements("constructor-arg");
91 | if (elelist != null && elelist.size() > 0) {
92 | String id = ele.attributeValue("id");
93 |
94 | for (Element element : elelist) {
95 | ConstructorArgBean argBean = new ConstructorArgBean();
96 | argBean.setClazzName(ele.attribute("class").getText());
97 | if (element.attribute("name") != null) {
98 | argBean.setArgName(element.attribute("name").getText());
99 | }
100 | if (element.attribute("index") != null) {
101 | argBean.setArgIndex(Integer.valueOf(element.attribute("index").getText()));
102 | }
103 | if (element.attribute("type") != null) {
104 | argBean.setArgType(element.attribute("type").getText());
105 | }
106 | if (element.attribute("ref") != null) {
107 | String ref = element.attribute("ref").getText();
108 | Element refelem = elements.get(ref);
109 | String aClass = refelem.attribute("class").getText();
110 | argBean.setRefType(aClass);
111 | }
112 | if (element.attribute("value") != null) {
113 | argBean.setArgValue(element.attribute("value").getText());
114 | } else {
115 | Element value = element.element("value");
116 | if (value != null) {
117 | argBean.setArgValue(value.getTextTrim());
118 | }
119 | }
120 | argConstructors.add(argBean);
121 | }
122 | }
123 | }
124 | }
125 |
126 | public Map getAllClassMap() {
127 | Map map = new HashMap<>();
128 | for (String s : elements.keySet()) {
129 | Element element = elements.get(s);
130 |
131 | String aClass = element.attribute("class").getText();
132 | if (element.attribute("scope") == null) {
133 | aClass += ";singleton";
134 | } else {
135 | aClass += ";" + element.attribute("scope").getText();
136 | }
137 | map.put(s, aClass);
138 | }
139 | return map;
140 | }
141 |
142 | public List getArgConstructors() {
143 | return argConstructors;
144 | }
145 |
146 |
147 | /**
148 | * Process AOP related configuration in xml
149 | *
150 | * @param doc the doc of xml file
151 | * @return the list of AopXMLResultBean
152 | */
153 | public List processAopElements(Document doc) {
154 | List configlist = doc.getRootElement().elements("config");
155 | List pointcutelements = new ArrayList<>();
156 | List partpointcutele = new ArrayList<>();
157 | List aspelement = new ArrayList<>();
158 | List beforeelement = new ArrayList<>();
159 | List afterelement = new ArrayList<>();
160 | List aroundelement = new ArrayList<>();
161 | List areturnelement = new ArrayList<>();
162 | List athrowelement = new ArrayList<>();
163 |
164 | Map partpointmap = new HashMap<>();
165 | Map stringStringMap = new HashMap<>();
166 | Map tmppointmap = new HashMap<>();
167 |
168 |
169 | List resbenas = new ArrayList<>();
170 | int gorder = 1;
171 | for (Element config : configlist) {
172 | aspelement.clear();
173 | stringStringMap.clear();
174 | pointcutelements.addAll(config.elements("pointcut"));
175 | if (pointcutelements.size() > 0) {
176 | stringStringMap.putAll(pointcutelesProcess(pointcutelements));
177 | }
178 | aspelement.addAll(config.elements("aspect"));
179 | for (Element asp : aspelement) {
180 | partpointmap.clear();
181 | tmppointmap.clear();
182 | beforeelement.clear();
183 | afterelement.clear();
184 | aroundelement.clear();
185 | areturnelement.clear();
186 | athrowelement.clear();
187 | String id = asp.attribute("ref").getText();
188 | int order = 1;
189 | if (asp.attribute("order") != null) {
190 | order = Integer.parseInt(asp.attribute("order").getText());
191 | } else {
192 | order = gorder++;
193 | }
194 | Element element = elements.get(id);
195 | String aClass = element.attribute("class").getText();
196 |
197 |
198 | partpointcutele.addAll(asp.elements("pointcut"));
199 | if (partpointcutele.size() > 0) {
200 | partpointmap.putAll(pointcutelesProcess(partpointcutele));
201 | }
202 | tmppointmap.putAll(stringStringMap);
203 | tmppointmap.putAll(partpointmap);
204 |
205 | beforeelement.addAll(asp.elements("before"));
206 | Map beforemap = alertProcess(beforeelement);
207 | resbenas.addAll(ProcessActiveAndPointcut(tmppointmap, beforemap, aClass, "before", order));
208 |
209 | afterelement.addAll(asp.elements("after"));
210 | Map aftermap = alertProcess(afterelement);
211 | resbenas.addAll(ProcessActiveAndPointcut(tmppointmap, aftermap, aClass, "after", order));
212 |
213 | aroundelement.addAll(asp.elements("around"));
214 | Map aroundmap = alertProcess(aroundelement);
215 | resbenas.addAll(ProcessActiveAndPointcut(tmppointmap, aroundmap, aClass, "around", order));
216 |
217 | areturnelement.addAll(asp.elements("after-returning"));
218 | Map areturnmap = alertProcess(areturnelement);
219 | resbenas.addAll(ProcessActiveAndPointcut(tmppointmap, areturnmap, aClass, "afterreturn", order));
220 |
221 | athrowelement.addAll(asp.elements("after-throwing"));
222 | Map athrowmap = alertProcess(athrowelement);
223 | resbenas.addAll(ProcessActiveAndPointcut(tmppointmap, athrowmap, aClass, "afterthrow", order));
224 | }
225 | }
226 |
227 | return resbenas;
228 | }
229 |
230 | /**
231 | * Correlate the advices with pointcut expression
232 | *
233 | * @param pointcutmap pointcut map
234 | * @param activemap advice map
235 | * @param aclazz the string of aspect
236 | * @param activetype active type
237 | * @return the list of AopXMLResultBean
238 | */
239 | public List ProcessActiveAndPointcut(Map pointcutmap, Map activemap, String aclazz, String activetype, int order) {
240 | List beanList = new ArrayList<>();
241 | if (pointcutmap.size() > 0 && activemap.size() > 0) {
242 | for (String value : activemap.values()) {
243 | String method = value.split(";")[0];
244 | String pcutref = value.split(";")[1];
245 | for (String s : pointcutmap.keySet()) {
246 | if (pcutref.equals(s)) {
247 | AopXMLResultBean aopXMLResultBean = new AopXMLResultBean();
248 | aopXMLResultBean.setAopclass(aclazz);
249 | aopXMLResultBean.setAopmethod(method);
250 | aopXMLResultBean.setActivetype(activetype);
251 | aopXMLResultBean.setExper(pointcutmap.get(s));
252 | aopXMLResultBean.setOrder(order);
253 | beanList.add(aopXMLResultBean);
254 | }
255 | }
256 | }
257 | }
258 | return beanList;
259 | }
260 |
261 | /**
262 | * the map of key is id and val is expression
263 | *
264 | * @param pointcutelements the list of pointcut label
265 | * @return the map of key is id and val is expression
266 | */
267 | public Map pointcutelesProcess(List pointcutelements) {
268 | Map res = new HashMap<>();
269 | for (Element pointcutelement : pointcutelements) {
270 | String id = pointcutelement.attribute("id").getText();
271 | String expression = pointcutelement.attribute("expression").getText();
272 | res.put(id, expression);
273 | }
274 | return res;
275 | }
276 |
277 | /**
278 | * Process the advice label and get pointcut-ref
279 | *
280 | * @param alertelement the list of alert element
281 | * @return the map of key is methodName+pointcut and val is pointcut id
282 | */
283 | public Map alertProcess(List alertelement) {
284 | Map res = new HashMap<>();
285 | if (alertelement.size() > 0) {
286 | for (Element element : alertelement) {
287 | String method = element.attribute("method").getText();
288 | String pintcutref = element.attribute("pointcut-ref").getText();
289 | res.put(method + pintcutref, method + ";" + pintcutref);
290 | }
291 | }
292 | return res;
293 | }
294 |
295 | public List getChildElements(Element element) {
296 | List elements = element.elements();
297 | return elements;
298 | }
299 |
300 | public Element getElement(String id) {
301 | return elements.get(id);
302 | }
303 |
304 | }
305 |
--------------------------------------------------------------------------------
/src/main/resources/config.properties:
--------------------------------------------------------------------------------
1 | bean_xml_paths =
2 |
--------------------------------------------------------------------------------