├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── README.md
├── bin
├── org
│ └── json
│ │ ├── CDL.class
│ │ ├── Cookie.class
│ │ ├── CookieList.class
│ │ ├── HTTP.class
│ │ ├── HTTPTokener.class
│ │ ├── JSONArray.class
│ │ ├── JSONException.class
│ │ ├── JSONML.class
│ │ ├── JSONObject$Null.class
│ │ ├── JSONObject.class
│ │ ├── JSONPointer$Builder.class
│ │ ├── JSONPointer.class
│ │ ├── JSONPointerException.class
│ │ ├── JSONString.class
│ │ ├── JSONStringer.class
│ │ ├── JSONTokener.class
│ │ ├── JSONWriter.class
│ │ ├── LICENSE
│ │ ├── Property.class
│ │ ├── README
│ │ ├── XML.class
│ │ └── XMLTokener.class
└── osu
│ └── seclab
│ └── inputscope
│ ├── main
│ └── runTest.class
│ ├── stringvsa
│ ├── backwardslicing
│ │ ├── BackwardContext.class
│ │ ├── BackwardController.class
│ │ ├── CallStackItem.class
│ │ ├── DataSourceType.class
│ │ ├── ICollecter.class
│ │ └── TaintRules.class
│ ├── base
│ │ ├── ExecTrace.class
│ │ ├── GlobalStatistics.class
│ │ ├── ParameterTransferStmt$LinkedVariableBox.class
│ │ ├── ParameterTransferStmt.class
│ │ ├── StmtPoint.class
│ │ └── TargetType.class
│ ├── forwardexec
│ │ ├── SimulateEngine.class
│ │ └── StmtPath.class
│ ├── graph
│ │ ├── CallGraph.class
│ │ ├── CallGraphNode.class
│ │ ├── DGraph.class
│ │ ├── HeapObject.class
│ │ ├── IDGNode.class
│ │ ├── ValuePoint.class
│ │ └── specialcase
│ │ │ └── FindInClassAdd.class
│ ├── main
│ │ ├── ApkContext.class
│ │ └── Config.class
│ └── utility
│ │ ├── BlockGenerator.class
│ │ ├── BlockUtility.class
│ │ ├── ErrorHandler.class
│ │ ├── FileUtility.class
│ │ ├── FunctionUtility.class
│ │ ├── ListUtility.class
│ │ ├── Logger.class
│ │ ├── MethodUtility.class
│ │ ├── OtherUtility$AddCompute.class
│ │ ├── OtherUtility$AndCompute.class
│ │ ├── OtherUtility$Compute.class
│ │ ├── OtherUtility$DivCompute.class
│ │ ├── OtherUtility$MulCompute.class
│ │ ├── OtherUtility$OrCompute.class
│ │ ├── OtherUtility$ShlCompute.class
│ │ ├── OtherUtility$ShrCompute.class
│ │ ├── OtherUtility$SubCompute.class
│ │ ├── OtherUtility$UshrCompute.class
│ │ ├── OtherUtility$XorCompute.class
│ │ └── OtherUtility.class
│ └── taintanalysis
│ ├── base
│ ├── SinkMethod.class
│ ├── SourcePoint.class
│ └── TaintQuestion.class
│ ├── main
│ ├── CrossPath.class
│ ├── QuestionGenerator.class
│ └── TResSolve.class
│ ├── solver
│ ├── CallStackItem.class
│ ├── SimulationContext.class
│ ├── SimulationEngine.class
│ ├── StmtItem.class
│ └── TaintQuestionSolver.class
│ └── utility
│ ├── BlockGenerator.class
│ ├── FileUtility.class
│ ├── ListUtility.class
│ ├── Logger.class
│ ├── MethodUtility.class
│ ├── TimeUtility$1.class
│ └── TimeUtility.class
├── example
└── InputScopeExample.apk
├── libs
├── android.jar
├── apktool-lib_fat.jar
├── javatuples-1.2.jar
├── json-20151123.jar
└── xmlpull-1.1.3.1.jar
├── src
├── org
│ └── json
│ │ ├── CDL.java
│ │ ├── Cookie.java
│ │ ├── CookieList.java
│ │ ├── HTTP.java
│ │ ├── HTTPTokener.java
│ │ ├── JSONArray.java
│ │ ├── JSONException.java
│ │ ├── JSONML.java
│ │ ├── JSONObject.java
│ │ ├── JSONPointer.java
│ │ ├── JSONPointerException.java
│ │ ├── JSONString.java
│ │ ├── JSONStringer.java
│ │ ├── JSONTokener.java
│ │ ├── JSONWriter.java
│ │ ├── LICENSE
│ │ ├── Property.java
│ │ ├── README
│ │ ├── XML.java
│ │ └── XMLTokener.java
└── osu
│ └── seclab
│ └── inputscope
│ ├── main
│ └── runTest.java
│ ├── stringvsa
│ ├── backwardslicing
│ │ ├── BackwardContext.java
│ │ ├── BackwardController.java
│ │ ├── CallStackItem.java
│ │ ├── DataSourceType.java
│ │ ├── ICollecter.java
│ │ └── TaintRules.java
│ ├── base
│ │ ├── ExecTrace.java
│ │ ├── GlobalStatistics.java
│ │ ├── ParameterTransferStmt.java
│ │ ├── StmtPoint.java
│ │ └── TargetType.java
│ ├── forwardexec
│ │ ├── SimulateEngine.java
│ │ └── StmtPath.java
│ ├── graph
│ │ ├── CallGraph.java
│ │ ├── CallGraphNode.java
│ │ ├── DGraph.java
│ │ ├── HeapObject.java
│ │ ├── IDGNode.java
│ │ ├── ValuePoint.java
│ │ └── specialcase
│ │ │ └── FindInClassAdd.java
│ ├── main
│ │ ├── ApkContext.java
│ │ └── Config.java
│ └── utility
│ │ ├── BlockGenerator.java
│ │ ├── BlockUtility.java
│ │ ├── ErrorHandler.java
│ │ ├── FileUtility.java
│ │ ├── FunctionUtility.java
│ │ ├── ListUtility.java
│ │ ├── Logger.java
│ │ ├── MethodUtility.java
│ │ └── OtherUtility.java
│ └── taintanalysis
│ ├── base
│ ├── SinkMethod.java
│ ├── SourcePoint.java
│ └── TaintQuestion.java
│ ├── main
│ ├── CrossPath.java
│ ├── QuestionGenerator.java
│ └── TResSolve.java
│ ├── solver
│ ├── CallStackItem.java
│ ├── SimulationContext.java
│ ├── SimulationEngine.java
│ ├── StmtItem.java
│ └── TaintQuestionSolver.java
│ └── utility
│ ├── BlockGenerator.java
│ ├── FileUtility.java
│ ├── ListUtility.java
│ ├── Logger.java
│ ├── MethodUtility.java
│ └── TimeUtility.java
└── taintrules.json
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | InputScope_TVSA
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 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # InputScope
2 | **InputScope** is a static analysis tool to automatically uncover hidden behaviors from user-input validation in mobile apps. The key components of **InputScope** are **Taint Analysis** and **String Value Analysis**. With these two components, **InputScope** takes the apk file of an app as input and uncovers both the context of user-input validation and also the comparison content that can be used with identify different types of hidden behaviors with a set of policies.
3 |
4 | For more details, please see the following [running example](#jump) and [our paper](https://web.cse.ohio-state.edu/~lin.3021/file/SP20.pdf) (S&P 2020)
5 |
6 | # Dependencies
7 | This is an Eclipse project that depends on Flowdroid:
8 |
9 | - [flowdroid](https://github.com/secure-software-engineering/FlowDroid)
10 | - [soot-infoflow-android](https://github.com/secure-software-engineering/FlowDroid/tree/master/soot-infoflow-android "soot-infoflow-android")
11 | - [soot-infoflow-cmd](https://github.com/secure-software-engineering/FlowDroid/tree/master/soot-infoflow-cmd "soot-infoflow-cmd")
12 | - [soot-infoflow-summaries](https://github.com/secure-software-engineering/FlowDroid/tree/master/soot-infoflow-summaries "soot-infoflow-summaries")
13 | - [soot-infoflow](https://github.com/secure-software-engineering/FlowDroid/tree/master/soot-infoflow "soot-infoflow")
14 |
15 | # Running Example
16 |
17 | ### target example code from *example/InputScopeExample.apk*
18 |
19 | ```java
20 | ...
21 |
22 | public class LoginActivity extends AppCompatActivity {
23 |
24 | private String successmsg = "Success";
25 | private String failmsg = "Fail";
26 |
27 |
28 | @Override
29 | public void onCreate(Bundle savedInstanceState) {
30 | ...
31 | final EditText masterpwdEditText = findViewById(R.id.masterpwd);
32 | final Button masterpwdButton = findViewById(R.id.b_masterpwd);
33 | SharedPreferences sharedpreferences = getApplicationContext().getSharedPreferences("password", Context.MODE_PRIVATE);
34 | SharedPreferences.Editor editor = sharedpreferences.edit();
35 | editor.putString("pwd", "tryMasterPwd");
36 | editor.commit();
37 | ...
38 | masterpwdButton.setOnClickListener(new View.OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | masterpwdActions(masterpwdEditText.getText().toString());
42 | }
43 | });
44 | ...
45 | }
46 |
47 | private void masterpwdActions(String value){
48 | SharedPreferences sharePre = getApplicationContext().getSharedPreferences("password", Context.MODE_PRIVATE);
49 | String fromSP = sharePre.getString("pwd", "non_exist");
50 |
51 | //user-input validation
52 | if (value.equals(fromSP) || value.equals("test_mp")){
53 | Toast.makeText(getApplicationContext(), "Master Password Test "+successmsg, Toast.LENGTH_LONG).show();
54 | }else{
55 | Toast.makeText(getApplicationContext(), "Master Password Test "+failmsg, Toast.LENGTH_LONG).show();
56 | }
57 | }
58 | }
59 | ```
60 |
61 | ### run
62 | Please make sure the taintrules.json file is in the same directory as InputScope.jar
63 | ```sh
64 | $ java -jar InputScope.jar ./example/InputScopeExample.apk ./libs/android.jar
65 | May 20, 2019 8:53:14 PM brut.androlib.res.AndrolibResources loadMainPkg
66 | INFO: Loading resource table...
67 | ...
68 |
69 | {"sinks":[{"unit":"$z0 = virtualinvoke $r1.(\"test_mp\")","method":"","src":["HARDCODED_STR"],"values":[{"0":["test_mp"]}]},{"unit":"$z0 = virtualinvoke $r1.($r4)","method":"","src":["LOCALFILEShare","HARDCODED_STR"],"values":[{"0":["SharedPreferences_GetString->\"pwd\""]}]}],"source":{"unit":"$r4 = virtualinvoke $r3.()","method":"","unitIndex":4}}
70 |
71 | ...
72 | ```
73 |
74 | ### example result explanation
75 | ```json
76 | {
77 | "sinks":[
78 | {
79 | "unit":"$z0 = virtualinvoke $r1.(\"test_mp\")",
80 | "method":"",
81 | "src":[
82 | "HARDCODED_STR"
83 | ],
84 | "values":[
85 | {
86 | "0":[
87 | "test_mp"
88 | ]
89 | }
90 | ]
91 | },
92 | {
93 | "unit":"$z0 = virtualinvoke $r1.($r4)",
94 | "method":"",
95 | "src":[
96 | "LOCALFILEShare",
97 | "HARDCODED_STR"
98 | ],
99 | "values":[
100 | {
101 | "0":[
102 | "SharedPreferences_GetString->\"pwd\""
103 | ]
104 | }
105 | ]
106 | }
107 | ],
108 | "source":{
109 | "unit":"$r4 = virtualinvoke $r3.()",
110 | "method":"",
111 | "unitIndex":4
112 | }
113 | }
114 | ```
115 | **source** includes information about a single user-input, and each **sink** is for one input validation of such user-input.
116 |
117 | # Citing
118 |
119 | If you create a research work that uses our work, please cite the associated paper:
120 | ```
121 | @inproceedings{inputscope:sp20,
122 | author = {Qingchuan Zhao and Chaoshun Zuo and Brendan Dolan-Gavitt and Giancarlo Pellegrino and Zhiqiang Lin} ,
123 | title = {Automatic Uncovering of Hidden Behaviors From Input Validation in Mobile Apps},
124 | booktitle = {Proceedings of the 2020 IEEE Symposium on Security and Privacy},
125 | address = {San Francisco, CA},
126 | month = {May},
127 | year = 2020,
128 | }
129 | ```
130 |
--------------------------------------------------------------------------------
/bin/org/json/CDL.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/CDL.class
--------------------------------------------------------------------------------
/bin/org/json/Cookie.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/Cookie.class
--------------------------------------------------------------------------------
/bin/org/json/CookieList.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/CookieList.class
--------------------------------------------------------------------------------
/bin/org/json/HTTP.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/HTTP.class
--------------------------------------------------------------------------------
/bin/org/json/HTTPTokener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/HTTPTokener.class
--------------------------------------------------------------------------------
/bin/org/json/JSONArray.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONArray.class
--------------------------------------------------------------------------------
/bin/org/json/JSONException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONException.class
--------------------------------------------------------------------------------
/bin/org/json/JSONML.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONML.class
--------------------------------------------------------------------------------
/bin/org/json/JSONObject$Null.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONObject$Null.class
--------------------------------------------------------------------------------
/bin/org/json/JSONObject.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONObject.class
--------------------------------------------------------------------------------
/bin/org/json/JSONPointer$Builder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONPointer$Builder.class
--------------------------------------------------------------------------------
/bin/org/json/JSONPointer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONPointer.class
--------------------------------------------------------------------------------
/bin/org/json/JSONPointerException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONPointerException.class
--------------------------------------------------------------------------------
/bin/org/json/JSONString.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONString.class
--------------------------------------------------------------------------------
/bin/org/json/JSONStringer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONStringer.class
--------------------------------------------------------------------------------
/bin/org/json/JSONTokener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONTokener.class
--------------------------------------------------------------------------------
/bin/org/json/JSONWriter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/JSONWriter.class
--------------------------------------------------------------------------------
/bin/org/json/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2002 JSON.org
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | The Software shall be used for Good, not Evil.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/bin/org/json/Property.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/Property.class
--------------------------------------------------------------------------------
/bin/org/json/README:
--------------------------------------------------------------------------------
1 | JSON in Java [package org.json]
2 |
3 | JSON is a light-weight, language independent, data interchange format.
4 | See http://www.JSON.org/
5 |
6 | The files in this package implement JSON encoders/decoders in Java.
7 | It also includes the capability to convert between JSON and XML, HTTP
8 | headers, Cookies, and CDL.
9 |
10 | This is a reference implementation. There is a large number of JSON packages
11 | in Java. Perhaps someday the Java community will standardize on one. Until
12 | then, choose carefully.
13 |
14 | The license includes this restriction: "The software shall be used for good,
15 | not evil." If your conscience cannot live with that, then choose a different
16 | package.
17 |
18 | The package compiles on Java 1.6-1.8.
19 |
20 |
21 | JSONObject.java: The JSONObject can parse text from a String or a JSONTokener
22 | to produce a map-like object. The object provides methods for manipulating its
23 | contents, and for producing a JSON compliant object serialization.
24 |
25 | JSONArray.java: The JSONObject can parse text from a String or a JSONTokener
26 | to produce a vector-like object. The object provides methods for manipulating
27 | its contents, and for producing a JSON compliant array serialization.
28 |
29 | JSONTokener.java: The JSONTokener breaks a text into a sequence of individual
30 | tokens. It can be constructed from a String, Reader, or InputStream.
31 |
32 | JSONException.java: The JSONException is the standard exception type thrown
33 | by this package.
34 |
35 | JSONPointer.java: Implementation of
36 | [JSON Pointer (RFC 6901)](https://tools.ietf.org/html/rfc6901). Supports
37 | JSON Pointers both in the form of string representation and URI fragment
38 | representation.
39 |
40 | JSONString.java: The JSONString interface requires a toJSONString method,
41 | allowing an object to provide its own serialization.
42 |
43 | JSONStringer.java: The JSONStringer provides a convenient facility for
44 | building JSON strings.
45 |
46 | JSONWriter.java: The JSONWriter provides a convenient facility for building
47 | JSON text through a writer.
48 |
49 |
50 | CDL.java: CDL provides support for converting between JSON and comma
51 | delimited lists.
52 |
53 | Cookie.java: Cookie provides support for converting between JSON and cookies.
54 |
55 | CookieList.java: CookieList provides support for converting between JSON and
56 | cookie lists.
57 |
58 | HTTP.java: HTTP provides support for converting between JSON and HTTP headers.
59 |
60 | HTTPTokener.java: HTTPTokener extends JSONTokener for parsing HTTP headers.
61 |
62 | XML.java: XML provides support for converting between JSON and XML.
63 |
64 | JSONML.java: JSONML provides support for converting between JSONML and XML.
65 |
66 | XMLTokener.java: XMLTokener extends JSONTokener for parsing XML text.
67 |
68 | Unit tests are maintained in a separate project. Contributing developers can test
69 | JSON-java pull requests with the code in this project:
70 | https://github.com/stleary/JSON-Java-unit-test
71 |
72 | Numeric types in this package comply with ECMA-404: The JSON Data Interchange Format
73 | (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) and
74 | RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format
75 | (https://tools.ietf.org/html/rfc7159#section-6).
76 | This package fully supports Integer, Long, and Double Java types. Partial support
77 | for BigInteger and BigDecimal values in JSONObject and JSONArray objects is provided
78 | in the form of get(), opt(), and put() API methods.
79 |
80 | Although 1.6 compatibility is currently supported, it is not a project goal and may be
81 | removed in some future release.
82 |
83 | In compliance with RFC7159 page 10 section 9, the parser is more lax with what is valid
84 | JSON than the Generator. For Example, the tab character (U+0009) is allowed when reading
85 | JSON Text strings, but when output by the Generator, tab is properly converted to \t in
86 | the string. Other instances may occur where reading invalid JSON text does not cause an
87 | error to be generated. Malformed JSON Texts such as missing end " (quote) on strings or
88 | invalid number formats (1.2e6.3) will cause errors as such documents can not be read
89 | reliably.
90 |
91 | Release history:
92 |
93 | 20160810 Revert code that was breaking opt*() methods.
94 |
95 | 20160807 This release contains a bug in the JSONObject.opt*() and JSONArray.opt*() methods,
96 | it is not recommended for use.
97 | Java 1.6 compatability fixed, JSONArray.toList() and JSONObject.toMap(),
98 | RFC4180 compatibility, JSONPointer, some exception fixes, optional XML type conversion.
99 | Contains the latest code as of 7 Aug, 2016
100 |
101 | 20160212 Java 1.6 compatibility, OSGi bundle. Contains the latest code as of 12 Feb, 2016.
102 |
103 | 20151123 JSONObject and JSONArray initialization with generics. Contains the
104 | latest code as of 23 Nov, 2015.
105 |
106 | 20150729 Checkpoint for Maven central repository release. Contains the latest code
107 | as of 29 July, 2015.
108 |
109 | JSON-java releases can be found by searching the Maven repository for groupId "org.json"
110 | and artifactId "json". For example:
111 | https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.json%22%20AND%20a%3A%22json%22
112 |
--------------------------------------------------------------------------------
/bin/org/json/XML.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/XML.class
--------------------------------------------------------------------------------
/bin/org/json/XMLTokener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/org/json/XMLTokener.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/main/runTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/main/runTest.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/backwardslicing/BackwardContext.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/backwardslicing/BackwardContext.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/backwardslicing/BackwardController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/backwardslicing/BackwardController.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/backwardslicing/CallStackItem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/backwardslicing/CallStackItem.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/backwardslicing/DataSourceType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/backwardslicing/DataSourceType.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/backwardslicing/ICollecter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/backwardslicing/ICollecter.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/backwardslicing/TaintRules.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/backwardslicing/TaintRules.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/base/ExecTrace.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/base/ExecTrace.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/base/GlobalStatistics.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/base/GlobalStatistics.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/base/ParameterTransferStmt$LinkedVariableBox.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/base/ParameterTransferStmt$LinkedVariableBox.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/base/ParameterTransferStmt.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/base/ParameterTransferStmt.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/base/StmtPoint.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/base/StmtPoint.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/base/TargetType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/base/TargetType.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/forwardexec/SimulateEngine.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/forwardexec/SimulateEngine.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/forwardexec/StmtPath.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/forwardexec/StmtPath.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/CallGraph.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/CallGraph.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/CallGraphNode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/CallGraphNode.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/DGraph.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/DGraph.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/HeapObject.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/HeapObject.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/IDGNode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/IDGNode.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/ValuePoint.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/ValuePoint.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/graph/specialcase/FindInClassAdd.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/graph/specialcase/FindInClassAdd.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/main/ApkContext.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/main/ApkContext.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/main/Config.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/main/Config.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/BlockGenerator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/BlockGenerator.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/BlockUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/BlockUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/ErrorHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/ErrorHandler.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/FileUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/FileUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/FunctionUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/FunctionUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/ListUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/ListUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/Logger.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/Logger.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/MethodUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/MethodUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$AddCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$AddCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$AndCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$AndCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$Compute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$Compute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$DivCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$DivCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$MulCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$MulCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$OrCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$OrCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$ShlCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$ShlCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$ShrCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$ShrCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$SubCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$SubCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$UshrCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$UshrCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$XorCompute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility$XorCompute.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/stringvsa/utility/OtherUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/base/SinkMethod.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/base/SinkMethod.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/base/SourcePoint.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/base/SourcePoint.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/base/TaintQuestion.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/base/TaintQuestion.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/main/CrossPath.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/main/CrossPath.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/main/QuestionGenerator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/main/QuestionGenerator.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/main/TResSolve.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/main/TResSolve.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/solver/CallStackItem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/solver/CallStackItem.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/solver/SimulationContext.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/solver/SimulationContext.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/solver/SimulationEngine.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/solver/SimulationEngine.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/solver/StmtItem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/solver/StmtItem.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/solver/TaintQuestionSolver.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/solver/TaintQuestionSolver.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/BlockGenerator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/BlockGenerator.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/FileUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/FileUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/ListUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/ListUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/Logger.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/Logger.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/MethodUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/MethodUtility.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/TimeUtility$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/TimeUtility$1.class
--------------------------------------------------------------------------------
/bin/osu/seclab/inputscope/taintanalysis/utility/TimeUtility.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/bin/osu/seclab/inputscope/taintanalysis/utility/TimeUtility.class
--------------------------------------------------------------------------------
/example/InputScopeExample.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/example/InputScopeExample.apk
--------------------------------------------------------------------------------
/libs/android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/libs/android.jar
--------------------------------------------------------------------------------
/libs/apktool-lib_fat.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/libs/apktool-lib_fat.jar
--------------------------------------------------------------------------------
/libs/javatuples-1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/libs/javatuples-1.2.jar
--------------------------------------------------------------------------------
/libs/json-20151123.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/libs/json-20151123.jar
--------------------------------------------------------------------------------
/libs/xmlpull-1.1.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSUSecLab/InputScope/00136f2a771dd800f41246cf58115963dafc2822/libs/xmlpull-1.1.3.1.jar
--------------------------------------------------------------------------------
/src/org/json/CDL.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | /**
28 | * This provides static methods to convert comma delimited text into a
29 | * JSONArray, and to convert a JSONArray into comma delimited text. Comma
30 | * delimited text is a very popular format for data interchange. It is
31 | * understood by most database, spreadsheet, and organizer programs.
32 | *
33 | * Each row of text represents a row in a table or a data record. Each row
34 | * ends with a NEWLINE character. Each row contains one or more values.
35 | * Values are separated by commas. A value can contain any character except
36 | * for comma, unless is is wrapped in single quotes or double quotes.
37 | *
38 | * The first row usually contains the names of the columns.
39 | *
40 | * A comma delimited list can be converted into a JSONArray of JSONObjects.
41 | * The names for the elements in the JSONObjects can be taken from the names
42 | * in the first row.
43 | * @author JSON.org
44 | * @version 2016-05-01
45 | */
46 | public class CDL {
47 |
48 | /**
49 | * Get the next value. The value can be wrapped in quotes. The value can
50 | * be empty.
51 | * @param x A JSONTokener of the source text.
52 | * @return The value string, or null if empty.
53 | * @throws JSONException if the quoted string is badly formed.
54 | */
55 | private static String getValue(JSONTokener x) throws JSONException {
56 | char c;
57 | char q;
58 | StringBuffer sb;
59 | do {
60 | c = x.next();
61 | } while (c == ' ' || c == '\t');
62 | switch (c) {
63 | case 0:
64 | return null;
65 | case '"':
66 | case '\'':
67 | q = c;
68 | sb = new StringBuffer();
69 | for (;;) {
70 | c = x.next();
71 | if (c == q) {
72 | //Handle escaped double-quote
73 | if(x.next() != '\"')
74 | {
75 | x.back();
76 | break;
77 | }
78 | }
79 | if (c == 0 || c == '\n' || c == '\r') {
80 | throw x.syntaxError("Missing close quote '" + q + "'.");
81 | }
82 | sb.append(c);
83 | }
84 | return sb.toString();
85 | case ',':
86 | x.back();
87 | return "";
88 | default:
89 | x.back();
90 | return x.nextTo(',');
91 | }
92 | }
93 |
94 | /**
95 | * Produce a JSONArray of strings from a row of comma delimited values.
96 | * @param x A JSONTokener of the source text.
97 | * @return A JSONArray of strings.
98 | * @throws JSONException
99 | */
100 | public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
101 | JSONArray ja = new JSONArray();
102 | for (;;) {
103 | String value = getValue(x);
104 | char c = x.next();
105 | if (value == null ||
106 | (ja.length() == 0 && value.length() == 0 && c != ',')) {
107 | return null;
108 | }
109 | ja.put(value);
110 | for (;;) {
111 | if (c == ',') {
112 | break;
113 | }
114 | if (c != ' ') {
115 | if (c == '\n' || c == '\r' || c == 0) {
116 | return ja;
117 | }
118 | throw x.syntaxError("Bad character '" + c + "' (" +
119 | (int)c + ").");
120 | }
121 | c = x.next();
122 | }
123 | }
124 | }
125 |
126 | /**
127 | * Produce a JSONObject from a row of comma delimited text, using a
128 | * parallel JSONArray of strings to provides the names of the elements.
129 | * @param names A JSONArray of names. This is commonly obtained from the
130 | * first row of a comma delimited text file using the rowToJSONArray
131 | * method.
132 | * @param x A JSONTokener of the source text.
133 | * @return A JSONObject combining the names and values.
134 | * @throws JSONException
135 | */
136 | public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x)
137 | throws JSONException {
138 | JSONArray ja = rowToJSONArray(x);
139 | return ja != null ? ja.toJSONObject(names) : null;
140 | }
141 |
142 | /**
143 | * Produce a comma delimited text row from a JSONArray. Values containing
144 | * the comma character will be quoted. Troublesome characters may be
145 | * removed.
146 | * @param ja A JSONArray of strings.
147 | * @return A string ending in NEWLINE.
148 | */
149 | public static String rowToString(JSONArray ja) {
150 | StringBuilder sb = new StringBuilder();
151 | for (int i = 0; i < ja.length(); i += 1) {
152 | if (i > 0) {
153 | sb.append(',');
154 | }
155 | Object object = ja.opt(i);
156 | if (object != null) {
157 | String string = object.toString();
158 | if (string.length() > 0 && (string.indexOf(',') >= 0 ||
159 | string.indexOf('\n') >= 0 || string.indexOf('\r') >= 0 ||
160 | string.indexOf(0) >= 0 || string.charAt(0) == '"')) {
161 | sb.append('"');
162 | int length = string.length();
163 | for (int j = 0; j < length; j += 1) {
164 | char c = string.charAt(j);
165 | if (c >= ' ' && c != '"') {
166 | sb.append(c);
167 | }
168 | }
169 | sb.append('"');
170 | } else {
171 | sb.append(string);
172 | }
173 | }
174 | }
175 | sb.append('\n');
176 | return sb.toString();
177 | }
178 |
179 | /**
180 | * Produce a JSONArray of JSONObjects from a comma delimited text string,
181 | * using the first row as a source of names.
182 | * @param string The comma delimited text.
183 | * @return A JSONArray of JSONObjects.
184 | * @throws JSONException
185 | */
186 | public static JSONArray toJSONArray(String string) throws JSONException {
187 | return toJSONArray(new JSONTokener(string));
188 | }
189 |
190 | /**
191 | * Produce a JSONArray of JSONObjects from a comma delimited text string,
192 | * using the first row as a source of names.
193 | * @param x The JSONTokener containing the comma delimited text.
194 | * @return A JSONArray of JSONObjects.
195 | * @throws JSONException
196 | */
197 | public static JSONArray toJSONArray(JSONTokener x) throws JSONException {
198 | return toJSONArray(rowToJSONArray(x), x);
199 | }
200 |
201 | /**
202 | * Produce a JSONArray of JSONObjects from a comma delimited text string
203 | * using a supplied JSONArray as the source of element names.
204 | * @param names A JSONArray of strings.
205 | * @param string The comma delimited text.
206 | * @return A JSONArray of JSONObjects.
207 | * @throws JSONException
208 | */
209 | public static JSONArray toJSONArray(JSONArray names, String string)
210 | throws JSONException {
211 | return toJSONArray(names, new JSONTokener(string));
212 | }
213 |
214 | /**
215 | * Produce a JSONArray of JSONObjects from a comma delimited text string
216 | * using a supplied JSONArray as the source of element names.
217 | * @param names A JSONArray of strings.
218 | * @param x A JSONTokener of the source text.
219 | * @return A JSONArray of JSONObjects.
220 | * @throws JSONException
221 | */
222 | public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
223 | throws JSONException {
224 | if (names == null || names.length() == 0) {
225 | return null;
226 | }
227 | JSONArray ja = new JSONArray();
228 | for (;;) {
229 | JSONObject jo = rowToJSONObject(names, x);
230 | if (jo == null) {
231 | break;
232 | }
233 | ja.put(jo);
234 | }
235 | if (ja.length() == 0) {
236 | return null;
237 | }
238 | return ja;
239 | }
240 |
241 |
242 | /**
243 | * Produce a comma delimited text from a JSONArray of JSONObjects. The
244 | * first row will be a list of names obtained by inspecting the first
245 | * JSONObject.
246 | * @param ja A JSONArray of JSONObjects.
247 | * @return A comma delimited text.
248 | * @throws JSONException
249 | */
250 | public static String toString(JSONArray ja) throws JSONException {
251 | JSONObject jo = ja.optJSONObject(0);
252 | if (jo != null) {
253 | JSONArray names = jo.names();
254 | if (names != null) {
255 | return rowToString(names) + toString(names, ja);
256 | }
257 | }
258 | return null;
259 | }
260 |
261 | /**
262 | * Produce a comma delimited text from a JSONArray of JSONObjects using
263 | * a provided list of names. The list of names is not included in the
264 | * output.
265 | * @param names A JSONArray of strings.
266 | * @param ja A JSONArray of JSONObjects.
267 | * @return A comma delimited text.
268 | * @throws JSONException
269 | */
270 | public static String toString(JSONArray names, JSONArray ja)
271 | throws JSONException {
272 | if (names == null || names.length() == 0) {
273 | return null;
274 | }
275 | StringBuffer sb = new StringBuffer();
276 | for (int i = 0; i < ja.length(); i += 1) {
277 | JSONObject jo = ja.optJSONObject(i);
278 | if (jo != null) {
279 | sb.append(rowToString(jo.toJSONArray(names)));
280 | }
281 | }
282 | return sb.toString();
283 | }
284 | }
285 |
--------------------------------------------------------------------------------
/src/org/json/Cookie.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | /**
28 | * Convert a web browser cookie specification to a JSONObject and back.
29 | * JSON and Cookies are both notations for name/value pairs.
30 | * @author JSON.org
31 | * @version 2015-12-09
32 | */
33 | public class Cookie {
34 |
35 | /**
36 | * Produce a copy of a string in which the characters '+', '%', '=', ';'
37 | * and control characters are replaced with "%hh". This is a gentle form
38 | * of URL encoding, attempting to cause as little distortion to the
39 | * string as possible. The characters '=' and ';' are meta characters in
40 | * cookies. By convention, they are escaped using the URL-encoding. This is
41 | * only a convention, not a standard. Often, cookies are expected to have
42 | * encoded values. We encode '=' and ';' because we must. We encode '%' and
43 | * '+' because they are meta characters in URL encoding.
44 | * @param string The source string.
45 | * @return The escaped result.
46 | */
47 | public static String escape(String string) {
48 | char c;
49 | String s = string.trim();
50 | int length = s.length();
51 | StringBuilder sb = new StringBuilder(length);
52 | for (int i = 0; i < length; i += 1) {
53 | c = s.charAt(i);
54 | if (c < ' ' || c == '+' || c == '%' || c == '=' || c == ';') {
55 | sb.append('%');
56 | sb.append(Character.forDigit((char)((c >>> 4) & 0x0f), 16));
57 | sb.append(Character.forDigit((char)(c & 0x0f), 16));
58 | } else {
59 | sb.append(c);
60 | }
61 | }
62 | return sb.toString();
63 | }
64 |
65 |
66 | /**
67 | * Convert a cookie specification string into a JSONObject. The string
68 | * will contain a name value pair separated by '='. The name and the value
69 | * will be unescaped, possibly converting '+' and '%' sequences. The
70 | * cookie properties may follow, separated by ';', also represented as
71 | * name=value (except the secure property, which does not have a value).
72 | * The name will be stored under the key "name", and the value will be
73 | * stored under the key "value". This method does not do checking or
74 | * validation of the parameters. It only converts the cookie string into
75 | * a JSONObject.
76 | * @param string The cookie specification string.
77 | * @return A JSONObject containing "name", "value", and possibly other
78 | * members.
79 | * @throws JSONException
80 | */
81 | public static JSONObject toJSONObject(String string) throws JSONException {
82 | String name;
83 | JSONObject jo = new JSONObject();
84 | Object value;
85 | JSONTokener x = new JSONTokener(string);
86 | jo.put("name", x.nextTo('='));
87 | x.next('=');
88 | jo.put("value", x.nextTo(';'));
89 | x.next();
90 | while (x.more()) {
91 | name = unescape(x.nextTo("=;"));
92 | if (x.next() != '=') {
93 | if (name.equals("secure")) {
94 | value = Boolean.TRUE;
95 | } else {
96 | throw x.syntaxError("Missing '=' in cookie parameter.");
97 | }
98 | } else {
99 | value = unescape(x.nextTo(';'));
100 | x.next();
101 | }
102 | jo.put(name, value);
103 | }
104 | return jo;
105 | }
106 |
107 |
108 | /**
109 | * Convert a JSONObject into a cookie specification string. The JSONObject
110 | * must contain "name" and "value" members.
111 | * If the JSONObject contains "expires", "domain", "path", or "secure"
112 | * members, they will be appended to the cookie specification string.
113 | * All other members are ignored.
114 | * @param jo A JSONObject
115 | * @return A cookie specification string
116 | * @throws JSONException
117 | */
118 | public static String toString(JSONObject jo) throws JSONException {
119 | StringBuilder sb = new StringBuilder();
120 |
121 | sb.append(escape(jo.getString("name")));
122 | sb.append("=");
123 | sb.append(escape(jo.getString("value")));
124 | if (jo.has("expires")) {
125 | sb.append(";expires=");
126 | sb.append(jo.getString("expires"));
127 | }
128 | if (jo.has("domain")) {
129 | sb.append(";domain=");
130 | sb.append(escape(jo.getString("domain")));
131 | }
132 | if (jo.has("path")) {
133 | sb.append(";path=");
134 | sb.append(escape(jo.getString("path")));
135 | }
136 | if (jo.optBoolean("secure")) {
137 | sb.append(";secure");
138 | }
139 | return sb.toString();
140 | }
141 |
142 | /**
143 | * Convert %hh sequences to single characters, and
144 | * convert plus to space.
145 | * @param string A string that may contain
146 | * + (plus) and
147 | * %hh sequences.
148 | * @return The unescaped string.
149 | */
150 | public static String unescape(String string) {
151 | int length = string.length();
152 | StringBuilder sb = new StringBuilder(length);
153 | for (int i = 0; i < length; ++i) {
154 | char c = string.charAt(i);
155 | if (c == '+') {
156 | c = ' ';
157 | } else if (c == '%' && i + 2 < length) {
158 | int d = JSONTokener.dehexchar(string.charAt(i + 1));
159 | int e = JSONTokener.dehexchar(string.charAt(i + 2));
160 | if (d >= 0 && e >= 0) {
161 | c = (char)(d * 16 + e);
162 | i += 2;
163 | }
164 | }
165 | sb.append(c);
166 | }
167 | return sb.toString();
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/src/org/json/CookieList.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | import java.util.Iterator;
28 |
29 | /**
30 | * Convert a web browser cookie list string to a JSONObject and back.
31 | * @author JSON.org
32 | * @version 2015-12-09
33 | */
34 | public class CookieList {
35 |
36 | /**
37 | * Convert a cookie list into a JSONObject. A cookie list is a sequence
38 | * of name/value pairs. The names are separated from the values by '='.
39 | * The pairs are separated by ';'. The names and the values
40 | * will be unescaped, possibly converting '+' and '%' sequences.
41 | *
42 | * To add a cookie to a cooklist,
43 | * cookielistJSONObject.put(cookieJSONObject.getString("name"),
44 | * cookieJSONObject.getString("value"));
45 | * @param string A cookie list string
46 | * @return A JSONObject
47 | * @throws JSONException
48 | */
49 | public static JSONObject toJSONObject(String string) throws JSONException {
50 | JSONObject jo = new JSONObject();
51 | JSONTokener x = new JSONTokener(string);
52 | while (x.more()) {
53 | String name = Cookie.unescape(x.nextTo('='));
54 | x.next('=');
55 | jo.put(name, Cookie.unescape(x.nextTo(';')));
56 | x.next();
57 | }
58 | return jo;
59 | }
60 |
61 | /**
62 | * Convert a JSONObject into a cookie list. A cookie list is a sequence
63 | * of name/value pairs. The names are separated from the values by '='.
64 | * The pairs are separated by ';'. The characters '%', '+', '=', and ';'
65 | * in the names and values are replaced by "%hh".
66 | * @param jo A JSONObject
67 | * @return A cookie list string
68 | * @throws JSONException
69 | */
70 | public static String toString(JSONObject jo) throws JSONException {
71 | boolean b = false;
72 | Iterator keys = jo.keys();
73 | String string;
74 | StringBuilder sb = new StringBuilder();
75 | while (keys.hasNext()) {
76 | string = keys.next();
77 | if (!jo.isNull(string)) {
78 | if (b) {
79 | sb.append(';');
80 | }
81 | sb.append(Cookie.escape(string));
82 | sb.append("=");
83 | sb.append(Cookie.escape(jo.getString(string)));
84 | b = true;
85 | }
86 | }
87 | return sb.toString();
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/org/json/HTTP.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | import java.util.Iterator;
28 |
29 | /**
30 | * Convert an HTTP header to a JSONObject and back.
31 | * @author JSON.org
32 | * @version 2015-12-09
33 | */
34 | public class HTTP {
35 |
36 | /** Carriage return/line feed. */
37 | public static final String CRLF = "\r\n";
38 |
39 | /**
40 | * Convert an HTTP header string into a JSONObject. It can be a request
41 | * header or a response header. A request header will contain
42 | *
120 | * Any other members of the JSONObject will be output as HTTP fields.
121 | * The result will end with two CRLF pairs.
122 | * @param jo A JSONObject
123 | * @return An HTTP header string.
124 | * @throws JSONException if the object does not contain enough
125 | * information.
126 | */
127 | public static String toString(JSONObject jo) throws JSONException {
128 | Iterator keys = jo.keys();
129 | String string;
130 | StringBuilder sb = new StringBuilder();
131 | if (jo.has("Status-Code") && jo.has("Reason-Phrase")) {
132 | sb.append(jo.getString("HTTP-Version"));
133 | sb.append(' ');
134 | sb.append(jo.getString("Status-Code"));
135 | sb.append(' ');
136 | sb.append(jo.getString("Reason-Phrase"));
137 | } else if (jo.has("Method") && jo.has("Request-URI")) {
138 | sb.append(jo.getString("Method"));
139 | sb.append(' ');
140 | sb.append('"');
141 | sb.append(jo.getString("Request-URI"));
142 | sb.append('"');
143 | sb.append(' ');
144 | sb.append(jo.getString("HTTP-Version"));
145 | } else {
146 | throw new JSONException("Not enough material for an HTTP header.");
147 | }
148 | sb.append(CRLF);
149 | while (keys.hasNext()) {
150 | string = keys.next();
151 | if (!"HTTP-Version".equals(string) && !"Status-Code".equals(string) &&
152 | !"Reason-Phrase".equals(string) && !"Method".equals(string) &&
153 | !"Request-URI".equals(string) && !jo.isNull(string)) {
154 | sb.append(string);
155 | sb.append(": ");
156 | sb.append(jo.getString(string));
157 | sb.append(CRLF);
158 | }
159 | }
160 | sb.append(CRLF);
161 | return sb.toString();
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/src/org/json/HTTPTokener.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | /**
28 | * The HTTPTokener extends the JSONTokener to provide additional methods
29 | * for the parsing of HTTP headers.
30 | * @author JSON.org
31 | * @version 2015-12-09
32 | */
33 | public class HTTPTokener extends JSONTokener {
34 |
35 | /**
36 | * Construct an HTTPTokener from a string.
37 | * @param string A source string.
38 | */
39 | public HTTPTokener(String string) {
40 | super(string);
41 | }
42 |
43 |
44 | /**
45 | * Get the next token or string. This is used in parsing HTTP headers.
46 | * @throws JSONException
47 | * @return A String.
48 | */
49 | public String nextToken() throws JSONException {
50 | char c;
51 | char q;
52 | StringBuilder sb = new StringBuilder();
53 | do {
54 | c = next();
55 | } while (Character.isWhitespace(c));
56 | if (c == '"' || c == '\'') {
57 | q = c;
58 | for (;;) {
59 | c = next();
60 | if (c < ' ') {
61 | throw syntaxError("Unterminated string.");
62 | }
63 | if (c == q) {
64 | return sb.toString();
65 | }
66 | sb.append(c);
67 | }
68 | }
69 | for (;;) {
70 | if (c == 0 || Character.isWhitespace(c)) {
71 | return sb.toString();
72 | }
73 | sb.append(c);
74 | c = next();
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/org/json/JSONException.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /**
4 | * The JSONException is thrown by the JSON.org classes when things are amiss.
5 | *
6 | * @author JSON.org
7 | * @version 2015-12-09
8 | */
9 | public class JSONException extends RuntimeException {
10 | /** Serialization ID */
11 | private static final long serialVersionUID = 0;
12 |
13 | /**
14 | * Constructs a JSONException with an explanatory message.
15 | *
16 | * @param message
17 | * Detail about the reason for the exception.
18 | */
19 | public JSONException(final String message) {
20 | super(message);
21 | }
22 |
23 | /**
24 | * Constructs a JSONException with an explanatory message and cause.
25 | *
26 | * @param message
27 | * Detail about the reason for the exception.
28 | * @param cause
29 | * The cause.
30 | */
31 | public JSONException(final String message, final Throwable cause) {
32 | super(message, cause);
33 | }
34 |
35 | /**
36 | * Constructs a new JSONException with the specified cause.
37 | *
38 | * @param cause
39 | * The cause.
40 | */
41 | public JSONException(final Throwable cause) {
42 | super(cause.getMessage(), cause);
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/org/json/JSONPointer.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | import static java.lang.String.format;
4 |
5 | import java.io.UnsupportedEncodingException;
6 | import java.net.URLDecoder;
7 | import java.net.URLEncoder;
8 | import java.util.*;
9 |
10 | /*
11 | Copyright (c) 2002 JSON.org
12 |
13 | Permission is hereby granted, free of charge, to any person obtaining a copy
14 | of this software and associated documentation files (the "Software"), to deal
15 | in the Software without restriction, including without limitation the rights
16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 | copies of the Software, and to permit persons to whom the Software is
18 | furnished to do so, subject to the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be included in all
21 | copies or substantial portions of the Software.
22 |
23 | The Software shall be used for Good, not Evil.
24 |
25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 | SOFTWARE.
32 | */
33 |
34 | /**
35 | * A JSON Pointer is a simple query language defined for JSON documents by
36 | * RFC 6901.
37 | *
38 | * In a nutshell, JSONPointer allows the user to navigate into a JSON document
39 | * using strings, and retrieve targeted objects, like a simple form of XPATH.
40 | * Path segments are separated by the '/' char, which signifies the root of
41 | * the document when it appears as the first char of the string. Array
42 | * elements are navigated using ordinals, counting from 0. JSONPointer strings
43 | * may be extended to any arbitrary number of segments. If the navigation
44 | * is successful, the matched item is returned. A matched item may be a
45 | * JSONObject, a JSONArray, or a JSON value. If the JSONPointer string building
46 | * fails, an appropriate exception is thrown. If the navigation fails to find
47 | * a match, a JSONPointerException is thrown.
48 | *
49 | * @author JSON.org
50 | * @version 2016-05-14
51 | */
52 | public class JSONPointer {
53 |
54 | // used for URL encoding and decoding
55 | private static final String ENCODING = "utf-8";
56 |
57 | /**
58 | * This class allows the user to build a JSONPointer in steps, using
59 | * exactly one segment in each step.
60 | */
61 | public static class Builder {
62 |
63 | // Segments for the eventual JSONPointer string
64 | private final List refTokens = new ArrayList();
65 |
66 | /**
67 | * Creates a {@code JSONPointer} instance using the tokens previously set using the
68 | * {@link #append(String)} method calls.
69 | */
70 | public JSONPointer build() {
71 | return new JSONPointer(refTokens);
72 | }
73 |
74 | /**
75 | * Adds an arbitary token to the list of reference tokens. It can be any non-null value.
76 | *
77 | * Unlike in the case of JSON string or URI fragment representation of JSON pointers, the
78 | * argument of this method MUST NOT be escaped. If you want to query the property called
79 | * {@code "a~b"} then you should simply pass the {@code "a~b"} string as-is, there is no
80 | * need to escape it as {@code "a~0b"}.
81 | *
82 | * @param token the new token to be appended to the list
83 | * @return {@code this}
84 | * @throws NullPointerException if {@code token} is null
85 | */
86 | public Builder append(String token) {
87 | if (token == null) {
88 | throw new NullPointerException("token cannot be null");
89 | }
90 | refTokens.add(token);
91 | return this;
92 | }
93 |
94 | /**
95 | * Adds an integer to the reference token list. Although not necessarily, mostly this token will
96 | * denote an array index.
97 | *
98 | * @param arrayIndex the array index to be added to the token list
99 | * @return {@code this}
100 | */
101 | public Builder append(int arrayIndex) {
102 | refTokens.add(String.valueOf(arrayIndex));
103 | return this;
104 | }
105 | }
106 |
107 | /**
108 | * Static factory method for {@link Builder}. Example usage:
109 | *
110 | *
118 | *
119 | * @return a builder instance which can be used to construct a {@code JSONPointer} instance by chained
120 | * {@link Builder#append(String)} calls.
121 | */
122 | public static Builder builder() {
123 | return new Builder();
124 | }
125 |
126 | // Segments for the JSONPointer string
127 | private final List refTokens;
128 |
129 | /**
130 | * Pre-parses and initializes a new {@code JSONPointer} instance. If you want to
131 | * evaluate the same JSON Pointer on different JSON documents then it is recommended
132 | * to keep the {@code JSONPointer} instances due to performance considerations.
133 | *
134 | * @param pointer the JSON String or URI Fragment representation of the JSON pointer.
135 | * @throws IllegalArgumentException if {@code pointer} is not a valid JSON pointer
136 | */
137 | public JSONPointer(String pointer) {
138 | if (pointer == null) {
139 | throw new NullPointerException("pointer cannot be null");
140 | }
141 | if (pointer.isEmpty()) {
142 | refTokens = Collections.emptyList();
143 | return;
144 | }
145 | if (pointer.startsWith("#/")) {
146 | pointer = pointer.substring(2);
147 | try {
148 | pointer = URLDecoder.decode(pointer, ENCODING);
149 | } catch (UnsupportedEncodingException e) {
150 | throw new RuntimeException(e);
151 | }
152 | } else if (pointer.startsWith("/")) {
153 | pointer = pointer.substring(1);
154 | } else {
155 | throw new IllegalArgumentException("a JSON pointer should start with '/' or '#/'");
156 | }
157 | refTokens = new ArrayList();
158 | for (String token : pointer.split("/")) {
159 | refTokens.add(unescape(token));
160 | }
161 | }
162 |
163 | public JSONPointer(List refTokens) {
164 | this.refTokens = new ArrayList(refTokens);
165 | }
166 |
167 | private String unescape(String token) {
168 | return token.replace("~1", "/").replace("~0", "~")
169 | .replace("\\\"", "\"")
170 | .replace("\\\\", "\\");
171 | }
172 |
173 | /**
174 | * Evaluates this JSON Pointer on the given {@code document}. The {@code document}
175 | * is usually a {@link JSONObject} or a {@link JSONArray} instance, but the empty
176 | * JSON Pointer ({@code ""}) can be evaluated on any JSON values and in such case the
177 | * returned value will be {@code document} itself.
178 | *
179 | * @param document the JSON document which should be the subject of querying.
180 | * @return the result of the evaluation
181 | * @throws JSONPointerException if an error occurs during evaluation
182 | */
183 | public Object queryFrom(Object document) {
184 | if (refTokens.isEmpty()) {
185 | return document;
186 | }
187 | Object current = document;
188 | for (String token : refTokens) {
189 | if (current instanceof JSONObject) {
190 | current = ((JSONObject) current).opt(unescape(token));
191 | } else if (current instanceof JSONArray) {
192 | current = readByIndexToken(current, token);
193 | } else {
194 | throw new JSONPointerException(format(
195 | "value [%s] is not an array or object therefore its key %s cannot be resolved", current,
196 | token));
197 | }
198 | }
199 | return current;
200 | }
201 |
202 | /**
203 | * Matches a JSONArray element by ordinal position
204 | * @param current the JSONArray to be evaluated
205 | * @param indexToken the array index in string form
206 | * @return the matched object. If no matching item is found a
207 | * JSONPointerException is thrown
208 | */
209 | private Object readByIndexToken(Object current, String indexToken) {
210 | try {
211 | int index = Integer.parseInt(indexToken);
212 | JSONArray currentArr = (JSONArray) current;
213 | if (index >= currentArr.length()) {
214 | throw new JSONPointerException(format("index %d is out of bounds - the array has %d elements", index,
215 | currentArr.length()));
216 | }
217 | return currentArr.get(index);
218 | } catch (NumberFormatException e) {
219 | throw new JSONPointerException(format("%s is not an array index", indexToken), e);
220 | }
221 | }
222 |
223 | /**
224 | * Returns a string representing the JSONPointer path value using string
225 | * representation
226 | */
227 | @Override
228 | public String toString() {
229 | StringBuilder rval = new StringBuilder("");
230 | for (String token: refTokens) {
231 | rval.append('/').append(escape(token));
232 | }
233 | return rval.toString();
234 | }
235 |
236 | /**
237 | * Escapes path segment values to an unambiguous form.
238 | * The escape char to be inserted is '~'. The chars to be escaped
239 | * are ~, which maps to ~0, and /, which maps to ~1. Backslashes
240 | * and double quote chars are also escaped.
241 | * @param token the JSONPointer segment value to be escaped
242 | * @return the escaped value for the token
243 | */
244 | private String escape(String token) {
245 | return token.replace("~", "~0")
246 | .replace("/", "~1")
247 | .replace("\\", "\\\\")
248 | .replace("\"", "\\\"");
249 | }
250 |
251 | /**
252 | * Returns a string representing the JSONPointer path value using URI
253 | * fragment identifier representation
254 | */
255 | public String toURIFragment() {
256 | try {
257 | StringBuilder rval = new StringBuilder("#");
258 | for (String token : refTokens) {
259 | rval.append('/').append(URLEncoder.encode(token, ENCODING));
260 | }
261 | return rval.toString();
262 | } catch (UnsupportedEncodingException e) {
263 | throw new RuntimeException(e);
264 | }
265 | }
266 |
267 | }
268 |
--------------------------------------------------------------------------------
/src/org/json/JSONPointerException.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | /**
28 | * The JSONPointerException is thrown by {@link JSONPointer} if an error occurs
29 | * during evaluating a pointer.
30 | *
31 | * @author JSON.org
32 | * @version 2016-05-13
33 | */
34 | public class JSONPointerException extends JSONException {
35 | private static final long serialVersionUID = 8872944667561856751L;
36 |
37 | public JSONPointerException(String message) {
38 | super(message);
39 | }
40 |
41 | public JSONPointerException(String message, Throwable cause) {
42 | super(message, cause);
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/org/json/JSONString.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 | /**
3 | * The JSONString interface allows a toJSONString()
4 | * method so that a class can change the behavior of
5 | * JSONObject.toString(), JSONArray.toString(),
6 | * and JSONWriter.value(Object). The
7 | * toJSONString method will be used instead of the default behavior
8 | * of using the Object's toString() method and quoting the result.
9 | */
10 | public interface JSONString {
11 | /**
12 | * The toJSONString method allows a class to produce its own JSON
13 | * serialization.
14 | *
15 | * @return A strictly syntactically correct JSON text.
16 | */
17 | public String toJSONString();
18 | }
19 |
--------------------------------------------------------------------------------
/src/org/json/JSONStringer.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2006 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | import java.io.StringWriter;
28 |
29 | /**
30 | * JSONStringer provides a quick and convenient way of producing JSON text.
31 | * The texts produced strictly conform to JSON syntax rules. No whitespace is
32 | * added, so the results are ready for transmission or storage. Each instance of
33 | * JSONStringer can produce one JSON text.
34 | *
35 | * A JSONStringer instance provides a value method for appending
36 | * values to the
37 | * text, and a key
38 | * method for adding keys before values in objects. There are array
39 | * and endArray methods that make and bound array values, and
40 | * object and endObject methods which make and bound
41 | * object values. All of these methods return the JSONWriter instance,
42 | * permitting cascade style. For example,
51 | * The first method called must be array or object.
52 | * There are no methods for adding commas or colons. JSONStringer adds them for
53 | * you. Objects and arrays can be nested up to 20 levels deep.
54 | *
55 | * This can sometimes be easier than using a JSONObject to build a string.
56 | * @author JSON.org
57 | * @version 2015-12-09
58 | */
59 | public class JSONStringer extends JSONWriter {
60 | /**
61 | * Make a fresh JSONStringer. It can be used to build one JSON text.
62 | */
63 | public JSONStringer() {
64 | super(new StringWriter());
65 | }
66 |
67 | /**
68 | * Return the JSON text. This method is used to obtain the product of the
69 | * JSONStringer instance. It will return null if there was a
70 | * problem in the construction of the JSON text (such as the calls to
71 | * array were not properly balanced with calls to
72 | * endArray).
73 | * @return The JSON text.
74 | */
75 | public String toString() {
76 | return this.mode == 'd' ? this.writer.toString() : null;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/org/json/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2002 JSON.org
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | The Software shall be used for Good, not Evil.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/org/json/Property.java:
--------------------------------------------------------------------------------
1 | package org.json;
2 |
3 | /*
4 | Copyright (c) 2002 JSON.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | The Software shall be used for Good, not Evil.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 | */
26 |
27 | import java.util.Enumeration;
28 | import java.util.Iterator;
29 | import java.util.Properties;
30 |
31 | /**
32 | * Converts a Property file data into JSONObject and back.
33 | * @author JSON.org
34 | * @version 2015-05-05
35 | */
36 | public class Property {
37 | /**
38 | * Converts a property file object into a JSONObject. The property file object is a table of name value pairs.
39 | * @param properties java.util.Properties
40 | * @return JSONObject
41 | * @throws JSONException
42 | */
43 | public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
44 | JSONObject jo = new JSONObject();
45 | if (properties != null && !properties.isEmpty()) {
46 | Enumeration> enumProperties = properties.propertyNames();
47 | while(enumProperties.hasMoreElements()) {
48 | String name = (String)enumProperties.nextElement();
49 | jo.put(name, properties.getProperty(name));
50 | }
51 | }
52 | return jo;
53 | }
54 |
55 | /**
56 | * Converts the JSONObject into a property file object.
57 | * @param jo JSONObject
58 | * @return java.util.Properties
59 | * @throws JSONException
60 | */
61 | public static Properties toProperties(JSONObject jo) throws JSONException {
62 | Properties properties = new Properties();
63 | if (jo != null) {
64 | Iterator keys = jo.keys();
65 | while (keys.hasNext()) {
66 | String name = keys.next();
67 | properties.put(name, jo.getString(name));
68 | }
69 | }
70 | return properties;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/org/json/README:
--------------------------------------------------------------------------------
1 | JSON in Java [package org.json]
2 |
3 | JSON is a light-weight, language independent, data interchange format.
4 | See http://www.JSON.org/
5 |
6 | The files in this package implement JSON encoders/decoders in Java.
7 | It also includes the capability to convert between JSON and XML, HTTP
8 | headers, Cookies, and CDL.
9 |
10 | This is a reference implementation. There is a large number of JSON packages
11 | in Java. Perhaps someday the Java community will standardize on one. Until
12 | then, choose carefully.
13 |
14 | The license includes this restriction: "The software shall be used for good,
15 | not evil." If your conscience cannot live with that, then choose a different
16 | package.
17 |
18 | The package compiles on Java 1.6-1.8.
19 |
20 |
21 | JSONObject.java: The JSONObject can parse text from a String or a JSONTokener
22 | to produce a map-like object. The object provides methods for manipulating its
23 | contents, and for producing a JSON compliant object serialization.
24 |
25 | JSONArray.java: The JSONObject can parse text from a String or a JSONTokener
26 | to produce a vector-like object. The object provides methods for manipulating
27 | its contents, and for producing a JSON compliant array serialization.
28 |
29 | JSONTokener.java: The JSONTokener breaks a text into a sequence of individual
30 | tokens. It can be constructed from a String, Reader, or InputStream.
31 |
32 | JSONException.java: The JSONException is the standard exception type thrown
33 | by this package.
34 |
35 | JSONPointer.java: Implementation of
36 | [JSON Pointer (RFC 6901)](https://tools.ietf.org/html/rfc6901). Supports
37 | JSON Pointers both in the form of string representation and URI fragment
38 | representation.
39 |
40 | JSONString.java: The JSONString interface requires a toJSONString method,
41 | allowing an object to provide its own serialization.
42 |
43 | JSONStringer.java: The JSONStringer provides a convenient facility for
44 | building JSON strings.
45 |
46 | JSONWriter.java: The JSONWriter provides a convenient facility for building
47 | JSON text through a writer.
48 |
49 |
50 | CDL.java: CDL provides support for converting between JSON and comma
51 | delimited lists.
52 |
53 | Cookie.java: Cookie provides support for converting between JSON and cookies.
54 |
55 | CookieList.java: CookieList provides support for converting between JSON and
56 | cookie lists.
57 |
58 | HTTP.java: HTTP provides support for converting between JSON and HTTP headers.
59 |
60 | HTTPTokener.java: HTTPTokener extends JSONTokener for parsing HTTP headers.
61 |
62 | XML.java: XML provides support for converting between JSON and XML.
63 |
64 | JSONML.java: JSONML provides support for converting between JSONML and XML.
65 |
66 | XMLTokener.java: XMLTokener extends JSONTokener for parsing XML text.
67 |
68 | Unit tests are maintained in a separate project. Contributing developers can test
69 | JSON-java pull requests with the code in this project:
70 | https://github.com/stleary/JSON-Java-unit-test
71 |
72 | Numeric types in this package comply with ECMA-404: The JSON Data Interchange Format
73 | (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) and
74 | RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format
75 | (https://tools.ietf.org/html/rfc7159#section-6).
76 | This package fully supports Integer, Long, and Double Java types. Partial support
77 | for BigInteger and BigDecimal values in JSONObject and JSONArray objects is provided
78 | in the form of get(), opt(), and put() API methods.
79 |
80 | Although 1.6 compatibility is currently supported, it is not a project goal and may be
81 | removed in some future release.
82 |
83 | In compliance with RFC7159 page 10 section 9, the parser is more lax with what is valid
84 | JSON than the Generator. For Example, the tab character (U+0009) is allowed when reading
85 | JSON Text strings, but when output by the Generator, tab is properly converted to \t in
86 | the string. Other instances may occur where reading invalid JSON text does not cause an
87 | error to be generated. Malformed JSON Texts such as missing end " (quote) on strings or
88 | invalid number formats (1.2e6.3) will cause errors as such documents can not be read
89 | reliably.
90 |
91 | Release history:
92 |
93 | 20160810 Revert code that was breaking opt*() methods.
94 |
95 | 20160807 This release contains a bug in the JSONObject.opt*() and JSONArray.opt*() methods,
96 | it is not recommended for use.
97 | Java 1.6 compatability fixed, JSONArray.toList() and JSONObject.toMap(),
98 | RFC4180 compatibility, JSONPointer, some exception fixes, optional XML type conversion.
99 | Contains the latest code as of 7 Aug, 2016
100 |
101 | 20160212 Java 1.6 compatibility, OSGi bundle. Contains the latest code as of 12 Feb, 2016.
102 |
103 | 20151123 JSONObject and JSONArray initialization with generics. Contains the
104 | latest code as of 23 Nov, 2015.
105 |
106 | 20150729 Checkpoint for Maven central repository release. Contains the latest code
107 | as of 29 July, 2015.
108 |
109 | JSON-java releases can be found by searching the Maven repository for groupId "org.json"
110 | and artifactId "json". For example:
111 | https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.json%22%20AND%20a%3A%22json%22
112 |
--------------------------------------------------------------------------------
/src/osu/seclab/inputscope/main/runTest.java:
--------------------------------------------------------------------------------
1 | package osu.seclab.inputscope.main;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.HashMap;
6 | import java.util.HashSet;
7 | import java.util.Hashtable;
8 | import java.util.List;
9 |
10 | import org.jf.smali.SmaliMethodParameter;
11 | import org.json.JSONArray;
12 | import org.json.JSONObject;
13 |
14 | import osu.seclab.inputscope.stringvsa.backwardslicing.TaintRules;
15 | import osu.seclab.inputscope.stringvsa.graph.CallGraph;
16 | import osu.seclab.inputscope.stringvsa.graph.DGraph;
17 | import osu.seclab.inputscope.stringvsa.graph.IDGNode;
18 | import osu.seclab.inputscope.stringvsa.graph.ValuePoint;
19 | import osu.seclab.inputscope.stringvsa.utility.Logger;
20 | import osu.seclab.inputscope.taintanalysis.base.TaintQuestion;
21 | import osu.seclab.inputscope.taintanalysis.main.QuestionGenerator;
22 | import osu.seclab.inputscope.taintanalysis.utility.FileUtility;
23 | import osu.seclab.inputscope.taintanalysis.utility.TimeUtility;
24 | import soot.Scene;
25 | import soot.options.Options;
26 |
27 | public class runTest {
28 | public static String path;
29 | public static String pn;
30 | static Hashtable> m2m;
31 |
32 | // args[0] app package name
33 | // args[1] android.jar path
34 | public static void main(String[] args) {
35 |
36 | String fp = "";
37 | fp = args[0];
38 |
39 | // String ajar = "android.jar";
40 | String ajar = args[1];
41 | path = fp;
42 |
43 |
44 | String[] tpn = fp.split("/");
45 | pn = tpn[tpn.length - 1].substring(0, tpn[tpn.length - 1].length() - 4);
46 | System.out.println(pn);
47 |
48 | Options.v().set_src_prec(Options.src_prec_apk);
49 | Options.v().set_process_dir(Collections.singletonList(fp));
50 | Options.v().set_force_android_jar(ajar);
51 | Options.v().set_process_multiple_dex(true);
52 | Options.v().set_android_api_version(24);
53 | Options.v().set_output_format(Options.output_format_none);
54 | Options.v().set_force_overwrite(true);
55 | Options.v().set_allow_phantom_refs(true);
56 | Options.v().set_whole_program(true);
57 | Options.v().ignore_resolution_errors();
58 |
59 | Scene.v().loadNecessaryClasses();
60 | TimeUtility.startWatcherBruce(7 * 60);
61 |
62 | // Taint Analysis
63 | QuestionGenerator qg = new QuestionGenerator();
64 |
65 | HashSet init_taint_res = qg.generateInputQuestions().solveInputQuestions(false);
66 |
67 | HashSet taint_res = combineTaintRes(init_taint_res);
68 |
69 | System.out.println("\n===============Taint Analysis Result===============\n");
70 |
71 | for (String result : taint_res)
72 | System.out.println(result.toString());
73 |
74 |
75 | // String VSA
76 | CallGraph.init();
77 | System.out.println("\n===============String Value Analysis Result===============\n");
78 | HashSet strVSA_res = runStrVSA(taint_res);
79 |
80 | System.out.println("\n===============Final Result===============\n");
81 |
82 | for (String result : strVSA_res) {
83 | System.out.println(result.toString());
84 | FileUtility.wf("./" + pn, result.toString(), true);
85 | }
86 |
87 | }
88 |
89 | public static HashSet combineTaintRes(HashSet taint_res) {
90 | Hashtable cres = new Hashtable();
91 | for (String result : taint_res) {
92 | JSONObject cur_json = new JSONObject(result);
93 | String tmp_key = cur_json.getJSONObject("source").get("unit").toString();
94 | tmp_key += cur_json.getJSONObject("source").get("method").toString();
95 | tmp_key += cur_json.getJSONObject("source").get("unitIndex").toString();
96 | if (!cres.containsKey(tmp_key)) {
97 | JSONObject tmp_json = new JSONObject();
98 | tmp_json.put("sinks", cur_json.getJSONArray("sinks"));
99 | tmp_json.put("source", cur_json.getJSONObject("source"));
100 | cres.put(tmp_key, tmp_json.toString());
101 |
102 | } else {
103 | JSONObject tmp_json = new JSONObject(cres.get(tmp_key));
104 | for (Object nsink : cur_json.getJSONArray("sinks")) {
105 | boolean isHave = false;
106 | for (Object osink : tmp_json.getJSONArray("sinks")) {
107 | if (checkSinkJsonStrEquality(nsink.toString(), osink.toString())) {
108 | isHave = true;
109 | break;
110 | }
111 | }
112 | if (!isHave) {
113 | tmp_json.getJSONArray("sinks").put((JSONObject) nsink);
114 | }
115 | }
116 | cres.put(tmp_key, tmp_json.toString());
117 | }
118 | }
119 | HashSet ret_res = new HashSet();
120 | for (String tkey : cres.keySet()) {
121 | ret_res.add(cres.get(tkey).toString());
122 | }
123 | return ret_res;
124 |
125 |
126 | }
127 |
128 | public static boolean checkSinkJsonStrEquality(String jstr1, String jstr2) {
129 | JSONObject json1 = new JSONObject(jstr1);
130 | JSONObject json2 = new JSONObject(jstr2);
131 | if (!json1.getString("unit").equals(json2.getString("unit"))) {
132 | return false;
133 | } else if (!json1.getString("method").equals(json2.getString("method"))) {
134 | return false;
135 | } else if (!json1.getString("taint_var").equals(json2.getString("taint_var"))) {
136 | return false;
137 | } else if (!json1.get("unitIndex").toString().equals(json2.get("unitIndex").toString())) {
138 | return false;
139 | }
140 | return true;
141 | }
142 |
143 | public static HashSet runStrVSA(HashSet tres) {
144 | HashSet results = null;
145 | HashSet fresults = new HashSet();
146 | String tmp_smtd;
147 | String tmp_sinstr;
148 | String tmp_tvar;
149 | String tmp_rinstr;
150 |
151 | for (String result : tres) {
152 | m2m = new Hashtable>();
153 | JSONObject cur_json = new JSONObject(result);
154 | JSONArray sinks_arr = cur_json.getJSONArray("sinks");
155 | for (Object str : sinks_arr) {
156 | tmp_smtd = ((JSONObject) str).getString("method").trim();
157 | tmp_sinstr = ((JSONObject) str).getString("unit").trim();
158 | tmp_tvar = ((JSONObject) str).getString("taint_var").trim();
159 | tmp_rinstr = tmp_sinstr.replace(tmp_tvar, "taintedVariable");
160 | if (!m2m.containsKey(tmp_smtd)) {
161 | m2m.put(tmp_smtd, new Hashtable());
162 | }
163 | if (!m2m.get(tmp_smtd).contains(tmp_rinstr)) {
164 | m2m.get(tmp_smtd).put(tmp_rinstr, tmp_sinstr);
165 | }
166 | }
167 | results = vsa(m2m);
168 |
169 | for (String tmp_res : results) {
170 | JSONObject tmp_json = new JSONObject(tmp_res);
171 | tmp_json.put("source", cur_json.get("source"));
172 | fresults.add(tmp_json.toString());
173 | }
174 |
175 |
176 | }
177 |
178 | return fresults;
179 | }
180 |
181 | public static HashSet vsa(Hashtable> m2m2) {
182 |
183 | DGraph dg = new DGraph();
184 |
185 | List allvps = new ArrayList();
186 | List vps = null;
187 | JSONObject tmp;
188 |
189 | for (String tmtd : m2m2.keySet()) {
190 |
191 | vps = ValuePoint.find(dg, tmtd, m2m2.get(tmtd), 10000);
192 | for (ValuePoint vp : vps) {
193 | // vp.print();
194 | allvps.add(vp);
195 | }
196 | }
197 |
198 | dg.solve(allvps);
199 |
200 | HashSet result = new HashSet();
201 |
202 | JSONObject result_json = new JSONObject();
203 |
204 | for (IDGNode tn : dg.getNodes()) {
205 | Logger.print(tn.toString());
206 | }
207 |
208 | for (ValuePoint vp : allvps) {
209 | tmp = vp.toJson();
210 | if (tmp.has("values"))
211 | Logger.print(tmp.getJSONArray("values").toString());
212 | result_json.append("sinks", vp.toJson());
213 | }
214 | // result.put("package", pn);
215 |
216 | System.out.println(result_json.toString());
217 |
218 | if (!result.contains(result_json.toString())) {
219 | result.add(result_json.toString());
220 | }
221 |
222 |
223 | return result;
224 | }
225 |
226 | public static void saveFinalResult(HashSet taint_res, HashSet vsa_res) {
227 | JSONObject result = new JSONObject();
228 | // JSONObject tmp_result = new JSONObject();
229 | for (String tres : taint_res) {
230 | JSONObject cur_tres = new JSONObject(tres);
231 | result.put("package", pn);
232 |
233 | result.put("source", cur_tres.get("source"));
234 |
235 | }
236 | }
237 |
238 | }
239 |
--------------------------------------------------------------------------------
/src/osu/seclab/inputscope/stringvsa/backwardslicing/BackwardController.java:
--------------------------------------------------------------------------------
1 | package osu.seclab.inputscope.stringvsa.backwardslicing;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import soot.SootMethod;
7 | import osu.seclab.inputscope.stringvsa.graph.DGraph;
8 | import osu.seclab.inputscope.stringvsa.graph.ValuePoint;
9 | import osu.seclab.inputscope.stringvsa.main.Config;
10 |
11 | public class BackwardController {
12 | static BackwardController sc = new BackwardController();
13 |
14 | public static BackwardController getInstance() {
15 | return sc;
16 | }
17 |
18 | private BackwardController() {
19 |
20 | }
21 |
22 | public static void main(String[] args) {
23 | // TODO Auto-generated method stub
24 |
25 | }
26 |
27 | public List doBackWard(ValuePoint vp, DGraph dg) {
28 | List bcs = new ArrayList();
29 | bcs.add(new BackwardContext(vp, dg));
30 |
31 | long stime = System.currentTimeMillis();
32 | BackwardContext bc;
33 | while (true) {
34 |
35 | bc = null;
36 | for (BackwardContext tmp : bcs) {
37 | if (!tmp.backWardHasFinished()) {
38 | bc = tmp;
39 | break;
40 | }
41 | }
42 | if (bc == null) {
43 | break;
44 | }
45 | bcs.addAll(bc.oneStepBackWard());
46 |
47 |
48 | if (Config.BackwardContextTimeOut != -1 && System.currentTimeMillis() - stime > Config.BackwardContextTimeOut) {
49 | for (BackwardContext tmp : bcs) {
50 | tmp.finished();
51 | }
52 | }
53 | }
54 |
55 | bcs.forEach(var -> {
56 | var.printExceTrace();
57 | });
58 |
59 | return bcs;
60 |
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/osu/seclab/inputscope/stringvsa/backwardslicing/CallStackItem.java:
--------------------------------------------------------------------------------
1 | package osu.seclab.inputscope.stringvsa.backwardslicing;
2 |
3 | import soot.SootMethod;
4 | import soot.Unit;
5 | import soot.Value;
6 | import soot.toolkits.graph.Block;
7 |
8 | public class CallStackItem {
9 | SootMethod smethd;
10 | Block blcok;
11 | Unit currentInstruction;
12 | Value returnTarget;
13 |
14 | public CallStackItem(SootMethod smethd, Block blcok, Unit currentInstruction, Value returnTarget) {
15 | super();
16 | this.smethd = smethd;
17 | this.blcok = blcok;
18 | this.currentInstruction = currentInstruction;
19 | this.returnTarget = returnTarget;
20 | }
21 |
22 | public SootMethod getSmethd() {
23 | return smethd;
24 | }
25 |
26 | public void setSmethd(SootMethod smethd) {
27 | this.smethd = smethd;
28 | }
29 |
30 | public Block getBlcok() {
31 | return blcok;
32 | }
33 |
34 | public void setBlcok(Block blcok) {
35 | this.blcok = blcok;
36 | }
37 |
38 | public Unit getCurrentInstruction() {
39 | return currentInstruction;
40 | }
41 |
42 | public void setCurrentInstruction(Unit currentInstruction) {
43 | this.currentInstruction = currentInstruction;
44 | }
45 |
46 | public Value getReturnTarget(int fff) {
47 | return returnTarget;
48 | }
49 |
50 | public void setReturnTarget(Value returnTarget) {
51 | this.returnTarget = returnTarget;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/osu/seclab/inputscope/stringvsa/backwardslicing/DataSourceType.java:
--------------------------------------------------------------------------------
1 | package osu.seclab.inputscope.stringvsa.backwardslicing;
2 |
3 | public enum DataSourceType {
4 | HARDCODED_STR, HARDCODED_NUM, SYSTEM_API, DEVICES_RET, LOCALFILE, LOCALFILESql, LOCALFILEShare, UI, INTERNET_RET, NATIVE_CALL, NOCALLER, NO_HANDLED_CALL, INTENT, BUNDLE, List, crypto;
5 | }
6 |
--------------------------------------------------------------------------------
/src/osu/seclab/inputscope/stringvsa/backwardslicing/ICollecter.java:
--------------------------------------------------------------------------------
1 | package osu.seclab.inputscope.stringvsa.backwardslicing;
2 |
3 | import java.util.List;
4 |
5 | public interface ICollecter {
6 | public void clear();
7 |
8 | public void put(BackwardContext bc);
9 |
10 | public List retrieve();
11 | }
12 |
--------------------------------------------------------------------------------
/src/osu/seclab/inputscope/stringvsa/backwardslicing/TaintRules.java:
--------------------------------------------------------------------------------
1 | package osu.seclab.inputscope.stringvsa.backwardslicing;
2 |
3 | import java.io.IOException;
4 | import java.nio.file.Files;
5 | import java.nio.file.Paths;
6 | import java.util.ArrayList;
7 | import java.util.HashMap;
8 | import java.util.List;
9 |
10 | import org.json.JSONObject;
11 |
12 | public class TaintRules {
13 |
14 | static String RULE_PATH = "taintrules.json";
15 | static String RULE_TAINT_KEY = "taint";
16 | static String RULE_TAINT_BASENAME = "base";
17 | static String RULE_TAINT_ALLARGS = "args";
18 | static String RULE_TAINT_ARGS_PRE = "arg";
19 | static String RULE_TAINT_IS_SYS_API_SRC = "isSystemAPISrc";
20 |
21 | static JSONObject rules;
22 | static {
23 | String rjs = null;
24 | try {
25 | rjs = new String(Files.readAllBytes(Paths.get(RULE_PATH)));
26 | } catch (IOException e) {
27 | System.err.println("TaintRules load error!");
28 | e.printStackTrace();
29 | System.exit(0);
30 | }
31 |
32 | rules = new JSONObject(rjs);
33 | }
34 |
35 | private TaintRules() {
36 | }
37 |
38 | static TaintRules tr = new TaintRules();
39 |
40 | public static TaintRules getInstance() {
41 | return tr;
42 | }
43 |
44 | HashMap CACHEisBaseIntrested = new HashMap();
45 | HashMap> CACHEgetInterestedArgIndexes = new HashMap>();
46 |
47 | public boolean hasRuleFor(String msig) {
48 | return rules.has(msig);
49 | }
50 |
51 | public boolean isBaseIntrested(String msig) {
52 | if (CACHEisBaseIntrested.containsKey(msig)) {
53 | return CACHEisBaseIntrested.get(msig);
54 | }
55 | boolean res = rules.getJSONObject(msig).getJSONArray(RULE_TAINT_KEY).toList().contains(RULE_TAINT_BASENAME);
56 | CACHEisBaseIntrested.put(msig, res);
57 | return res;
58 | }
59 |
60 | public List getInterestedArgIndexes(String msig, int argsLen) {
61 | if (CACHEgetInterestedArgIndexes.containsKey(msig)) {
62 | return CACHEgetInterestedArgIndexes.get(msig);
63 | }
64 |
65 | List indexes = new ArrayList();
66 | List