├── .gitignore
├── .travis.yml
├── Makefile
├── README.md
├── Untitled
├── WALA.iml
├── apps
├── HelloCordova.apk
├── HelloHybrid.apk
├── HelloScript.apk
├── HelloScript22.apk
├── HelloScript_simple.apk
├── HelloScript_test-2.apk
├── HybridAPIArgNum.apk
├── NormalAliasFlowTest.apk
├── NormalAliasFlowTest_objfield1.apk
└── NormalAliasFlowTest_objfield_false.apk
├── build-maven-jars.py
├── build.gradle
├── build.xml
├── change-version.py
├── data
├── .DS_Store
├── android.jar
└── android_stub.jar
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── kr.ac.kaist.wala.hybridroid.frontend
└── src
│ └── kr
│ └── ac
│ └── kaist
│ └── wala
│ └── hybridroid
│ └── frontend
│ ├── Driver.java
│ ├── JSONOut.java
│ ├── Shell.java
│ └── bridge
│ ├── BridgeInfo.java
│ ├── ClassInfo.java
│ └── MethodInfo.java
├── kr.ac.kaist.wala.hybridroid.test.data
├── ConstantValueTest.apk
├── annotation
│ └── AnnotationTest.apk
└── callgraph
│ ├── bridgefield
│ └── BridgeFieldTest.apk
│ ├── reachability
│ ├── DualReachableMethodTest.apk
│ ├── DynamicJSExecutionTest.apk
│ ├── MultiplePageLoadTest.apk
│ ├── ReachableMethodTest.apk
│ └── UnreachableMethodTest.apk
│ ├── subwebview
│ └── SubWebViewTest.apk
│ └── webview
│ ├── MultipleWebViewAndDiffBridgeTest.apk
│ └── MultipleWebViewTest.apk
├── kr.ac.kaist.wala.hybridroid.test
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── META-INF
│ └── MANIFEST.MF
├── build.gradle
├── build.properties
├── pom.xml
├── src
│ └── test
│ │ └── java
│ │ └── kr
│ │ └── ac
│ │ └── kaist
│ │ └── wala
│ │ └── hybridroid
│ │ └── test
│ │ ├── FileCollector.java
│ │ ├── TestConfig.java
│ │ ├── annotation
│ │ └── AnnotationTest.java
│ │ └── callgraph
│ │ ├── BridgeFieldTest.java
│ │ ├── DynamicJSExectionTest.java
│ │ ├── MultipleHTMLLoadTest.java
│ │ ├── MultipleWebViewTest.java
│ │ ├── ReachableBridgeTest.java
│ │ └── SubClassWebViewTest.java
└── test.config
├── kr.ac.kaist.wala.hybridroid.types
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
└── kr.ac.kaist.wala.hybridroid.types.iml
├── kr.ac.kaist.wala.hybridroid.util
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── META-INF
│ └── MANIFEST.MF
├── build.gradle
├── build.properties
├── build.xml
├── pom.xml
└── src
│ └── kr
│ └── ac
│ └── kaist
│ └── wala
│ └── hybridroid
│ └── util
│ ├── data
│ ├── None.java
│ ├── Option.java
│ ├── Pair.java
│ └── Some.java
│ ├── debug
│ └── Debug.java
│ ├── file
│ ├── DummyFileManager.java
│ ├── FileCollector.java
│ ├── FilePrinter.java
│ ├── FileWriter.java
│ ├── OnlineFileReader.java
│ └── YMLParser.java
│ ├── graph
│ └── visualize
│ │ └── Visualizer.java
│ ├── print
│ ├── AsyncPrinter.java
│ └── IRPrinter.java
│ └── timer
│ └── Timer.java
├── kr.ac.kaist.wala.hybridroid
├── .#Untitled
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── META-INF
│ └── MANIFEST.MF
├── Untitled
├── build.gradle
├── build.properties
├── build.xml
├── cg_new.dex
├── dat
│ └── wala.properties
├── libs
│ └── apktool_2.3.0.jar
├── pom.xml
├── src
│ └── kr
│ │ └── ac
│ │ └── kaist
│ │ └── wala
│ │ └── hybridroid
│ │ ├── analysis
│ │ ├── AnalysisScopeBuilder.java
│ │ ├── FieldDefAnalysis.java
│ │ ├── HybridCFGAnalysis.java
│ │ ├── resource
│ │ │ ├── AndroidDecompiler.java
│ │ │ ├── AndroidResourceAnalysis.java
│ │ │ ├── SmaliParser.java
│ │ │ └── XMLStringResourceReader.java
│ │ └── string
│ │ │ ├── AndroidStringAnalysis.java
│ │ │ ├── ArgumentHotspot.java
│ │ │ ├── Hotspot.java
│ │ │ ├── StringAnalysis.java
│ │ │ ├── StringAnalysisResult.java
│ │ │ ├── constraint
│ │ │ ├── AbstractConstraintEdge.java
│ │ │ ├── AppendOpNode.java
│ │ │ ├── AssignOpNode.java
│ │ │ ├── BinaryOpNode.java
│ │ │ ├── ConstBox.java
│ │ │ ├── ConstType.java
│ │ │ ├── ConstraintGraph.java
│ │ │ ├── ConstraintVisitor.java
│ │ │ ├── IBox.java
│ │ │ ├── IBoxVisitor.java
│ │ │ ├── IConstraintEdge.java
│ │ │ ├── IConstraintMonitor.java
│ │ │ ├── IConstraintNode.java
│ │ │ ├── IOperatorNode.java
│ │ │ ├── IndexOfOpNode.java
│ │ │ ├── InteractionConstraintMonitor.java
│ │ │ ├── JoinOpNode.java
│ │ │ ├── LengthOpNode.java
│ │ │ ├── OrderedEdge.java
│ │ │ ├── ParamBox.java
│ │ │ ├── PropagationEdge.java
│ │ │ ├── ReplaceOpNode.java
│ │ │ ├── SubstringOpNode.java
│ │ │ ├── ToStringOpNode.java
│ │ │ ├── UnaryOpNode.java
│ │ │ ├── UriCodecDecodeOpNode.java
│ │ │ ├── UriGetQueryParameterOpNode.java
│ │ │ ├── UriParseOpNode.java
│ │ │ ├── VarBox.java
│ │ │ └── solver
│ │ │ │ ├── ForwardSetSolver.java
│ │ │ │ ├── IStringConstraintSolver.java
│ │ │ │ ├── InteractiveSolverMonitor.java
│ │ │ │ ├── IterationSolverMonitor.java
│ │ │ │ ├── domain
│ │ │ │ ├── BooleanDomain.java
│ │ │ │ ├── DoubleSetDomain.java
│ │ │ │ ├── IBooleanDomain.java
│ │ │ │ ├── IDomain.java
│ │ │ │ ├── IDomainOp.java
│ │ │ │ ├── IDoubleDomain.java
│ │ │ │ ├── IIntegerDomain.java
│ │ │ │ ├── ILongDomain.java
│ │ │ │ ├── IStringDomain.java
│ │ │ │ ├── IntegerSetDomain.java
│ │ │ │ ├── LongSetDomain.java
│ │ │ │ ├── StringSetDomain.java
│ │ │ │ └── value
│ │ │ │ │ ├── BooleanBotValue.java
│ │ │ │ │ ├── BooleanTopValue.java
│ │ │ │ │ ├── BotValue.java
│ │ │ │ │ ├── DoubleBotValue.java
│ │ │ │ │ ├── DoubleTopValue.java
│ │ │ │ │ ├── IBooleanValue.java
│ │ │ │ │ ├── IDoubleValue.java
│ │ │ │ │ ├── IIntegerValue.java
│ │ │ │ │ ├── ILongValue.java
│ │ │ │ │ ├── IStringValue.java
│ │ │ │ │ ├── IValue.java
│ │ │ │ │ ├── IntegerBotValue.java
│ │ │ │ │ ├── IntegerTopValue.java
│ │ │ │ │ ├── LongBotValue.java
│ │ │ │ │ ├── LongTopValue.java
│ │ │ │ │ ├── StringBotValue.java
│ │ │ │ │ ├── StringTopValue.java
│ │ │ │ │ └── TopValue.java
│ │ │ │ └── model
│ │ │ │ ├── AppendOpSetModel.java
│ │ │ │ ├── IOperationModel.java
│ │ │ │ ├── ISolverMonitor.java
│ │ │ │ ├── IndexOfOpSetModel.java
│ │ │ │ ├── JoinOpSetModel.java
│ │ │ │ ├── LengthOpSetModel.java
│ │ │ │ ├── ReplaceOpSetModel.java
│ │ │ │ ├── SubstringOpSetModel.java
│ │ │ │ ├── ToStringOpSetModel.java
│ │ │ │ ├── UriCodecDecodeOpSetModel.java
│ │ │ │ ├── UriGetQueryParameterOpSetModel.java
│ │ │ │ └── UriParseOpSetModel.java
│ │ │ ├── model
│ │ │ ├── AbstractClassModel.java
│ │ │ ├── CharsetProviderClassModel.java
│ │ │ ├── IClassModel.java
│ │ │ ├── IMethodModel.java
│ │ │ ├── ObjectClassModel.java
│ │ │ ├── StringBufferClassModel.java
│ │ │ ├── StringBuilderClassModel.java
│ │ │ ├── StringClassModel.java
│ │ │ ├── StringModel.java
│ │ │ ├── UriClassModel.java
│ │ │ └── UriCodecClassModel.java
│ │ │ └── resource
│ │ │ └── model
│ │ │ └── ContextClassModel.java
│ │ ├── appinfo
│ │ ├── ManifestInfo.java
│ │ ├── XMLManifestReader.java
│ │ └── properties
│ │ │ └── Property.java
│ │ ├── callback
│ │ └── CallbackAndroidJavaVisitor.java
│ │ ├── callgraph
│ │ ├── AndroidHybridAnalysisScope.java
│ │ ├── AndroidHybridCallGraphBuilder.java
│ │ ├── AndroidHybridMethodTargetSelector.java
│ │ ├── AndroidMethodTargetSelector.java
│ │ ├── HybridClassLoaderFactory.java
│ │ ├── HybridContextSelector.java
│ │ ├── HybridIRFactory.java
│ │ ├── JavaJavaScriptHybridCallGraphBuilder.java
│ │ ├── ResourceCallGraphBuilder.java
│ │ └── graphutils
│ │ │ ├── ConstraintGraphVisualizer.java
│ │ │ ├── WalaCFGVisualizer.java
│ │ │ └── WalaCGVisualizer.java
│ │ ├── checker
│ │ └── HybridAPIMisusesChecker.java
│ │ ├── command
│ │ └── CommandArguments.java
│ │ ├── exception
│ │ └── InternalError.java
│ │ ├── models
│ │ ├── AndroidHybridAppModel.java
│ │ ├── Java60RegressionExclusions.txt
│ │ ├── miniprologue.js
│ │ ├── preamble.js
│ │ └── prologue.js
│ │ ├── pointer
│ │ ├── InterfaceClass.java
│ │ ├── JSCompatibleClassFilter.java
│ │ ├── JavaCompatibleClassFilter.java
│ │ ├── MockupClass.java
│ │ ├── MockupInstanceKey.java
│ │ └── ResourceInstanceKey.java
│ │ ├── print
│ │ ├── NodePrinter.java
│ │ └── Printer.java
│ │ ├── shell
│ │ └── Shell.java
│ │ ├── test
│ │ ├── ModeledCallGraphForTaint.java
│ │ ├── PrivateLeakageDetector.java
│ │ └── TaintAnalysisForHybrid.java
│ │ ├── types
│ │ ├── AndroidJavaJavaScriptTypeMap.java
│ │ └── HybriDroidTypes.java
│ │ └── utils
│ │ ├── LoaderUtils.java
│ │ ├── LocalFileReader.java
│ │ ├── TypeRefHelper.java
│ │ ├── VisualizeCGTest.java
│ │ └── Wrapper.java
└── wala.properties
├── pom.xml
├── settings.gradle
└── targets
├── e42
├── e42.target
└── pom.xml
├── e44
├── e44.iml
├── e44.target
└── pom.xml
├── e47
├── e47.target
└── pom.xml
├── pom.xml
└── targets.iml
/.gitignore:
--------------------------------------------------------------------------------
1 | *.config
2 | *.txt
3 | *.js
4 | *.html
5 | *.DS_Store
6 | *.class
7 | *.out
8 | *.swp
9 | *.dot
10 | *.svg
11 | */bin/
12 | */bin/*
13 | *~
14 | HybriDroid/tmp/
15 | HybriDroid/cfg/
16 | .metadata/
17 | com.ibm.wala.cast.java.jdt.test/
18 | com.ibm.wala.cast.java.polyglot/lib/
19 | com.ibm.wala.cast.java.test.data/src/JLex/
20 | com.ibm.wala.cast.java.test/testdata/
21 | com.ibm.wala.cast.js.html.nu_validator/lib/
22 | com.ibm.wala.cast.js.rhino.test/*.dump
23 | com.ibm.wala.cast.js.rhino.test/*.html*
24 | com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
25 | com.ibm.wala.cast.js.rhino.test/?game*
26 | com.ibm.wala.cast.js.rhino.test/BunnyHunt
27 | com.ibm.wala.cast.js.rhino.test/digg_attack
28 | com.ibm.wala.cast.js.rhino.test/game.php*
29 | com.ibm.wala.cast.js.rhino.test/xxxx
30 | com.ibm.wala.cast.js.rhino/lib/
31 | com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
32 | com.ibm.wala.cast.js.test/examples-src/ajaxslt/
33 | com.ibm.wala.cast.js/lib/
34 | com.ibm.wala.core.testdata/*.jar
35 | com.ibm.wala.core.testdata/@dot/
36 | com.ibm.wala.core.testdata/lib/
37 | com.ibm.wala.core.tests/dat/wala.examples.properties
38 | com.ibm.wala.core.tests/report
39 | com.ibm.wala.core/@dot
40 | com.ibm.wala.core/com.ibm.wala.core*.jar
41 | com.ibm.wala.core/dat/wala.properties
42 | com.ibm.wala.dalvik/src/logback.xml
43 | com.ibm.wala.ide.jdt.test/testdata/
44 | edu.kit.wala.smali.test/out/
45 | target/
46 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | android:
3 | components:
4 | - build-tools-28.0.3
5 | jdk: oraclejdk8
6 | before_install:
7 | - git clone --depth=50 https://github.com/wala/WALA WALA
8 | install:
9 | - pushd WALA
10 | - mvn clean install -DskipTests -B -q
11 | - popd
12 | script:
13 | - make test
14 | sudo: false
15 | cache:
16 | directories:
17 | - $HOME/.m2
18 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | BASH := bash
2 | GRD := gradle
3 | GRDW := gradlew
4 | MVN := mvn
5 | GIT := git
6 |
7 | WALA_DIR := WALA
8 | WALA_CORE := $(WALA_DIR)/com.ibm.wala.core
9 | WALA_RHINO :=$(WALA_DIR)/com.ibm.wala.cast.js.rhino
10 | WALA_UTIL := $(WALA_DIR)/com.ibm.wala.util
11 | WALA_NU := $(WALA_DIR)/com.ibm.wala.cast.js.html.nu_validator
12 | WALA_CAST := $(WALA_DIR)/com.ibm.wala.cast
13 | WALA_DALVIK := $(WALA_DIR)/com.ibm.wala.dalvik
14 | WALA_RHINO_TEST := $(WALA_DIR)/com.ibm.wala.cast.js.rhino.test
15 | WALA_SHRIKE := $(WALA_DIR)/com.ibm.wala.shrike
16 | WALA_JS := $(WALA_DIR)/com.ibm.wala.cast.js
17 | WALA_JS_TEST := $(WALA_DIR)/com.ibm.wala.cast.js.test
18 | WALA_JAVA := $(WALA_DIR)/com.ibm.wala.cast.java
19 | WALA_CORE_TEST := $(WALA_DIR)/com.ibm.wala.core.tests
20 |
21 | WALA_TARGETS := $(WALA_CORE)/target $(WALA_RHINO)/target $(WALA_UTIL)/target $(WALA_NU)/target $(WALA_CAST)/target $(WALA_DALVIK)/target $(WALA_RHINO_TEST)/target $(WALA_SHRIKE)/target $(WALA_JS)/target $(WALA_JS_TEST)/target $(WALA_JAVA)/target $(WALA_CORE_TEST)/target
22 |
23 | HYBRIDROID := kr.ac.kaist.wala.hybridroid/build/libs/kr.ac.kaist.wala.hybridroid.jar
24 | HYBRIDROID_TARGET := hybridroid.jar
25 | HYBRIDROID_TEST := kr.ac.kaist.wala.hybridroid.test
26 |
27 | $(HYBRIDROID_TARGET): $(HYBRIDROID)
28 | cp $(HYBRIDROID) $(HYBRIDROID_TARGET)
29 |
30 | $(HYBRIDROID): $(WALA_TARGETS)
31 | $(BASH) $(GRDW) build -x test
32 |
33 | $(WALA_TARGETS): $(WALA_DIR)
34 | $(MVN) clean install -DskipTests -B -q -f $(WALA_DIR)/pom.xml
35 |
36 | $(WALA_DIR):
37 | $(GIT) clone --depth=50 https://github.com/wala/WALA $(WALA_DIR)
38 |
39 | clean:
40 | $(BASH) $(GRDW) clean -PwalaDir=$(WALA_DIR)
41 | rm $(HYBRIDROID_TARGET)
42 |
43 | test:
44 | $(BASH) $(GRDW) cleanTest test -b $(HYBRIDROID_TEST)/build.gradle
45 |
46 | .PHONY: compile clean test
47 | .SILENT: compile $(WALA_TARGETS) $(WALA_DIR) clean $(HYBRIDROID_TARGET) $(HYBRIDROID) test
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HybriDroid [](https://travis-ci.org/SunghoLee/HybriDroid)
2 |
3 | A static analysis framework to analyze Android hybrid applications.
4 |
5 | ## Getting Started
6 |
7 | ### Prerequisites
8 |
9 | To build and execute HybriDroid, Gradle and Java are required.
10 |
11 | HybriDroid is tested under:
12 |
13 | * JDK 1.8.0
14 | * Gradle 4.3.1
15 |
16 | HybriDroid is built on top of WALA requiring Maven and wget. WALA is automatically downloaded in the HybriDroid compilation process but Maven and wget are needed before the compilation.
17 |
18 | ### Building HybriDroid
19 |
20 | HybriDroid is compiled as follow:
21 |
22 | ```
23 | bash-3.2$ make
24 | ```
25 |
26 | The ``Makefile`` clones WALA, compiles it, and compiles HybriDroid. When the compilation is done, ``hybridroid.jar`` is created in the root directory of HybriDroid project.
27 |
28 | ## Running HybriDroid
29 |
30 | Java Runtime directory and Android rt file must be set in ``wala.properties`` as follow before running HybriDroid. Android rt file is included in HybriDroid project.
31 |
32 | ```
33 | // Java runtime directory
34 | java_runtime_dir = /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib
35 | // Android rt directory
36 | android_rt_jar = /Users/leesh/Documents/repo/HybriDroid/data/android.jar
37 | ```
38 |
39 | Then, HybriDroid is executed as follow:
40 |
41 | ```
42 | java -jar hybridroid.jar -cfg -t HelloHybrid.apk -p wala.properties
43 | ```
44 |
45 | ## WALA
46 |
47 | HybriDroid is implemented and integrated in WALA. For more details on WALA, see the WALA home page.
49 |
50 | The current version of WALA requires build-tools-26.0.2 of Android sdk. If an error occurs in the WALA compilation, download Android sdk and build-tools-26.0.2 as well as add ``android-sdk/tools/bin`` to your PATH.
51 |
52 | ## License
53 |
54 | This project is licensed under the Eclipse Public License v1.0
55 |
--------------------------------------------------------------------------------
/WALA.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/apps/HelloCordova.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HelloCordova.apk
--------------------------------------------------------------------------------
/apps/HelloHybrid.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HelloHybrid.apk
--------------------------------------------------------------------------------
/apps/HelloScript.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HelloScript.apk
--------------------------------------------------------------------------------
/apps/HelloScript22.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HelloScript22.apk
--------------------------------------------------------------------------------
/apps/HelloScript_simple.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HelloScript_simple.apk
--------------------------------------------------------------------------------
/apps/HelloScript_test-2.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HelloScript_test-2.apk
--------------------------------------------------------------------------------
/apps/HybridAPIArgNum.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/HybridAPIArgNum.apk
--------------------------------------------------------------------------------
/apps/NormalAliasFlowTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/NormalAliasFlowTest.apk
--------------------------------------------------------------------------------
/apps/NormalAliasFlowTest_objfield1.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/NormalAliasFlowTest_objfield1.apk
--------------------------------------------------------------------------------
/apps/NormalAliasFlowTest_objfield_false.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/apps/NormalAliasFlowTest_objfield_false.apk
--------------------------------------------------------------------------------
/build-maven-jars.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # script to build jars for maven central
4 | import sys
5 | import subprocess
6 | import os
7 |
8 | # action should be either 'install' (for local test)
9 | # or 'deploy' (for deployment to maven central).
10 | # if current version is SNAPSHOT, will only be deployed
11 | # to sonatype's staging servers. otherwise, will be
12 | # deployed to maven central
13 | action = sys.argv[1]
14 |
15 | # projects for which we should build jars, in order
16 | # will be prefixed with 'com.ibm.wala.'
17 | projects = [
18 | "util",
19 | "shrike",
20 | "core",
21 | "cast",
22 | "cast.java",
23 | "cast.java.ecj",
24 | "cast.js",
25 | "cast.js.rhino"
26 | ]
27 |
28 | for proj in projects:
29 | full_proj = "com.ibm.wala." + proj
30 | print full_proj
31 | os.chdir(full_proj)
32 | mvnCmd = "mvn -f mvncentral.xml clean " + action
33 | try:
34 | subprocess.check_output(mvnCmd, shell=True)
35 | except subprocess.CalledProcessError as e:
36 | print "OUTPUT"
37 | print e.output
38 | raise
39 | os.chdir("..")
40 |
41 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | def wala = file("WALA")
2 |
3 | subprojects{
4 | ext {
5 | wala_path = wala.getAbsolutePath()
6 | wala_version = "1.5.3"
7 | }
8 | }
9 |
10 | wrapper{
11 | gradleVersion = "5.2.1"
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/change-version.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # specify versions as version number, optionally followed by
4 | # '-SNAPSHOT' for a snapshot version
5 | import sys
6 | import subprocess
7 |
8 | oldVersion = sys.argv[1]
9 | newVersion = sys.argv[2]
10 |
11 | print oldVersion + " --> " + newVersion
12 |
13 | oldVersion = oldVersion.replace(".", "\.")
14 | newVersion = newVersion.replace(".", "\.")
15 |
16 | cleanCmd = "mvn clean -q"
17 | print cleanCmd
18 | subprocess.check_output(cleanCmd, shell=True)
19 |
20 | xmlCmd = "find -E ./ -regex \".*(pom|mvncentral)\.xml\" | xargs -n 1 perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\'"
21 | print xmlCmd
22 | subprocess.check_output(xmlCmd, shell=True)
23 |
24 | oldIsSnapshot = oldVersion.endswith("SNAPSHOT")
25 | newIsSnapShot = newVersion.endswith("SNAPSHOT")
26 |
27 | bundleOld = oldVersion if not oldIsSnapshot else oldVersion.replace("-SNAPSHOT","\.qualifier")
28 | bundleNew = newVersion if not newIsSnapShot else newVersion.replace("-SNAPSHOT","\.qualifier")
29 |
30 | otherCmd = "find -E ./ -regex \".*(MANIFEST\.MF|feature\.xml)\" | xargs -n 1 perl -pi -e \'s/" + bundleOld + "/" + bundleNew + "/g\'"
31 |
32 | print otherCmd
33 | subprocess.check_output(otherCmd, shell=True)
34 |
35 | print "done"
36 |
37 |
38 |
--------------------------------------------------------------------------------
/data/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/data/.DS_Store
--------------------------------------------------------------------------------
/data/android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/data/android.jar
--------------------------------------------------------------------------------
/data/android_stub.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/data/android_stub.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS="-Xmx64m"
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.frontend/src/kr/ac/kaist/wala/hybridroid/frontend/JSONOut.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package kr.ac.kaist.wala.hybridroid.frontend;
5 |
6 | import kr.ac.kaist.wala.hybridroid.frontend.bridge.BridgeInfo;
7 | import kr.ac.kaist.wala.hybridroid.frontend.bridge.ClassInfo;
8 | import kr.ac.kaist.wala.hybridroid.frontend.bridge.MethodInfo;
9 | import kr.ac.kaist.wala.hybridroid.util.data.Pair;
10 | import org.json.simple.JSONArray;
11 | import org.json.simple.JSONObject;
12 |
13 | import java.io.File;
14 | import java.io.IOException;
15 | import java.util.HashMap;
16 | import java.util.HashSet;
17 | import java.util.Map;
18 | import java.util.Set;
19 |
20 | /**
21 | * @author Sungho Lee
22 | *
23 | */
24 | public class JSONOut {
25 | private Map> m;
26 |
27 | public JSONOut(Map> m){
28 | this.m = m;
29 | // System.out.println(m);
30 | }
31 |
32 | @SuppressWarnings("unchecked")
33 | public String toJSONString() throws IOException{
34 | JSONObject outer = new JSONObject();
35 | JSONObject js2bridge = new JSONObject();
36 | JSONObject klass = new JSONObject();
37 |
38 | Map>> jsBridgeMap = new HashMap>>();
39 | Map classMap = new HashMap();
40 |
41 | for(File f : m.keySet()){
42 | Set bis = m.get(f);
43 | String jsPath = f.getCanonicalPath();
44 | if(bis != null && !bis.isEmpty()){
45 | for(BridgeInfo bi : bis){
46 | String cn = bi.getClassInfo().getClassName();
47 | if(!jsBridgeMap.containsKey(jsPath))
48 | jsBridgeMap.put(jsPath, new HashSet>());
49 | jsBridgeMap.get(jsPath).add(Pair.make(bi.getName(), cn));
50 | classMap.put(cn, bi.getClassInfo());
51 | }
52 | }
53 | }
54 |
55 | for(String n : jsBridgeMap.keySet()){
56 | JSONObject bridge = new JSONObject();
57 |
58 | Set> bridgeMap = jsBridgeMap.get(n);
59 |
60 | for(Pair p : bridgeMap){
61 | String b = p.fst();
62 | String o = p.snd();
63 | if(!bridge.containsKey(b))
64 | bridge.put(b, new JSONArray());
65 | ((JSONArray)(bridge.get(b))).add(o);
66 | }
67 | js2bridge.put(n, bridge);
68 | }
69 |
70 | outer.put("js2bridge", js2bridge);
71 |
72 | for(String n : classMap.keySet()){
73 | ClassInfo c = classMap.get(n);
74 | JSONArray methods = new JSONArray();
75 |
76 | for(MethodInfo mi : c.getAllAccessibleMethods()){
77 | JSONObject method = new JSONObject();
78 | JSONArray params = new JSONArray();
79 | method.put("name", mi.getName().toString());
80 | for(int i = (mi.isStatic()? 0 : 1); i < mi.getNumberOfParameters(); i++){
81 | String ptn = mi.getParameterType(i).getName().getClassName().toString();
82 | params.add(ptn);
83 | }
84 | method.put("params", params);
85 | method.put("result", mi.getReturnType().getName().getClassName().toString());
86 | methods.add(method);
87 | }
88 | klass.put(c.getClassName(), methods);
89 | }
90 | outer.put("classes", klass);
91 | return outer.toJSONString();
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.frontend/src/kr/ac/kaist/wala/hybridroid/frontend/Shell.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package kr.ac.kaist.wala.hybridroid.frontend;
5 |
6 | import kr.ac.kaist.wala.hybridroid.frontend.bridge.BridgeInfo;
7 |
8 | import java.io.BufferedWriter;
9 | import java.io.File;
10 | import java.io.FileWriter;
11 | import java.io.IOException;
12 | import java.util.Map;
13 | import java.util.Set;
14 |
15 | /**
16 | * @author Sungho Lee
17 | *
18 | */
19 | public class Shell {
20 | public static long START;
21 |
22 | static public void main(String[] args){
23 | long start = System.currentTimeMillis();
24 | START = start;
25 |
26 | Driver d = new Driver();
27 |
28 | Map> m = d.analyzeBridgeMapping(args[0], args[1]);
29 | JSONOut out = new JSONOut(m);
30 |
31 | try {
32 | BufferedWriter bw = new BufferedWriter(new FileWriter(args[2]));
33 | bw.write(out.toJSONString());
34 | bw.flush();
35 | bw.close();
36 | } catch (IOException e) {
37 | // TODO Auto-generated catch block
38 | e.printStackTrace();
39 | }
40 |
41 | long end = System.currentTimeMillis();
42 | System.out.println("#time: " + (end - start));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.frontend/src/kr/ac/kaist/wala/hybridroid/frontend/bridge/BridgeInfo.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.frontend.bridge;
12 |
13 | /**
14 | * Data structure denotes bridge information used for access from JavaScript to Java in hybrid applications.
15 | * @author Sungho Lee
16 | *
17 | */
18 | public class BridgeInfo {
19 | private String name;
20 | private ClassInfo klass;
21 |
22 | public BridgeInfo(String name, ClassInfo klass){
23 | this.name = name;
24 | this.klass = klass;
25 | }
26 |
27 | /**
28 | * Get the name of this bridge.
29 | * @return the name of this bridge.
30 | */
31 | public String getName(){
32 | return this.name;
33 | }
34 |
35 | /**
36 | * Get the class information of a Java object referred by this bridge.
37 | * @return the Java class information for this bridge.
38 | */
39 | public ClassInfo getClassInfo(){
40 | return this.klass;
41 | }
42 |
43 | public String toString(){
44 | String res = "";
45 | res = name + " -> " + klass;
46 | return res;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/ConstantValueTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/ConstantValueTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/annotation/AnnotationTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/annotation/AnnotationTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/bridgefield/BridgeFieldTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/bridgefield/BridgeFieldTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/DualReachableMethodTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/DualReachableMethodTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/DynamicJSExecutionTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/DynamicJSExecutionTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/MultiplePageLoadTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/MultiplePageLoadTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/ReachableMethodTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/ReachableMethodTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/UnreachableMethodTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/reachability/UnreachableMethodTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/subwebview/SubWebViewTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/subwebview/SubWebViewTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/webview/MultipleWebViewAndDiffBridgeTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/webview/MultipleWebViewAndDiffBridgeTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test.data/callgraph/webview/MultipleWebViewTest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid.test.data/callgraph/webview/MultipleWebViewTest.apk
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | kr.ac.kaist.wala.hybridroid.test
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.jdt.core.javanature
26 | org.eclipse.pde.PluginNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Test
4 | Bundle-SymbolicName: kr.ac.kaist.wala.hybridroid.test
5 | Bundle-Version: 0.0.1.qualifier
6 | Bundle-ClassPath: test.jar,
7 | libs/junit-4.11.jar
8 | Export-Package: kr.ac.kaist.wala.hybridroid.test,
9 | kr.ac.kaist.wala.hybridroid.test.annotation,
10 | kr.ac.kaist.wala.hybridroid.test.callgraph
11 | Require-Bundle: org.junit;bundle-version="4.11.0",
12 | com.ibm.wala.core;bundle-version="1.4.4",
13 | kr.ac.kaist.wala.hybridroid;bundle-version="0.0.1"
14 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | repositories {
4 | mavenCentral()
5 | }
6 |
7 | test {
8 | maxHeapSize = "8g"
9 | useJUnitPlatform()
10 |
11 | testLogging {
12 | events "passed", "started", "failed", "skipped"
13 | }
14 |
15 | reports {
16 | junitXml.enabled = false
17 | html.enabled = true
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation gradleApi()
23 | testImplementation ('junit:junit:3.8.1')
24 | testCompileOnly('junit:junit:4.12')
25 | testImplementation('org.junit.jupiter:junit-jupiter-api:5.1.0')
26 | testRuntimeOnly(
27 | 'org.junit.jupiter:junit-jupiter-engine:5.1.0',
28 | 'org.junit.vintage:junit-vintage-engine:5.1.0'
29 | )
30 | testImplementation project(':kr.ac.kaist.wala.hybridroid')
31 | testImplementation files(wala_path + '/com.ibm.wala.cast.js.rhino/target/com.ibm.wala.cast.js.rhino-' + wala_version + '-SNAPSHOT.jar',
32 | wala_path + '/com.ibm.wala.util/target/com.ibm.wala.util-' + wala_version + '-SNAPSHOT.jar',
33 | wala_path + '/com.ibm.wala.cast.js.html.nu_validator/target/com.ibm.wala.cast.js.html.nu_validator-' + wala_version + '-SNAPSHOT.jar',
34 | wala_path + '/com.ibm.wala.cast/target/com.ibm.wala.cast-' + wala_version + '-SNAPSHOT.jar',
35 | wala_path + '/com.ibm.wala.dalvik/target/com.ibm.wala.dalvik-' + wala_version + '-SNAPSHOT.jar',
36 | wala_path + '/com.ibm.wala.cast.js.rhino.test/target/com.ibm.wala.cast.js.rhino.test-' + wala_version + '-SNAPSHOT.jar',
37 | wala_path + '/com.ibm.wala.shrike/target/com.ibm.wala.shrike-' + wala_version + '-SNAPSHOT.jar',
38 | wala_path + '/com.ibm.wala.cast.js/target/com.ibm.wala.cast.js-' + wala_version + '-SNAPSHOT.jar',
39 | wala_path + '/com.ibm.wala.cast.js.test/target/com.ibm.wala.cast.js.test-' + wala_version + '-SNAPSHOT.jar',
40 | wala_path + '/com.ibm.wala.cast.java/target/com.ibm.wala.cast.java-' + wala_version + '-SNAPSHOT.jar',
41 | wala_path + '/com.ibm.wala.core/target/com.ibm.wala.core-' + wala_version + '-SNAPSHOT.jar',
42 | wala_path + '/com.ibm.wala.core.tests/target/com.ibm.wala.core.tests-' + wala_version + '-SNAPSHOT.jar')
43 | testImplementation group: 'org.smali', name: 'dexlib2', version: '2.2.4'
44 | }
45 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/build.properties:
--------------------------------------------------------------------------------
1 | source.test.jar = src/
2 | bin.includes = META-INF/,\
3 | test.jar
4 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | kr.ac.kaist.wala
7 | HybridDroid
8 | 0.0.1-SNAPSHOT
9 |
10 | kr.ac.kaist.wala.hybridroid.test
11 | eclipse-plugin
12 |
13 |
14 |
15 | kr.ac.kaist.wala
16 | kr.ac.kaist.wala.hybridroid
17 | 0.0.1-SNAPSHOT
18 |
19 |
20 |
21 | junit
22 | junit
23 | 4.11
24 | test
25 |
26 |
27 |
28 |
29 |
30 |
31 | org.apache.maven.plugins
32 | maven-surefire-plugin
33 |
34 |
35 | test
36 | test
37 |
38 | ${project.build.outputDirectory}
39 | -Xmx2G -ea
40 | true
41 | 2
42 | false
43 |
44 |
45 | test
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/src/test/java/kr/ac/kaist/wala/hybridroid/test/FileCollector.java:
--------------------------------------------------------------------------------
1 | package kr.ac.kaist.wala.hybridroid.test;
2 |
3 | import java.io.File;
4 | import java.io.FileFilter;
5 |
6 | public class FileCollector {
7 | public static File[] getAPKsInDir(String dirPath){
8 | File dir = new File(dirPath);
9 |
10 | return dir.listFiles(new FileFilter(){
11 | @Override
12 | public boolean accept(File pathname) {
13 | // TODO Auto-generated method stub
14 | return pathname.getName().endsWith(".apk");
15 | }});
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/src/test/java/kr/ac/kaist/wala/hybridroid/test/TestConfig.java:
--------------------------------------------------------------------------------
1 | package kr.ac.kaist.wala.hybridroid.test;
2 |
3 | import com.ibm.wala.ipa.cha.ClassHierarchyException;
4 | import com.ibm.wala.util.CancelException;
5 | import kr.ac.kaist.wala.hybridroid.test.annotation.AnnotationTest;
6 | import kr.ac.kaist.wala.hybridroid.test.callgraph.*;
7 | import org.junit.runner.JUnitCore;
8 | import org.junit.runner.Result;
9 | import org.junit.runner.notification.Failure;
10 |
11 | import java.io.File;
12 | import java.io.FileInputStream;
13 | import java.io.FileNotFoundException;
14 | import java.io.IOException;
15 | import java.util.Properties;
16 | import java.io.PrintStream;
17 | import java.io.ByteArrayOutputStream;
18 |
19 | public class TestConfig {
20 |
21 | public static Properties testProperties;
22 | public static String TEST_DIR = "test_dir";
23 | public static String LIB_JAR = "android_jar";
24 |
25 | static{
26 | testProperties = new Properties();
27 | try {
28 | testProperties.load(new FileInputStream(new File("test.config")));
29 | } catch (FileNotFoundException e) {
30 | // TODO Auto-generated catch block
31 | System.out.println("Working Dir: " + new File(".").getAbsolutePath());
32 | e.printStackTrace();
33 | System.exit(-1);
34 | } catch (IOException e) {
35 | // TODO Auto-generated catch block
36 | e.printStackTrace();
37 | }
38 | }
39 |
40 | public static String getTestDir(){
41 | return testProperties.getProperty(TEST_DIR);
42 | }
43 |
44 | public static String getLibPath(){
45 | return testProperties.getProperty(LIB_JAR);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/src/test/java/kr/ac/kaist/wala/hybridroid/test/annotation/AnnotationTest.java:
--------------------------------------------------------------------------------
1 | package kr.ac.kaist.wala.hybridroid.test.annotation;
2 |
3 | import com.ibm.wala.ipa.cha.ClassHierarchyException;
4 | import com.ibm.wala.util.CancelException;
5 | import kr.ac.kaist.wala.hybridroid.analysis.HybridCFGAnalysis;
6 | import kr.ac.kaist.wala.hybridroid.test.FileCollector;
7 | import kr.ac.kaist.wala.hybridroid.test.TestConfig;
8 | import org.junit.Ignore;
9 | import org.junit.Test;
10 |
11 | import java.io.File;
12 | import java.io.IOException;
13 |
14 | import static org.junit.Assert.assertEquals;
15 | import static org.junit.Assert.assertTrue;
16 |
17 | public class AnnotationTest {
18 |
19 | public static String TEST_DIR = "annotation";
20 |
21 |
22 | @Test
23 | public void missingAnnotationMethodShouldInvisible() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException{
24 | File[] tests = FileCollector.getAPKsInDir(TestConfig.getTestDir() + File.separator + TEST_DIR);
25 | boolean AnnotationTest_apk = false;
26 | for(File f : tests){
27 | String testName = f.getName();
28 | HybridCFGAnalysis cfgAnalysis = new HybridCFGAnalysis();
29 | cfgAnalysis.main(f.getCanonicalPath(), TestConfig.getLibPath());
30 | System.out.println("name: DONE??");
31 | for(String s: cfgAnalysis.getWarnings()){
32 | switch(testName){
33 | case "AnnotationTest.apk":
34 | AnnotationTest_apk = true;
35 | assertEquals(testName + ": ", "[Error] the [[JAVA_JS_BRIDGE:],] is not matched.", s);
36 | break;
37 | }
38 | }
39 | }
40 |
41 | assertTrue(AnnotationTest_apk);
42 | }
43 |
44 |
45 | @Test
46 | public void ignoreAnnotationInfoBeforeKitkat(){
47 | //TODO: implement test apps
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.test/test.config:
--------------------------------------------------------------------------------
1 | test_dir = ../kr.ac.kaist.wala.hybridroid.test.data
2 | android_jar = ../data/android.jar
3 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.types/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.types/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | kr.ac.kaist.wala.hybridroid.types
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.types/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.types/kr.ac.kaist.wala.hybridroid.types.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | kr.ac.kaist.wala.hybridroid.util
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.jdt.core.javanature
26 | org.eclipse.pde.PluginNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.7
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.7
12 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: Util
4 | Bundle-SymbolicName: kr.ac.kaist.wala.hybridroid.util
5 | Bundle-Version: 0.0.1.qualifier
6 | Bundle-ClassPath: util.jar
7 | Require-Bundle: com.ibm.wala.core,
8 | com.ibm.wala.dalvik
9 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | repositories {
4 | }
5 |
6 | sourceSets {
7 | main {
8 | java {
9 | srcDir 'src'
10 | }
11 | }
12 | test {
13 | java {
14 | srcDir 'test'
15 | }
16 | }
17 | }
18 |
19 | dependencies {
20 | implementation files(wala_path + '/com.ibm.wala.util/target/com.ibm.wala.util-' + wala_version + '-SNAPSHOT.jar',
21 | wala_path + '/com.ibm.wala.dalvik/target/com.ibm.wala.dalvik-' + wala_version + '-SNAPSHOT.jar',
22 | wala_path + '/com.ibm.wala.core/target/com.ibm.wala.core-' + wala_version + '-SNAPSHOT.jar')
23 | }
24 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/build.properties:
--------------------------------------------------------------------------------
1 | source.util.jar = src/
2 | bin.includes = META-INF/,\
3 | util.jar
4 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | kr.ac.kaist.wala
7 | HybridDroid
8 | 0.0.1-SNAPSHOT
9 |
10 | kr.ac.kaist.wala.hybridroid.util
11 | eclipse-plugin
12 |
13 |
14 |
15 | com.ibm.wala
16 | com.ibm.wala.util
17 | 1.5.0-SNAPSHOT
18 |
19 |
20 |
21 | com.ibm.wala
22 | com.ibm.wala.core
23 | 1.5.0-SNAPSHOT
24 |
25 |
26 |
27 | com.ibm.wala
28 | com.ibm.wala.dalvik
29 | 1.5.0-SNAPSHOT
30 |
31 |
32 |
33 |
34 |
35 |
36 | maven-dependency-plugin
37 |
38 |
39 |
40 | copy
41 |
42 |
43 |
44 |
45 | org.apache.commons
46 | commons-lang3
47 | 3.7
48 | jar
49 | false
50 |
51 |
52 | ${basedir}/lib
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/data/None.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.data;
12 |
13 | public class None implements Option {
14 |
15 | @Override
16 | public boolean isSome() {
17 | // TODO Auto-generated method stub
18 | return false;
19 | }
20 |
21 | @Override
22 | public boolean isNone() {
23 | // TODO Auto-generated method stub
24 | return true;
25 | }
26 |
27 | @Override
28 | public T get() {
29 | // TODO Auto-generated method stub
30 | throw new InternalError("'None' object can not be gotten.");
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/data/Option.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.data;
12 |
13 | public interface Option {
14 |
15 | public boolean isSome();
16 | public boolean isNone();
17 | public T get();
18 | }
19 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/data/Pair.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.data;
12 |
13 | public class Pair {
14 | private X fst;
15 | private Y snd;
16 |
17 | static public Pair make(X fst, Y snd){
18 | return new Pair(fst, snd);
19 | }
20 |
21 | private Pair(X fst, Y snd){
22 | this.fst = fst;
23 | this.snd = snd;
24 | }
25 |
26 | public X fst(){
27 | return fst;
28 | }
29 |
30 | public Y snd(){
31 | return snd;
32 | }
33 |
34 | @Override
35 | public int hashCode(){
36 | return fst.hashCode() + snd.hashCode();
37 | }
38 |
39 | @Override
40 | public boolean equals(Object o){
41 | if(o instanceof Pair){
42 | if(fst.equals(((Pair) o).fst()) && snd.equals(((Pair) o).snd()))
43 | return true;
44 | }
45 |
46 | return false;
47 | }
48 |
49 | @Override
50 | public String toString(){
51 | return "[ " + fst + ", " + snd + "]";
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/data/Some.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.data;
12 |
13 | public class Some implements Option {
14 |
15 | private T o;
16 |
17 | public Some(T o){
18 | this.o = o;
19 | }
20 |
21 | @Override
22 | public boolean isSome() {
23 | // TODO Auto-generated method stub
24 | return true;
25 | }
26 |
27 | @Override
28 | public boolean isNone() {
29 | // TODO Auto-generated method stub
30 | return false;
31 | }
32 |
33 | @Override
34 | public T get() {
35 | // TODO Auto-generated method stub
36 | return o;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/debug/Debug.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.debug;
12 |
13 | public class Debug {
14 | public static void setDebuggable(Object o, boolean t){
15 |
16 | }
17 |
18 | public static void printMsg(String s){
19 |
20 | }
21 |
22 | public static void temporaryStop(){
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/file/DummyFileManager.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.file;
12 |
13 | import java.io.File;
14 | import java.util.HashSet;
15 | import java.util.Set;
16 |
17 | public class DummyFileManager {
18 | private static Set dummies = new HashSet();
19 |
20 | public static void addDummyFile(File f){
21 | dummies.add(f);
22 | }
23 |
24 | // public static void removeAllDummies(){
25 | // for(dummies.)
26 | //
27 | // }
28 | }
29 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/file/FileCollector.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.file;
12 |
13 | import java.io.File;
14 | import java.util.HashSet;
15 | import java.util.Set;
16 |
17 | public class FileCollector {
18 | public static Set collectFiles(File dir, String... exts){
19 | Set res = new HashSet();
20 | for(File f : dir.listFiles()){
21 | if(f.isDirectory())
22 | res.addAll(collectFiles(f, exts));
23 | else{
24 | for(String ext : exts)
25 | if(f.getName().endsWith(ext))
26 | res.add(f);
27 | }
28 | }
29 | return res;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/file/FilePrinter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.file;
12 |
13 | import kr.ac.kaist.wala.hybridroid.util.print.AsyncPrinter;
14 |
15 | import java.io.*;
16 |
17 | public class FilePrinter {
18 |
19 | public static void print(File f, OutputStream os) throws InternalError{
20 | if(!f.exists()){
21 | try {
22 | throw new InternalError("the file does not exsit: " + f.getCanonicalPath());
23 | } catch (IOException e) {
24 | // TODO Auto-generated catch block
25 | e.printStackTrace();
26 | }
27 | }
28 |
29 | BufferedReader br = null;
30 | BufferedWriter bw = null;
31 | try {
32 | br = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
33 | bw = new BufferedWriter(new OutputStreamWriter(os));
34 |
35 | String s = null;
36 |
37 | while ((s = br.readLine()) != null) {
38 | bw.write(s + "\n");
39 | }
40 | bw.flush();
41 | } catch (IOException e) {
42 |
43 | } finally {
44 | try {
45 | if (br != null)
46 | br.close();
47 | if (bw != null)
48 | bw.close();
49 | } catch (IOException e) {
50 | // TODO Auto-generated catch block
51 | e.printStackTrace();
52 | }
53 | }
54 | }
55 |
56 | public static void printUsingShell(File f, String path){
57 | if(!f.exists()){
58 | try {
59 | throw new InternalError("the file does not exsit: " + f.getCanonicalPath());
60 | } catch (IOException e) {
61 | // TODO Auto-generated catch block
62 | e.printStackTrace();
63 | }
64 | }
65 |
66 | Runtime r = Runtime.getRuntime();
67 | try {
68 | System.out.println("cp " + f.getCanonicalPath() + " " + path);
69 | Process p = r.exec("cp " + f.getCanonicalPath() + " " + path);
70 | AsyncPrinter errPinter = new AsyncPrinter(p.getErrorStream(), AsyncPrinter.PRINT_ERR);
71 | AsyncPrinter outPinter = new AsyncPrinter(p.getInputStream(), AsyncPrinter.PRINT_OUT);
72 | errPinter.run();
73 | outPinter.run();
74 | p.waitFor();
75 | } catch (IOException e) {
76 | e.printStackTrace();
77 | } catch (InterruptedException e) {
78 | e.printStackTrace();
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/file/OnlineFileReader.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.file;
12 |
13 | import java.io.BufferedReader;
14 | import java.io.IOException;
15 | import java.io.InputStreamReader;
16 | import java.net.URL;
17 |
18 | public class OnlineFileReader {
19 | private String path;
20 |
21 | public OnlineFileReader(String path){
22 | this.path = path;
23 | }
24 |
25 | public String readData() throws IOException{
26 | String res = "";
27 |
28 | URL url = new URL(path);
29 |
30 | BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
31 |
32 | String s = null;
33 |
34 | boolean isFirstLine = true;
35 |
36 | while((s = br.readLine()) != null){
37 | if(!isFirstLine)
38 | res += "\n";
39 |
40 | res += s;
41 |
42 | if(isFirstLine)
43 | isFirstLine = false;
44 | }
45 | br.close();
46 |
47 | return res;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/print/AsyncPrinter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.print;
12 |
13 | import java.io.BufferedReader;
14 | import java.io.IOException;
15 | import java.io.InputStream;
16 | import java.io.InputStreamReader;
17 | import java.io.PrintStream;
18 |
19 | /**
20 | * Print messages from input stream asynchronously. This supports two type of
21 | * message; Standard-out and Standard-error.
22 | *
23 | * @author Sungho Lee
24 | */
25 | public class AsyncPrinter extends Thread {
26 | static public final int PRINT_OUT = 1;
27 | static public final int PRINT_ERR = 2;
28 |
29 | private BufferedReader reader;
30 | private PrintStream printer;
31 |
32 | /**
33 | * Unique constructor for AsyncPrinter.
34 | * @param reader the input stream for printing.
35 | * @param type the type of printing. now, only support standard-out and standard-error.
36 | */
37 | public AsyncPrinter(InputStream reader, int type){
38 | this.reader = new BufferedReader(new InputStreamReader(reader));
39 | setPrinter(type);
40 | }
41 |
42 | /**
43 | * Set printing type for AsyncPrinter.
44 | * @param type the type of printing. now, only support standard-out and standard-error.
45 | */
46 | private void setPrinter(int type){
47 | switch(type){
48 | case PRINT_OUT:
49 | printer = System.out;
50 | break;
51 | case PRINT_ERR:
52 | printer = System.err;
53 | break;
54 | default:
55 |
56 | }
57 | }
58 |
59 | /**
60 | * Start printing messages from the input stream. Must stop this operation
61 | * using stop method when no more need to print messages for preventing
62 | * the resource waste.
63 | */
64 | @Override
65 | public void run() {
66 | // TODO Auto-generated method stub
67 | String s;
68 |
69 | try {
70 | while ((s = reader.readLine()) != null)
71 | printer.println(s);
72 | } catch (IOException e) {
73 | // TODO Auto-generated catch block
74 | e.printStackTrace();
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/print/IRPrinter.java:
--------------------------------------------------------------------------------
1 | package kr.ac.kaist.wala.hybridroid.util.print;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileWriter;
6 | import java.io.IOException;
7 | import java.util.Iterator;
8 |
9 | import com.ibm.wala.dalvik.classLoader.DexIRFactory;
10 | import com.ibm.wala.ipa.callgraph.CGNode;
11 | import com.ibm.wala.ipa.callgraph.CallGraph;
12 | import com.ibm.wala.ipa.callgraph.impl.Everywhere;
13 | import com.ibm.wala.ssa.IR;
14 | import com.ibm.wala.ssa.SSAInstruction;
15 | import com.ibm.wala.ssa.SSAOptions;
16 |
17 | /**
18 | * Created by leesh on 07/03/2017.
19 | */
20 | public class IRPrinter {
21 |
22 | public static void printIR(CallGraph cg, String out, Filter f){
23 | if(f == null)
24 | f = defaultFilter();
25 |
26 | File outFile = new File(out);
27 | try {
28 | BufferedWriter bw = new BufferedWriter(new FileWriter(outFile));
29 | for(CGNode n : cg) {
30 | if(!f.filter(n))
31 | continue;
32 | bw.write("N" + n.toString() + "\n");
33 | bw.write("=======================================\n");
34 | IR ir = makeIR(n);
35 | if(ir != null) {
36 | SSAInstruction[] insts = ir.getInstructions();
37 | int index = 1;
38 | for (int i = 0; i < insts.length; i++) {
39 | SSAInstruction inst = insts[i];
40 | if (inst != null) {
41 | bw.write("( " + (i) + " ) " + inst + "\n");
42 | }
43 | }
44 | bw.write("[Succ]=================================\n");
45 | Iterator iSucc = cg.getSuccNodes(n);
46 | while (iSucc.hasNext()) {
47 | CGNode succ = iSucc.next();
48 | bw.write("\t" + succ + "\n");
49 | }
50 | }
51 | bw.newLine();
52 | bw.newLine();
53 | }
54 |
55 | bw.flush();
56 | bw.close();
57 | } catch (IOException e) {
58 | e.printStackTrace();
59 | }
60 | }
61 |
62 | private static IR makeIR(CGNode n){
63 | IR ir = n.getIR();
64 |
65 | if(ir == null){
66 | DexIRFactory irFactory = new DexIRFactory();
67 | try {
68 | ir = irFactory.makeIR(n.getMethod(), Everywhere.EVERYWHERE, SSAOptions.defaultOptions());
69 | }catch(NullPointerException e){
70 | return null;
71 | }
72 | }
73 | return ir;
74 | }
75 |
76 | public interface Filter{
77 | boolean filter(CGNode n);
78 | }
79 |
80 | static public Filter defaultFilter(){
81 | return new Filter() {
82 | @Override
83 | public boolean filter(CGNode n) {
84 | return true;
85 | }
86 | };
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid.util/src/kr/ac/kaist/wala/hybridroid/util/timer/Timer.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2002 - 2006 IBM Corporation.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.util.timer;
12 |
13 | public class Timer {
14 | private long start;
15 | private long end;
16 | static public Timer start(){
17 | return new Timer(System.currentTimeMillis());
18 | }
19 |
20 | private Timer(long start){
21 | this.start = start;
22 | }
23 |
24 | public long end(){
25 | this.end = System.currentTimeMillis();
26 | return end - start;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/.#Untitled:
--------------------------------------------------------------------------------
1 | leesh@Sunghoui-iMac.local.1047
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | kr.ac.kaist.wala.hybridroid
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.jdt.core.javanature
26 | org.eclipse.pde.PluginNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'application'
3 |
4 | mainClassName = 'kr/ac/kaist/wala/hybridroid/shell/Shell'
5 |
6 | repositories {
7 | mavenLocal()
8 | mavenCentral()
9 | maven {
10 | url "https://repo.eclipse.org/content/groups/releases/"
11 | }
12 | }
13 |
14 | sourceSets {
15 | main {
16 | java {
17 | srcDir 'src'
18 | }
19 | }
20 | test {
21 | java {
22 | srcDir 'test'
23 | }
24 | }
25 | }
26 |
27 | jar {
28 | manifest {
29 | attributes(
30 | 'Main-Class': 'kr.ac.kaist.wala.hybridroid.shell.Shell'
31 | )
32 | }
33 |
34 | from({ (configurations.compileClasspath).collect { it.isDirectory() ? it : zipTree(it) } }){
35 | exclude "META-INF/*.SF"
36 | exclude "META-INF/*.DSA"
37 | exclude "META-INF/*.RSA"
38 | }
39 |
40 | from('src'){
41 | include '**/*.txt'
42 | include '**/*.js'
43 | }
44 | }
45 |
46 | dependencies {
47 |
48 | implementation project(':kr.ac.kaist.wala.hybridroid.util')
49 | implementation files(wala_path + '/com.ibm.wala.cast.js.rhino/target/com.ibm.wala.cast.js.rhino-' + wala_version + '-SNAPSHOT.jar',
50 | wala_path + '/com.ibm.wala.util/target/com.ibm.wala.util-' + wala_version + '-SNAPSHOT.jar',
51 | wala_path + '/com.ibm.wala.cast.js.html.nu_validator/target/com.ibm.wala.cast.js.html.nu_validator-' + wala_version + '-SNAPSHOT.jar',
52 | wala_path + '/com.ibm.wala.cast/target/com.ibm.wala.cast-' + wala_version + '-SNAPSHOT.jar',
53 | wala_path + '/com.ibm.wala.dalvik/target/com.ibm.wala.dalvik-' + wala_version + '-SNAPSHOT.jar',
54 | wala_path + '/com.ibm.wala.cast.js.rhino.test/target/com.ibm.wala.cast.js.rhino.test-' + wala_version + '-SNAPSHOT.jar',
55 | wala_path + '/com.ibm.wala.shrike/target/com.ibm.wala.shrike-' + wala_version + '-SNAPSHOT.jar',
56 | wala_path + '/com.ibm.wala.cast.js/target/com.ibm.wala.cast.js-' + wala_version + '-SNAPSHOT.jar',
57 | wala_path + '/com.ibm.wala.cast.js.test/target/com.ibm.wala.cast.js.test-' + wala_version + '-SNAPSHOT.jar',
58 | wala_path + '/com.ibm.wala.cast.java/target/com.ibm.wala.cast.java-' + wala_version + '-SNAPSHOT.jar',
59 | wala_path + '/com.ibm.wala.core/target/com.ibm.wala.core-' + wala_version + '-SNAPSHOT.jar',
60 | wala_path + '/com.ibm.wala.core.tests/target/com.ibm.wala.core.tests-' + wala_version + '-SNAPSHOT.jar',
61 | 'libs/apktool_2.3.0.jar')
62 | // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
63 | implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
64 | // https://mvnrepository.com/artifact/commons-cli/commons-cli
65 | implementation group: 'commons-cli', name: 'commons-cli', version: '1.4'
66 | implementation group: 'org.smali', name: 'dexlib2', version: '2.2.4'
67 | implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.20'
68 | implementation group: 'net.htmlparser.jericho', name: 'jericho-html', version: '3.2'
69 | implementation group: 'commons-io', name: 'commons-io', version: '2.4'
70 | implementation group: 'org.mozilla', name: 'rhino', version: '1.7.10'
71 | }
72 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/build.properties:
--------------------------------------------------------------------------------
1 | source.hybridroid.jar = src/
2 | bin.includes = META-INF/,\
3 | hybridroid.jar,\
4 | lib/commons-cli-1.4.jar,\
5 | lib/commons-lang3-3.7.jar,\
6 | libs/apktool_2.3.0.jar
7 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/libs/apktool_2.3.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunghoLee/HybriDroid/a5bc657e952a290d0121e79343b6fa39554ce012/kr.ac.kaist.wala.hybridroid/libs/apktool_2.3.0.jar
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/ArgumentHotspot.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string;
12 |
13 | import com.ibm.wala.types.ClassLoaderReference;
14 | import com.ibm.wala.types.Selector;
15 | import com.ibm.wala.types.TypeReference;
16 |
17 | public class ArgumentHotspot implements Hotspot {
18 | private TypeReference cDescriptor;
19 | private Selector mSelector;
20 | private int argIndex;
21 |
22 | public ArgumentHotspot(ClassLoaderReference cRef, String cDescriptor, String mDescriptor, int argIndex){
23 | this.argIndex = argIndex;
24 |
25 | this.cDescriptor = TypeReference.findOrCreateClass(cRef, cDescriptor.substring(0, cDescriptor.lastIndexOf("/")), cDescriptor.substring(cDescriptor.lastIndexOf("/")+1));
26 | this.mSelector = Selector.make(mDescriptor);
27 | }
28 |
29 | public TypeReference getClassDescriptor() {
30 | return this.cDescriptor;
31 | }
32 |
33 | public Selector getMethodDescriptor() {
34 | return this.mSelector;
35 | }
36 |
37 | public int getArgIndex() {
38 | return argIndex;
39 | }
40 |
41 | @Override
42 | public int index(){
43 | return getArgIndex();
44 | }
45 |
46 | @Override
47 | public String toString(){
48 | return "ArgSpot[" + cDescriptor + " " + mSelector + " (@" + argIndex + ")]";
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/Hotspot.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string;
12 |
13 | public interface Hotspot {
14 | public String toString();
15 | public int index();
16 | }
17 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/StringAnalysis.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string;
12 |
13 | import java.util.List;
14 |
15 | public interface StringAnalysis {
16 |
17 | public void addAnalysisScope(String path);
18 | public void analyze(List hotspots) throws Exception;
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/StringAnalysisResult.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string;
12 |
13 | import com.ibm.wala.types.MethodReference;
14 | import com.ibm.wala.util.collections.Pair;
15 |
16 | import java.util.HashMap;
17 | import java.util.Map;
18 |
19 | public class StringAnalysisResult {
20 | private int methodNum;
21 | private int callSiteNum;
22 | private int posNum;
23 | private Map methodNumMap;
24 | private Map, Integer> callSiteMap;
25 | private Map, Integer> posMap;
26 | private Map valueMap;
27 |
28 | public StringAnalysisResult(){
29 | methodNumMap = new HashMap();
30 | callSiteMap = new HashMap, Integer>();
31 | posMap = new HashMap, Integer>();
32 | valueMap = new HashMap();
33 | methodNum = 1;
34 | callSiteNum = 1;
35 | posNum = 1;
36 | }
37 |
38 | public void setResult(MethodReference caller, int instIndex, int argPos, String v){
39 | if(!methodNumMap.containsKey(caller))
40 | methodNumMap.put(caller, methodNum++);
41 |
42 | int iCaller = methodNumMap.get(caller);
43 | Pair pCallSite = Pair.make(iCaller, instIndex);
44 |
45 | if(!callSiteMap.containsKey(pCallSite))
46 | callSiteMap.put(pCallSite, callSiteNum++);
47 |
48 | int iCallSite = callSiteMap.get(pCallSite);
49 | Pair pPos = Pair.make(iCallSite, argPos);
50 |
51 | if(!posMap.containsKey(pPos))
52 | posMap.put(pPos, posNum++);
53 |
54 | int iPos = posMap.get(pPos);
55 |
56 | valueMap.put(iPos, new StringValue(v));
57 | }
58 |
59 | public StringValue getValueAt(MethodReference mr, int instIndex, int argPos){
60 | if(methodNumMap.containsKey(mr)){
61 | int iMr = methodNumMap.get(mr);
62 | Pair pCallSite = Pair.make(iMr, instIndex);
63 | if(callSiteMap.containsKey(pCallSite)){
64 | int iCallSite = callSiteMap.get(pCallSite);
65 | Pair pPos = Pair.make(iCallSite, argPos);
66 | if(posMap.containsKey(pPos)){
67 | int iPos = posMap.get(pPos);
68 | if(valueMap.containsKey(iPos)){
69 | return valueMap.get(iPos);
70 | }
71 | }
72 | }
73 | }
74 |
75 | return new StringValue();
76 | }
77 |
78 | class StringValue{
79 | private String v;
80 |
81 | public StringValue(){
82 |
83 | }
84 |
85 | public StringValue(String v){
86 | this.v = v;
87 | }
88 |
89 | public boolean isDecided(){
90 | return v != null;
91 | }
92 |
93 | public String value(){
94 | return v;
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/AbstractConstraintEdge.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public class AbstractConstraintEdge implements IConstraintEdge{
14 | private IConstraintNode from;
15 | private IConstraintNode to;
16 |
17 | protected AbstractConstraintEdge(IConstraintNode from, IConstraintNode to){
18 | this.from = from;
19 | this.to = to;
20 | }
21 |
22 | @Override
23 | public IConstraintNode from(){
24 | return from;
25 | }
26 |
27 | @Override
28 | public IConstraintNode to(){
29 | return to;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/AppendOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.AppendOpSetModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
16 |
17 | public class AppendOpNode implements IOperatorNode {
18 | static private IOperationModel m;
19 |
20 | static{
21 | m = AppendOpSetModel.getInstance();
22 | }
23 |
24 | public AppendOpNode(){}
25 |
26 | @Override
27 | public String toString(){
28 | return "append";
29 | }
30 |
31 | @Override
32 | public IValue apply(IValue... args) {
33 | // TODO Auto-generated method stub
34 | return m.apply(args);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/AssignOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import com.ibm.wala.util.debug.Assertions;
14 |
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
16 |
17 | public class AssignOpNode implements IOperatorNode {
18 | public AssignOpNode(){
19 | }
20 |
21 | @Override
22 | public String toString(){
23 | return "=";
24 | }
25 |
26 | @Override
27 | public IValue apply(IValue... args) {
28 | // TODO Auto-generated method stub
29 | if(args.length != 1)
30 | Assertions.UNREACHABLE("AssignOpNode must have only one predecessor: " + args);
31 |
32 | return args[0];
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/BinaryOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 |
15 | public class BinaryOpNode implements IOperatorNode {
16 | public static enum BinaryOperator{
17 | PLUS{
18 | @Override
19 | public String toString(){
20 | return "+";
21 | }
22 | },
23 | MINUS{
24 | @Override
25 | public String toString(){
26 | return "-";
27 | }
28 | },
29 | MULTIPLY{
30 | @Override
31 | public String toString(){
32 | return "X";
33 | }
34 | },
35 | DIVIDE{
36 | @Override
37 | public String toString(){
38 | return "/";
39 | }
40 | },
41 | AND{
42 | @Override
43 | public String toString(){
44 | return "&&";
45 | }
46 | },
47 | OR{
48 | @Override
49 | public String toString(){
50 | return "||";
51 | }
52 | }
53 | };
54 |
55 | private BinaryOperator o;
56 |
57 | public BinaryOpNode(BinaryOperator o){
58 | this.o = o;
59 | }
60 |
61 | @Override
62 | public String toString(){
63 | return o.toString();
64 | }
65 |
66 | @Override
67 | public IValue apply(IValue... args) {
68 | // TODO Auto-generated method stub
69 | return null;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/ConstBox.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import com.ibm.wala.ipa.callgraph.CGNode;
14 |
15 | public class ConstBox implements IBox {
16 | private CGNode node;
17 | private Object value;
18 | private ConstType type;
19 |
20 | public ConstBox(CGNode node, Object value, ConstType type){
21 | this.node = node;
22 | this.value = value;
23 | this.type = type;
24 | }
25 |
26 | private ConstType getConstType(Object v){
27 | if(v instanceof String)
28 | return ConstType.STRING;
29 | else if(v instanceof Boolean)
30 | return ConstType.BOOL;
31 | else if(v instanceof Integer)
32 | return ConstType.INT;
33 | else if(v instanceof Double)
34 | return ConstType.DOUBLE;
35 | else if(v instanceof Float)
36 | return ConstType.DOUBLE;
37 | else if(v instanceof Long)
38 | return ConstType.LONG;
39 |
40 | return ConstType.UNKNOWN;
41 | }
42 |
43 | @Override
44 | public String toString(){
45 | String str = "ConstBox[value: ";
46 | str += value.toString().replace("\"", "\\\"");
47 | str += ", type: " + type + "] declared in ";
48 | str += node.getMethod().getName().toString();
49 | return str;
50 | }
51 |
52 | public Object getValue(){
53 | return value;
54 | }
55 |
56 | public ConstType getType(){
57 | return type;
58 | }
59 |
60 | @Override
61 | public T visit(IBoxVisitor v){
62 | return v.visit(this);
63 | }
64 |
65 | @Override
66 | public CGNode getNode() {
67 | // TODO Auto-generated method stub
68 | return node;
69 | }
70 |
71 | @Override
72 | public int hashCode(){
73 | return node.hashCode() + value.hashCode() + type.hashCode();
74 | }
75 |
76 | @Override
77 | public boolean equals(Object o){
78 | if(o instanceof ConstBox){
79 | ConstBox v = (ConstBox)o;
80 | if(node.equals(v.getNode()) && value.equals(v.getValue()) && type.equals(v.getType()))
81 | return true;
82 | }
83 | return false;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/ConstType.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public enum ConstType {
14 | STRING,
15 | INT,
16 | BOOL,
17 | DOUBLE,
18 | LONG,
19 | LONG_TOP,
20 | LONG_BOT,
21 | STRING_TOP,
22 | STRING_BOT,
23 | INT_TOP,
24 | BOOL_TOP,
25 | DOUBLE_TOP,
26 | UNKNOWN;
27 |
28 | private String name;
29 |
30 | static{
31 | STRING.name = "String";
32 | INT.name = "int";
33 | BOOL.name = "bool";
34 | DOUBLE.name = "double";
35 | STRING_TOP.name = "StringTop";
36 | INT_TOP.name = "IntTop";
37 | BOOL_TOP.name = "BoolTop";
38 | DOUBLE_TOP.name = "DoubleTop";
39 | UNKNOWN.name = "unknown";
40 | }
41 |
42 | public String toString(){
43 | return name;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IBox.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import com.ibm.wala.ipa.callgraph.CGNode;
14 |
15 | public interface IBox extends IConstraintNode {
16 | public T visit(IBoxVisitor v);
17 | public CGNode getNode();
18 | }
19 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IBoxVisitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public interface IBoxVisitor {
14 | public T visit(VarBox b);
15 | public T visit(ParamBox b);
16 | public T visit(ConstBox b);
17 | }
18 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IConstraintEdge.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public interface IConstraintEdge {
14 | public IConstraintNode from();
15 | public IConstraintNode to();
16 | }
17 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IConstraintMonitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import java.util.Set;
14 |
15 | public interface IConstraintMonitor {
16 | public void monitor(int iter, ConstraintGraph graph, IBox b, Set res);
17 | }
18 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IConstraintNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public interface IConstraintNode {
14 | @Override
15 | public String toString();
16 | }
17 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IOperatorNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 |
15 | public interface IOperatorNode extends IConstraintNode {
16 | public IValue apply(IValue... args);
17 | }
18 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/IndexOfOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IndexOfOpSetModel;
16 |
17 | public class IndexOfOpNode implements IOperatorNode {
18 |
19 | private static IOperationModel m;
20 |
21 | static{
22 | m = IndexOfOpSetModel.getInstance();
23 | }
24 |
25 | public IndexOfOpNode(){}
26 |
27 | @Override
28 | public String toString(){
29 | return "indexOf";
30 | }
31 |
32 | @Override
33 | public IValue apply(IValue... args) {
34 | // TODO Auto-generated method stub
35 | return m.apply(args);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/JoinOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.JoinOpSetModel;
16 |
17 | public class JoinOpNode implements IOperatorNode {
18 |
19 | private static IOperationModel m;
20 |
21 | static{
22 | m = JoinOpSetModel.getInstance();
23 | }
24 |
25 | public JoinOpNode(){
26 | }
27 |
28 | @Override
29 | public String toString(){
30 | return "join";
31 | }
32 |
33 | @Override
34 | public IValue apply(IValue... args) {
35 | // TODO Auto-generated method stub
36 | return m.apply(args);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/LengthOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.LengthOpSetModel;
16 |
17 | public class LengthOpNode implements IOperatorNode {
18 |
19 | private static IOperationModel m;
20 |
21 | static{
22 | m = LengthOpSetModel.getInstance();
23 | }
24 |
25 | public LengthOpNode(){}
26 |
27 | @Override
28 | public String toString(){
29 | return "length";
30 | }
31 |
32 | @Override
33 | public IValue apply(IValue... args) {
34 | // TODO Auto-generated method stub
35 | return m.apply(args);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/OrderedEdge.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public class OrderedEdge extends AbstractConstraintEdge {
14 | private int order;
15 |
16 | public OrderedEdge(IConstraintNode from, IConstraintNode to, int order){
17 | super(from, to);
18 | this.order = order;
19 | }
20 |
21 | public int getOrder(){
22 | return order;
23 | }
24 |
25 | @Override
26 | public String toString(){
27 | return from() + " -> " + to() + " (order: " + order + ")";
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/ParamBox.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import com.ibm.wala.ipa.callgraph.CGNode;
14 |
15 | public class ParamBox implements IBox {
16 | private CGNode node;
17 | private int var;
18 |
19 | public ParamBox(CGNode node, int var){
20 | if(var < 1)
21 | throw new InternalError("parameter variable cannot be less than 1: var[" + var + "] in " + node);
22 | this.node = node;
23 | this.var = var;
24 | }
25 |
26 | @Override
27 | public String toString(){
28 | String str = "ParamBox[";
29 | str += var;
30 | str += "] of " + node.getMethod().getName().toString();
31 | return str;
32 | }
33 |
34 | public int getVar(){
35 | return var;
36 | }
37 |
38 | @Override
39 | public T visit(IBoxVisitor v){
40 | return v.visit(this);
41 | }
42 |
43 | @Override
44 | public CGNode getNode() {
45 | // TODO Auto-generated method stub
46 | return node;
47 | }
48 |
49 | @Override
50 | public int hashCode(){
51 | return node.hashCode() + var;
52 | }
53 |
54 | @Override
55 | public boolean equals(Object o){
56 | if(o instanceof ParamBox){
57 | ParamBox v = (ParamBox)o;
58 | if(node.equals(v.getNode()) && var == v.getVar())
59 | return true;
60 | }
61 | return false;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/PropagationEdge.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | public class PropagationEdge extends AbstractConstraintEdge {
14 | public PropagationEdge(IConstraintNode from, IConstraintNode to){
15 | super(from, to);
16 | }
17 |
18 | @Override
19 | public String toString(){
20 | return from() + " -> " + to();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/ReplaceOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.ReplaceOpSetModel;
16 |
17 | public class ReplaceOpNode implements IOperatorNode {
18 | private static IOperationModel m ;
19 |
20 | static{
21 | m = ReplaceOpSetModel.getInstance();
22 | }
23 |
24 | public ReplaceOpNode(){}
25 |
26 | @Override
27 | public String toString(){
28 | return "replace";
29 | }
30 |
31 | @Override
32 | public IValue apply(IValue... args) {
33 | // TODO Auto-generated method stub
34 | return m.apply(args);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/SubstringOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.SubstringOpSetModel;
16 |
17 | public class SubstringOpNode implements IOperatorNode {
18 |
19 | private static IOperationModel m;
20 |
21 | static{
22 | m = SubstringOpSetModel.getInstance();
23 | }
24 | public SubstringOpNode(){}
25 |
26 | @Override
27 | public String toString(){
28 | return "subString";
29 | }
30 |
31 | @Override
32 | public IValue apply(IValue... args) {
33 | // TODO Auto-generated method stub
34 | return m.apply(args);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/ToStringOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.ToStringOpSetModel;
16 |
17 | public class ToStringOpNode implements IOperatorNode {
18 |
19 | private static IOperationModel m;
20 |
21 | static{
22 | m = ToStringOpSetModel.getInstance();
23 | }
24 |
25 | public ToStringOpNode(){}
26 |
27 | @Override
28 | public String toString(){
29 | return "toString";
30 | }
31 |
32 | @Override
33 | public IValue apply(IValue... args) {
34 | // TODO Auto-generated method stub
35 | return m.apply(args);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/UnaryOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 |
15 | public class UnaryOpNode implements IOperatorNode {
16 | public static enum UnaryOperator{
17 | MINUS{
18 | @Override
19 | public String toString(){
20 | return "-";
21 | }
22 | },
23 | NOT{
24 | @Override
25 | public String toString(){
26 | return "!";
27 | }
28 | }
29 | };
30 |
31 | private UnaryOperator o;
32 |
33 | public UnaryOpNode(UnaryOperator o){
34 | this.o = o;
35 | }
36 |
37 | @Override
38 | public String toString(){
39 | return o.toString();
40 | }
41 |
42 | @Override
43 | public IValue apply(IValue... args) {
44 | // TODO Auto-generated method stub
45 | return null;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/UriCodecDecodeOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.UriCodecDecodeOpSetModel;
16 |
17 | public class UriCodecDecodeOpNode implements IOperatorNode {
18 | private static IOperationModel m;
19 |
20 | static{
21 | m = UriCodecDecodeOpSetModel.getInstance();
22 | }
23 |
24 | public UriCodecDecodeOpNode(){}
25 |
26 | @Override
27 | public String toString(){
28 | return "UriCodec.decode";
29 | }
30 |
31 | @Override
32 | public IValue apply(IValue... args) {
33 | // TODO Auto-generated method stub
34 | return m.apply(args);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/UriGetQueryParameterOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.UriGetQueryParameterOpSetModel;
16 |
17 | public class UriGetQueryParameterOpNode implements IOperatorNode {
18 | private static IOperationModel m;
19 |
20 | static{
21 | m = UriGetQueryParameterOpSetModel.getInstance();
22 | }
23 |
24 | public UriGetQueryParameterOpNode(){}
25 |
26 | @Override
27 | public String toString(){
28 | return "Uri.getQueryParameter";
29 | }
30 |
31 | @Override
32 | public IValue apply(IValue... args) {
33 | // TODO Auto-generated method stub
34 | return m.apply(args);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/UriParseOpNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.IOperationModel;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.UriParseOpSetModel;
16 |
17 | public class UriParseOpNode implements IOperatorNode {
18 |
19 | private static IOperationModel m;
20 |
21 | static{
22 | m = UriParseOpSetModel.getInstance();
23 | }
24 |
25 | public UriParseOpNode(){}
26 |
27 | @Override
28 | public String toString(){
29 | return "Uri.parse";
30 | }
31 |
32 | @Override
33 | public IValue apply(IValue... args) {
34 | // TODO Auto-generated method stub
35 | return m.apply(args);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/VarBox.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint;
12 |
13 | import com.ibm.wala.ipa.callgraph.CGNode;
14 |
15 | public class VarBox implements IBox {
16 | private CGNode node;
17 | private int iindex;
18 | private int var;
19 |
20 | public VarBox(CGNode node, int iindex, int var){
21 | if(var < 1){
22 | String msg = "variable cannot be less than 1: var[" + var + "] in " + node;
23 | if(iindex > -1)
24 | msg += "\nat " + node.getIR().getInstructions()[iindex];
25 | throw new InternalError(msg);
26 | }
27 |
28 | this.node = node;
29 | this.iindex = iindex;
30 | this.var = var;
31 | }
32 |
33 | @Override
34 | public String toString(){
35 | String str = "VarBox[";
36 | // SSAInstruction inst = node.getIR().getInstructions()[iindex];
37 | str += var;
38 | str += "] ";//@ " + inst;
39 | str += " in " + node /*.getMethod().getName().toString()*/ + " of " + node.getMethod().getDeclaringClass().getName().getClassName();
40 | return str;
41 | }
42 |
43 | public int getVar(){
44 | return var;
45 | }
46 |
47 | public int getIndex(){
48 | return iindex;
49 | }
50 |
51 | @Override
52 | public T visit(IBoxVisitor v){
53 | return v.visit(this);
54 | }
55 |
56 | @Override
57 | public CGNode getNode() {
58 | // TODO Auto-generated method stub
59 | return node;
60 | }
61 |
62 | @Override
63 | public int hashCode(){
64 | return node.hashCode() + var;
65 | }
66 |
67 | @Override
68 | public boolean equals(Object o){
69 | if(o instanceof VarBox){
70 | VarBox v = (VarBox)o;
71 | if(node.equals(v.getNode()) && var == v.getVar())
72 | return true;
73 | }
74 | return false;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/IStringConstraintSolver.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.ConstraintGraph;
14 |
15 | import java.util.Map;
16 |
17 | public interface IStringConstraintSolver {
18 | public Map solve(ConstraintGraph graph);
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/IterationSolverMonitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver;
12 |
13 | import java.util.Queue;
14 |
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.IConstraintNode;
16 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
17 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model.ISolverMonitor;
18 |
19 | public class IterationSolverMonitor implements ISolverMonitor {
20 |
21 | private int iter = 1;
22 | @Override
23 | public void monitor(Queue worklist, IConstraintNode n, IValue preV, IValue newV, boolean isUpdate) {
24 | // TODO Auto-generated method stub
25 | String print = "#" + (iter++) + ": ";
26 | print += "(" + worklist.size() + ")";
27 | print += n +" ";
28 | print += preV + " => " + newV + " [" + isUpdate + "]";
29 | // System.out.println(print);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/IBooleanDomain.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.BooleanBotValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.BooleanTopValue;
15 |
16 | public interface IBooleanDomain extends IDomain {
17 | public static BooleanTopValue TOP = BooleanTopValue.getInstance();
18 | public static BooleanBotValue BOT = BooleanBotValue.getInstance();
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/IDomain.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.BotValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.TopValue;
16 |
17 | public interface IDomain {
18 | public static TopValue TOP = TopValue.getInstance();
19 | public static BotValue BOT = BotValue.getInstance();
20 | public IDomainOp getOperator();
21 | public boolean isInstanceof(IValue v);
22 | }
23 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/IDomainOp.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 |
15 | import java.util.Set;
16 |
17 | public interface IDomainOp {
18 | public IValue alpha(S cv);
19 | public IValue alpha(Set cv);
20 | public T gamma(IValue v);
21 | }
22 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/IDoubleDomain.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.DoubleBotValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.DoubleTopValue;
15 |
16 | public interface IDoubleDomain extends IDomain {
17 | public static DoubleTopValue TOP = DoubleTopValue.getInstance();
18 | public static DoubleBotValue BOT = DoubleBotValue.getInstance();
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/IIntegerDomain.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IntegerBotValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IntegerTopValue;
15 |
16 | public interface IIntegerDomain extends IDomain {
17 | public static IntegerTopValue TOP = IntegerTopValue.getInstance();
18 | public static IntegerBotValue BOT = IntegerBotValue.getInstance();
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/ILongDomain.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.LongBotValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.LongTopValue;
15 |
16 | public interface ILongDomain extends IDomain {
17 | public static LongTopValue TOP = LongTopValue.getInstance();
18 | public static LongBotValue BOT = LongBotValue.getInstance();
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/IStringDomain.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.StringBotValue;
14 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.StringTopValue;
15 |
16 | public interface IStringDomain extends IDomain{
17 | public static StringTopValue TOP = StringTopValue.getInstance();
18 | public static StringBotValue BOT = StringBotValue.getInstance();
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/BooleanBotValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class BooleanBotValue extends TopValue implements IBooleanValue {
14 |
15 | private static BooleanBotValue instance;
16 | public static BooleanBotValue getInstance(){
17 | if(instance == null)
18 | instance = new BooleanBotValue();
19 | return instance;
20 | }
21 |
22 | private BooleanBotValue(){}
23 |
24 | @Override
25 | public IValue clone() {
26 | // TODO Auto-generated method stub
27 | return this;
28 | }
29 |
30 | @Override
31 | public IValue weakUpdate(IValue v) {
32 | // TODO Auto-generated method stub
33 | if(v instanceof IBooleanValue)
34 | return v;
35 | else if(v instanceof BotValue)
36 | return this;
37 | return TopValue.getInstance();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/BooleanTopValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class BooleanTopValue extends TopValue implements IBooleanValue {
14 | private static BooleanTopValue instance;
15 | public static BooleanTopValue getInstance(){
16 | if(instance == null)
17 | instance = new BooleanTopValue();
18 | return instance;
19 | }
20 |
21 | private BooleanTopValue(){}
22 |
23 | @Override
24 | public IValue clone() {
25 | // TODO Auto-generated method stub
26 | return this;
27 | }
28 |
29 | @Override
30 | public IValue weakUpdate(IValue v) {
31 | // TODO Auto-generated method stub
32 | if(v instanceof IBooleanValue)
33 | return this;
34 | else if(v instanceof BotValue)
35 | return this;
36 | else
37 | return TopValue.getInstance();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/BotValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.IDomain;
14 |
15 | public class BotValue implements IValue {
16 |
17 | private static BotValue instance;
18 | public static BotValue getInstance(){
19 | if(instance == null)
20 | instance = new BotValue();
21 | return instance;
22 | }
23 |
24 | protected BotValue(){}
25 |
26 | @Override
27 | public IValue clone() {
28 | // TODO Auto-generated method stub
29 | return this;
30 | }
31 |
32 | @Override
33 | public IValue weakUpdate(IValue v) {
34 | // TODO Auto-generated method stub
35 | return v;
36 | }
37 |
38 | @Override
39 | public IDomain getDomain() {
40 | // TODO Auto-generated method stub
41 | return null;
42 | }
43 |
44 | @Override
45 | public String toString(){
46 | return "BOT";
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/DoubleBotValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class DoubleBotValue extends BotValue implements IDoubleValue {
14 |
15 | private static DoubleBotValue instance;
16 | public static DoubleBotValue getInstance(){
17 | if(instance == null)
18 | instance = new DoubleBotValue();
19 | return instance;
20 | }
21 |
22 | private DoubleBotValue(){}
23 |
24 | @Override
25 | public IValue clone() {
26 | // TODO Auto-generated method stub
27 | return this;
28 | }
29 |
30 | @Override
31 | public IValue weakUpdate(IValue v) {
32 | // TODO Auto-generated method stub
33 | if(v instanceof IDoubleValue)
34 | return v;
35 | else if(v instanceof BotValue)
36 | return this;
37 | else
38 | return TopValue.getInstance();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/DoubleTopValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class DoubleTopValue extends TopValue implements IDoubleValue {
14 | private static DoubleTopValue instance;
15 | public static DoubleTopValue getInstance(){
16 | if(instance == null)
17 | instance = new DoubleTopValue();
18 | return instance;
19 | }
20 |
21 | private DoubleTopValue(){}
22 |
23 | @Override
24 | public IValue clone() {
25 | // TODO Auto-generated method stub
26 | return this;
27 | }
28 |
29 | @Override
30 | public IValue weakUpdate(IValue v) {
31 | // TODO Auto-generated method stub
32 | if(v instanceof IDoubleValue)
33 | return this;
34 | else if(v instanceof BotValue)
35 | return this;
36 | else
37 | return TopValue.getInstance();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IBooleanValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public interface IBooleanValue extends IValue {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IDoubleValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public interface IDoubleValue extends IValue {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IIntegerValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public interface IIntegerValue extends IValue {
14 | }
15 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/ILongValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public interface ILongValue extends IValue {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IStringValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public interface IStringValue extends IValue {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.IDomain;
14 |
15 | public interface IValue {
16 | public IValue clone();
17 | public IValue weakUpdate(IValue v);
18 | public IDomain getDomain();
19 | }
20 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IntegerBotValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class IntegerBotValue extends BotValue implements IIntegerValue {
14 |
15 | private static IntegerBotValue instance;
16 | public static IntegerBotValue getInstance(){
17 | if(instance == null)
18 | instance = new IntegerBotValue();
19 | return instance;
20 | }
21 |
22 | private IntegerBotValue(){}
23 |
24 | @Override
25 | public IValue clone() {
26 | // TODO Auto-generated method stub
27 | return this;
28 | }
29 |
30 | @Override
31 | public IValue weakUpdate(IValue v) {
32 | // TODO Auto-generated method stub
33 | if(v instanceof IIntegerValue)
34 | return v;
35 | else if(v instanceof BotValue)
36 | return this;
37 | else
38 | return TopValue.getInstance();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/IntegerTopValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class IntegerTopValue extends TopValue implements IIntegerValue {
14 |
15 | private static IntegerTopValue instance;
16 | public static IntegerTopValue getInstance(){
17 | if(instance == null)
18 | instance = new IntegerTopValue();
19 | return instance;
20 | }
21 |
22 | private IntegerTopValue(){}
23 |
24 | @Override
25 | public IValue clone() {
26 | // TODO Auto-generated method stub
27 | return this;
28 | }
29 |
30 | @Override
31 | public IValue weakUpdate(IValue v) {
32 | // TODO Auto-generated method stub
33 | if(v instanceof IIntegerValue)
34 | return this;
35 | else if(v instanceof BotValue)
36 | return this;
37 | else
38 | return TopValue.getInstance();
39 | }
40 |
41 | @Override
42 | public String toString(){
43 | return "IntegerTop";
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/LongBotValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class LongBotValue extends BotValue implements ILongValue {
14 | private static LongBotValue instance;
15 | public static LongBotValue getInstance(){
16 | if(instance == null)
17 | instance = new LongBotValue();
18 | return instance;
19 | }
20 |
21 | private LongBotValue(){}
22 |
23 | @Override
24 | public IValue clone() {
25 | // TODO Auto-generated method stub
26 | return this;
27 | }
28 |
29 | @Override
30 | public IValue weakUpdate(IValue v) {
31 | // TODO Auto-generated method stub
32 | if(v instanceof ILongValue)
33 | return v;
34 | else if(v instanceof BotValue)
35 | return this;
36 | else
37 | return TopValue.getInstance();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/LongTopValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class LongTopValue extends TopValue implements ILongValue {
14 |
15 | private static LongTopValue instance;
16 | public static LongTopValue getInstance(){
17 | if(instance == null)
18 | instance = new LongTopValue();
19 | return instance;
20 | }
21 |
22 | private LongTopValue(){}
23 |
24 | @Override
25 | public IValue clone() {
26 | // TODO Auto-generated method stub
27 | return this;
28 | }
29 |
30 | @Override
31 | public IValue weakUpdate(IValue v) {
32 | // TODO Auto-generated method stub
33 | if(v instanceof ILongValue)
34 | return this;
35 | else if(v instanceof BotValue)
36 | return this;
37 | else
38 | return TopValue.getInstance();
39 | }
40 |
41 | @Override
42 | public String toString(){
43 | return "LongTop";
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/StringBotValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class StringBotValue extends BotValue implements IStringValue {
14 |
15 | private static StringBotValue instance;
16 | public static StringBotValue getInstance(){
17 | if(instance == null)
18 | instance = new StringBotValue();
19 | return instance;
20 | }
21 |
22 | private StringBotValue(){}
23 |
24 | @Override
25 | public IValue clone() {
26 | // TODO Auto-generated method stub
27 | return this;
28 | }
29 |
30 | @Override
31 | public IValue weakUpdate(IValue v) {
32 | // TODO Auto-generated method stub
33 | if(v instanceof IStringValue)
34 | return v;
35 | else if(v instanceof BotValue)
36 | return this;
37 | return TopValue.getInstance();
38 | }
39 |
40 | @Override
41 | public String toString(){
42 | return "StringBot";
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/StringTopValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | public class StringTopValue extends TopValue implements IStringValue {
14 |
15 | private static StringTopValue instance;
16 | public static StringTopValue getInstance(){
17 | if(instance == null)
18 | instance = new StringTopValue();
19 | return instance;
20 | }
21 |
22 | private StringTopValue(){
23 | }
24 |
25 | @Override
26 | public IStringValue clone() {
27 | // TODO Auto-generated method stub
28 | return this;
29 | }
30 |
31 | @Override
32 | public IValue weakUpdate(IValue v) {
33 | // TODO Auto-generated method stub
34 | if(v instanceof IStringValue)
35 | return this;
36 | else if(v instanceof BotValue)
37 | return this;
38 | else
39 | return TopValue.getInstance();
40 | }
41 |
42 | @Override
43 | public String toString(){
44 | return "StringTop";
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/domain/value/TopValue.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.IDomain;
14 |
15 | public class TopValue implements IValue {
16 |
17 | private static TopValue instance;
18 | public static TopValue getInstance(){
19 | if(instance == null)
20 | instance = new TopValue();
21 | return instance;
22 | }
23 |
24 | protected TopValue(){}
25 |
26 | @Override
27 | public IValue clone() {
28 | // TODO Auto-generated method stub
29 | return this;
30 | }
31 |
32 | @Override
33 | public IValue weakUpdate(IValue v) {
34 | // TODO Auto-generated method stub
35 | return this;
36 | }
37 |
38 | @Override
39 | public IDomain getDomain(){
40 | return null;
41 | }
42 |
43 | @Override
44 | public String toString(){
45 | return "TOP";
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/model/IOperationModel.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 |
15 | public interface IOperationModel {
16 | public static boolean CRASH = true;
17 | public IValue apply(IValue... args);
18 | }
19 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/model/ISolverMonitor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model;
12 |
13 | import java.util.Queue;
14 |
15 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.IConstraintNode;
16 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
17 |
18 | public interface ISolverMonitor {
19 | public void monitor(Queue worklist, IConstraintNode n, IValue preV, IValue newV, boolean isUpdate);
20 | }
21 |
--------------------------------------------------------------------------------
/kr.ac.kaist.wala.hybridroid/src/kr/ac/kaist/wala/hybridroid/analysis/string/constraint/solver/model/JoinOpSetModel.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2016 IBM Corporation and KAIST.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Eclipse Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/epl-v10.html
7 | *
8 | * Contributors:
9 | * KAIST - initial API and implementation
10 | *******************************************************************************/
11 | package kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.model;
12 |
13 | import kr.ac.kaist.wala.hybridroid.analysis.string.constraint.solver.domain.value.IValue;
14 |
15 | public class JoinOpSetModel implements IOperationModel {
16 |
17 | private static JoinOpSetModel instance;
18 |
19 | public static JoinOpSetModel getInstance(){
20 | if(instance == null)
21 | instance = new JoinOpSetModel();
22 | return instance;
23 | }
24 |
25 | @Override
26 | public IValue apply(IValue... args) {
27 | // TODO Auto-generated method stub
28 | if(args.length < 2)
29 | throw new InternalError("Join operation must have two in-edge at least.");
30 |
31 | IValue arg = args[0].clone();
32 |
33 | for(int i=1; i cons = (Set