├── LICENSE ├── README.md ├── images └── AndroidSlicer.png ├── source └── AndroidSlicer │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.ui.prefs │ ├── AndroidCallbacks.txt │ ├── bin │ └── org │ │ └── ucr │ │ └── ds │ │ ├── cd │ │ ├── core │ │ │ ├── BB.class │ │ │ ├── CFG.class │ │ │ ├── ControlDependence$ControlDependanceStack.class │ │ │ ├── ControlDependence.class │ │ │ ├── Input.class │ │ │ ├── Instruction.class │ │ │ ├── InstructionUnits.class │ │ │ ├── MethodResult.class │ │ │ ├── PC.class │ │ │ ├── Slicer.class │ │ │ ├── ThreadManagement.class │ │ │ ├── Traces.class │ │ │ └── UnitMethod.class │ │ └── utilities │ │ │ ├── Constants.class │ │ │ ├── Instrumenter$1$1.class │ │ │ ├── Instrumenter$1.class │ │ │ ├── Instrumenter$TYPE.class │ │ │ ├── Instrumenter$ThreadRunner.class │ │ │ ├── Instrumenter.class │ │ │ ├── Parser.class │ │ │ ├── TestInside.class │ │ │ └── TimerManager.class │ │ ├── core │ │ ├── BB.class │ │ ├── CFG.class │ │ ├── ControlDependence.class │ │ ├── Instruction.class │ │ ├── PC.class │ │ └── ThreadManagement.class │ │ ├── parser │ │ └── Parser.class │ │ └── utilities │ │ ├── Constants.class │ │ ├── DexUtilities.class │ │ └── TimerManager.class │ ├── libs │ ├── AXMLPrinter2.jar │ ├── AndroidCallbacks.txt │ ├── Constants.class │ ├── Constants.java │ ├── TestInside.class │ ├── TestInside.java │ ├── axml-2.0.jar │ ├── commons-io-2.5.jar │ ├── junit.jar │ ├── org.hamcrest.core_1.3.0.jar │ ├── run.sh │ ├── soot-infoflow-android.jar │ ├── soot-infoflow.jar │ ├── soot-trunk.jar │ ├── sootclasses.jar │ ├── sootclasses.jar.new │ ├── sootclasses.jar.old │ └── xmlpull_1_0_5.jar │ └── src │ └── org │ └── ucr │ └── ds │ ├── cd │ ├── core │ │ ├── BB.java │ │ ├── CFG.java │ │ ├── ControlDependence.java │ │ ├── Input.java │ │ ├── Instruction.java │ │ ├── InstructionUnits.java │ │ ├── MethodResult.java │ │ ├── PC.java │ │ ├── Slicer.java │ │ ├── ThreadManagement.java │ │ ├── Traces.java │ │ └── UnitMethod.java │ └── utilities │ │ ├── Constants.java │ │ ├── Instrumenter.java │ │ ├── Parser.java │ │ ├── TestInside.java │ │ └── TimerManager.java │ ├── core │ ├── BB.java │ ├── CFG.java │ ├── ControlDependence.java │ ├── Instruction.java │ ├── PC.java │ └── ThreadManagement.java │ ├── parser │ └── Parser.java │ └── utilities │ ├── Constants.java │ ├── DexUtilities.java │ └── TimerManager.java └── tool ├── AndroidCallbacks.txt ├── AndroidSlicer.jar ├── AndroidSlicer.sh ├── Instrumenter.java ├── SourcesAndSinks.txt ├── commons-io-2.5.jar ├── instrumenter.sh ├── preSlicer.jar ├── preSlicer.sh ├── signapk.jar ├── soot-infoflow-android.jar ├── soot-infoflow.jar ├── soot-trunk.jar ├── sootclasses-trunk-jar-with-dependencies.jar ├── testkey.pk8 └── testkey.x509.pem /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 2 | Tanzirul Azim 3 | Arash Alavi 4 | Iulian Neamtiu 5 | Rajiv Gupta 6 | 7 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 10 | 11 | 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. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 14 | 15 | 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 HOLDER 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. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # AndroidSlicer 5 | AndroidSlicer is a dynamic slicing tool for Android Apps, useful for a variety of tasks, from testing to debugging to security. 6 | 7 | # Paper 8 | [Dynamic Slicing for Android](https://dl.acm.org/citation.cfm?id=3339649) 9 | 10 | Tanzirul Azim, Arash Alavi, Iulian Neamtiu, Rajiv Gupta. 11 | 12 | 41st International Conference on Software Engineering (ICSE'19), May 2019. 13 | 14 | # Usage 15 | AndroidSlicer is in Java. You can find the source code under the "source" directory and the required scripts for running the tool under the "tool" directory. 16 | 17 | 1. After cloning/extracting the tool directory in a folder (e.g., ~/AndroidSlicer/tool), you just need to change the ***PLATFORDIRFORSLICER*** parameter in 3 **instrumenter.sh**, **preSlicer.sh**, and **AndroidSlicer.sh** script files. ***PLATFORDIRFORSLICER*** is the path of your android sdk/platforms folder. 18 | 19 | 2. Copy the app apk file that you want to do the slicing into the tool directory (i.e., ~/AndroidSlicer/tool/). 20 | 21 | 3. Make sure that either your emulator is running or the phone is connected and accessible via adb. Then run the instrumenter script for the app using the following command: 22 | 23 | > **./instrumenter.sh ** 24 | 25 | > [E.g., ./instrumenter.sh com.myapp.apk] 26 | 27 | This will instrument the app, sign the instrumented apk file, and install the app on your emulator/real phone. 28 | 29 | P.S. In order to instrument (or not instrument) specific classes of the app, you can uncomment line number 175 in *Instrumenter.java* and specify the specific classes that you want (or don't want) to be instrumented. Please note that it can potentially lead to missing dependencies, unless you are certain you won't miss dependencies by filtering out those classes. 30 | 31 | 4. Run the following commands and then run the app on your emulator/real phone: 32 | 33 | >**adb logcat -c** 34 | 35 | >**adb logcat | grep SLICING > .logcat.txt** 36 | 37 | >[E.g., adb logcat | grep SLICING > com.myapp.apk.logcat.txt] 38 | 39 | After you finish with running the app, stop the above command. This will collect the required log file for AndroidSlicer. 40 | 41 | 5. Run the preSlicer script for the app: 42 | 43 | >**./preSlicer.sh ** 44 | 45 | >[E.g., ./preSlicer.sh com.myapp.apk] 46 | 47 | This will create a .logcat.processed.txt file. Each line starts with a number. You need to pick a number (your interesting point as the slicing criteria) to add to the next command. 48 | 49 | 6. Run the AndroidsSlicer script for the app and then enter the number that you picked from previous step: 50 | 51 | >**./AndroidsSlicer.sh ** 52 | 53 | >[E.g., ./AndroidsSlicer.sh com.myapp.apk] 54 | 55 | Finally, you will have the slices files wrt your slicing criteria 56 | 57 | 58 | # Contacts 59 | 60 | If you have questions, please contact Arash Alavi: [aalav003@ucr.edu](aalav003@ucr.edu) or Tanzirul Azim: [tanzir.buet@gmail.com](tanzir.buet@gmail.com). 61 | -------------------------------------------------------------------------------- /images/AndroidSlicer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/images/AndroidSlicer.png -------------------------------------------------------------------------------- /source/AndroidSlicer/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/AndroidSlicer/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AndroidSlicer 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 | -------------------------------------------------------------------------------- /source/AndroidSlicer/.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.ui.javadoc=false 3 | org.eclipse.jdt.ui.text.custom_code_templates= 4 | -------------------------------------------------------------------------------- /source/AndroidSlicer/AndroidCallbacks.txt: -------------------------------------------------------------------------------- 1 | android.accounts.OnAccountsUpdateListener 2 | android.animation.Animator$AnimatorListener 3 | android.animation.LayoutTransition$TransitionListener 4 | android.animation.TimeAnimator$TimeListener 5 | android.animation.ValueAnimator$AnimatorUpdateListener 6 | android.app.ActionBar$OnMenuVisibilityListener 7 | android.app.ActionBar$OnNavigationListener 8 | android.app.ActionBar$TabListener 9 | android.app.Application$ActivityLifecycleCallbacks 10 | android.app.DatePickerDialog$OnDateSetListener 11 | android.app.FragmentBreadCrumbs$OnBreadCrumbClickListener 12 | android.app.FragmentManager$OnBackStackChangedListener 13 | android.app.KeyguardManager$OnKeyguardExitResult 14 | android.app.LoaderManager$LoaderCallbacks 15 | android.app.PendingIntent$OnFinished 16 | android.app.SearchManager$OnCancelListener 17 | android.app.SearchManager$OnDismissListener 18 | android.app.TimePickerDialog$OnTimeSetListener 19 | android.bluetooth.BluetoothProfile$ServiceListener 20 | android.content.ClipboardManager$OnPrimaryClipChangedListener 21 | android.content.ComponentCallbacks 22 | android.content.ComponentCallbacks2 23 | android.content.DialogInterface$OnCancelListener 24 | android.content.DialogInterface$OnClickListener 25 | android.content.DialogInterface$OnDismissListener 26 | android.content.DialogInterface$OnKeyListener 27 | android.content.DialogInterface$OnMultiChoiceClickListener 28 | android.content.DialogInterface$OnShowListener 29 | android.content.IntentSender$OnFinished 30 | android.content.Loader$OnLoadCanceledListener 31 | android.content.Loader$OnLoadCompleteListener 32 | android.content.SharedPreferences$OnSharedPreferenceChangeListener 33 | android.content.SyncStatusObserver 34 | android.database.sqlite.SQLiteTransactionListener 35 | android.drm.DrmManagerClient$OnErrorListener 36 | android.drm.DrmManagerClient$OnEventListener 37 | android.drm.DrmManagerClient$OnInfoListener 38 | android.gesture.GestureOverlayView$OnGestureListener 39 | android.gesture.GestureOverlayView$OnGesturePerformedListener 40 | android.gesture.GestureOverlayView$OnGesturingListener 41 | android.graphics.SurfaceTexture$OnFrameAvailableListener 42 | android.hardware.Camera$AutoFocusCallback 43 | android.hardware.Camera$AutoFocusMoveCallback 44 | android.hardware.Camera$ErrorCallback 45 | android.hardware.Camera$FaceDetectionListener 46 | android.hardware.Camera$OnZoomChangeListener 47 | android.hardware.Camera$PictureCallback 48 | android.hardware.Camera$PreviewCallback 49 | android.hardware.Camera$ShutterCallback 50 | android.hardware.SensorEventListener 51 | android.hardware.display.DisplayManager$DisplayListener 52 | android.hardware.input.InputManager$InputDeviceListener 53 | android.inputmethodservice.KeyboardView$OnKeyboardActionListener 54 | android.location.GpsStatus$Listener 55 | android.location.GpsStatus$NmeaListener 56 | android.location.LocationListener 57 | android.media.AudioManager$OnAudioFocusChangeListener 58 | android.media.AudioRecord$OnRecordPositionUpdateListener 59 | android.media.JetPlayer$OnJetEventListener 60 | android.media.MediaPlayer$OnBufferingUpdateListener 61 | android.media.MediaPlayer$OnCompletionListener 62 | android.media.MediaPlayer$OnErrorListener 63 | android.media.MediaPlayer$OnInfoListener 64 | android.media.MediaPlayer$OnPreparedListener 65 | android.media.MediaPlayer$OnSeekCompleteListener 66 | android.media.MediaPlayer$OnTimedTextListener 67 | android.media.MediaPlayer$OnVideoSizeChangedListener 68 | android.media.MediaRecorder$OnErrorListener 69 | android.media.MediaRecorder$OnInfoListener 70 | android.media.MediaScannerConnection$MediaScannerConnectionClient 71 | android.media.MediaScannerConnection$OnScanCompletedListener 72 | android.media.SoundPool$OnLoadCompleteListener 73 | android.media.audiofx.AudioEffect$OnControlStatusChangeListener 74 | android.media.audiofx.AudioEffect$OnEnableStatusChangeListener 75 | android.media.audiofx.BassBoost$OnParameterChangeListener 76 | android.media.audiofx.EnvironmentalReverb$OnParameterChangeListener 77 | android.media.audiofx.Equalizer$OnParameterChangeListener 78 | android.media.audiofx.PresetReverb$OnParameterChangeListener 79 | android.media.audiofx.Virtualizer$OnParameterChangeListener 80 | android.media.audiofx.Visualizer$OnDataCaptureListener 81 | android.media.effect$EffectUpdateListener 82 | android.net.nsd.NsdManager$DiscoveryListener 83 | android.net.nsd.NsdManager$RegistrationListener 84 | android.net.nsd.NsdManager$ResolveListener 85 | android.net.sip.SipRegistrationListener 86 | android.net.wifi.p2p.WifiP2pManager$ActionListener 87 | android.net.wifi.p2p.WifiP2pManager$ChannelListener 88 | android.net.wifi.p2p.WifiP2pManager$ConnectionInfoListener 89 | android.net.wifi.p2p.WifiP2pManager$DnsSdServiceResponseListener 90 | android.net.wifi.p2p.WifiP2pManager$DnsSdTxtRecordListener 91 | android.net.wifi.p2p.WifiP2pManager$GroupInfoListener 92 | android.net.wifi.p2p.WifiP2pManager$PeerListListener 93 | android.net.wifi.p2p.WifiP2pManager$ServiceResponseListener 94 | android.net.wifi.p2p.WifiP2pManager$UpnpServiceResponseListener 95 | android.os.CancellationSignal$OnCancelListener 96 | android.os.IBinder$DeathRecipient 97 | android.os.MessageQueue$IdleHandler 98 | android.os.RecoverySystem$ProgressListener 99 | android.preference.Preference$OnPreferenceChangeListener 100 | android.preference.Preference$OnPreferenceClickListener 101 | android.preference.PreferenceFragment$OnPreferenceStartFragmentCallback 102 | android.preference.PreferenceManager$OnActivityDestroyListener 103 | android.preference.PreferenceManager$OnActivityResultListener 104 | android.preference.PreferenceManager$OnActivityStopListener 105 | android.security.KeyChainAliasCallback 106 | android.speech.RecognitionListener 107 | android.speech.tts.TextToSpeech$OnInitListener 108 | android.speech.tts.TextToSpeech$OnUtteranceCompletedListener 109 | android.view.ActionMode$Callback 110 | android.view.ActionProvider$VisibilityListener 111 | android.view.GestureDetector$OnDoubleTapListener 112 | android.view.GestureDetector$OnGestureListener 113 | android.view.InputQueue$Callback 114 | android.view.KeyEvent$Callback 115 | android.view.MenuItem$OnActionExpandListener 116 | android.view.MenuItem$OnMenuItemClickListener 117 | android.view.ScaleGestureDetector$OnScaleGestureListener 118 | android.view.SurfaceHolder$Callback 119 | android.view.SurfaceHolder$Callback2 120 | android.view.TextureView$SurfaceTextureListener 121 | android.view.View$OnAttachStateChangeListener 122 | android.view.View$OnClickListener 123 | android.view.View$OnCreateContextMenuListener 124 | android.view.View$OnDragListener 125 | android.view.View$OnFocusChangeListener 126 | android.view.View$OnGenericMotionListener 127 | android.view.View$OnHoverListener 128 | android.view.View$OnKeyListener 129 | android.view.View$OnLayoutChangeListener 130 | android.view.View$OnLongClickListener 131 | android.view.View$OnSystemUiVisibilityChangeListener� 132 | android.view.View$OnTouchListener 133 | android.view.ViewGroup$OnHierarchyChangeListener 134 | android.view.ViewStub$OnInflateListener 135 | android.view.ViewTreeObserver$OnDrawListener 136 | android.view.ViewTreeObserver$OnGlobalFocusChangeListener 137 | android.view.ViewTreeObserver$OnGlobalLayoutListener 138 | android.view.ViewTreeObserver$OnPreDrawListener 139 | android.view.ViewTreeObserver$OnScrollChangedListener 140 | android.view.ViewTreeObserver$OnTouchModeChangeListener 141 | android.view.accessibility.AccessibilityManager$AccessibilityStateChangeListener 142 | android.view.animation.Animation$AnimationListener 143 | android.view.inputmethod.InputMethod$SessionCallback 144 | android.view.inputmethod.InputMethodSession$EventCallback 145 | android.view.textservice.SpellCheckerSession$SpellCheckerSessionListener 146 | android.webkit.DownloadListener 147 | android.widget.AbsListView$MultiChoiceModeListener 148 | android.widget.AbsListView$OnScrollListener 149 | android.widget.AbsListView$RecyclerListener 150 | android.widget.AdapterView$OnItemClickListener 151 | android.widget.AdapterView$OnItemLongClickListener 152 | android.widget.AdapterView.OnItemSelectedListener 153 | android.widget.AutoCompleteTextView$OnDismissListener 154 | android.widget.CalendarView$OnDateChangeListener 155 | android.widget.Chronometer$OnChronometerTickListener 156 | android.widget.CompoundButton$OnCheckedChangeListener 157 | android.widget.DatePicker$OnDateChangedListener 158 | android.widget.ExpandableListView$OnChildClickListener 159 | android.widget.ExpandableListView$OnGroupClickListener 160 | android.widget.ExpandableListView$OnGroupCollapseListener 161 | android.widget.ExpandableListView$OnGroupExpandListener 162 | android.widget.Filter$FilterListener 163 | android.widget.NumberPicker$OnScrollListener 164 | android.widget.NumberPicker$OnValueChangeListener 165 | android.widget.NumberPicker$OnDismissListener 166 | android.widget.PopupMenu$OnMenuItemClickListener 167 | android.widget.PopupWindow$OnDismissListener 168 | android.widget.RadioGroup$OnCheckedChangeListener 169 | android.widget.RatingBar$OnRatingBarChangeListener 170 | android.widget.SearchView$OnCloseListener 171 | android.widget.SearchView$OnQueryTextListener 172 | android.widget.SearchView$OnSuggestionListener 173 | android.widget.SeekBar$OnSeekBarChangeListener 174 | android.widget.ShareActionProvider$OnShareTargetSelectedListener 175 | android.widget.SlidingDrawer$OnDrawerCloseListener 176 | android.widget.SlidingDrawer$OnDrawerOpenListener 177 | android.widget.SlidingDrawer$OnDrawerScrollListener 178 | android.widget.TabHost$OnTabChangeListener 179 | android.widget.TextView$OnEditorActionListener 180 | android.widget.TimePicker$OnTimeChangedListener 181 | android.widget.ZoomButtonsController$OnZoomListener 182 | -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/BB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/BB.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/CFG.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/CFG.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/ControlDependence$ControlDependanceStack.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/ControlDependence$ControlDependanceStack.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/ControlDependence.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/ControlDependence.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/Input.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/Input.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/Instruction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/Instruction.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/InstructionUnits.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/InstructionUnits.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/MethodResult.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/MethodResult.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/PC.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/PC.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/Slicer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/Slicer.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/ThreadManagement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/ThreadManagement.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/Traces.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/Traces.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/core/UnitMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/core/UnitMethod.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Constants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Constants.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$1$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$1$1.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$1.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$TYPE.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$TYPE.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$ThreadRunner.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter$ThreadRunner.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Instrumenter.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Parser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/Parser.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/TestInside.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/TestInside.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/TimerManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/cd/utilities/TimerManager.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/core/BB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/core/BB.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/core/CFG.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/core/CFG.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/core/ControlDependence.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/core/ControlDependence.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/core/Instruction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/core/Instruction.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/core/PC.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/core/PC.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/core/ThreadManagement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/core/ThreadManagement.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/parser/Parser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/parser/Parser.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/utilities/Constants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/utilities/Constants.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/utilities/DexUtilities.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/utilities/DexUtilities.class -------------------------------------------------------------------------------- /source/AndroidSlicer/bin/org/ucr/ds/utilities/TimerManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/bin/org/ucr/ds/utilities/TimerManager.class -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/AXMLPrinter2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/AXMLPrinter2.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/AndroidCallbacks.txt: -------------------------------------------------------------------------------- 1 | android.accounts.OnAccountsUpdateListener 2 | android.animation.Animator$AnimatorListener 3 | android.animation.LayoutTransition$TransitionListener 4 | android.animation.TimeAnimator$TimeListener 5 | android.animation.ValueAnimator$AnimatorUpdateListener 6 | android.app.ActionBar$OnMenuVisibilityListener 7 | android.app.ActionBar$OnNavigationListener 8 | android.app.ActionBar$TabListener 9 | android.app.Application$ActivityLifecycleCallbacks 10 | android.app.DatePickerDialog$OnDateSetListener 11 | android.app.FragmentBreadCrumbs$OnBreadCrumbClickListener 12 | android.app.FragmentManager$OnBackStackChangedListener 13 | android.app.KeyguardManager$OnKeyguardExitResult 14 | android.app.LoaderManager$LoaderCallbacks 15 | android.app.PendingIntent$OnFinished 16 | android.app.SearchManager$OnCancelListener 17 | android.app.SearchManager$OnDismissListener 18 | android.app.TimePickerDialog$OnTimeSetListener 19 | android.bluetooth.BluetoothProfile$ServiceListener 20 | android.content.ClipboardManager$OnPrimaryClipChangedListener 21 | android.content.ComponentCallbacks 22 | android.content.ComponentCallbacks2 23 | android.content.DialogInterface$OnCancelListener 24 | android.content.DialogInterface$OnClickListener 25 | android.content.DialogInterface$OnDismissListener 26 | android.content.DialogInterface$OnKeyListener 27 | android.content.DialogInterface$OnMultiChoiceClickListener 28 | android.content.DialogInterface$OnShowListener 29 | android.content.IntentSender$OnFinished 30 | android.content.Loader$OnLoadCanceledListener 31 | android.content.Loader$OnLoadCompleteListener 32 | android.content.SharedPreferences$OnSharedPreferenceChangeListener 33 | android.content.SyncStatusObserver 34 | android.database.sqlite.SQLiteTransactionListener 35 | android.drm.DrmManagerClient$OnErrorListener 36 | android.drm.DrmManagerClient$OnEventListener 37 | android.drm.DrmManagerClient$OnInfoListener 38 | android.gesture.GestureOverlayView$OnGestureListener 39 | android.gesture.GestureOverlayView$OnGesturePerformedListener 40 | android.gesture.GestureOverlayView$OnGesturingListener 41 | android.graphics.SurfaceTexture$OnFrameAvailableListener 42 | android.hardware.Camera$AutoFocusCallback 43 | android.hardware.Camera$AutoFocusMoveCallback 44 | android.hardware.Camera$ErrorCallback 45 | android.hardware.Camera$FaceDetectionListener 46 | android.hardware.Camera$OnZoomChangeListener 47 | android.hardware.Camera$PictureCallback 48 | android.hardware.Camera$PreviewCallback 49 | android.hardware.Camera$ShutterCallback 50 | android.hardware.SensorEventListener 51 | android.hardware.display.DisplayManager$DisplayListener 52 | android.hardware.input.InputManager$InputDeviceListener 53 | android.inputmethodservice.KeyboardView$OnKeyboardActionListener 54 | android.location.GpsStatus$Listener 55 | android.location.GpsStatus$NmeaListener 56 | android.location.LocationListener 57 | android.media.AudioManager$OnAudioFocusChangeListener 58 | android.media.AudioRecord$OnRecordPositionUpdateListener 59 | android.media.JetPlayer$OnJetEventListener 60 | android.media.MediaPlayer$OnBufferingUpdateListener 61 | android.media.MediaPlayer$OnCompletionListener 62 | android.media.MediaPlayer$OnErrorListener 63 | android.media.MediaPlayer$OnInfoListener 64 | android.media.MediaPlayer$OnPreparedListener 65 | android.media.MediaPlayer$OnSeekCompleteListener 66 | android.media.MediaPlayer$OnTimedTextListener 67 | android.media.MediaPlayer$OnVideoSizeChangedListener 68 | android.media.MediaRecorder$OnErrorListener 69 | android.media.MediaRecorder$OnInfoListener 70 | android.media.MediaScannerConnection$MediaScannerConnectionClient 71 | android.media.MediaScannerConnection$OnScanCompletedListener 72 | android.media.SoundPool$OnLoadCompleteListener 73 | android.media.audiofx.AudioEffect$OnControlStatusChangeListener 74 | android.media.audiofx.AudioEffect$OnEnableStatusChangeListener 75 | android.media.audiofx.BassBoost$OnParameterChangeListener 76 | android.media.audiofx.EnvironmentalReverb$OnParameterChangeListener 77 | android.media.audiofx.Equalizer$OnParameterChangeListener 78 | android.media.audiofx.PresetReverb$OnParameterChangeListener 79 | android.media.audiofx.Virtualizer$OnParameterChangeListener 80 | android.media.audiofx.Visualizer$OnDataCaptureListener 81 | android.media.effect$EffectUpdateListener 82 | android.net.nsd.NsdManager$DiscoveryListener 83 | android.net.nsd.NsdManager$RegistrationListener 84 | android.net.nsd.NsdManager$ResolveListener 85 | android.net.sip.SipRegistrationListener 86 | android.net.wifi.p2p.WifiP2pManager$ActionListener 87 | android.net.wifi.p2p.WifiP2pManager$ChannelListener 88 | android.net.wifi.p2p.WifiP2pManager$ConnectionInfoListener 89 | android.net.wifi.p2p.WifiP2pManager$DnsSdServiceResponseListener 90 | android.net.wifi.p2p.WifiP2pManager$DnsSdTxtRecordListener 91 | android.net.wifi.p2p.WifiP2pManager$GroupInfoListener 92 | android.net.wifi.p2p.WifiP2pManager$PeerListListener 93 | android.net.wifi.p2p.WifiP2pManager$ServiceResponseListener 94 | android.net.wifi.p2p.WifiP2pManager$UpnpServiceResponseListener 95 | android.os.CancellationSignal$OnCancelListener 96 | android.os.IBinder$DeathRecipient 97 | android.os.MessageQueue$IdleHandler 98 | android.os.RecoverySystem$ProgressListener 99 | android.preference.Preference$OnPreferenceChangeListener 100 | android.preference.Preference$OnPreferenceClickListener 101 | android.preference.PreferenceFragment$OnPreferenceStartFragmentCallback 102 | android.preference.PreferenceManager$OnActivityDestroyListener 103 | android.preference.PreferenceManager$OnActivityResultListener 104 | android.preference.PreferenceManager$OnActivityStopListener 105 | android.security.KeyChainAliasCallback 106 | android.speech.RecognitionListener 107 | android.speech.tts.TextToSpeech$OnInitListener 108 | android.speech.tts.TextToSpeech$OnUtteranceCompletedListener 109 | android.view.ActionMode$Callback 110 | android.view.ActionProvider$VisibilityListener 111 | android.view.GestureDetector$OnDoubleTapListener 112 | android.view.GestureDetector$OnGestureListener 113 | android.view.InputQueue$Callback 114 | android.view.KeyEvent$Callback 115 | android.view.MenuItem$OnActionExpandListener 116 | android.view.MenuItem$OnMenuItemClickListener 117 | android.view.ScaleGestureDetector$OnScaleGestureListener 118 | android.view.SurfaceHolder$Callback 119 | android.view.SurfaceHolder$Callback2 120 | android.view.TextureView$SurfaceTextureListener 121 | android.view.View$OnAttachStateChangeListener 122 | android.view.View$OnClickListener 123 | android.view.View$OnCreateContextMenuListener 124 | android.view.View$OnDragListener 125 | android.view.View$OnFocusChangeListener 126 | android.view.View$OnGenericMotionListener 127 | android.view.View$OnHoverListener 128 | android.view.View$OnKeyListener 129 | android.view.View$OnLayoutChangeListener 130 | android.view.View$OnLongClickListener 131 | android.view.View$OnSystemUiVisibilityChangeListener� 132 | android.view.View$OnTouchListener 133 | android.view.ViewGroup$OnHierarchyChangeListener 134 | android.view.ViewStub$OnInflateListener 135 | android.view.ViewTreeObserver$OnDrawListener 136 | android.view.ViewTreeObserver$OnGlobalFocusChangeListener 137 | android.view.ViewTreeObserver$OnGlobalLayoutListener 138 | android.view.ViewTreeObserver$OnPreDrawListener 139 | android.view.ViewTreeObserver$OnScrollChangedListener 140 | android.view.ViewTreeObserver$OnTouchModeChangeListener 141 | android.view.accessibility.AccessibilityManager$AccessibilityStateChangeListener 142 | android.view.animation.Animation$AnimationListener 143 | android.view.inputmethod.InputMethod$SessionCallback 144 | android.view.inputmethod.InputMethodSession$EventCallback 145 | android.view.textservice.SpellCheckerSession$SpellCheckerSessionListener 146 | android.webkit.DownloadListener 147 | android.widget.AbsListView$MultiChoiceModeListener 148 | android.widget.AbsListView$OnScrollListener 149 | android.widget.AbsListView$RecyclerListener 150 | android.widget.AdapterView$OnItemClickListener 151 | android.widget.AdapterView$OnItemLongClickListener 152 | android.widget.AdapterView.OnItemSelectedListener 153 | android.widget.AutoCompleteTextView$OnDismissListener 154 | android.widget.CalendarView$OnDateChangeListener 155 | android.widget.Chronometer$OnChronometerTickListener 156 | android.widget.CompoundButton$OnCheckedChangeListener 157 | android.widget.DatePicker$OnDateChangedListener 158 | android.widget.ExpandableListView$OnChildClickListener 159 | android.widget.ExpandableListView$OnGroupClickListener 160 | android.widget.ExpandableListView$OnGroupCollapseListener 161 | android.widget.ExpandableListView$OnGroupExpandListener 162 | android.widget.Filter$FilterListener 163 | android.widget.NumberPicker$OnScrollListener 164 | android.widget.NumberPicker$OnValueChangeListener 165 | android.widget.NumberPicker$OnDismissListener 166 | android.widget.PopupMenu$OnMenuItemClickListener 167 | android.widget.PopupWindow$OnDismissListener 168 | android.widget.RadioGroup$OnCheckedChangeListener 169 | android.widget.RatingBar$OnRatingBarChangeListener 170 | android.widget.SearchView$OnCloseListener 171 | android.widget.SearchView$OnQueryTextListener 172 | android.widget.SearchView$OnSuggestionListener 173 | android.widget.SeekBar$OnSeekBarChangeListener 174 | android.widget.ShareActionProvider$OnShareTargetSelectedListener 175 | android.widget.SlidingDrawer$OnDrawerCloseListener 176 | android.widget.SlidingDrawer$OnDrawerOpenListener 177 | android.widget.SlidingDrawer$OnDrawerScrollListener 178 | android.widget.TabHost$OnTabChangeListener 179 | android.widget.TextView$OnEditorActionListener 180 | android.widget.TimePicker$OnTimeChangedListener 181 | android.widget.ZoomButtonsController$OnZoomListener 182 | -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/Constants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/Constants.class -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/Constants.java: -------------------------------------------------------------------------------- 1 | 2 | public class Constants { 3 | 4 | public static final String PLATFORM_PATH ="/Users/tanzirulazim/Dropbox/PhD/phd_data/tools/android_sdk/android-sdk-macosx/platforms/"; 5 | public static final String SOURCE_SINK_PATH ="/Users/tanzirulazim/Dropbox/PhD/DynamicSlicing/svns/android_slicing/code/android_slicing_dalvik/static_analysis_dd/SourcesAndSinks.txt"; 6 | public static final String APK_PATH = "/Users/tanzirulazim/Dropbox/PhD/AutoExplorer/data/ApkBackup/original/Dictionary-4.apk"; 7 | } -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/TestInside.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/TestInside.class -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/TestInside.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | import java.util.Collections; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | 10 | import org.xmlpull.v1.XmlPullParserException; 11 | 12 | import soot.*; 13 | import soot.jimple.infoflow.android.SetupApplication; 14 | import soot.jimple.toolkits.callgraph.CallGraph; 15 | import soot.options.Options; 16 | import soot.toolkits.graph.ExceptionalUnitGraph; 17 | import soot.util.Chain; 18 | 19 | //import oracle.jrockit.jfr.Options; 20 | 21 | public class TestInside { 22 | 23 | //@SuppressWarnings("deprecation") 24 | public static void main(String[] args) { 25 | // TODO Auto-generated method stub 26 | 27 | SetupApplication app = new SetupApplication(Constants.PLATFORM_PATH, Constants.APK_PATH); 28 | try { 29 | 30 | app.calculateSourcesSinksEntrypoints(Constants.SOURCE_SINK_PATH); 31 | 32 | } catch (IOException e) { 33 | 34 | // TODO Auto-generated catch block 35 | 36 | e.printStackTrace(); 37 | 38 | } catch (XmlPullParserException e) { 39 | 40 | // TODO Auto-generated catch block 41 | 42 | e.printStackTrace(); 43 | 44 | } 45 | soot.G.reset(); 46 | Options.v().set_keep_line_number(true); 47 | 48 | 49 | Options.v().set_src_prec(Options.src_prec_apk); 50 | 51 | Options.v().set_process_dir(Collections.singletonList(Constants.APK_PATH)); 52 | 53 | 54 | Options.v().set_android_jars(Constants.PLATFORM_PATH); 55 | 56 | Options.v().set_whole_program(true); 57 | 58 | Options.v().set_allow_phantom_refs(true); 59 | 60 | Options.v().set_keep_line_number(true); 61 | Options.v().set_allow_phantom_refs(true); 62 | List list = new ArrayList<>(); 63 | list.add(Constants.APK_PATH); 64 | Options.v().set_process_dir(Collections.singletonList(Constants.APK_PATH)); 65 | 66 | Options.v().set_output_format(Options.output_format_none); 67 | 68 | Options.v().setPhaseOption("cg.spark verbose:true", "on"); 69 | Scene.v().loadNecessaryClasses(); 70 | 71 | // SetupApplication app = new SetupApplication(Constants.PLATFORM_PATH, Constants.APK_PATH); 72 | // try { 73 | // 74 | // app.calculateSourcesSinksEntrypoints(Constants.SOURCE_SINK_PATH); 75 | // 76 | // } catch (IOException e) { 77 | // 78 | // // TODO Auto-generated catch block 79 | // 80 | // e.printStackTrace(); 81 | // 82 | // } catch (XmlPullParserException e) { 83 | // 84 | // // TODO Auto-generated catch block 85 | // 86 | // e.printStackTrace(); 87 | // 88 | // } 89 | 90 | // 91 | 92 | SootMethod entryPoint = app.getEntryPointCreator().createDummyMain(); 93 | 94 | Options.v().set_main_class(entryPoint.getSignature()); 95 | 96 | Scene.v().setEntryPoints(Collections.singletonList(entryPoint)); 97 | System.out.println(entryPoint.getActiveBody()); 98 | 99 | PackManager.v().runPacks(); 100 | 101 | System.out.println(Scene.v().getCallGraph().size()); 102 | CallGraph cg = Scene.v().getCallGraph(); 103 | //app.runInfoflow(); 104 | 105 | 106 | 107 | // SootMethod sm = Scene.v().getMainMethod(); 108 | // 109 | // ExceptionalUnitGraph eu = new ExceptionalUnitGraph(sm.getActiveBody()); 110 | // 111 | // Body b = eu.getBody(); 112 | // Chain units = b.getUnits(); 113 | // 114 | // Iterator it = units.snapshotIterator(); 115 | // 116 | // while(it.hasNext()) 117 | // { 118 | // System.out.println("current: "+((Unit)it.next()).toString()); 119 | // System.out.println("next :" + eu.getSuccsOf(it.next())); 120 | // } 121 | // cfg.checkUnit(cfg.getARandomMethod()); 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/axml-2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/axml-2.0.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/commons-io-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/commons-io-2.5.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/junit.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/junit.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/org.hamcrest.core_1.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/org.hamcrest.core_1.3.0.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/run.sh: -------------------------------------------------------------------------------- 1 | # PKGNAME=`aapt dump badging $1 | grep package:\ name | awk '{ print $2 }' | cut -f2 -d"="` 2 | # #PLATFORMDIR=d:/sup_tools/Android/android-sdk/platforms 3 | # SOOTDIR=C:/tanzir_work/apptasker/Appstract/code/AndroidInstrumentation/src 4 | # TOOLDIR=C:/tanzir_work/apptasker/Appstract/code/instrumentation 5 | 6 | javac -cp ".:xmlpull_1_0_5.jar:axml-2.0.jar:AXMLPrinter2.jar:soot-infoflow.jar:soot-infoflow-android.jar:junit.jar:org.hamcrest.core_1.3.0.jar:soot-trunk.jar:sootclasses.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/rt.jar" TestInside.java 7 | #java -Xmx5g -cp ".:axml-2.0.jar:AXMLPrinter2.jar:soot-infoflow.jar:soot-infoflow-android.jar:junit.jar:org.hamcrest.core_1.3.0.jar:slf4j-api-1.7.5.jar:slf4j-simple-1.7.5.jar:soot.jar:sootclasses.jar:jasminclasses.jar:c:/Program Files/Java/jdk1.7.0_79/jre/lib/rt.jar" CallGraphGen -w -allow-phantom-refs -android-jars $PLATFORMDIR -src-prec apk -output-format dex -process-dir $1 8 | java -Xmx5g -cp ".:xmlpull_1_0_5.jar:axml-2.0.jar:AXMLPrinter2.jar:soot-infoflow.jar:soot-infoflow-android.jar:junit.jar:org.hamcrest.core_1.3.0.jar:soot-trunk.jar:sootclasses.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/rt.jar" TestInside 9 | -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/soot-infoflow-android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/soot-infoflow-android.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/soot-infoflow.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/soot-infoflow.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/soot-trunk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/soot-trunk.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/sootclasses.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/sootclasses.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/sootclasses.jar.new: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/sootclasses.jar.new -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/sootclasses.jar.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/sootclasses.jar.old -------------------------------------------------------------------------------- /source/AndroidSlicer/libs/xmlpull_1_0_5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/source/AndroidSlicer/libs/xmlpull_1_0_5.jar -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/BB.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import java.util.List; 4 | 5 | import soot.toolkits.graph.Block; 6 | 7 | public class BB { 8 | 9 | int _id; 10 | String _headIns; 11 | String _tailIns; 12 | List _listPreviousBBs; 13 | List _listNextBBs; 14 | List _listDirectorLines; 15 | String _methodName; 16 | String _className; 17 | Block _block; 18 | int _tailId; 19 | 20 | 21 | 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/CFG.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import org.xmlpull.v1.XmlPullParserException; 7 | import org.apache.commons.io.FileUtils; 8 | import org.ucr.ds.cd.utilities.*; 9 | 10 | import soot.jimple.infoflow.android.SetupApplication; 11 | import soot.toolkits.graph.*; 12 | import soot.*; 13 | import soot.tagkit.LineNumberTag; 14 | import soot.options.Options; 15 | import soot.jimple.JimpleBody; 16 | import soot.util.*; 17 | import java.util.*; 18 | import soot.options.*; 19 | 20 | public class CFG { 21 | 22 | public static Map > mapCFG = new LinkedHashMap>(); 23 | 24 | private static Map mapClassName = new LinkedHashMap(); 25 | private Map > mapClassMethod = new LinkedHashMap>(); 26 | 27 | private static List listDirectors = new ArrayList(); 28 | private static Map mapUnitDirector = new LinkedHashMap(); 29 | private static List listEndPoints = new ArrayList(); 30 | 31 | 32 | public CFG(String apkPath) 33 | { 34 | 35 | SetupApplication app = new SetupApplication(Constants.PLATFORM_PATH, apkPath); 36 | try { 37 | 38 | app.calculateSourcesSinksEntrypoints(Constants.SOURCE_SINK_PATH); 39 | 40 | } catch (IOException e) { 41 | 42 | // TODO Auto-generated catch block 43 | 44 | e.printStackTrace(); 45 | 46 | } catch (XmlPullParserException e) { 47 | 48 | // TODO Auto-generated catch block 49 | 50 | e.printStackTrace(); 51 | 52 | } 53 | 54 | soot.G.reset(); 55 | 56 | Options.v().set_keep_line_number(true); 57 | 58 | Options.v().set_src_prec(Options.src_prec_apk); 59 | 60 | Options.v().set_process_dir(Collections.singletonList(apkPath)); 61 | 62 | 63 | Options.v().set_android_jars(Constants.PLATFORM_PATH); 64 | 65 | Options.v().set_whole_program(true); 66 | 67 | Options.v().set_allow_phantom_refs(true); 68 | 69 | Options.v().set_keep_line_number(true); 70 | 71 | Options.v().set_output_format(Options.output_format_none); 72 | 73 | Options.v().setPhaseOption("cg.spark", "on"); 74 | 75 | Scene.v().loadNecessaryClasses(); 76 | } 77 | 78 | public static SootMethod getARandomMethod() 79 | { 80 | return Scene.v().getMainMethod(); 81 | } 82 | 83 | public static void calculateDirectorRegions(SootMethod sm) 84 | { 85 | Chain chain = sm.retrieveActiveBody().getUnits(); 86 | 87 | for(Unit u: chain) 88 | { 89 | //whether there is a transition 90 | if(u.getUnitBoxes().size()>0) 91 | { 92 | listDirectors.add(u); 93 | for(UnitBox b: u.getUnitBoxes()) 94 | { 95 | Unit unit = b.getUnit(); 96 | // List types = sm.getParameterTypes(); 97 | // for (Type p: types) 98 | // { 99 | // 100 | // } 101 | mapUnitDirector.put(unit, u); 102 | } 103 | } 104 | } 105 | } 106 | //check this method 107 | public static void loadCFG() 108 | { 109 | Chain chain = Scene.v().getApplicationClasses(); 110 | Iterator iterator = chain.snapshotIterator(); 111 | while(iterator.hasNext()) 112 | { 113 | SootClass sc = iterator.next(); 114 | List listMethods = sc.getMethods(); 115 | List listEug = new ArrayList(); 116 | for(SootMethod sm : listMethods) 117 | { 118 | if(sm.getSource()!= null){ 119 | listEug.add(new ExceptionalBlockGraph(sm.retrieveActiveBody())); 120 | } 121 | } 122 | 123 | mapCFG.put(sc, listEug); 124 | 125 | } 126 | } 127 | //check this method 128 | public static void saveCFG() throws IOException 129 | { 130 | Set scs = mapCFG.keySet(); 131 | 132 | for(SootClass sc:scs) 133 | { 134 | List ll = new ArrayList(); 135 | String header = sc.getName(); 136 | List l= mapCFG.get(sc); 137 | for(ExceptionalBlockGraph eb:l) 138 | { 139 | header += "," + eb.getBody().getMethod().getName(); 140 | List listBlocks = eb.getBlocks(); 141 | 142 | for(Block b: listBlocks) 143 | { 144 | 145 | header +=","+b.getHead().toString()+","+b.getHead().getJavaSourceStartLineNumber(); 146 | header +=","+b.getTail().toString()+","+b.getTail().getJavaSourceStartLineNumber(); 147 | 148 | List listPreds= b.getPreds(); 149 | List listSucc= b.getSuccs(); 150 | String predsLineNo= ",PRED_START"; 151 | if(listPreds.size()>0) 152 | { 153 | for(Block predBlock : listPreds) 154 | { 155 | predsLineNo += ","+predBlock.getTail().toString()+","+predBlock.getTail().getJavaSourceStartLineNumber(); 156 | } 157 | header +=predsLineNo +","+"PRED_END"; 158 | } 159 | 160 | String succsLineNo= ""; 161 | if(listSucc.size()>0) 162 | { 163 | for(Block succBlock : listSucc) 164 | { 165 | succsLineNo += ","+succBlock.getHead().toString()+","+succBlock.getHead().getJavaSourceStartLineNumber(); 166 | } 167 | header +=succsLineNo; 168 | } 169 | 170 | ll.add(header); 171 | } 172 | FileUtils.writeLines(new File(sc.getName()+"_block.dat"), ll, true); 173 | ll=new ArrayList(); 174 | } 175 | 176 | 177 | 178 | } 179 | } 180 | 181 | public static void checkUnit(SootMethod sm) 182 | { 183 | ExceptionalUnitGraph eu = new ExceptionalUnitGraph(sm.retrieveActiveBody()); 184 | 185 | Body b = eu.getBody(); 186 | Chain units = b.getUnits(); 187 | 188 | 189 | Iterator it = units.snapshotIterator(); 190 | 191 | while(it.hasNext()) 192 | { 193 | System.out.println("current: "+((Unit)it.next()).toString()); 194 | System.out.println("next :" + eu.getSuccsOf(it.next())); 195 | } 196 | 197 | } 198 | 199 | public static void getUnitFromLine(SootClass sc) 200 | { 201 | //first get sootmethod and class 202 | //then get it 203 | 204 | List listTemp = mapCFG.get(sc); 205 | for (ExceptionalBlockGraph eu: listTemp) 206 | { 207 | 208 | } 209 | } 210 | 211 | 212 | } 213 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/ControlDependence.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | public class ControlDependence { 7 | 8 | //immediate static post dominator 9 | 10 | static Map IMMIDIATE_STATIC_POST_DOMNATOR = new LinkedHashMap(); 11 | static class ControlDependanceStack 12 | { 13 | Instruction directorRegion; 14 | Instruction IPD; 15 | } 16 | //immediate dynamic post dominator 17 | //director of a region 18 | //immediate static post dominator of it 19 | 20 | } 21 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/Input.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import java.util.ArrayList; 4 | import java.util.LinkedHashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class Input { 9 | 10 | public Map mapKeyUnits =new LinkedHashMap(); 11 | public Map mapNoKey =new LinkedHashMap(); 12 | public Map mapKeyNo =new LinkedHashMap(); 13 | public List unitIds = new ArrayList(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/Instruction.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import com.sun.corba.se.impl.protocol.ServantCacheLocalCRDBase; 4 | 5 | import soot.Unit; 6 | 7 | public class Instruction { 8 | private String methodString; 9 | private String classString; 10 | private int line; 11 | private Unit unit; 12 | 13 | public Instruction() 14 | { 15 | setMethodString(""); 16 | setClassString(""); 17 | setLine(-1); 18 | setUnitString(null); 19 | } 20 | 21 | String getMethodString() { 22 | return methodString; 23 | } 24 | 25 | void setMethodString(String methodString) { 26 | this.methodString = methodString; 27 | } 28 | 29 | String getClassString() { 30 | return classString; 31 | } 32 | 33 | void setClassString(String classString) { 34 | this.classString = classString; 35 | } 36 | 37 | int getLine() { 38 | return line; 39 | } 40 | 41 | void setLine(int line) { 42 | this.line = line; 43 | } 44 | 45 | Unit getUnitString() { 46 | return unit; 47 | } 48 | 49 | void setUnitString(Unit unit) { 50 | this.unit = unit; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/InstructionUnits.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import soot.SootMethod; 4 | import soot.Unit; 5 | 6 | public class InstructionUnits { 7 | 8 | private Unit u; 9 | private SootMethod sm; 10 | private int lineNo = -1; 11 | //private int sootUnitPosition; 12 | private String sootUnitId; 13 | 14 | public Unit getUnit(){ 15 | return u; 16 | } 17 | 18 | public int getLineNo() 19 | { 20 | return lineNo; 21 | } 22 | 23 | public void setLineNo(int n) 24 | { 25 | lineNo = n; 26 | } 27 | 28 | public SootMethod getMethod(){ 29 | return sm; 30 | } 31 | 32 | public void setUnit( Unit unit){ 33 | this.u=unit; 34 | } 35 | 36 | public void setMethod(SootMethod method){ 37 | this.sm=method; 38 | } 39 | 40 | public InstructionUnits () 41 | { 42 | sootUnitId = ""; 43 | } 44 | 45 | public void setSootUnitId() 46 | { 47 | sootUnitId = ""+lineNo+"ZZZ"+sm.getName()+":"+sm.getDeclaringClass().getName()+":"+u.toString(); 48 | } 49 | 50 | public InstructionUnits (SootMethod sm) 51 | { 52 | sootUnitId = ""+lineNo+"ZZZ"+sm.getName()+":"+sm.getDeclaringClass().getName()+":"+u.toString(); 53 | } 54 | 55 | public void setUnitId(String id) 56 | { 57 | sootUnitId= id; 58 | } 59 | 60 | public String getUnitId() 61 | { 62 | return sootUnitId; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/MethodResult.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | public class MethodResult { 8 | Map mapInstUnits; 9 | boolean isEnd; 10 | String methodName; 11 | 12 | MethodResult(String methodName) 13 | { 14 | mapInstUnits = new LinkedHashMap(); 15 | isEnd =true; 16 | this.methodName = methodName; 17 | } 18 | 19 | Map getMap() 20 | { 21 | return mapInstUnits; 22 | } 23 | boolean getResult() 24 | { 25 | return isEnd; 26 | } 27 | 28 | void setResult(boolean result) 29 | { 30 | isEnd = result; 31 | } 32 | void addInsList(List listIUs) 33 | { 34 | for(InstructionUnits iu: listIUs) 35 | { 36 | mapInstUnits.put(iu.getUnitId(), iu); 37 | } 38 | 39 | } 40 | void addIns(InstructionUnits iu) 41 | { 42 | if(!iu.getMethod().getName().equals("")) 43 | { 44 | if(mapInstUnits.get(iu.getUnitId())==null) 45 | { 46 | 47 | mapInstUnits.put(iu.getUnitId(), iu); 48 | 49 | } 50 | else 51 | { 52 | mapInstUnits.put(iu.getUnitId(), iu); 53 | } 54 | } 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/PC.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | public class PC { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/Slicer.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.nio.charset.Charset; 8 | import java.util.ArrayList; 9 | import java.util.Collection; 10 | import java.util.Collections; 11 | import java.util.HashMap; 12 | import java.util.Iterator; 13 | import java.util.LinkedHashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | import java.util.Map.Entry; 17 | 18 | import org.apache.commons.io.FileUtils; 19 | import org.ucr.ds.cd.utilities.Constants; 20 | import org.ucr.ds.cd.utilities.Parser; 21 | import org.ucr.ds.utilities.DexUtilities; 22 | import org.xmlpull.v1.XmlPullParserException; 23 | 24 | import soot.Body; 25 | import soot.Local; 26 | import soot.PackManager; 27 | import soot.PatchingChain; 28 | import soot.Scene; 29 | import soot.SootClass; 30 | import soot.SootMethod; 31 | import soot.Unit; 32 | import soot.UnitBox; 33 | import soot.Value; 34 | import soot.ValueBox; 35 | import soot.jimple.AbstractStmtSwitch; 36 | import soot.jimple.AssignStmt; 37 | import soot.jimple.Constant; 38 | import soot.jimple.IdentityStmt; 39 | import soot.jimple.InvokeExpr; 40 | import soot.jimple.InvokeStmt; 41 | import soot.jimple.SpecialInvokeExpr; 42 | import soot.jimple.StaticInvokeExpr; 43 | import soot.jimple.Stmt; 44 | import soot.jimple.VirtualInvokeExpr; 45 | import soot.jimple.infoflow.android.SetupApplication; 46 | import soot.jimple.toolkits.callgraph.CallGraph; 47 | import soot.options.Options; 48 | import soot.toolkits.graph.Block; 49 | import soot.toolkits.graph.BlockGraph; 50 | import soot.toolkits.graph.ExceptionalBlockGraph; 51 | import soot.util.Chain; 52 | import soot.toolkits.graph.ExceptionalUnitGraph; 53 | import soot.toolkits.scalar.SimpleLocalDefs; 54 | 55 | 56 | 57 | public class Slicer { 58 | 59 | //method+class 60 | Map > mapMethodInst = new LinkedHashMap(); 61 | //unitmethodclass 62 | Map mapUnits = new LinkedHashMap(); 63 | //invokations 64 | Map mapInvokations = new LinkedHashMap(); 65 | //results 66 | Map resultMap = new LinkedHashMap(); 67 | 68 | public static String SourcesSinks; 69 | 70 | public static String platformPath; 71 | 72 | Input loadInputfromTraces(List tr) 73 | { 74 | int len = tr.size(); 75 | System.out.println("length:"+len); 76 | 77 | Map > mapTrace = new LinkedHashMap(); 78 | int i=0; 79 | int jj=0; 80 | for (Traces t: tr) 81 | { 82 | // if(i==853) 83 | // { 84 | // System.out.println("gotcha"); 85 | // } 86 | if(!mapTrace.containsKey(t._method+t._class)) 87 | { 88 | Map temp = new LinkedHashMap(); 89 | temp.put(i, t._ins); 90 | mapTrace.put(t._method+t._class, temp); 91 | jj++; 92 | } 93 | else 94 | { 95 | Map temp = mapTrace.get(t._method+t._class); 96 | temp.put(i, t._ins); 97 | mapTrace.put(t._method+t._class, temp); 98 | jj++; 99 | } 100 | i++; 101 | } 102 | 103 | System.out.println("Processed:"+jj); 104 | InstructionUnits []ins = new InstructionUnits[len]; 105 | List listUnis = new ArrayList(); 106 | Chain chain = Scene.v().getApplicationClasses(); 107 | Iterator iterator = chain.snapshotIterator(); 108 | i=0; 109 | while(iterator.hasNext()) 110 | { 111 | SootClass sc = iterator.next(); 112 | List methods = sc.getMethods(); 113 | for(SootMethod mt:methods) 114 | { 115 | String key= mt.getName()+sc.getName(); 116 | if(mt.getName().equals("getSimilarStems")) 117 | { 118 | PatchingChain units1 = mt.getActiveBody().getUnits(); 119 | Map unitString1 = new LinkedHashMap(); 120 | for(Unit u1: units1) 121 | { 122 | System.out.println("::::::::::::::::::::::::::::::"+u1.toString()+"::::::::::::::::"); 123 | } 124 | } 125 | try{ 126 | if(mt.getActiveBody()==null)continue; 127 | }catch(Exception ex) 128 | { 129 | System.out.println("No body:"+mt.getName()); 130 | continue; 131 | } 132 | PatchingChain units = mt.getActiveBody().getUnits(); 133 | Map unitString = new LinkedHashMap(); 134 | for(Unit u: units) 135 | { 136 | unitString.put(u.toString(), u); 137 | } 138 | if(!mapTrace.keySet().contains(key))continue; 139 | Map temp = mapTrace.get(key); 140 | //System.out.println("Entering:"+mt.getName()); 141 | for(Integer key1: temp.keySet()) 142 | { 143 | 144 | 145 | if(unitString.keySet().contains(temp.get(key1))) 146 | { 147 | Unit unit = unitString.get(temp.get(key1)); 148 | i++; 149 | InstructionUnits iu = new InstructionUnits(); 150 | iu.setMethod(mt); 151 | iu.setUnit(unit); 152 | iu.setLineNo(key1); 153 | iu.setSootUnitId(); 154 | try{ 155 | //System.out.println("This is filled up! "+ins[key1].getUnitId()); 156 | }catch(Exception ex) 157 | { 158 | 159 | } 160 | ins[key1] = iu; 161 | listUnis.add(iu); 162 | } 163 | } 164 | 165 | } 166 | 167 | } 168 | System.out.println("i:"+i +"size:"+listUnis.size()); 169 | //Map mapIns = new LinkedHashMap<>(); 170 | Input input = new Input(); 171 | i=0; 172 | 173 | while(i list, String outFile) throws IOException 195 | { 196 | System.out.println("Saving:" + list.size()); 197 | FileUtils.writeLines(new File(outFile), list); 198 | } 199 | public static void main(String args[]) 200 | { 201 | if(args[0].equals("h")) 202 | { 203 | System.out.println("slicer t apk trace_file output_processed_trace_file platformdir SourcesSinks" ); 204 | System.out.println("slicer r apk trace_file position_in_processed_trace_file platformdir SourcesSinks" ); 205 | System.exit(0); 206 | } 207 | try { 208 | boolean justTrace = false; 209 | String option = args[0]; 210 | int posToSlice = -1; 211 | String fileToParse = ""; 212 | String pathApk = ""; 213 | String outFile = ""; 214 | platformPath = args[4]; 215 | SourcesSinks = args[5]; 216 | if(option.equals("t")) 217 | { 218 | justTrace = true; 219 | pathApk = args[1]; 220 | fileToParse = args[2]; 221 | outFile = args[3]; 222 | } 223 | else 224 | { 225 | pathApk = args[1]; 226 | fileToParse = args[2]; 227 | posToSlice=Integer.parseInt(args[3]); 228 | 229 | } 230 | List trs = Parser.readFile(fileToParse); 231 | //HashMap>> map =Parser.doFilePreparation(trs); 232 | 233 | Slicer slicer = new Slicer(pathApk, platformPath); 234 | //HashMap> mp2 = slicer.getUnitMethodByLineNumberMethodNameClassName(map); 235 | //Input input =Parser.transformInput(mp2); 236 | Input input = slicer.loadInputfromTraces(trs); 237 | List callbackExecuted = new ArrayList(); 238 | if(justTrace) 239 | { 240 | System.out.println("Printing trace..."); 241 | List listTOPrint = new ArrayList(); 242 | Iterator entries = input.mapKeyNo.entrySet().iterator(); 243 | while (entries.hasNext()) { 244 | Entry thisEntry = (Entry) entries.next(); 245 | String key = (String)thisEntry.getKey(); 246 | Integer value = (Integer)thisEntry.getValue(); 247 | if(input.mapKeyUnits.get(key).getMethod().getName().startsWith("on")) 248 | { 249 | callbackExecuted.add(key); 250 | callbackExecuted.add("\n"); 251 | } 252 | listTOPrint.add(key); 253 | // ... 254 | } 255 | 256 | slicer.printList(listTOPrint, outFile); 257 | slicer.printList(callbackExecuted, pathApk+".callbacks.txt"); 258 | //FileUtils.writeLines(new File(outFile), input.mapKeyNo.keySet()); 259 | System.out.println("Printing Complete."); 260 | System.exit(0); 261 | 262 | } 263 | 264 | System.out.println("size of the trace after loading:"+input.mapKeyNo.keySet().size()); 265 | System.out.println("Testing for input:"+ input.mapNoKey.get(posToSlice)); 266 | List results = slicer.loadPDG(input , input.mapNoKey.get(posToSlice), posToSlice); 267 | 268 | System.out.println("Printing static program dependence from point of interest:"); 269 | List staticPrint = new ArrayList(); 270 | List dynamicPrint = new ArrayList(); 271 | for(MethodResult me: results) 272 | { 273 | Map mapp = me.getMap(); 274 | 275 | for(String key: mapp.keySet()) 276 | { 277 | InstructionUnits insUnit = mapp.get(key); 278 | 279 | System.out.println(key); 280 | staticPrint.add(key); 281 | 282 | 283 | } 284 | } 285 | System.out.println("Printing dynamic dependence:"); 286 | if(slicer.resultMap.size()>0) 287 | { 288 | for(String key: slicer.resultMap.keySet()) 289 | { 290 | dynamicPrint.add(slicer.resultMap.get(key).getUnitId()); 291 | } 292 | } 293 | 294 | slicer.printList(staticPrint, pathApk.trim()+"_static.dat"); 295 | slicer.printList(dynamicPrint, pathApk.trim()+"_dynamic.dat"); 296 | 297 | 298 | 299 | 300 | } catch (IOException e) { 301 | // TODO Auto-generated catch block 302 | e.printStackTrace(); 303 | } 304 | } 305 | 306 | 307 | public Slicer(String apkPath, String platFormDir) 308 | { 309 | SetupApplication app = new SetupApplication(platFormDir, apkPath); 310 | try { 311 | 312 | app.calculateSourcesSinksEntrypoints(SourcesSinks); 313 | 314 | } catch (IOException e) { 315 | 316 | // TODO Auto-generated catch block 317 | 318 | e.printStackTrace(); 319 | 320 | } catch (XmlPullParserException e) { 321 | 322 | // TODO Auto-generated catch block 323 | 324 | e.printStackTrace(); 325 | 326 | } 327 | 328 | soot.G.reset(); 329 | 330 | Options.v().set_keep_line_number(true); 331 | 332 | Options.v().set_src_prec(Options.src_prec_apk); 333 | 334 | Options.v().set_process_dir(Collections.singletonList(apkPath)); 335 | 336 | Options.v().set_android_jars(platformPath); 337 | 338 | Options.v().set_whole_program(true); 339 | 340 | Options.v().set_allow_phantom_refs(true); 341 | 342 | Options.v().set_keep_line_number(true); 343 | 344 | Options.v().set_output_format(Options.output_format_none); 345 | 346 | Options.v().setPhaseOption("cg.spark", "on"); 347 | 348 | Scene.v().loadNecessaryClasses(); 349 | SootMethod entryPoint = app.getEntryPointCreator().createDummyMain(); 350 | 351 | Options.v().set_main_class(entryPoint.getSignature()); 352 | 353 | Scene.v().setEntryPoints(Collections.singletonList(entryPoint)); 354 | 355 | System.out.println("............"+entryPoint.getActiveBody()); 356 | 357 | PackManager.v().runPacks(); 358 | } 359 | 360 | 361 | 362 | public List loadCallbacks() throws IOException 363 | { 364 | return FileUtils.readLines(new File(Constants.CALLBACK_FILE_NAME), Charset.defaultCharset()); 365 | } 366 | 367 | public void loadApis() 368 | { 369 | 370 | } 371 | 372 | Input loadTraces() 373 | { 374 | return null; 375 | } 376 | 377 | private void initializer() 378 | { 379 | 380 | } 381 | 382 | List getInstructionUnits(List listUnits, SootMethod sootMethod) 383 | { 384 | List listIUs = new ArrayList(); 385 | for(Unit u:listUnits) 386 | { 387 | InstructionUnits iu = new InstructionUnits(); 388 | iu.setMethod(sootMethod); 389 | iu.setUnit(u); 390 | iu.setLineNo(-1); 391 | iu.setSootUnitId(); 392 | listIUs.add(iu); 393 | } 394 | return listIUs; 395 | } 396 | MethodResult getMethodResult(InstructionUnits iu) 397 | { 398 | if(iu.getUnit() instanceof InvokeStmt) 399 | { 400 | int j=0; 401 | } 402 | MethodResult mer = new MethodResult(iu.getMethod().getName()); 403 | mer.addIns(iu); 404 | 405 | List listUnits = new ArrayList(); 406 | ExceptionalUnitGraph ex = new ExceptionalUnitGraph(iu.getMethod().getActiveBody()); 407 | SimpleLocalDefs simpleLocalDefs = new SimpleLocalDefs(ex); 408 | List units = new ArrayList(); 409 | 410 | List useBoxes; 411 | useBoxes = iu.getUnit().getUseBoxes(); 412 | List tempUseBoxes =new ArrayList(); 413 | for(ValueBox vb:useBoxes) 414 | { 415 | tempUseBoxes.add(vb); 416 | } 417 | 418 | //now for each usebox 419 | while(!tempUseBoxes.isEmpty()) 420 | { 421 | ValueBox vb = tempUseBoxes.remove(0); 422 | if(vb.getValue() instanceof Local) 423 | { 424 | Local local = (Local)vb.getValue(); 425 | if(local instanceof Constant) 426 | { 427 | continue; 428 | } 429 | if(iu.getMethod().getActiveBody().getParameterLocals().contains(local)) 430 | { 431 | mer.setResult(false); 432 | } 433 | List defUnits = simpleLocalDefs.getDefsOf(local); 434 | for(Unit u: defUnits) 435 | { 436 | if(!units.contains(u)) 437 | { 438 | units.add(u); 439 | for(ValueBox innerVb:u.getUseBoxes()) 440 | { 441 | tempUseBoxes.add(innerVb); 442 | } 443 | } 444 | 445 | } 446 | } 447 | } 448 | 449 | 450 | // Handle Intent PutExtrra 451 | List intentDefBoxes =new ArrayList(); 452 | for(Unit uu : units) 453 | { 454 | if(uu.toString().contains("= new android.content.Intent")) 455 | { 456 | List defBoxes; 457 | defBoxes = uu.getDefBoxes(); 458 | for(ValueBox vb:defBoxes) 459 | { 460 | intentDefBoxes.add(vb); 461 | } 462 | } 463 | } 464 | 465 | 466 | List realIntentBoxes =new ArrayList(); 467 | for(ValueBox vv: intentDefBoxes) 468 | { 469 | Local intentLocal = (Local)vv.getValue(); 470 | for(Unit uu : iu.getMethod().getActiveBody().getUnits()) 471 | { 472 | if(uu.toString().contains("virtualinvoke") && uu.toString().contains("putExtra") && uu.toString().contains(intentLocal.toString()+".") && uu instanceof InvokeStmt) 473 | { 474 | List useBoxes2; 475 | useBoxes2 = uu.getUseBoxes(); 476 | for(ValueBox vb:useBoxes2) 477 | { 478 | realIntentBoxes.add(vb); 479 | } 480 | units.add(uu); 481 | } 482 | if(uu.toString().contains("specialinvoke") && uu.toString().contains("android.content.Intent") && uu.toString().contains(intentLocal.toString()+".") && uu instanceof InvokeStmt) 483 | { 484 | List useBoxes2; 485 | useBoxes2 = uu.getUseBoxes(); 486 | for(ValueBox vb:useBoxes2) 487 | { 488 | realIntentBoxes.add(vb); 489 | } 490 | units.add(uu); 491 | } 492 | 493 | } 494 | } 495 | 496 | while(!realIntentBoxes.isEmpty()) 497 | { 498 | ValueBox vb = realIntentBoxes.remove(0); 499 | if(vb.getValue() instanceof Local) 500 | { 501 | Local local = (Local)vb.getValue(); 502 | if(local instanceof Constant) 503 | { 504 | continue; 505 | } 506 | if(iu.getMethod().getActiveBody().getParameterLocals().contains(local)) 507 | { 508 | mer.setResult(false); 509 | } 510 | 511 | List defUnits = simpleLocalDefs.getDefsOf(local); 512 | for(Unit u: defUnits) 513 | { 514 | if(!units.contains(u)) 515 | { 516 | units.add(u); 517 | for(ValueBox innerVb:u.getUseBoxes()) 518 | { 519 | realIntentBoxes.add(innerVb); 520 | } 521 | } 522 | 523 | } 524 | } 525 | } 526 | 527 | mer.addInsList(getInstructionUnits(units, iu.getMethod())); 528 | 529 | 530 | return mer; 531 | } 532 | 533 | void buildSlice(MethodResult mer, Map dynamicSlice) 534 | { 535 | Map staticSlice =new LinkedHashMap(); 536 | for(String key:mer.getMap().keySet()) 537 | { 538 | staticSlice.put(key, mer.getMap().get(key)); 539 | } 540 | 541 | for(String key: dynamicSlice.keySet()) 542 | { 543 | try{ 544 | if(staticSlice.containsKey("-1ZZZ"+key.split("ZZZ")[1])) 545 | { 546 | resultMap.put(key, dynamicSlice.get(key)); 547 | } 548 | } 549 | catch(ArrayIndexOutOfBoundsException ax) 550 | { 551 | System.out.println("Array:"+ key); 552 | } 553 | 554 | } 555 | 556 | } 557 | 558 | Map getChunk(int pos, Input input ) 559 | { 560 | InstructionUnits iu = input.mapKeyUnits.get(input.mapNoKey.get(pos)); 561 | String currentMethod = iu.getMethod().getName(); 562 | Map chunk = new LinkedHashMap(); 563 | int p = pos-1; 564 | while(p>=0) 565 | { 566 | iu = input.mapKeyUnits.get(input.mapNoKey.get(p)); 567 | if(iu==null) 568 | { 569 | p--; 570 | continue; 571 | } 572 | if (p>4055 && p<4061) 573 | { 574 | iu = input.mapKeyUnits.get(input.mapNoKey.get(p)); 575 | } 576 | 577 | if(iu!=null && iu.getMethod().getName().equals(currentMethod)) 578 | { 579 | chunk.put(iu.getUnitId(), iu); 580 | } 581 | else 582 | break; 583 | p--; 584 | } 585 | return chunk; 586 | } 587 | 588 | List loadPDG(Input input, String unitId, int pp) 589 | { 590 | //Input input =loadTraces(); 591 | List listMer = new ArrayList(); 592 | InstructionUnits iu = input.mapKeyUnits.get(unitId); 593 | int position = input.mapKeyNo.get(unitId); 594 | MethodResult mer = getMethodResult(iu); 595 | for(String keyString : mer.getMap().keySet()) 596 | { 597 | System.out.println(mer.getMap().get(keyString)); 598 | } 599 | String currentMethod = iu.getMethod().getName(); 600 | String lastMethod = iu.getMethod().getName(); 601 | listMer.add(mer); 602 | if(mer.getResult()==true) 603 | { 604 | buildSlice(mer, getChunk(position, input)); 605 | return listMer; 606 | } 607 | else 608 | { 609 | buildSlice(mer, getChunk(position, input)); 610 | listMer.add(mer); 611 | position --; 612 | while(position >=0) 613 | { 614 | if(position==1683) 615 | { 616 | int kkr = 0; 617 | } 618 | String nextKey = input.mapNoKey.get(position); 619 | InstructionUnits nextUnit = input.mapKeyUnits.get(nextKey); 620 | if(nextUnit ==null || nextUnit.getUnit()==null) 621 | { 622 | position--; 623 | continue; 624 | } 625 | Unit unit = nextUnit.getUnit(); 626 | String invokedMethod=""; 627 | if(unit instanceof AssignStmt) 628 | { 629 | AssignStmt assighStmt = (AssignStmt)unit; 630 | Value v =assighStmt.getRightOp(); 631 | 632 | if(v instanceof VirtualInvokeExpr) 633 | { 634 | invokedMethod = ((VirtualInvokeExpr)v).getMethod().getName(); 635 | } 636 | if(v instanceof StaticInvokeExpr) 637 | { 638 | invokedMethod = ((StaticInvokeExpr)v).getMethod().getName(); 639 | } 640 | 641 | else if(v instanceof SpecialInvokeExpr) 642 | { 643 | invokedMethod = ((SpecialInvokeExpr)v).getMethod().getName(); 644 | } 645 | 646 | else if(v instanceof InvokeExpr) 647 | { 648 | invokedMethod = ((InvokeExpr)v).getMethod().getName(); 649 | } 650 | } 651 | 652 | if(unit instanceof InvokeStmt || unit instanceof VirtualInvokeExpr || unit instanceof SpecialInvokeExpr || unit instanceof StaticInvokeExpr|| unit instanceof InvokeExpr ) 653 | { 654 | currentMethod = nextUnit.getMethod().getName(); 655 | 656 | if(unit instanceof InvokeStmt) 657 | { 658 | InvokeExpr iex = ((InvokeStmt)unit).getInvokeExpr(); 659 | invokedMethod = iex.getMethod().getName(); 660 | } 661 | 662 | if(unit instanceof VirtualInvokeExpr) 663 | { 664 | invokedMethod = ((VirtualInvokeExpr)unit).getMethod().getName(); 665 | } 666 | 667 | if(unit instanceof StaticInvokeExpr) 668 | { 669 | invokedMethod = ((VirtualInvokeExpr)unit).getMethod().getName(); 670 | } 671 | 672 | else if(unit instanceof SpecialInvokeExpr) 673 | { 674 | invokedMethod = ((SpecialInvokeExpr)unit).getMethod().getName(); 675 | } 676 | 677 | else if(unit instanceof InvokeExpr) 678 | { 679 | invokedMethod = ((SpecialInvokeExpr)unit).getMethod().getName(); 680 | } 681 | } 682 | 683 | if(!invokedMethod.equals("")) 684 | { 685 | 686 | if(invokedMethod.equals(lastMethod)) 687 | { 688 | MethodResult mer2 = getMethodResult(nextUnit); 689 | if(getMethodResult(nextUnit).getResult()!=true) 690 | { 691 | buildSlice(mer2, getChunk(position, input)); 692 | listMer.add(mer2); 693 | } 694 | else 695 | { 696 | buildSlice(mer2, getChunk(position, input)); 697 | listMer.add(mer2); 698 | return listMer; 699 | } 700 | } 701 | } 702 | lastMethod=currentMethod; 703 | position--; 704 | } 705 | 706 | } 707 | System.out.println("Done"); 708 | return listMer; 709 | } 710 | 711 | } 712 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/ThreadManagement.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | public class ThreadManagement { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/Traces.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | public class Traces { 4 | 5 | public int _lineNo; 6 | public String _class; 7 | public String _method; 8 | public String _type; 9 | public String _ins; 10 | public String _unitString; 11 | } 12 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/core/UnitMethod.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.core; 2 | 3 | import soot.SootMethod; 4 | import soot.Unit; 5 | 6 | public class UnitMethod { 7 | 8 | private Unit u; 9 | private SootMethod sm; 10 | private int lineNo; 11 | 12 | public Unit getUnit(){ 13 | return u; 14 | } 15 | 16 | public int getLineNo() 17 | { 18 | return lineNo; 19 | } 20 | 21 | public void setLineNo(int n) 22 | { 23 | lineNo = n; 24 | } 25 | 26 | public SootMethod getMethod(){ 27 | return sm; 28 | } 29 | 30 | public void setUnit( Unit unit){ 31 | this.u=unit; 32 | } 33 | 34 | public void setMethod(SootMethod method){ 35 | this.sm=method; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/utilities/Constants.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.utilities; 2 | 3 | public class Constants { 4 | 5 | public static final String PLATFORM_PATH =""; 6 | public static final String SOURCE_SINK_PATH =""; 7 | public static final String APK_PATH = ""; 8 | public static final String PRED_START="PRED_START"; 9 | public static final String PRED_END="PRED_END"; 10 | public static final String CFG_FILE_NAME="cfg.dat"; 11 | public static final String CALLBACK_FILE_NAME="callbacks.txt"; 12 | public static final int TOKEN_LENGTH = 6; 13 | public static final int PRED_MAX_COUNT=100; 14 | public static final int SUCC_MAX_COUNT=100; 15 | public static final int ERROR_RETURN = -1; 16 | } -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/utilities/Instrumenter.java: -------------------------------------------------------------------------------- 1 | //the purpose of this class is to add logging functionality to the apk, so that we can get what we require 2 | package org.ucr.ds.cd.utilities; 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | //import MethodInstrumenter.ThreadRunner; 9 | import soot.Body; 10 | import soot.BodyTransformer; 11 | import soot.Local; 12 | import soot.PackManager; 13 | import soot.PatchingChain; 14 | import soot.RefType; 15 | import soot.Scene; 16 | import soot.SootClass; 17 | import soot.SootMethod; 18 | import soot.Transform; 19 | import soot.Unit; 20 | import soot.jimple.AbstractStmtSwitch; 21 | import soot.jimple.AssignStmt; 22 | import soot.jimple.DefinitionStmt; 23 | import soot.jimple.IfStmt; 24 | import soot.jimple.InvokeExpr; 25 | import soot.jimple.InvokeStmt; 26 | import soot.jimple.Jimple; 27 | import soot.jimple.Stmt; 28 | import soot.jimple.LookupSwitchStmt; 29 | import soot.jimple.StringConstant; 30 | import soot.jimple.SwitchStmt; 31 | import soot.options.Options; 32 | 33 | public class Instrumenter { 34 | 35 | static long time =5*60*1000; 36 | static String pkgName = ""; 37 | public static Object mLock = new Object(); 38 | public static boolean isComplete = false; 39 | static enum TYPE {DIRECTOR, HEAD, TAIL, DEF, INST}; 40 | 41 | static List tailsList = new ArrayList(); 42 | static List headsList = new ArrayList(); 43 | static List directorList = new ArrayList(); 44 | static List defList = new ArrayList(); 45 | static SootClass cls ; 46 | static SootMethod mtd ; 47 | static boolean isCallback = false; 48 | static List identityStmts = new ArrayList(); 49 | static class ThreadRunner extends Thread 50 | { 51 | public void run() 52 | { 53 | while (time <= 30*60*1000) 54 | { 55 | System.out.println("Waiting: at observer. Time = " + time ); 56 | System.out.println("sade"); 57 | synchronized (mLock) { 58 | if(!isComplete) 59 | { 60 | try { 61 | Thread.sleep(5*60*1000); 62 | }catch(Exception ex) 63 | { 64 | 65 | } 66 | } 67 | 68 | } 69 | time+=5*60*1000; 70 | } 71 | System.out.println("Observer: Cannot wait 10 minutes for a single app. Exiting."); 72 | System.exit(0); 73 | 74 | } 75 | } 76 | 77 | static void initialize(String pkgName2) 78 | { 79 | Options.v().set_src_prec(Options.src_prec_apk); 80 | pkgName = pkgName2.replace("'", ""); 81 | if(pkgName.contains("/")) 82 | { 83 | String[] pkgNameArray = pkgName.split("/"); 84 | pkgName = pkgNameArray[pkgNameArray.length-1]; 85 | } 86 | System.out.println ("pkg: "+pkgName); 87 | Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES); 88 | Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES); 89 | 90 | } 91 | 92 | static void addLog(TYPE type, Unit u, SootClass sc, SootMethod sm, Body b) 93 | { 94 | String header = u.getJavaSourceStartLineNumber() +","+ sc.getName() + "," + sm.getName(); 95 | String tag = "SLC: "; 96 | String typeStr = ""; 97 | 98 | switch(type) 99 | { 100 | case DIRECTOR: 101 | typeStr = "__director__"; 102 | break; 103 | case HEAD: 104 | typeStr = "__head__"; 105 | break; 106 | case TAIL: 107 | typeStr = "__tail__"; 108 | break; 109 | case INST: 110 | typeStr = "__inst__"; 111 | break; 112 | default: 113 | break; 114 | } 115 | String toAdd = tag+"," + header + "," + typeStr+"," + u.toString(); 116 | 117 | addPrint(toAdd, u, b); 118 | } 119 | 120 | static String getPayload(TYPE type, Unit u, SootClass sc, SootMethod sm, Body b) 121 | { 122 | String header = u.getJavaSourceStartLineNumber() +"ZZZ"+ sc.getName() + "ZZZ" + sm.getName(); 123 | String tag = "SLICING: "; 124 | String typeStr = ""; 125 | 126 | switch(type) 127 | { 128 | case DIRECTOR: 129 | typeStr = "__director__"; 130 | break; 131 | case HEAD: 132 | typeStr = "__head__"; 133 | break; 134 | case TAIL: 135 | typeStr = "__tail__"; 136 | break; 137 | case INST: 138 | typeStr = "__inst__"; 139 | break; 140 | default: 141 | break; 142 | } 143 | return tag+"ZZZ" + header + "ZZZ" + typeStr+"ZZZ" + u.toString(); 144 | } 145 | 146 | static void addPrint(String str, Unit u, Body b) 147 | { 148 | 149 | Local tmpRef = addTmpRef(b); 150 | Local tmpString = addTmpString(b); 151 | 152 | final PatchingChain units = b.getUnits(); 153 | units.insertBefore(Jimple.v().newAssignStmt( 154 | tmpRef, Jimple.v().newStaticFieldRef( 155 | Scene.v().getField("").makeRef())), u); 156 | 157 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 158 | StringConstant.v(str)), u); 159 | 160 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 161 | units.insertBefore(Jimple.v().newInvokeStmt( 162 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 163 | } 164 | 165 | static void runMethodTransformationPack() 166 | { 167 | 168 | PackManager.v().getPack("jtp").add(new Transform("jtp.myInstrumenter", new BodyTransformer() { 169 | 170 | @Override 171 | protected void internalTransform(final Body b, String phaseName, @SuppressWarnings("rawtypes") Map options) { 172 | 173 | //Uncomment the below line and its corresponding "}" to narrow down the scope of 174 | //instrumented classes to your interested classes by putting the name of classes that 175 | //you want or don't want to instrument. 176 | //if(!(b.getMethod().getDeclaringClass().getName().contains("com.squareup.picasso"))) { 177 | SootClass sc = b.getMethod().getDeclaringClass(); 178 | SootMethod sm = b.getMethod(); 179 | final PatchingChain units = b.getUnits(); 180 | 181 | for(Iterator iter = units.snapshotIterator(); iter.hasNext();) { 182 | final Unit u = (Unit) iter.next(); 183 | 184 | cls = sc; 185 | mtd = sm; 186 | if(b.getMethod().getName().startsWith("on")) 187 | { 188 | isCallback = true; 189 | } 190 | 191 | u.apply(new AbstractStmtSwitch() { 192 | 193 | public void caseInvokeStmt(InvokeStmt stmt) { 194 | 195 | Local tmpRef = addTmpRef(b); 196 | Local tmpString = addTmpString(b); 197 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 198 | InvokeExpr iex = stmt.getInvokeExpr(); 199 | if(isCallback) 200 | { 201 | payload = "CALLBACK_SLC: " + payload; 202 | isCallback = false; 203 | } 204 | units.insertBefore(Jimple.v().newAssignStmt( 205 | tmpRef, Jimple.v().newStaticFieldRef( 206 | Scene.v().getField("").makeRef())), u); 207 | 208 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 209 | StringConstant.v(payload)), u); 210 | 211 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 212 | units.insertBefore(Jimple.v().newInvokeStmt( 213 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 214 | b.validate(); 215 | } 216 | 217 | 218 | public void caseAssignStmt(AssignStmt stmt) 219 | { 220 | Local tmpRef = addTmpRef(b); 221 | Local tmpString = addTmpString(b); 222 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 223 | if(isCallback) 224 | { 225 | payload = "CALLBACK_SLC: " + payload; 226 | isCallback = false; 227 | } 228 | units.insertBefore(Jimple.v().newAssignStmt( 229 | tmpRef, Jimple.v().newStaticFieldRef( 230 | Scene.v().getField("").makeRef())), u); 231 | 232 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 233 | StringConstant.v(payload)), u); 234 | 235 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 236 | units.insertBefore(Jimple.v().newInvokeStmt( 237 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 238 | b.validate(); 239 | } 240 | 241 | 242 | public void caseDefinitionStmt(DefinitionStmt stmt) 243 | { 244 | Local tmpRef = addTmpRef(b); 245 | Local tmpString = addTmpString(b); 246 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 247 | if(isCallback) 248 | { 249 | payload = "CALLBACK_SLC: " + payload; 250 | isCallback = false; 251 | } 252 | units.insertBefore(Jimple.v().newAssignStmt( 253 | tmpRef, Jimple.v().newStaticFieldRef( 254 | Scene.v().getField("").makeRef())), u); 255 | 256 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 257 | StringConstant.v(payload)), u); 258 | 259 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 260 | units.insertBefore(Jimple.v().newInvokeStmt( 261 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 262 | b.validate(); 263 | } 264 | 265 | public void caseLookupSwitchStmt(LookupSwitchStmt stmt) 266 | { 267 | Local tmpRef = addTmpRef(b); 268 | Local tmpString = addTmpString(b); 269 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 270 | if(isCallback) 271 | { 272 | payload = "CALLBACK_SLC: " + payload; 273 | isCallback = false; 274 | } 275 | units.insertBefore(Jimple.v().newAssignStmt( 276 | tmpRef, Jimple.v().newStaticFieldRef( 277 | Scene.v().getField("").makeRef())), u); 278 | 279 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 280 | StringConstant.v(payload)), u); 281 | 282 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 283 | units.insertBefore(Jimple.v().newInvokeStmt( 284 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 285 | b.validate(); 286 | } 287 | public void caseSwitchStmt(SwitchStmt stmt) 288 | { 289 | Local tmpRef = addTmpRef(b); 290 | Local tmpString = addTmpString(b); 291 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 292 | if(isCallback) 293 | { 294 | payload = "CALLBACK_SLC: " + payload; 295 | isCallback = false; 296 | } 297 | units.insertBefore(Jimple.v().newAssignStmt( 298 | tmpRef, Jimple.v().newStaticFieldRef( 299 | Scene.v().getField("").makeRef())), u); 300 | 301 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 302 | StringConstant.v(payload)), u); 303 | 304 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 305 | units.insertBefore(Jimple.v().newInvokeStmt( 306 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 307 | b.validate(); 308 | } 309 | public void caseIfStmt(IfStmt stmt) 310 | { 311 | Local tmpRef = addTmpRef(b); 312 | Local tmpString = addTmpString(b); 313 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 314 | if(isCallback) 315 | { 316 | payload = "CALLBACK_SLC: " + payload; 317 | isCallback = false; 318 | } 319 | units.insertBefore(Jimple.v().newAssignStmt( 320 | tmpRef, Jimple.v().newStaticFieldRef( 321 | Scene.v().getField("").makeRef())), u); 322 | 323 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 324 | StringConstant.v(payload)), u); 325 | 326 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 327 | units.insertBefore(Jimple.v().newInvokeStmt( 328 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 329 | b.validate(); 330 | } 331 | 332 | public void caseStmt(Stmt stmt) 333 | { 334 | Local tmpRef = addTmpRef(b); 335 | Local tmpString = addTmpString(b); 336 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 337 | if(isCallback) 338 | { 339 | payload = "CALLBACK_SLC: " + payload; 340 | isCallback = false; 341 | } 342 | units.insertBefore(Jimple.v().newAssignStmt( 343 | tmpRef, Jimple.v().newStaticFieldRef( 344 | Scene.v().getField("").makeRef())), u); 345 | 346 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 347 | StringConstant.v(payload)), u); 348 | 349 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 350 | units.insertBefore(Jimple.v().newInvokeStmt( 351 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 352 | b.validate(); 353 | } 354 | 355 | }); 356 | 357 | } 358 | //}//if uuid 359 | 360 | } 361 | })); 362 | 363 | } 364 | 365 | private static Local addClassRef(Body body) 366 | { 367 | Local tmpRef = Jimple.v().newLocal("classRef", RefType.v("java.lang.Class")); 368 | body.getLocals().add(tmpRef); 369 | return tmpRef; 370 | } 371 | 372 | private static Local addStringRef(Body body) 373 | { 374 | Local tmpStrRef = Jimple.v().newLocal("stringRef", RefType.v("java.lang.String")); 375 | body.getLocals().add(tmpStrRef); 376 | return tmpStrRef; 377 | } 378 | 379 | private static Local addTmpRef(Body body) 380 | { 381 | Local tmpRef = Jimple.v().newLocal("tmpRef", RefType.v("java.io.PrintStream")); 382 | body.getLocals().add(tmpRef); 383 | return tmpRef; 384 | } 385 | 386 | private static Local addTmpString(Body body) 387 | { 388 | Local tmpString = Jimple.v().newLocal("tmpString", RefType.v("java.lang.String")); 389 | body.getLocals().add(tmpString); 390 | return tmpString; 391 | } 392 | 393 | public static void main (String args[]) 394 | { 395 | initialize(args[0]); 396 | 397 | runMethodTransformationPack(); 398 | int argLen = args.length-1; 399 | String newArgs[] = new String [argLen]; 400 | 401 | for (int ii =1; ii < argLen + 1; ii++) 402 | { 403 | newArgs[ii-1]=args[ii]; 404 | } 405 | 406 | soot.Main.main(newArgs); 407 | System.exit(0); 408 | } 409 | 410 | } 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/utilities/Parser.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.utilities; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.nio.charset.Charset; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.Iterator; 9 | import java.util.List; 10 | 11 | import org.apache.commons.io.FileUtils; 12 | import org.ucr.ds.cd.core.Input; 13 | import org.ucr.ds.cd.core.InstructionUnits; 14 | import org.ucr.ds.cd.core.Traces; 15 | 16 | import soot.Body; 17 | import soot.Scene; 18 | import soot.SootClass; 19 | import soot.SootMethod; 20 | import soot.Unit; 21 | import soot.toolkits.graph.Block; 22 | import soot.toolkits.graph.BlockGraph; 23 | import soot.toolkits.graph.ExceptionalBlockGraph; 24 | import soot.util.Chain; 25 | 26 | public class Parser { 27 | //tested 28 | public static List readFile(String fileName) throws IOException 29 | { 30 | List traces = FileUtils.readLines(new File(fileName), Charset.defaultCharset()); 31 | List listTraces = new ArrayList(); 32 | 33 | for(String line : traces) 34 | { 35 | String []tokens = line.split("ZZZ"); 36 | if(tokens.length != 6) continue; 37 | if(tokens.length == Constants.TOKEN_LENGTH) 38 | { 39 | Traces tr = new Traces(); 40 | tr._lineNo = Integer.parseInt(tokens[1]); 41 | tr._class = tokens[2]; 42 | tr._method = tokens[3]; 43 | tr._type = tokens[4]; 44 | tr._ins = tokens[5]; 45 | listTraces.add(tr); 46 | } 47 | else 48 | continue; 49 | } 50 | 51 | return listTraces; 52 | 53 | } 54 | public static Input transformInput(HashMap> mapUnits) throws IOException 55 | { 56 | //HashMap> mapUnits = getUnitMethodByLineNumberMethodNameClassName(); 57 | Input input = new Input(); 58 | int i=0; 59 | for(Integer key : mapUnits.keySet()) 60 | { 61 | List units = mapUnits.get(key); 62 | for(InstructionUnits iu: units) 63 | { 64 | input.mapKeyNo.put(iu.getUnitId(), i); 65 | input.mapKeyUnits.put(iu.getUnitId(), iu); 66 | input.mapNoKey.put(i, iu.getUnitId()); 67 | i++; 68 | } 69 | 70 | 71 | } 72 | return input; 73 | } 74 | 75 | // private static HashMap> getUnitMethodByLineNumberMethodNameClassName() throws IOException { 76 | // 77 | // HashMap>> hashresult = doFilePreparation(readFile(Constants.TRACE_FILE_NAME)); 78 | // HashMap> finlaMapResult = new HashMap>(); 79 | // for (String name: hashresult.keySet()){ 80 | // 81 | // String key =name.toString(); 82 | // HashMap> value = hashresult.get(name); 83 | // for (String name2: value.keySet()){ 84 | // String key2 =name2.toString(); 85 | // String value2 = value.get(key2).toString(); 86 | // System.out.println(key + " " + key2 + " " +value2); 87 | // } 88 | // } 89 | // 90 | // for (String keyclass : hashresult.keySet()) { 91 | // Chain chain = Scene.v().getApplicationClasses(); 92 | // Iterator iterator = chain.snapshotIterator(); 93 | // while (iterator.hasNext()) { 94 | // SootClass sootClassTemp = iterator.next(); 95 | // if(sootClassTemp.getName().equals(keyclass)) 96 | // { 97 | // HashMap> tempMethodMap =hashresult.get(keyclass); 98 | // for (String keymethod : tempMethodMap.keySet()) { 99 | // List methods = sootClassTemp.getMethods(); 100 | // for (SootMethod sootMethodTemp : methods) { 101 | // if(keymethod.equals(sootMethodTemp.getName())) 102 | // { 103 | // ArrayList arrayToSearch = tempMethodMap.get(keymethod); 104 | // for (String s : arrayToSearch) 105 | // { 106 | // String[] splited = s.split(","); //[0]=lineNumber [1]=Position in original file 107 | // int lineNumber= Integer.parseInt(splited[0]); 108 | // int positionInOriginalFile= Integer.parseInt(splited[1]); 109 | // Body sootBody = sootMethodTemp.retrieveActiveBody(); 110 | // BlockGraph blockGraph = new ExceptionalBlockGraph(sootBody); 111 | // for (Block block : blockGraph.getBlocks()) 112 | // { 113 | // for(Iterator iter = block.iterator(); iter.hasNext();) 114 | // { 115 | // Unit unit = iter.next(); 116 | // if(unit.getJavaSourceStartLineNumber() == lineNumber) 117 | // { 118 | // InstructionUnits um = new InstructionUnits(sootMethodTemp); 119 | // um.setUnit(unit); 120 | // um.setMethod(sootMethodTemp); 121 | // um.setLineNo(lineNumber); 122 | // if(!finlaMapResult.containsKey(positionInOriginalFile)) 123 | // { 124 | // ArrayList tempumarray = new ArrayList(); 125 | // tempumarray.add(um); 126 | // finlaMapResult.put(positionInOriginalFile, tempumarray); 127 | // } 128 | // else{ 129 | // ArrayList tempumarray = finlaMapResult.get(positionInOriginalFile); 130 | // tempumarray.add(um); 131 | // finlaMapResult.put(positionInOriginalFile, tempumarray); 132 | // } 133 | // } 134 | // } 135 | // } 136 | // } 137 | // } 138 | // } 139 | // } 140 | // 141 | // } 142 | // } 143 | // } 144 | // 145 | // 146 | // return finlaMapResult; 147 | // 148 | // } 149 | 150 | public static HashMap>> doFilePreparation(List traces) throws IOException { 151 | 152 | HashMap>> mapResult = new HashMap>>(); 153 | 154 | String myLine = null; 155 | 156 | int counterForPosition=1; 157 | for(Traces t : traces) 158 | { 159 | //String[] array = myLine.split(","); 160 | int linenumber = t._lineNo; 161 | String methodName = t._method; 162 | String className = t._class; 163 | if(!mapResult.containsKey(className)) { 164 | ArrayList tempArray = new ArrayList(); 165 | tempArray.add(linenumber + "," + counterForPosition); 166 | HashMap> tempMethodMap = new HashMap>(); 167 | tempMethodMap.put(methodName, tempArray); 168 | mapResult.put(className , tempMethodMap); 169 | } 170 | else{ 171 | HashMap> tempMap =mapResult.get(className); 172 | if(!tempMap.containsKey(methodName)) 173 | { 174 | ArrayList tempArray = new ArrayList(); 175 | tempArray.add(linenumber + "," + counterForPosition); 176 | tempMap.put(methodName,tempArray); 177 | mapResult.put(className , tempMap); 178 | 179 | } 180 | else{ 181 | ArrayList tempArray =tempMap.get(methodName); 182 | tempArray.add(linenumber+","+counterForPosition); 183 | tempMap.put(methodName,tempArray); 184 | mapResult.put(className , tempMap); 185 | } 186 | } 187 | counterForPosition++; 188 | } 189 | return mapResult; 190 | } 191 | 192 | } 193 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/utilities/TestInside.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.utilities; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | import java.util.Collections; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | import org.ucr.ds.cd.core.CFG; 10 | import org.xmlpull.v1.XmlPullParserException; 11 | 12 | import soot.*; 13 | import soot.jimple.IfStmt; 14 | import soot.jimple.infoflow.android.SetupApplication; 15 | import soot.jimple.toolkits.callgraph.CallGraph; 16 | import soot.options.Options; 17 | import soot.toolkits.graph.ExceptionalUnitGraph; 18 | import soot.util.Chain; 19 | 20 | //import oracle.jrockit.jfr.Options; 21 | 22 | public class TestInside { 23 | 24 | //@SuppressWarnings("deprecation") 25 | public static void main(String[] args) { 26 | // TODO Auto-generated method stub 27 | 28 | SetupApplication app = new SetupApplication(Constants.PLATFORM_PATH, Constants.APK_PATH); 29 | try { 30 | 31 | app.calculateSourcesSinksEntrypoints(Constants.SOURCE_SINK_PATH); 32 | 33 | } catch (IOException e) { 34 | 35 | // TODO Auto-generated catch block 36 | 37 | e.printStackTrace(); 38 | 39 | } catch (XmlPullParserException e) { 40 | 41 | // TODO Auto-generated catch block 42 | 43 | e.printStackTrace(); 44 | 45 | } 46 | 47 | soot.G.reset(); 48 | Options.v().set_keep_line_number(true); 49 | 50 | 51 | Options.v().set_src_prec(Options.src_prec_apk); 52 | 53 | Options.v().set_process_dir(Collections.singletonList(Constants.APK_PATH)); 54 | 55 | 56 | Options.v().set_android_jars(Constants.PLATFORM_PATH); 57 | 58 | Options.v().set_whole_program(true); 59 | 60 | Options.v().set_allow_phantom_refs(true); 61 | 62 | Options.v().set_keep_line_number(true); 63 | Options.v().set_allow_phantom_refs(true); 64 | List list = new ArrayList(); 65 | list.add(Constants.APK_PATH); 66 | Options.v().set_process_dir(Collections.singletonList(Constants.APK_PATH)); 67 | 68 | Options.v().set_output_format(Options.output_format_none); 69 | 70 | Options.v().setPhaseOption("cg.spark verbose:true", "on"); 71 | Scene.v().loadNecessaryClasses(); 72 | 73 | 74 | 75 | // 76 | 77 | SootMethod entryPoint = app.getEntryPointCreator().createDummyMain(); 78 | 79 | Options.v().set_main_class(entryPoint.getSignature()); 80 | 81 | Scene.v().setEntryPoints(Collections.singletonList(entryPoint)); 82 | System.out.println(entryPoint.getActiveBody()); 83 | 84 | PackManager.v().runPacks(); 85 | // 86 | // System.out.println(Scene.v().getCallGraph().size()); 87 | // CallGraph cg = Scene.v().getCallGraph(); 88 | //app.runInfoflow(); 89 | 90 | 91 | 92 | SootMethod sm = entryPoint; 93 | 94 | ExceptionalUnitGraph eu = new ExceptionalUnitGraph(sm.getActiveBody()); 95 | 96 | Body b = eu.getBody(); 97 | Chain units = b.getUnits(); 98 | 99 | Iterator it = units.snapshotIterator(); 100 | 101 | while(it.hasNext()) 102 | { 103 | if(it instanceof IfStmt) 104 | { 105 | System.out.println("if"); 106 | } 107 | 108 | System.out.println("current: "+((Unit)it.next()).toString()); 109 | System.out.println("next :" + eu.getSuccsOf(it.next())); 110 | } 111 | // cfg.checkUnit(cfg.getARandomMethod()); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/cd/utilities/TimerManager.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.cd.utilities; 2 | 3 | public class TimerManager { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/core/BB.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.core; 2 | 3 | public class BB { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/core/CFG.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.core; 2 | 3 | public class CFG { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/core/ControlDependence.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.core; 2 | 3 | public class ControlDependence { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/core/Instruction.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.core; 2 | 3 | public class Instruction { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/core/PC.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.core; 2 | 3 | public class PC { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/core/ThreadManagement.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.core; 2 | 3 | public class ThreadManagement { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/parser/Parser.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.parser; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.nio.charset.Charset; 6 | import java.util.List; 7 | 8 | import org.apache.commons.io.FileUtils; 9 | 10 | public class Parser { 11 | 12 | 13 | public static void parse(String arg, int line, int block, int seq) throws IOException 14 | { 15 | String token = ","; 16 | // String splittedString[] = arg.split(token); 17 | List lines = FileUtils.readLines(new File(arg), Charset.defaultCharset()); 18 | //get block number, lets this represents line 19 | 20 | for (String line1: lines) 21 | { 22 | //get the block number and line number 23 | //gather seq no of sequences of block number of blocks 24 | 25 | //now create an array of objects 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/utilities/Constants.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.utilities; 2 | 3 | public class Constants { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/utilities/DexUtilities.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.utilities; 2 | 3 | import java.util.Iterator; 4 | import java.util.List; 5 | 6 | import soot.Body; 7 | import soot.Scene; 8 | import soot.SootClass; 9 | import soot.SootMethod; 10 | import soot.Unit; 11 | import soot.toolkits.graph.Block; 12 | import soot.toolkits.graph.BlockGraph; 13 | import soot.toolkits.graph.ExceptionalBlockGraph; 14 | import soot.util.Chain; 15 | 16 | public class DexUtilities { 17 | 18 | // 19 | public static Unit getUnitByLineNumber(int lineNumber , String className, Chain chain) 20 | { 21 | Unit result=null; 22 | 23 | //Chain chain = Scene.v().getApplicationClasses(); 24 | Iterator iterator = chain.snapshotIterator(); 25 | while (iterator.hasNext()) { 26 | SootClass sootClassTemp = iterator.next(); 27 | if(sootClassTemp.getName().contains(className)) 28 | { 29 | List methods = sootClassTemp.getMethods(); 30 | for (SootMethod sootMethodTemp : methods) { 31 | if(sootMethodTemp.getSource()!= null){ 32 | Body sootBody = sootMethodTemp.retrieveActiveBody(); 33 | BlockGraph blockGraph = new ExceptionalBlockGraph(sootBody); 34 | for (Block block : blockGraph.getBlocks()) 35 | { 36 | for(Iterator iter = block.iterator(); iter.hasNext();) 37 | { 38 | Unit unit = iter.next(); 39 | if(unit.getJavaSourceStartLineNumber() == lineNumber) 40 | result=unit; 41 | } 42 | } 43 | 44 | } 45 | } 46 | } 47 | } 48 | 49 | return result; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /source/AndroidSlicer/src/org/ucr/ds/utilities/TimerManager.java: -------------------------------------------------------------------------------- 1 | package org.ucr.ds.utilities; 2 | 3 | public class TimerManager { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /tool/AndroidCallbacks.txt: -------------------------------------------------------------------------------- 1 | android.accounts.OnAccountsUpdateListener 2 | android.animation.Animator$AnimatorListener 3 | android.animation.LayoutTransition$TransitionListener 4 | android.animation.TimeAnimator$TimeListener 5 | android.animation.ValueAnimator$AnimatorUpdateListener 6 | android.app.ActionBar$OnMenuVisibilityListener 7 | android.app.ActionBar$OnNavigationListener 8 | android.app.ActionBar$TabListener 9 | android.app.Application$ActivityLifecycleCallbacks 10 | android.app.DatePickerDialog$OnDateSetListener 11 | android.app.FragmentBreadCrumbs$OnBreadCrumbClickListener 12 | android.app.FragmentManager$OnBackStackChangedListener 13 | android.app.KeyguardManager$OnKeyguardExitResult 14 | android.app.LoaderManager$LoaderCallbacks 15 | android.app.PendingIntent$OnFinished 16 | android.app.SearchManager$OnCancelListener 17 | android.app.SearchManager$OnDismissListener 18 | android.app.TimePickerDialog$OnTimeSetListener 19 | android.bluetooth.BluetoothProfile$ServiceListener 20 | android.content.ClipboardManager$OnPrimaryClipChangedListener 21 | android.content.ComponentCallbacks 22 | android.content.ComponentCallbacks2 23 | android.content.DialogInterface$OnCancelListener 24 | android.content.DialogInterface$OnClickListener 25 | android.content.DialogInterface$OnDismissListener 26 | android.content.DialogInterface$OnKeyListener 27 | android.content.DialogInterface$OnMultiChoiceClickListener 28 | android.content.DialogInterface$OnShowListener 29 | android.content.IntentSender$OnFinished 30 | android.content.Loader$OnLoadCanceledListener 31 | android.content.Loader$OnLoadCompleteListener 32 | android.content.SharedPreferences$OnSharedPreferenceChangeListener 33 | android.content.SyncStatusObserver 34 | android.database.sqlite.SQLiteTransactionListener 35 | android.drm.DrmManagerClient$OnErrorListener 36 | android.drm.DrmManagerClient$OnEventListener 37 | android.drm.DrmManagerClient$OnInfoListener 38 | android.gesture.GestureOverlayView$OnGestureListener 39 | android.gesture.GestureOverlayView$OnGesturePerformedListener 40 | android.gesture.GestureOverlayView$OnGesturingListener 41 | android.graphics.SurfaceTexture$OnFrameAvailableListener 42 | android.hardware.Camera$AutoFocusCallback 43 | android.hardware.Camera$AutoFocusMoveCallback 44 | android.hardware.Camera$ErrorCallback 45 | android.hardware.Camera$FaceDetectionListener 46 | android.hardware.Camera$OnZoomChangeListener 47 | android.hardware.Camera$PictureCallback 48 | android.hardware.Camera$PreviewCallback 49 | android.hardware.Camera$ShutterCallback 50 | android.hardware.SensorEventListener 51 | android.hardware.display.DisplayManager$DisplayListener 52 | android.hardware.input.InputManager$InputDeviceListener 53 | android.inputmethodservice.KeyboardView$OnKeyboardActionListener 54 | android.location.GpsStatus$Listener 55 | android.location.GpsStatus$NmeaListener 56 | android.location.LocationListener 57 | android.media.AudioManager$OnAudioFocusChangeListener 58 | android.media.AudioRecord$OnRecordPositionUpdateListener 59 | android.media.JetPlayer$OnJetEventListener 60 | android.media.MediaPlayer$OnBufferingUpdateListener 61 | android.media.MediaPlayer$OnCompletionListener 62 | android.media.MediaPlayer$OnErrorListener 63 | android.media.MediaPlayer$OnInfoListener 64 | android.media.MediaPlayer$OnPreparedListener 65 | android.media.MediaPlayer$OnSeekCompleteListener 66 | android.media.MediaPlayer$OnTimedTextListener 67 | android.media.MediaPlayer$OnVideoSizeChangedListener 68 | android.media.MediaRecorder$OnErrorListener 69 | android.media.MediaRecorder$OnInfoListener 70 | android.media.MediaScannerConnection$MediaScannerConnectionClient 71 | android.media.MediaScannerConnection$OnScanCompletedListener 72 | android.media.SoundPool$OnLoadCompleteListener 73 | android.media.audiofx.AudioEffect$OnControlStatusChangeListener 74 | android.media.audiofx.AudioEffect$OnEnableStatusChangeListener 75 | android.media.audiofx.BassBoost$OnParameterChangeListener 76 | android.media.audiofx.EnvironmentalReverb$OnParameterChangeListener 77 | android.media.audiofx.Equalizer$OnParameterChangeListener 78 | android.media.audiofx.PresetReverb$OnParameterChangeListener 79 | android.media.audiofx.Virtualizer$OnParameterChangeListener 80 | android.media.audiofx.Visualizer$OnDataCaptureListener 81 | android.media.effect$EffectUpdateListener 82 | android.net.nsd.NsdManager$DiscoveryListener 83 | android.net.nsd.NsdManager$RegistrationListener 84 | android.net.nsd.NsdManager$ResolveListener 85 | android.net.sip.SipRegistrationListener 86 | android.net.wifi.p2p.WifiP2pManager$ActionListener 87 | android.net.wifi.p2p.WifiP2pManager$ChannelListener 88 | android.net.wifi.p2p.WifiP2pManager$ConnectionInfoListener 89 | android.net.wifi.p2p.WifiP2pManager$DnsSdServiceResponseListener 90 | android.net.wifi.p2p.WifiP2pManager$DnsSdTxtRecordListener 91 | android.net.wifi.p2p.WifiP2pManager$GroupInfoListener 92 | android.net.wifi.p2p.WifiP2pManager$PeerListListener 93 | android.net.wifi.p2p.WifiP2pManager$ServiceResponseListener 94 | android.net.wifi.p2p.WifiP2pManager$UpnpServiceResponseListener 95 | android.os.CancellationSignal$OnCancelListener 96 | android.os.IBinder$DeathRecipient 97 | android.os.MessageQueue$IdleHandler 98 | android.os.RecoverySystem$ProgressListener 99 | android.preference.Preference$OnPreferenceChangeListener 100 | android.preference.Preference$OnPreferenceClickListener 101 | android.preference.PreferenceFragment$OnPreferenceStartFragmentCallback 102 | android.preference.PreferenceManager$OnActivityDestroyListener 103 | android.preference.PreferenceManager$OnActivityResultListener 104 | android.preference.PreferenceManager$OnActivityStopListener 105 | android.security.KeyChainAliasCallback 106 | android.speech.RecognitionListener 107 | android.speech.tts.TextToSpeech$OnInitListener 108 | android.speech.tts.TextToSpeech$OnUtteranceCompletedListener 109 | android.view.ActionMode$Callback 110 | android.view.ActionProvider$VisibilityListener 111 | android.view.GestureDetector$OnDoubleTapListener 112 | android.view.GestureDetector$OnGestureListener 113 | android.view.InputQueue$Callback 114 | android.view.KeyEvent$Callback 115 | android.view.MenuItem$OnActionExpandListener 116 | android.view.MenuItem$OnMenuItemClickListener 117 | android.view.ScaleGestureDetector$OnScaleGestureListener 118 | android.view.SurfaceHolder$Callback 119 | android.view.SurfaceHolder$Callback2 120 | android.view.TextureView$SurfaceTextureListener 121 | android.view.View$OnAttachStateChangeListener 122 | android.view.View$OnClickListener 123 | android.view.View$OnCreateContextMenuListener 124 | android.view.View$OnDragListener 125 | android.view.View$OnFocusChangeListener 126 | android.view.View$OnGenericMotionListener 127 | android.view.View$OnHoverListener 128 | android.view.View$OnKeyListener 129 | android.view.View$OnLayoutChangeListener 130 | android.view.View$OnLongClickListener 131 | android.view.View$OnSystemUiVisibilityChangeListener� 132 | android.view.View$OnTouchListener 133 | android.view.ViewGroup$OnHierarchyChangeListener 134 | android.view.ViewStub$OnInflateListener 135 | android.view.ViewTreeObserver$OnDrawListener 136 | android.view.ViewTreeObserver$OnGlobalFocusChangeListener 137 | android.view.ViewTreeObserver$OnGlobalLayoutListener 138 | android.view.ViewTreeObserver$OnPreDrawListener 139 | android.view.ViewTreeObserver$OnScrollChangedListener 140 | android.view.ViewTreeObserver$OnTouchModeChangeListener 141 | android.view.accessibility.AccessibilityManager$AccessibilityStateChangeListener 142 | android.view.animation.Animation$AnimationListener 143 | android.view.inputmethod.InputMethod$SessionCallback 144 | android.view.inputmethod.InputMethodSession$EventCallback 145 | android.view.textservice.SpellCheckerSession$SpellCheckerSessionListener 146 | android.webkit.DownloadListener 147 | android.widget.AbsListView$MultiChoiceModeListener 148 | android.widget.AbsListView$OnScrollListener 149 | android.widget.AbsListView$RecyclerListener 150 | android.widget.AdapterView$OnItemClickListener 151 | android.widget.AdapterView$OnItemLongClickListener 152 | android.widget.AdapterView.OnItemSelectedListener 153 | android.widget.AutoCompleteTextView$OnDismissListener 154 | android.widget.CalendarView$OnDateChangeListener 155 | android.widget.Chronometer$OnChronometerTickListener 156 | android.widget.CompoundButton$OnCheckedChangeListener 157 | android.widget.DatePicker$OnDateChangedListener 158 | android.widget.ExpandableListView$OnChildClickListener 159 | android.widget.ExpandableListView$OnGroupClickListener 160 | android.widget.ExpandableListView$OnGroupCollapseListener 161 | android.widget.ExpandableListView$OnGroupExpandListener 162 | android.widget.Filter$FilterListener 163 | android.widget.NumberPicker$OnScrollListener 164 | android.widget.NumberPicker$OnValueChangeListener 165 | android.widget.NumberPicker$OnDismissListener 166 | android.widget.PopupMenu$OnMenuItemClickListener 167 | android.widget.PopupWindow$OnDismissListener 168 | android.widget.RadioGroup$OnCheckedChangeListener 169 | android.widget.RatingBar$OnRatingBarChangeListener 170 | android.widget.SearchView$OnCloseListener 171 | android.widget.SearchView$OnQueryTextListener 172 | android.widget.SearchView$OnSuggestionListener 173 | android.widget.SeekBar$OnSeekBarChangeListener 174 | android.widget.ShareActionProvider$OnShareTargetSelectedListener 175 | android.widget.SlidingDrawer$OnDrawerCloseListener 176 | android.widget.SlidingDrawer$OnDrawerOpenListener 177 | android.widget.SlidingDrawer$OnDrawerScrollListener 178 | android.widget.TabHost$OnTabChangeListener 179 | android.widget.TextView$OnEditorActionListener 180 | android.widget.TimePicker$OnTimeChangedListener 181 | android.widget.ZoomButtonsController$OnZoomListener 182 | -------------------------------------------------------------------------------- /tool/AndroidSlicer.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/AndroidSlicer.jar -------------------------------------------------------------------------------- /tool/AndroidSlicer.sh: -------------------------------------------------------------------------------- 1 | PLATFORDIRFORSLICER="/home/aalav003/Desktop/adt-bundle-linux-x86_64-20140702/sdk/platforms/" 2 | SOURCESINK="SourcesAndSinks.txt" 3 | 4 | echo "please enter the line number for slicing criterion" 5 | read line_no 6 | 7 | java -jar AndroidSlicer.jar r $1 "$1.logcat.txt" $line_no $PLATFORDIRFORSLICER $SOURCESINK 8 | -------------------------------------------------------------------------------- /tool/Instrumenter.java: -------------------------------------------------------------------------------- 1 | //the purpose of this class is to add logging functionality to the apk, so that we can get what we require 2 | import java.util.ArrayList; 3 | import java.util.Iterator; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | //import MethodInstrumenter.ThreadRunner; 8 | import soot.Body; 9 | import soot.BodyTransformer; 10 | import soot.Local; 11 | import soot.PackManager; 12 | import soot.PatchingChain; 13 | import soot.RefType; 14 | import soot.Scene; 15 | import soot.SootClass; 16 | import soot.SootMethod; 17 | import soot.Transform; 18 | import soot.Unit; 19 | import soot.jimple.AbstractStmtSwitch; 20 | import soot.jimple.AssignStmt; 21 | import soot.jimple.DefinitionStmt; 22 | import soot.jimple.IfStmt; 23 | import soot.jimple.InvokeExpr; 24 | import soot.jimple.InvokeStmt; 25 | import soot.jimple.Jimple; 26 | import soot.jimple.Stmt; 27 | import soot.jimple.LookupSwitchStmt; 28 | import soot.jimple.StringConstant; 29 | import soot.jimple.SwitchStmt; 30 | import soot.options.Options; 31 | 32 | public class Instrumenter { 33 | 34 | static long time =5*60*1000; 35 | static String pkgName = ""; 36 | public static Object mLock = new Object(); 37 | public static boolean isComplete = false; 38 | static enum TYPE {DIRECTOR, HEAD, TAIL, DEF, INST}; 39 | 40 | static List tailsList = new ArrayList(); 41 | static List headsList = new ArrayList(); 42 | static List directorList = new ArrayList(); 43 | static List defList = new ArrayList(); 44 | static SootClass cls ; 45 | static SootMethod mtd ; 46 | static boolean isCallback = false; 47 | static List identityStmts = new ArrayList(); 48 | static class ThreadRunner extends Thread 49 | { 50 | public void run() 51 | { 52 | while (time <= 30*60*1000) 53 | { 54 | System.out.println("Waiting: at observer. Time = " + time ); 55 | System.out.println("sade"); 56 | synchronized (mLock) { 57 | if(!isComplete) 58 | { 59 | try { 60 | Thread.sleep(5*60*1000); 61 | }catch(Exception ex) 62 | { 63 | 64 | } 65 | } 66 | 67 | } 68 | time+=5*60*1000; 69 | } 70 | System.out.println("Observer: Cannot wait 10 minutes for a single app. Exiting."); 71 | System.exit(0); 72 | 73 | } 74 | } 75 | 76 | static void initialize(String pkgName2) 77 | { 78 | Options.v().set_src_prec(Options.src_prec_apk); 79 | pkgName = pkgName2.replace("'", ""); 80 | if(pkgName.contains("/")) 81 | { 82 | String[] pkgNameArray = pkgName.split("/"); 83 | pkgName = pkgNameArray[pkgNameArray.length-1]; 84 | } 85 | System.out.println ("pkg: "+pkgName); 86 | Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES); 87 | Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES); 88 | 89 | } 90 | 91 | static void addLog(TYPE type, Unit u, SootClass sc, SootMethod sm, Body b) 92 | { 93 | String header = u.getJavaSourceStartLineNumber() +","+ sc.getName() + "," + sm.getName(); 94 | String tag = "SLC: "; 95 | String typeStr = ""; 96 | 97 | switch(type) 98 | { 99 | case DIRECTOR: 100 | typeStr = "__director__"; 101 | break; 102 | case HEAD: 103 | typeStr = "__head__"; 104 | break; 105 | case TAIL: 106 | typeStr = "__tail__"; 107 | break; 108 | case INST: 109 | typeStr = "__inst__"; 110 | break; 111 | default: 112 | break; 113 | } 114 | String toAdd = tag+"," + header + "," + typeStr+"," + u.toString(); 115 | 116 | addPrint(toAdd, u, b); 117 | } 118 | 119 | static String getPayload(TYPE type, Unit u, SootClass sc, SootMethod sm, Body b) 120 | { 121 | String header = u.getJavaSourceStartLineNumber() +"ZZZ"+ sc.getName() + "ZZZ" + sm.getName(); 122 | String tag = "SLICING: "; 123 | String typeStr = ""; 124 | 125 | switch(type) 126 | { 127 | case DIRECTOR: 128 | typeStr = "__director__"; 129 | break; 130 | case HEAD: 131 | typeStr = "__head__"; 132 | break; 133 | case TAIL: 134 | typeStr = "__tail__"; 135 | break; 136 | case INST: 137 | typeStr = "__inst__"; 138 | break; 139 | default: 140 | break; 141 | } 142 | return tag+"ZZZ" + header + "ZZZ" + typeStr+"ZZZ" + u.toString(); 143 | } 144 | 145 | static void addPrint(String str, Unit u, Body b) 146 | { 147 | 148 | Local tmpRef = addTmpRef(b); 149 | Local tmpString = addTmpString(b); 150 | 151 | final PatchingChain units = b.getUnits(); 152 | units.insertBefore(Jimple.v().newAssignStmt( 153 | tmpRef, Jimple.v().newStaticFieldRef( 154 | Scene.v().getField("").makeRef())), u); 155 | 156 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 157 | StringConstant.v(str)), u); 158 | 159 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 160 | units.insertBefore(Jimple.v().newInvokeStmt( 161 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 162 | } 163 | 164 | static void runMethodTransformationPack() 165 | { 166 | 167 | PackManager.v().getPack("jtp").add(new Transform("jtp.myInstrumenter", new BodyTransformer() { 168 | 169 | @Override 170 | protected void internalTransform(final Body b, String phaseName, @SuppressWarnings("rawtypes") Map options) { 171 | 172 | // Uncomment the below line and its corresponding "}" to narrow down the scope of 173 | //instrumented classes to your interested classes by putting the name of classes that 174 | //you want or don't want to instrument. 175 | //if(!(b.getMethod().getDeclaringClass().getName().contains("com.squareup.picasso"))) { 176 | SootClass sc = b.getMethod().getDeclaringClass(); 177 | SootMethod sm = b.getMethod(); 178 | final PatchingChain units = b.getUnits(); 179 | 180 | for(Iterator iter = units.snapshotIterator(); iter.hasNext();) { 181 | final Unit u = (Unit) iter.next(); 182 | 183 | cls = sc; 184 | mtd = sm; 185 | if(b.getMethod().getName().startsWith("on")) 186 | { 187 | isCallback = true; 188 | } 189 | 190 | u.apply(new AbstractStmtSwitch() { 191 | 192 | public void caseInvokeStmt(InvokeStmt stmt) { 193 | 194 | Local tmpRef = addTmpRef(b); 195 | Local tmpString = addTmpString(b); 196 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 197 | InvokeExpr iex = stmt.getInvokeExpr(); 198 | if(isCallback) 199 | { 200 | payload = "CALLBACK_SLC: " + payload; 201 | isCallback = false; 202 | } 203 | units.insertBefore(Jimple.v().newAssignStmt( 204 | tmpRef, Jimple.v().newStaticFieldRef( 205 | Scene.v().getField("").makeRef())), u); 206 | 207 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 208 | StringConstant.v(payload)), u); 209 | 210 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 211 | units.insertBefore(Jimple.v().newInvokeStmt( 212 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 213 | b.validate(); 214 | } 215 | 216 | 217 | public void caseAssignStmt(AssignStmt stmt) 218 | { 219 | Local tmpRef = addTmpRef(b); 220 | Local tmpString = addTmpString(b); 221 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 222 | if(isCallback) 223 | { 224 | payload = "CALLBACK_SLC: " + payload; 225 | isCallback = false; 226 | } 227 | units.insertBefore(Jimple.v().newAssignStmt( 228 | tmpRef, Jimple.v().newStaticFieldRef( 229 | Scene.v().getField("").makeRef())), u); 230 | 231 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 232 | StringConstant.v(payload)), u); 233 | 234 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 235 | units.insertBefore(Jimple.v().newInvokeStmt( 236 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 237 | b.validate(); 238 | } 239 | 240 | 241 | public void caseDefinitionStmt(DefinitionStmt stmt) 242 | { 243 | Local tmpRef = addTmpRef(b); 244 | Local tmpString = addTmpString(b); 245 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 246 | if(isCallback) 247 | { 248 | payload = "CALLBACK_SLC: " + payload; 249 | isCallback = false; 250 | } 251 | units.insertBefore(Jimple.v().newAssignStmt( 252 | tmpRef, Jimple.v().newStaticFieldRef( 253 | Scene.v().getField("").makeRef())), u); 254 | 255 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 256 | StringConstant.v(payload)), u); 257 | 258 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 259 | units.insertBefore(Jimple.v().newInvokeStmt( 260 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 261 | b.validate(); 262 | } 263 | 264 | public void caseLookupSwitchStmt(LookupSwitchStmt stmt) 265 | { 266 | Local tmpRef = addTmpRef(b); 267 | Local tmpString = addTmpString(b); 268 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 269 | if(isCallback) 270 | { 271 | payload = "CALLBACK_SLC: " + payload; 272 | isCallback = false; 273 | } 274 | units.insertBefore(Jimple.v().newAssignStmt( 275 | tmpRef, Jimple.v().newStaticFieldRef( 276 | Scene.v().getField("").makeRef())), u); 277 | 278 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 279 | StringConstant.v(payload)), u); 280 | 281 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 282 | units.insertBefore(Jimple.v().newInvokeStmt( 283 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 284 | b.validate(); 285 | } 286 | public void caseSwitchStmt(SwitchStmt stmt) 287 | { 288 | Local tmpRef = addTmpRef(b); 289 | Local tmpString = addTmpString(b); 290 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 291 | if(isCallback) 292 | { 293 | payload = "CALLBACK_SLC: " + payload; 294 | isCallback = false; 295 | } 296 | units.insertBefore(Jimple.v().newAssignStmt( 297 | tmpRef, Jimple.v().newStaticFieldRef( 298 | Scene.v().getField("").makeRef())), u); 299 | 300 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 301 | StringConstant.v(payload)), u); 302 | 303 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 304 | units.insertBefore(Jimple.v().newInvokeStmt( 305 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 306 | b.validate(); 307 | } 308 | public void caseIfStmt(IfStmt stmt) 309 | { 310 | Local tmpRef = addTmpRef(b); 311 | Local tmpString = addTmpString(b); 312 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 313 | if(isCallback) 314 | { 315 | payload = "CALLBACK_SLC: " + payload; 316 | isCallback = false; 317 | } 318 | units.insertBefore(Jimple.v().newAssignStmt( 319 | tmpRef, Jimple.v().newStaticFieldRef( 320 | Scene.v().getField("").makeRef())), u); 321 | 322 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 323 | StringConstant.v(payload)), u); 324 | 325 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 326 | units.insertBefore(Jimple.v().newInvokeStmt( 327 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 328 | b.validate(); 329 | } 330 | 331 | public void caseStmt(Stmt stmt) 332 | { 333 | Local tmpRef = addTmpRef(b); 334 | Local tmpString = addTmpString(b); 335 | String payload = getPayload(TYPE.INST, u, cls, mtd, b); 336 | if(isCallback) 337 | { 338 | payload = "CALLBACK_SLC: " + payload; 339 | isCallback = false; 340 | } 341 | units.insertBefore(Jimple.v().newAssignStmt( 342 | tmpRef, Jimple.v().newStaticFieldRef( 343 | Scene.v().getField("").makeRef())), u); 344 | 345 | units.insertBefore(Jimple.v().newAssignStmt(tmpString, 346 | StringConstant.v(payload)), u); 347 | 348 | SootMethod toCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); 349 | units.insertBefore(Jimple.v().newInvokeStmt( 350 | Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); 351 | b.validate(); 352 | } 353 | 354 | }); 355 | 356 | } 357 | //}//if uuid 358 | 359 | } 360 | })); 361 | 362 | } 363 | 364 | private static Local addClassRef(Body body) 365 | { 366 | Local tmpRef = Jimple.v().newLocal("classRef", RefType.v("java.lang.Class")); 367 | body.getLocals().add(tmpRef); 368 | return tmpRef; 369 | } 370 | 371 | private static Local addStringRef(Body body) 372 | { 373 | Local tmpStrRef = Jimple.v().newLocal("stringRef", RefType.v("java.lang.String")); 374 | body.getLocals().add(tmpStrRef); 375 | return tmpStrRef; 376 | } 377 | 378 | private static Local addTmpRef(Body body) 379 | { 380 | Local tmpRef = Jimple.v().newLocal("tmpRef", RefType.v("java.io.PrintStream")); 381 | body.getLocals().add(tmpRef); 382 | return tmpRef; 383 | } 384 | 385 | private static Local addTmpString(Body body) 386 | { 387 | Local tmpString = Jimple.v().newLocal("tmpString", RefType.v("java.lang.String")); 388 | body.getLocals().add(tmpString); 389 | return tmpString; 390 | } 391 | 392 | public static void main (String args[]) 393 | { 394 | initialize(args[0]); 395 | 396 | runMethodTransformationPack(); 397 | int argLen = args.length-1; 398 | String newArgs[] = new String [argLen]; 399 | 400 | for (int ii =1; ii < argLen + 1; ii++) 401 | { 402 | newArgs[ii-1]=args[ii]; 403 | } 404 | 405 | soot.Main.main(newArgs); 406 | System.exit(0); 407 | } 408 | 409 | } 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | -------------------------------------------------------------------------------- /tool/SourcesAndSinks.txt: -------------------------------------------------------------------------------- 1 | -> _SOURCE_ 2 | -> _SOURCE_ 3 | 4 | android.permission.READ_PHONE_STATE -> _SOURCE_ 5 | android.permission.READ_PHONE_STATE -> _SOURCE_ 6 | android.permission.READ_PHONE_STATE -> _SOURCE_ 7 | android.permission.READ_PHONE_STATE -> _SOURCE_ 8 | 9 | -> _SOURCE_ 10 | -> _SOURCE_ 11 | 12 | -> _SOURCE_ 13 | -> _SOURCE_ 14 | -> _SOURCE_ 15 | -> _SOURCE_ 16 | -> _SOURCE_ 17 | 18 | (java.lang.String,java.lang.String)> -> _SINK_ 19 | 20 | % add Activity.getIntent() as source instead of the next methods to avoid duplicate results. 21 | % -> _SOURCE_ 22 | % -> _SOURCE_ 23 | % -> _SOURCE_ 24 | % -> _SOURCE_ 25 | % -> _SOURCE_ 26 | % -> _SOURCE_ 27 | % -> _SOURCE_ 28 | % -> _SOURCE_ 29 | % -> _SOURCE_ 30 | % -> _SOURCE_ 31 | % -> _SOURCE_ 32 | % -> _SOURCE_ 33 | % -> _SOURCE_ 34 | % -> _SOURCE_ 35 | % -> _SOURCE_ 36 | % -> _SOURCE_ 37 | % -> _SOURCE_ 38 | % -> _SOURCE_ 39 | % -> _SOURCE_ 40 | % -> _SOURCE_ 41 | % -> _SOURCE_ 42 | % -> _SOURCE_ 43 | % -> _SOURCE_ 44 | % -> _SOURCE_ 45 | % -> _SOURCE_ 46 | % -> _SOURCE_ 47 | % -> _SOURCE_ 48 | % -> _SOURCE_ 49 | % -> _SOURCE_ 50 | % -> _SOURCE_ 51 | % -> _SOURCE_ 52 | % -> _SOURCE_ 53 | % -> _SOURCE_ 54 | % -> _SOURCE_ 55 | % -> _SOURCE_ 56 | % -> _SOURCE_ 57 | % -> _SOURCE_ 58 | % -> _SOURCE_ 59 | % -> _SOURCE_ 60 | % -> _SOURCE_ 61 | % -> _SOURCE_ 62 | % -> _SOURCE_ 63 | % -> _SOURCE_ 64 | 65 | %()> -> _SOURCE_ 66 | %(android.content.Intent)> -> _SOURCE_ 67 | %(java.lang.String)> -> _SOURCE_ 68 | %(java.lang.String,android.net.Uri)> -> _SOURCE_ 69 | %(android.content.Context,java.lang.Class)> -> _SOURCE_ 70 | %(java.lang.String,android.net.Uri,android.content.Context,java.lang.Class)> -> _SOURCE_ 71 | 72 | %bundle sources 73 | -> _SOURCE_ 74 | -> _SOURCE_ 75 | -> _SOURCE_ 76 | -> _SOURCE_ 77 | -> _SOURCE_ 78 | -> _SOURCE_ 79 | -> _SOURCE_ 80 | -> _SOURCE_ 81 | -> _SOURCE_ 82 | -> _SOURCE_ 83 | -> _SOURCE_ 84 | -> _SOURCE_ 85 | -> _SOURCE_ 86 | -> _SOURCE_ 87 | -> _SOURCE_ 88 | -> _SOURCE_ 89 | -> _SOURCE_ 90 | -> _SOURCE_ 91 | -> _SOURCE_ 92 | -> _SOURCE_ 93 | -> _SOURCE_ 94 | -> _SOURCE_ 95 | -> _SOURCE_ 96 | -> _SOURCE_ 97 | -> _SOURCE_ 98 | -> _SOURCE_ 99 | -> _SOURCE_ 100 | -> _SOURCE_ 101 | -> _SOURCE_ 102 | -> _SOURCE_ 103 | -> _SOURCE_ 104 | -> _SOURCE_ 105 | -> _SOURCE_ 106 | -> _SOURCE_ 107 | -> _SOURCE_ 108 | -> _SOURCE_ 109 | -> _SOURCE_ 110 | -> _SOURCE_ 111 | -> _SOURCE_ 112 | 113 | %bundle sinks 114 | -> _SINK_ 115 | -> _SINK_ 116 | -> _SINK_ 117 | -> _SINK_ 118 | -> _SINK_ 119 | -> _SINK_ 120 | -> _SINK_ 121 | -> _SINK_ 122 | -> _SINK_ 123 | -> _SINK_ 124 | -> _SINK_ 125 | -> _SINK_ 126 | -> _SINK_ 127 | -> _SINK_ 128 | -> _SINK_ 129 | -> _SINK_ 130 | -> _SINK_ 131 | -> _SINK_ 132 | -> _SINK_ 133 | -> _SINK_ 134 | -> _SINK_ 135 | -> _SINK_ 136 | -> _SINK_ 137 | -> _SINK_ 138 | -> _SINK_ 139 | -> _SINK_ 140 | -> _SINK_ 141 | -> _SINK_ 142 | -> _SINK_ 143 | -> _SINK_ 144 | -> _SINK_ 145 | 146 | -> _SOURCE_ 147 | -> _SOURCE_ 148 | -> _SOURCE_ 149 | -> _SOURCE_ 150 | -> _SOURCE_ 151 | -> _SOURCE_ 152 | -> _SOURCE_ 153 | -> _SOURCE_ 154 | -> _SOURCE_ 155 | -> _SOURCE_ 156 | -> _SOURCE_ 157 | -> _SOURCE_ 158 | -> _SOURCE_ 159 | -> _SOURCE_ 160 | 161 | -> _SOURCE_ 162 | -> _SOURCE_ 163 | -> _SOURCE_ 164 | -> _SOURCE_ 165 | -> _SOURCE_ 166 | 167 | -> _SINK_ 168 | -> _SINK_ 169 | -> _SINK_ 170 | -> _SINK_ 171 | -> _SINK_ 172 | -> _SINK_ 173 | -> _SINK_ 174 | -> _SINK_ 175 | -> _SINK_ 176 | -> _SINK_ 177 | -> _SINK_ 178 | -> _SINK_ 179 | -> _SINK_ 180 | -> _SINK_ 181 | 182 | -> _SINK_ 183 | -> _SINK_ 184 | -> _SINK_ 185 | 186 | -> _SINK_ 187 | -> _SINK_ 188 | -> _SINK_ 189 | 190 | -> _SINK_ 191 | -> _SINK_ 192 | -> _SINK_ 193 | -> _SINK_ 194 | -> _SINK_ 195 | -> _SINK_ 196 | 197 | -> _SINK_ 198 | 199 | -> _SINK_ 200 | -> _SINK_ 201 | 202 | -> _SINK_ 203 | -> _SINK_ 204 | -> _SINK_ 205 | -> _SINK_ 206 | -> _SINK_ 207 | 208 | % -> _SINK_ 209 | % -> _SINK_ 210 | % -> _SINK_ 211 | % -> _SINK_ 212 | % -> _SINK_ 213 | % -> _SINK_ 214 | % -> _SINK_ 215 | % -> _SINK_ 216 | % -> _SINK_ 217 | % -> _SINK_ 218 | % -> _SINK_ 219 | % -> _SINK_ 220 | % -> _SINK_ 221 | % -> _SINK_ 222 | % -> _SINK_ 223 | % -> _SINK_ 224 | % -> _SINK_ 225 | % -> _SINK_ 226 | % -> _SINK_ 227 | % -> _SINK_ 228 | % -> _SINK_ 229 | % -> _SINK_ 230 | % -> _SINK_ 231 | % -> _SINK_ 232 | 233 | -> _SINK_ 234 | -> _SINK_ 235 | -> _SINK_ 236 | 237 | -> _SINK_ 238 | 239 | -> _SINK_ 240 | -> _SINK_ 241 | -> _SINK_ 242 | 243 | -> _SINK_ 244 | -> _SINK_ 245 | 246 | -> _SINK_ 247 | android.permission.SEND_SMS -> _SINK_ 248 | android.permission.SEND_SMS -> _SINK_ 249 | android.permission.SEND_SMS -> _SINK_ 250 | -> _SINK_ 251 | -> _SINK_ 252 | 253 | -> _SINK_ 254 | -> _SINK_ 255 | -> _SINK_ 256 | -> _SINK_ 257 | -> _SINK_ 258 | 259 | -> _SINK_ 260 | -> _SINK_ 261 | -> _SINK_ 262 | -> _SINK_ 263 | -> _SINK_ 264 | 265 | -> _SOURCE_ 266 | 267 | 268 | -> _SOURCE_ 269 | -> _SOURCE_ 270 | -> _SOURCE_ 271 | -> _SOURCE_ 272 | -> _SOURCE_ 273 | -> _SOURCE_ 274 | -> _SOURCE_ 275 | -> _SOURCE_ 276 | -> _SOURCE_ 277 | -> _SOURCE_ 278 | -> _SOURCE_ 279 | -> _SOURCE_ 280 | -> _SOURCE_ 281 | 282 | -> _SINK_ 283 | -> _SINK_ 284 | 285 | -> _SOURCE_ 286 | -> _SOURCE_ 287 | 288 | (java.lang.String,java.lang.String,int,java.lang.String)> -> _SINK_ 289 | (java.lang.String,java.lang.String,java.lang.String)> -> _SINK_ 290 | (java.lang.String,java.lang.String,int,java.lang.String,java.net.URLStreamHandler)> -> _SINK_ 291 | (java.lang.String)> -> _SINK_ 292 | (java.net.URL,java.lang.String)> -> _SINK_ 293 | (java.net.URL,java.lang.String,java.net.URLStreamHandler)> -> _SINK_ 294 | 295 | -> _SINK_ 296 | -> _SINK_ 297 | -> _SINK_ 298 | -> _SINK_ 299 | -> _SINK_ 300 | -> _SINK_ 301 | -> _SINK_ 302 | -> _SINK_ 303 | -> _SINK_ 304 | 305 | -> _SOURCE_ 306 | 307 | -> _SINK_ 308 | 309 | % Do not enter this method as a source. Our callback parameter handling will take care 310 | % of the parameters of this method anyway. Adding this method taints the whole activity! 311 | % -> _SOURCE_ 312 | 313 | -> _SINK_ 314 | -> _SINK_ 315 | -> _SINK_ 316 | -> _SINK_ 317 | -> _SINK_ 318 | -> _SINK_ 319 | -> _SINK_ 320 | -> _SINK_ 321 | -> _SINK_ 322 | -> _SINK_ 323 | -> _SINK_ 324 | -> _SINK_ 325 | -> _SINK_ 326 | -> _SINK_ 327 | -> _SINK_ 328 | -> _SINK_ 329 | -> _SINK_ 330 | -> _SINK_ 331 | -> _SINK_ 332 | -> _SINK_ 333 | -> _SINK_ 334 | -> _SINK_ 335 | -> _SINK_ 336 | -> _SINK_ 337 | -> _SINK_ 338 | 339 | -> _SINK_ 340 | -> _SINK_ 341 | -> _SINK_ 342 | -> _SINK_ 343 | -> _SINK_ 344 | 345 | 346 | 347 | % -> _SOURCE_ 348 | -> _SOURCE_ 349 | -> _SOURCE_ 350 | -> _SOURCE_ 351 | 352 | -> _SINK_ -------------------------------------------------------------------------------- /tool/commons-io-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/commons-io-2.5.jar -------------------------------------------------------------------------------- /tool/instrumenter.sh: -------------------------------------------------------------------------------- 1 | echo "if you closed adb logcat press enter" 2 | read input_close 3 | rm -r sootOutput/$1 4 | PLATFORDIRFORSLICER="/home/aalav003/Desktop/adt-bundle-linux-x86_64-20140702/sdk/platforms/" 5 | SOURCESINK="SourcesAndSinks.txt" 6 | 7 | PKGNAME=`aapt dump badging $1 | grep package:\ name | awk '{ print $2 }' | cut -f2 -d"="` 8 | echo $PKGNAME 9 | 10 | 11 | #javac -cp ".:sootclasses-trunk-jar-with-dependencies.jar:soot-infoflow-android.jar;/usr/lib/jvm/java-8-oracle/jre/rt.jar" Instrumenter.java 12 | #java -Xmx5g -cp ".:sootclasses-trunk-jar-with-dependencies.jar:soot-infoflow-android.jar;/usr/lib/jvm/java-8-oracle/jre/rt.jar" Instrumenter $PKGNAME -w -allow-phantom-refs -process-multiple-dex -android-jars $PLATFORDIRFORSLICER -src-prec apk -output-format dex -process-dir $1 13 | 14 | javac -cp ".:soot-trunk.jar:soot-infoflow.jar:soot-infoflow-android.jar;/usr/lib/jvm/java-8-oracle/jre/rt.jar" Instrumenter.java 15 | java -Xmx5g -cp ".:soot-trunk.jar:soot-infoflow.jar:soot-infoflow-android.jar;/usr/lib/jvm/java-8-oracle/jre/rt.jar" Instrumenter $PKGNAME -w -allow-phantom-refs -process-multiple-dex -android-jars $PLATFORDIRFORSLICER -src-prec apk -output-format dex -process-dir $1 16 | 17 | chmod 777 sootOutput/$1 18 | echo signing sootOutput/$1 to sootOutput/$1_signed.apk 19 | java -jar signapk.jar testkey.x509.pem testkey.pk8 sootOutput/$1 $1_signed.apk 20 | 21 | chmod 777 $1_signed.apk 22 | 23 | 24 | -------------------------------------------------------------------------------- /tool/preSlicer.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/preSlicer.jar -------------------------------------------------------------------------------- /tool/preSlicer.sh: -------------------------------------------------------------------------------- 1 | PLATFORDIRFORSLICER="/home/aalav003/Desktop/adt-bundle-linux-x86_64-20140702/sdk/platforms/" 2 | SOURCESINK="SourcesAndSinks.txt" 3 | 4 | java -jar preSlicer.jar t $1 "$1.logcat.txt" "$1.logcat.processed.txt" $PLATFORDIRFORSLICER $SOURCESINK 5 | -------------------------------------------------------------------------------- /tool/signapk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/signapk.jar -------------------------------------------------------------------------------- /tool/soot-infoflow-android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/soot-infoflow-android.jar -------------------------------------------------------------------------------- /tool/soot-infoflow.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/soot-infoflow.jar -------------------------------------------------------------------------------- /tool/soot-trunk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/soot-trunk.jar -------------------------------------------------------------------------------- /tool/sootclasses-trunk-jar-with-dependencies.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/sootclasses-trunk-jar-with-dependencies.jar -------------------------------------------------------------------------------- /tool/testkey.pk8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ucr-riple/AndroidSlicer/72bb9c61760951299495afe487e61d211d59bd00/tool/testkey.pk8 -------------------------------------------------------------------------------- /tool/testkey.x509.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD 3 | VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g 4 | VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE 5 | AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe 6 | Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET 7 | MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G 8 | A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p 9 | ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI 10 | hvcNAQEBBQADggENADCCAQgCggEBANaTGQTexgskse3HYuDZ2CU+Ps1s6x3i/waM 11 | qOi8qM1r03hupwqnbOYOuw+ZNVn/2T53qUPn6D1LZLjk/qLT5lbx4meoG7+yMLV4 12 | wgRDvkxyGLhG9SEVhvA4oU6Jwr44f46+z4/Kw9oe4zDJ6pPQp8PcSvNQIg1QCAcy 13 | 4ICXF+5qBTNZ5qaU7Cyz8oSgpGbIepTYOzEJOmc3Li9kEsBubULxWBjf/gOBzAzU 14 | RNps3cO4JFgZSAGzJWQTT7/emMkod0jb9WdqVA2BVMi7yge54kdVMxHEa5r3b97s 15 | zI5p58ii0I54JiCUP5lyfTwE/nKZHZnfm644oLIXf6MdW2r+6R8CAQOjgfwwgfkw 16 | HQYDVR0OBBYEFEhZAFY9JyxGrhGGBaR0GawJyowRMIHJBgNVHSMEgcEwgb6AFEhZ 17 | AFY9JyxGrhGGBaR0GawJyowRoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE 18 | CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH 19 | QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG 20 | CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAJNurL4H8gHfMAwGA1Ud 21 | EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHqvlozrUMRBBVEY0NqrrwFbinZa 22 | J6cVosK0TyIUFf/azgMJWr+kLfcHCHJsIGnlw27drgQAvilFLAhLwn62oX6snb4Y 23 | LCBOsVMR9FXYJLZW2+TcIkCRLXWG/oiVHQGo/rWuWkJgU134NDEFJCJGjDbiLCpe 24 | +ZTWHdcwauTJ9pUbo8EvHRkU3cYfGmLaLfgn9gP+pWA7LFQNvXwBnDa6sppCccEX 25 | 31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr 26 | sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0= 27 | -----END CERTIFICATE----- 28 | --------------------------------------------------------------------------------