-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
108 changed files
with
18,683 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Android-Disassembler | ||
Disassemble .so (NDK, JNI) files on Android. Capstone-based disassembler application on android | ||
|
||
# Features | ||
- Shows details of elf files. | ||
- Disassembles the entire code sections. | ||
- Has various export options of the disassembly. | ||
- Highlights branch instructions. | ||
- Has Instant analysis mode. | ||
|
||
# Usuage | ||
1. Choose an elf file to analyze. | ||
1. Go to details tab. | ||
1. Press `Show details` button to see details. | ||
1. Press `Save to file` button to save it. | ||
1. Go to disassembly tab. | ||
1. Press `disassemble` button. | ||
1. Choose instant mode or persist mode. | ||
1. To export the disassembly, press `Export` button and choose the option. | ||
|
||
# Analysis mode | ||
- Instant mode | ||
Fast and lightweight, but buggy. | ||
- Persist mode | ||
A bit lags, but OK | ||
|
||
# Export mode | ||
- Classic | ||
Pretty! | ||
- Simple | ||
Can be directly pasted as code! | ||
- Json | ||
It can be loaded again to analyze again(though reloading is not implemented yet - Sorry:( ) | ||
|
||
# Permissions | ||
|
||
Before using the app you need some steps: | ||
**Granting permissions** | ||
|
||
![image](images/Screenshot_20180926-090152.png) | ||
![image](images/Screenshot_20180926-090201.png) | ||
|
||
# ScreenShots | ||
![image](images/Screenshot_20180926-090313.png?rw) | ||
![image](images/Screenshot_20180926-090316.png) | ||
![image](images/Screenshot_20180926-090327.png) | ||
![image](images/Screenshot_20180926-090417.png) | ||
|
||
|
||
# Build | ||
I use [AIDE](https://play.google.com/store/apps/details?id=com.aide.ui) to build the project. | ||
|
||
As AIDE doesn't seem to support gradle&JNI mixed project you need to downliad some library projects. | ||
|
||
https://github.com/dandar3/android-support-v7-appcompat | ||
|
||
And [modified storagechooser-2.](https://github.com/KYHSGeekCode/storage-chooser-2-android-buildable-libtary-project) | ||
|
||
# Open Source | ||
- This app used [Capstone](https://github.com/aquynh/capstone), and [Colorpickerview](https://github.com/danielnilsson9/color-picker-view). | ||
|
||
# What's new | ||
- Changed to Android Studio structure. | ||
|
||
# TODO | ||
- Optimization |
Binary file not shown.
187 changes: 187 additions & 0 deletions
187
app/src/github/danielnilsson9/colorpickerview/dialog/ColorPickerDialogFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
/* | ||
* Copyright (C) 2015 Daniel Nilsson | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.github.danielnilsson9.colorpickerview.dialog; | ||
|
||
//import com.github.danielnilsson9.colorpickerview.R; | ||
import com.github.danielnilsson9.colorpickerview.view.ColorPanelView; | ||
import com.github.danielnilsson9.colorpickerview.view.ColorPickerView; | ||
import com.github.danielnilsson9.colorpickerview.view.ColorPickerView.OnColorChangedListener; | ||
import android.app.Activity; | ||
import android.app.Dialog; | ||
import android.app.DialogFragment; | ||
import android.content.DialogInterface; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.View.OnClickListener; | ||
import android.view.ViewGroup; | ||
import android.view.Window; | ||
import android.widget.Button; | ||
import android.widget.TextView; | ||
import com.jourhyang.disasmarm.*; | ||
|
||
public class ColorPickerDialogFragment extends DialogFragment { | ||
|
||
public interface ColorPickerDialogListener { | ||
public void onColorSelected(int dialogId, int color); | ||
public void onDialogDismissed(int dialogId); | ||
} | ||
|
||
|
||
private int mDialogId = -1; | ||
|
||
private ColorPickerView mColorPicker; | ||
private ColorPanelView mOldColorPanel; | ||
private ColorPanelView mNewColorPanel; | ||
private Button mOkButton; | ||
|
||
private ColorPickerDialogListener mListener; | ||
|
||
|
||
public static ColorPickerDialogFragment newInstance(int dialogId, int initialColor) { | ||
return newInstance(dialogId, null, null, initialColor, false); | ||
} | ||
|
||
public static ColorPickerDialogFragment newInstance( | ||
int dialogId, String title, String okButtonText, int initialColor, boolean showAlphaSlider) { | ||
|
||
ColorPickerDialogFragment frag = new ColorPickerDialogFragment(); | ||
Bundle args = new Bundle(); | ||
args.putInt("id", dialogId); | ||
args.putString("title", title); | ||
args.putString("ok_button", okButtonText); | ||
args.putBoolean("alpha", showAlphaSlider); | ||
args.putInt("init_color", initialColor); | ||
|
||
frag.setArguments(args); | ||
|
||
return frag; | ||
} | ||
|
||
|
||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
mDialogId = getArguments().getInt("id"); | ||
} | ||
|
||
@Override | ||
public void onAttach(Activity activity) { | ||
super.onAttach(activity); | ||
|
||
Log.d("color-picker-view", "onAttach()"); | ||
|
||
// Check for listener in parent activity | ||
try { | ||
mListener = (ColorPickerDialogListener) activity; | ||
} | ||
catch (ClassCastException e) { | ||
e.printStackTrace(); | ||
throw new ClassCastException("Parent activity must implement " | ||
+ "ColorPickerDialogListener to receive result."); | ||
} | ||
} | ||
|
||
|
||
|
||
@Override | ||
public Dialog onCreateDialog(Bundle savedInstanceState) { | ||
Dialog d = super.onCreateDialog(savedInstanceState); | ||
|
||
|
||
d.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
d.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, | ||
ViewGroup.LayoutParams.WRAP_CONTENT); | ||
|
||
return d; | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
View v = inflater.inflate(R.layout.colorpickerview__dialog_color_picker, container); | ||
|
||
|
||
TextView titleView = (TextView) v.findViewById(android.R.id.title); | ||
|
||
mColorPicker = (ColorPickerView) | ||
v.findViewById(R.id.colorpickerview__color_picker_view); | ||
mOldColorPanel = (ColorPanelView) | ||
v.findViewById(R.id.colorpickerview__color_panel_old); | ||
mNewColorPanel = (ColorPanelView) | ||
v.findViewById(R.id.colorpickerview__color_panel_new); | ||
mOkButton = (Button) v.findViewById(android.R.id.button1); | ||
|
||
|
||
mColorPicker.setOnColorChangedListener(new OnColorChangedListener() { | ||
|
||
@Override | ||
public void onColorChanged(int newColor) { | ||
mNewColorPanel.setColor(newColor); | ||
} | ||
}); | ||
|
||
mOkButton.setOnClickListener(new OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
mListener.onColorSelected(mDialogId, mColorPicker.getColor()); | ||
getDialog().dismiss(); | ||
} | ||
|
||
}); | ||
|
||
|
||
String title = getArguments().getString("title"); | ||
|
||
if(title != null) { | ||
titleView.setText(title); | ||
} | ||
else { | ||
titleView.setVisibility(View.GONE); | ||
} | ||
|
||
|
||
if(savedInstanceState == null) { | ||
mColorPicker.setAlphaSliderVisible( | ||
getArguments().getBoolean("alpha")); | ||
|
||
|
||
String ok = getArguments().getString("ok_button"); | ||
if(ok != null) { | ||
mOkButton.setText(ok); | ||
} | ||
|
||
int initColor = getArguments().getInt("init_color"); | ||
|
||
mOldColorPanel.setColor(initColor); | ||
mColorPicker.setColor(initColor, true); | ||
} | ||
|
||
|
||
return v; | ||
} | ||
|
||
|
||
@Override | ||
public void onDismiss(DialogInterface dialog) { | ||
super.onDismiss(dialog); | ||
mListener.onDialogDismissed(mDialogId); | ||
} | ||
|
||
} |
133 changes: 133 additions & 0 deletions
133
app/src/github/danielnilsson9/colorpickerview/drawable/AlphaPatternDrawable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* Copyright (C) 2015 Daniel Nilsson | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.github.danielnilsson9.colorpickerview.drawable; | ||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.Canvas; | ||
import android.graphics.ColorFilter; | ||
import android.graphics.Paint; | ||
import android.graphics.Rect; | ||
import android.graphics.Bitmap.Config; | ||
import android.graphics.drawable.Drawable; | ||
|
||
/** | ||
* This drawable will draw a simple white and gray chessboard pattern. | ||
* It's pattern you will often see as a background behind a | ||
* partly transparent image in many applications. | ||
* @author Daniel Nilsson | ||
*/ | ||
public class AlphaPatternDrawable extends Drawable { | ||
|
||
private int mRectangleSize = 10; | ||
|
||
private Paint mPaint = new Paint(); | ||
private Paint mPaintWhite = new Paint(); | ||
private Paint mPaintGray = new Paint(); | ||
|
||
private int numRectanglesHorizontal; | ||
private int numRectanglesVertical; | ||
|
||
/** | ||
* Bitmap in which the pattern will be cached. | ||
* This is so the pattern will not have to be recreated each time draw() gets called. | ||
* Because recreating the pattern i rather expensive. I will only be recreated if the | ||
* size changes. | ||
*/ | ||
private Bitmap mBitmap; | ||
|
||
public AlphaPatternDrawable(int rectangleSize) { | ||
mRectangleSize = rectangleSize; | ||
mPaintWhite.setColor(0xffffffff); | ||
mPaintGray.setColor(0xffcbcbcb); | ||
} | ||
|
||
@Override | ||
public void draw(Canvas canvas) { | ||
if(mBitmap != null && !mBitmap.isRecycled()) { | ||
canvas.drawBitmap(mBitmap, null, getBounds(), mPaint); | ||
} | ||
} | ||
|
||
@Override | ||
public int getOpacity() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void setAlpha(int alpha) { | ||
throw new UnsupportedOperationException("Alpha is not supported by this drawable."); | ||
} | ||
|
||
@Override | ||
public void setColorFilter(ColorFilter cf) { | ||
throw new UnsupportedOperationException("ColorFilter is not supported by this drawable."); | ||
} | ||
|
||
@Override | ||
protected void onBoundsChange(Rect bounds) { | ||
super.onBoundsChange(bounds); | ||
|
||
int height = bounds.height(); | ||
int width = bounds.width(); | ||
|
||
numRectanglesHorizontal = (int) Math.ceil((width / mRectangleSize)); | ||
numRectanglesVertical = (int) Math.ceil(height / mRectangleSize); | ||
|
||
generatePatternBitmap(); | ||
|
||
} | ||
|
||
/** | ||
* This will generate a bitmap with the pattern | ||
* as big as the rectangle we were allow to draw on. | ||
* We do this to chache the bitmap so we don't need to | ||
* recreate it each time draw() is called since it | ||
* takes a few milliseconds. | ||
*/ | ||
private void generatePatternBitmap(){ | ||
|
||
if(getBounds().width() <= 0 || getBounds().height() <= 0){ | ||
return; | ||
} | ||
|
||
mBitmap = Bitmap.createBitmap(getBounds().width(), getBounds().height(), Config.ARGB_8888); | ||
Canvas canvas = new Canvas(mBitmap); | ||
|
||
Rect r = new Rect(); | ||
boolean verticalStartWhite = true; | ||
for (int i = 0; i <= numRectanglesVertical; i++) { | ||
|
||
boolean isWhite = verticalStartWhite; | ||
for (int j = 0; j <= numRectanglesHorizontal; j++) { | ||
|
||
r.top = i * mRectangleSize; | ||
r.left = j * mRectangleSize; | ||
r.bottom = r.top + mRectangleSize; | ||
r.right = r.left + mRectangleSize; | ||
|
||
canvas.drawRect(r, isWhite ? mPaintWhite : mPaintGray); | ||
|
||
isWhite = !isWhite; | ||
} | ||
|
||
verticalStartWhite = !verticalStartWhite; | ||
|
||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.