Skip to content

Commit

Permalink
All new things for adding the reflection Logger to Redexer
Browse files Browse the repository at this point in the history
  • Loading branch information
rmega12 committed Feb 26, 2021
1 parent f4c9a83 commit aecf54e
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 0 deletions.
Binary file added data/loggingFull.dex
Binary file not shown.
7 changes: 7 additions & 0 deletions logging-interface/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
Binary file added logging-interface/classes.dex
Binary file not shown.
10 changes: 10 additions & 0 deletions logging-interface/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

JAVA_COMPILE="javac src/*.java"
echo $JAVA_COMPILE
$JAVA_COMPILE
D8_CONVERT="d8 --release --no-desugaring src/*.class"
echo $D8_CONVERT
$D8_CONVERT
cp classes.dex ../data/logging.dex.fakeTemp
rm src/*.class
41 changes: 41 additions & 0 deletions logging-interface/src/LoggerI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Copyright (c) 2010-2014,
* Jinseong Jeon <jsjeon@cs.umd.edu>
* Kris Micinski <micinski@cs.umd.edu>
* Jeff Foster <jfoster@cs.umd.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The names of the contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.umd.logging;

public interface LoggerI {
public void logBasicBlockEntry(int arg);
public void logMethodEntry(String cname, String mname, Object[] args);
public void logMethodExit(String cname, String mname, Object[] args);
public void logAPIEntry(String cname, String mname, Object[] args);
public void logAPIExit(String cname, String mname, Object[] args);
}
50 changes: 50 additions & 0 deletions logging-interface/src/LoggerShim.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* Copyright (c) 2010-2014,
* Jinseong Jeon <jsjeon@cs.umd.edu>
* Kris Micinski <micinski@cs.umd.edu>
* Jeff Foster <jfoster@cs.umd.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The names of the contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.umd.logging;

import java.lang.reflect.Constructor;

public class LoggerShim {
public static LoggerI theLogger;

static {
try {
Class<?> c = Class.forName("org.umd.logging.Logger");
Constructor<?> cons = c.getConstructor();
theLogger = (LoggerI) cons.newInstance();
} catch (Exception e) {
System.err.println("Exception raised when 'instantiating' LoggerShim. Probably means " +
"that the Logger class couldn't be found.");
}
}
}
10 changes: 10 additions & 0 deletions logging/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Notes on building logging.dex and loggingFull.dex:

- Installing Android Studio will get all the build tools needed to build both of these tools using
the associated scripts.
- If installing Android Studio is not an option, the android command line tools can be installed
at [INSERT LINK]. The gradle binary can be found here [INSERT LINK]. Gradle will handle the install
of the needed build tools when you run build_and_copy.sh for the first time, once you have set your
ANDROID_SDK_ROOT environment variable to [something relative to where you installed the command
line tools]. Once gradle has installed those build tools, make.sh in the logging-interface
directory will also have all dependencies installed.
41 changes: 41 additions & 0 deletions logging/app/src/main/java/org/umd/logging/LoggerI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Copyright (c) 2010-2014,
* Jinseong Jeon <jsjeon@cs.umd.edu>
* Kris Micinski <micinski@cs.umd.edu>
* Jeff Foster <jfoster@cs.umd.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The names of the contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.umd.logging;

public interface LoggerI {
public void logBasicBlockEntry(int arg);
public void logMethodEntry(String cname, String mname, Object[] args);
public void logMethodExit(String cname, String mname, Object[] args);
public void logAPIEntry(String cname, String mname, Object[] args);
public void logAPIExit(String cname, String mname, Object[] args);
}

0 comments on commit aecf54e

Please sign in to comment.