mirror of
https://github.com/RfidResearchGroup/RFIDtools.git
synced 2026-05-12 11:19:59 -07:00
Merge pull request #50 from xianglin1998/master
SimpleConsoleView test work finally
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
[submodule "pm3rdv4rrg/src/main/cpp/proxmark3"]
|
||||
path = pm3rdv4rrg/src/main/cpp/proxmark3
|
||||
url = https://github.com/xianglin1998/proxmark3.git
|
||||
[submodule "pm3rdv4rrg/src/main/cpp/bzip2"]
|
||||
path = pm3rdv4rrg/src/main/cpp/bzip2
|
||||
url = http://sourceware.org/git/bzip2.git
|
||||
@@ -63,6 +63,19 @@ Download and flash [Compiled FW 12 August](https://www.dropbox.com/s/416lsrqpr2l
|
||||
- CMAKE: 3.10
|
||||
- NDK: 20.0.5594570
|
||||
|
||||
## How to build?
|
||||
The RFIDTools have some gitsubmodule
|
||||
|
||||
Get the source from GitHub:
|
||||
|
||||
git clone https://github.com/xianglin1998/RFIDtools RFIDtools
|
||||
cd RFIDtools
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
|
||||
After clone and init submodule, you can use your AndroidStudio open this project.
|
||||
|
||||
## App core implementation
|
||||
|
||||
Comunication: LocalSocket & LocalServerSocket(Android)
|
||||
|
||||
@@ -8,8 +8,8 @@ android {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 28
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
versionCode 24
|
||||
versionName "1.4.6 Termux"
|
||||
versionCode 25
|
||||
versionName "1.4.7 Termux and SimpleView"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -66,8 +66,8 @@ dependencies {
|
||||
implementation project(':chameleon')
|
||||
implementation project(':communication')
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation project(path: ':pm3flasher')
|
||||
implementation project(':pm3rdv4rrg')
|
||||
implementation project(path: ':xmodem')
|
||||
|
||||
// The dep from TERMUX(A FullTerminal implements.)
|
||||
|
||||
@@ -77,7 +77,8 @@
|
||||
<activity android:name=".activities.tools.KeyFileListActivity" />
|
||||
<activity android:name=".activities.main.PM3FlasherMainActivity" />
|
||||
<activity android:name=".activities.tools.Proxmark3FirmwareActivity" />
|
||||
<activity android:name=".activities.tools.Proxmark3NewTerminalInitActivity" />
|
||||
<activity android:name=".activities.proxmark3.rdv4_rrg.Proxmark3NewTerminalInitActivity" />
|
||||
<activity android:name=".activities.proxmark3.rdv4_rrg.Proxmark3Rdv4RRGRedTeamConsoleActivity" />
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
{"name": "Mifare 1k Dump", "cmd": "hf mf dump"},
|
||||
{"name": "Read iclass", "cmd": "hf iclass reader"},
|
||||
{"name": "Dump iclass legacy", "cmd": "hf iclass dump k afa785a7dab33378"},
|
||||
{"name": "Hardware Test", "cmd": "hw tune"}
|
||||
{"name": "Hardware Test", "cmd": "hw tune"},
|
||||
{"name": "Hardware Version", "cmd": "hw version"},
|
||||
],
|
||||
[
|
||||
{"name" : "High Frequency"},
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import androidx.appcompat.app.AlertDialog;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.main.PM3FlasherMainActivity;
|
||||
import cn.rrg.rdv.activities.tools.DeviceConnectActivity;
|
||||
import cn.rrg.rdv.activities.tools.Proxmark3NewTerminalInitActivity;
|
||||
import cn.rrg.rdv.activities.proxmark3.rdv4_rrg.Proxmark3NewTerminalInitActivity;
|
||||
import cn.rrg.rdv.callback.ConnectFailedCtxCallback;
|
||||
import cn.rrg.rdv.models.AbstractDeviceModel;
|
||||
import cn.rrg.rdv.models.Proxmark3Rdv4SppModel;
|
||||
@@ -53,7 +53,7 @@ public class Proxmark3Rdv4RRGConnectActivity
|
||||
|
||||
@Override
|
||||
public String getConnectingMsg() {
|
||||
return getString(R.string.tips_view_use_termux);
|
||||
return getString(R.string.tips_plz_wait);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cn.rrg.rdv.activities.main;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
|
||||
@@ -12,23 +12,19 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.dxl.common.interfaces.OnTouchListener;
|
||||
import cn.dxl.common.util.DisplayUtil;
|
||||
import cn.dxl.common.util.HexUtil;
|
||||
import cn.dxl.common.util.LanguageUtil;
|
||||
import cn.dxl.common.util.LogUtils;
|
||||
import cn.dxl.common.util.StatusBarUtil;
|
||||
import cn.dxl.common.widget.ToastUtil;
|
||||
import cn.dxl.common.util.VibratorUtils;
|
||||
import cn.dxl.mifare.NfcTagListenUtils;
|
||||
import cn.dxl.mifare.StdMifareIntent;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.application.Properties;
|
||||
import cn.rrg.rdv.util.Commons;
|
||||
|
||||
/**
|
||||
@@ -95,9 +91,6 @@ public abstract class BaseActivity
|
||||
protected void onPause() {
|
||||
Log.d(LOG_TAG, "Act is pause");
|
||||
super.onPause();
|
||||
/*
|
||||
* 在这里解注册各大前台事件!
|
||||
* */
|
||||
mStdMfUtil.disableForegroundDispatch(this);
|
||||
}
|
||||
|
||||
@@ -105,10 +98,9 @@ public abstract class BaseActivity
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
String language = Commons.getLanguage();
|
||||
if (language.equals("auto")) {
|
||||
//如果value = auto,则设置为跟随系统!
|
||||
super.attachBaseContext(newBase);
|
||||
} else {
|
||||
//否则国际化!
|
||||
LogUtils.d("New app language: " + language);
|
||||
super.attachBaseContext(LanguageUtil.setAppLanguage(newBase, language));
|
||||
}
|
||||
}
|
||||
@@ -125,16 +117,12 @@ public abstract class BaseActivity
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
//有新的意图时会启动
|
||||
Bundle data = intent.getExtras();
|
||||
if (data != null) {
|
||||
Tag tag = data.getParcelable(NfcAdapter.EXTRA_TAG);
|
||||
if (tag != null) {
|
||||
//存入全局操作域!
|
||||
NfcTagListenUtils.setTag(tag);
|
||||
//显示 UID!
|
||||
ToastUtil.show(this, getString(R.string.tips_uid) + HexUtil.toHexString(tag.getId()), true);
|
||||
//震动一下!
|
||||
VibratorUtils.runOneAsDelay(context, 1000);
|
||||
NfcTagListenUtils.notifyOnNewTag(tag);
|
||||
}
|
||||
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package cn.rrg.rdv.activities.proxmark3.rdv4_rrg;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import cn.dxl.common.util.FileUtils;
|
||||
import cn.rrg.console.define.ICommandTools;
|
||||
import cn.rrg.console.define.ICommandType;
|
||||
import cn.rrg.freo.IORedirector;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.tools.BaseConsoleActivity;
|
||||
import cn.rrg.rdv.implement.EntryICommandType;
|
||||
import cn.rrg.rdv.util.Paths;
|
||||
|
||||
public abstract class Proxmark3ConsoleActivity
|
||||
extends BaseConsoleActivity
|
||||
implements View.OnClickListener,
|
||||
CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
//滞留一个视图实例,可用如GUI,子控件实现!
|
||||
protected View guiView = null;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//重定向!
|
||||
IORedirector.setStdEO(Paths.PM3_FORWARD_O, IORedirector.STD_OUT);
|
||||
IORedirector.setStdEO(Paths.PM3_FORWARD_E, IORedirector.STD_ERR);
|
||||
IORedirector.setStdIN(Paths.COMMON_FORWARD_I);
|
||||
}
|
||||
}).start();
|
||||
|
||||
//父类先初初始化!
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//默认关闭错误消息输出区域(用不上...)
|
||||
ckBoxOpenOutputError.setChecked(false);
|
||||
//覆盖父类的停止按钮点击实例
|
||||
btnStop.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.btnStop) {//判断当前是否有客户端可终止的任务在执行,是的话则终止!
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//TODO 此处进行IO,模拟键盘输入!
|
||||
stopPM3Client4KeyBorad();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
//通过键盘输入结束任务!
|
||||
protected void stopPM3Client4KeyBorad() {
|
||||
FileUtils.writeString(new File(Paths.COMMON_FORWARD_I), "\n", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
//非常有必要进行相关的结束操作!
|
||||
stopPM3Client4KeyBorad();
|
||||
mCMD.stopExecute();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/*
|
||||
* 重写视图实例寻找,方便进行控制!
|
||||
* */
|
||||
@Override
|
||||
public <T extends View> T findViewById(int id) {
|
||||
T view = super.findViewById(id);
|
||||
return view != null ? view : guiView != null ? guiView.findViewById(id) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
//don't need process!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getCommandGUI() {
|
||||
return guiView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File initOutTarget() {
|
||||
return new File(Paths.PM3_FORWARD_O);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File initErrTarget() {
|
||||
return new File(Paths.PM3_FORWARD_E);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int startTest(ICommandTools cmd) {
|
||||
mDefaultCMD = "help";
|
||||
if (edtInputCmd.getText().toString().length() > 0) {
|
||||
mDefaultCMD = edtInputCmd.getText().toString();
|
||||
}
|
||||
//此处做出多行执行优化!
|
||||
int ret = -2;
|
||||
//优化,如果是多行命令的操作!
|
||||
if (mDefaultCMD.contains("\n")) {
|
||||
//包含换行,则当作多行处理!
|
||||
String[] cmds = mDefaultCMD.split("\n");
|
||||
Log.d(LOG_TAG, "警告,当前执行的是多行处理操作!");
|
||||
for (String c : cmds) {
|
||||
Log.d(LOG_TAG, "当前执行的命令: " + c);
|
||||
mCMD.startExecute(c);
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
//直接执行命令并且在执行命令完成后进行回调!
|
||||
ret = cmd.startExecute(mDefaultCMD);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewOutLine(String line) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewErrLine(String line) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICommandType initType() {
|
||||
return new EntryICommandType();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTestEnd() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTesting() {
|
||||
return super.isTesting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stopTest() {
|
||||
//super.stopTest();
|
||||
//TODO 无必要停止PM3的底层线程!
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package cn.rrg.rdv.activities.proxmark3.rdv4_rrg;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.termux.app.TermuxActivity;
|
||||
|
||||
import cn.dxl.common.widget.ToastUtil;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.main.BaseActivity;
|
||||
import cn.rrg.rdv.activities.main.PM3FlasherMainActivity;
|
||||
import cn.rrg.rdv.util.Commons;
|
||||
import cn.rrg.rdv.util.Proxmark3Installer;
|
||||
|
||||
public class Proxmark3NewTerminalInitActivity extends BaseActivity {
|
||||
|
||||
private RadioGroup rdoGroupTerminalSelect;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_pm3_terminal_init);
|
||||
|
||||
rdoGroupTerminalSelect = findViewById(R.id.rdoGroupTerminalSelect);
|
||||
rdoGroupTerminalSelect.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
switch (checkedId) {
|
||||
case R.id.rdoBtnFullTerminal:
|
||||
Commons.setTerminalType(0);
|
||||
break;
|
||||
case R.id.rdoBtnSimpleTerminal:
|
||||
Commons.setTerminalType(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
rdoGroupTerminalSelect.check(checkTerminalType());
|
||||
|
||||
findViewById(R.id.btnFwFlash).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(activity, PM3FlasherMainActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnGoToTermux).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (rdoGroupTerminalSelect.getCheckedRadioButtonId() == -1) {
|
||||
ToastUtil.show(context, getString(R.string.tips_terminal_select_like), false);
|
||||
return;
|
||||
}
|
||||
if (Commons.isPM3ClientDecompressed()) {
|
||||
go();
|
||||
} else {
|
||||
Proxmark3Installer.installIfNeed(activity, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
go();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CheckBox box = findViewById(R.id.ckBoxAutoGoTermux);
|
||||
box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Commons.setAutoGoToTerminal(isChecked);
|
||||
}
|
||||
});
|
||||
box.setChecked(Commons.getAutoGoToTerminal());
|
||||
|
||||
// Must have init pm3 client and check auto go and have the terminal type selected!
|
||||
if (Commons.getAutoGoToTerminal()
|
||||
&& Commons.isPM3ClientDecompressed()
|
||||
&& Commons.getTerminalType() != -1) {
|
||||
go();
|
||||
}
|
||||
}
|
||||
|
||||
public void go() {
|
||||
if (Commons.getTerminalType() == 0) {
|
||||
startActivity(new Intent(this, TermuxActivity.class));
|
||||
} else {
|
||||
startActivity(new Intent(this, Proxmark3Rdv4RRGRedTeamConsoleActivity.class));
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private int checkTerminalType() {
|
||||
switch (Commons.getTerminalType()) {
|
||||
case -1:
|
||||
default:
|
||||
return -1;
|
||||
|
||||
case 0:
|
||||
return R.id.rdoBtnFullTerminal;
|
||||
|
||||
case 1:
|
||||
return R.id.rdoBtnSimpleTerminal;
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.rrg.rdv.activities.proxmark3.rdv4_rrg;
|
||||
|
||||
import cn.rrg.console.define.ICommandTools;
|
||||
import cn.rrg.natives.Proxmark3RRGRdv4Tools;
|
||||
|
||||
public class Proxmark3Rdv4RRGConsoleActivity
|
||||
extends Proxmark3ConsoleActivity {
|
||||
|
||||
@Override
|
||||
protected ICommandTools initCMD() {
|
||||
//替换为rdv4的工具类!
|
||||
return new Proxmark3RRGRdv4Tools();
|
||||
}
|
||||
}
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
package cn.rrg.rdv.activities.proxmark3.rdv4_rrg;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.termux.app.TermuxService;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rrg.freo.IORedirector;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.adapter.EasyBtnAdapter;
|
||||
import cn.rrg.rdv.javabean.EasyCMDEntry;
|
||||
import cn.rrg.rdv.util.EasyBtnUtil;
|
||||
import cn.dxl.common.widget.DoubleInputDialog;
|
||||
import cn.dxl.common.util.ArrayUtils;
|
||||
import cn.dxl.common.widget.ToastUtil;
|
||||
import cn.dxl.common.util.ViewUtil;
|
||||
import cn.rrg.rdv.util.Paths;
|
||||
|
||||
public class Proxmark3Rdv4RRGRedTeamConsoleActivity
|
||||
extends Proxmark3Rdv4RRGConsoleActivity {
|
||||
|
||||
private GridView gridViewShowEasyButton;
|
||||
private EasyBtnAdapter adapter;
|
||||
private List<EasyCMDEntry> easyCMDEntries = new ArrayList<>();
|
||||
|
||||
//构造一个简单的对话框,用于提示需要的操作!
|
||||
private AlertDialog operaDialog;
|
||||
//显示添加按钮!
|
||||
private TextView txtAddEasyBtn;
|
||||
//缓存当前要操作的项目!
|
||||
private int operaPosition;
|
||||
//配置文件操作工具
|
||||
private EasyBtnUtil easyBtnUtil = new EasyBtnUtil();
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
btnGui.setText(getString(R.string.console_dynamic_btn));
|
||||
//隐藏不需要的区域!
|
||||
skBarConsoleViewScale.setProgress(10);
|
||||
//设置pm3的输入提示
|
||||
edtInputCmd.setHint(getString(R.string.pm3_hint));
|
||||
|
||||
//不能让用户关闭通讯!
|
||||
btnStop.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
stopPM3Client4KeyBorad();
|
||||
}
|
||||
});
|
||||
|
||||
initViews();
|
||||
initActions();
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 更改工作目录!
|
||||
IORedirector.chdir(TermuxService.HOME_PATH + File.separator + Paths.PM3_PATH);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
//先初始化视图!
|
||||
guiView = ViewUtil.inflate(this, R.layout.easy_button_container);
|
||||
|
||||
gridViewShowEasyButton = findViewById(R.id.gridViewShowEasyButton);
|
||||
adapter = new EasyBtnAdapter(this, R.layout.item_easy__btn, easyCMDEntries);
|
||||
gridViewShowEasyButton.setAdapter(adapter);
|
||||
|
||||
//添加数据!
|
||||
EasyCMDEntry[] buttons = getCMDs();
|
||||
if (buttons != null) {
|
||||
easyCMDEntries.addAll(Arrays.asList(getCMDs()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
txtAddEasyBtn = findViewById(R.id.txtAddEasyBtn);
|
||||
}
|
||||
|
||||
private void initActions() {
|
||||
//列表项单击时执行相应的命令!
|
||||
gridViewShowEasyButton.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
//点击了对应项时,取出对应的实体,进行命令发送!
|
||||
EasyCMDEntry entry = easyCMDEntries.get(position);
|
||||
if (entry != null) {
|
||||
String cmd = entry.getCommand();
|
||||
if (cmd != null) {
|
||||
//先提交命令到输入框
|
||||
putCMDAndClosePop(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//列表项长按时显示相关的操作项!
|
||||
gridViewShowEasyButton.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
operaDialog.show();
|
||||
operaPosition = position;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
//构建一个用于显示操作的对话框!
|
||||
operaDialog = new AlertDialog.Builder(this).setItems(new String[]{getString(R.string.delete), getString(R.string.modify)}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final EasyCMDEntry entry = easyCMDEntries.get(operaPosition);
|
||||
if (which == 0) {
|
||||
new AlertDialog.Builder(context).setTitle(R.string.warning).setMessage(getString(R.string.enter_delete)
|
||||
+ "\n\nItem name: " + entry.getCmdName())
|
||||
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//做出删除操作!
|
||||
easyCMDEntries.remove(operaPosition);
|
||||
adapter.notifyDataSetChanged();
|
||||
//TODO 本地配置删除!
|
||||
if (easyBtnUtil.deleteButton(0, operaPosition)) {
|
||||
ToastUtil.show(context, getString(R.string.success), false);
|
||||
} else {
|
||||
ToastUtil.show(context, getString(R.string.failed), false);
|
||||
}
|
||||
}
|
||||
}).setNegativeButton(getString(R.string.no), null).show();
|
||||
} else {
|
||||
//做出修改操作,先取出原来的数据!
|
||||
DoubleInputDialog inputDialog = new DoubleInputDialog(context);
|
||||
inputDialog.setTitle(R.string.button_edit);
|
||||
inputDialog.getHint1().setText(R.string.title_input);
|
||||
inputDialog.getHint2().setText(R.string.command_input);
|
||||
//设置到视图上!
|
||||
inputDialog.getEdtInput1().setText(entry.getCmdName());
|
||||
inputDialog.getEdtInput2().setText(entry.getCommand());
|
||||
//然后设置操作回调并且显示!
|
||||
inputDialog.setSaveListener(new DoubleInputDialog.OnSaveListener() {
|
||||
@Override
|
||||
public void onSave(String[] content) {
|
||||
//操作成功,进行内存更新!
|
||||
entry.setCmdName(content[0]);
|
||||
entry.setCommand(content[1]);
|
||||
adapter.notifyDataSetChanged();
|
||||
//TODO 然后进行本地更新!
|
||||
if (easyBtnUtil.updateButton(0, operaPosition, entry.getCmdName(), entry.getCommand())) {
|
||||
//现在的话已经更新成功
|
||||
ToastUtil.show(context, getString(R.string.success), false);
|
||||
} else {
|
||||
ToastUtil.show(context, getString(R.string.failed), false);
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
}).create();
|
||||
//设置添加按钮的动作!
|
||||
txtAddEasyBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//做出增加操作,构建一个实体用于保存!
|
||||
EasyCMDEntry entry = new EasyCMDEntry();
|
||||
DoubleInputDialog inputDialog = new DoubleInputDialog(context);
|
||||
inputDialog.setTitle(R.string.btn_add);
|
||||
inputDialog.getHint1().setText(R.string.title_input);
|
||||
inputDialog.getHint2().setText(R.string.command_input);
|
||||
//然后设置操作回调并且显示!
|
||||
inputDialog.setSaveListener(new DoubleInputDialog.OnSaveListener() {
|
||||
@Override
|
||||
public void onSave(String[] content) {
|
||||
//操作成功,进行内存更新!
|
||||
entry.setCmdName(content[0]);
|
||||
entry.setCommand(content[1]);
|
||||
easyCMDEntries.add(entry);
|
||||
adapter.notifyDataSetChanged();
|
||||
//TODO 然后进行本地更新!
|
||||
if (easyBtnUtil.inertButton(0, entry.getCmdName(), entry.getCommand())) {
|
||||
//现在的话已经更新成功
|
||||
ToastUtil.show(context, getString(R.string.success), false);
|
||||
} else {
|
||||
ToastUtil.show(context, getString(R.string.failed), false);
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private EasyCMDEntry[] getCMDs() {
|
||||
//默认先拿0组的按钮,以后做多组分页的时候再做其他组的处理!
|
||||
List<EasyCMDEntry> btns = easyBtnUtil.getButtons(0);
|
||||
if (btns == null) return null;
|
||||
return ArrayUtils.list2Arr(btns);
|
||||
}
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
package cn.rrg.rdv.activities.tools;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.termux.app.TermuxActivity;
|
||||
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.main.BaseActivity;
|
||||
import cn.rrg.rdv.activities.main.PM3FlasherMainActivity;
|
||||
import cn.rrg.rdv.util.Commons;
|
||||
import cn.rrg.rdv.util.Proxmark3Installer;
|
||||
|
||||
public class Proxmark3NewTerminalInitActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_pm3_terminal_init);
|
||||
|
||||
|
||||
findViewById(R.id.btnFwFlash).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(activity, PM3FlasherMainActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnGoToTermux).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (Commons.isPM3ClientDecompressed()) {
|
||||
go();
|
||||
} else {
|
||||
Proxmark3Installer.installIfNeed(activity, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
go();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CheckBox box = findViewById(R.id.ckBoxAutoGoTermux);
|
||||
box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Commons.setAutoGoToTermux(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
// Must have init pm3 client and check auto go!
|
||||
if (Commons.getAutoGoToTermux() && Commons.isPM3ClientDecompressed()) {
|
||||
go();
|
||||
}
|
||||
}
|
||||
|
||||
public void go() {
|
||||
startActivity(new Intent(this, TermuxActivity.class));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ public class Properties {
|
||||
public static String k_app_language = "language";
|
||||
//Key files select history!
|
||||
public static String k_common_rw_keyfile_selected = "commonRWKeyFilesSelected";
|
||||
// Auto Goto Termux View
|
||||
public static String k_auto_goto_termux = "autoGotoTermuxView";
|
||||
// Auto Goto terminal View
|
||||
public static String k_auto_goto_terminal = "autoGotoTermuxView";
|
||||
// The type of terminal
|
||||
public static String k_terminal_type = "terminal_type";
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import cn.rrg.rdv.activities.connect.PN53XUsbBulkTransferActivity;
|
||||
import cn.rrg.rdv.activities.connect.Proxmark3Rdv4RRGConnectActivity;
|
||||
import cn.rrg.rdv.activities.main.GeneralNfcDeviceMain;
|
||||
import cn.rrg.rdv.activities.main.PN53XNfcMain;
|
||||
import cn.rrg.rdv.activities.tools.Proxmark3NewTerminalInitActivity;
|
||||
import cn.rrg.rdv.activities.proxmark3.rdv4_rrg.Proxmark3NewTerminalInitActivity;
|
||||
import cn.rrg.rdv.binder.BannerImageViewBinder;
|
||||
import cn.rrg.rdv.binder.DeviceInfoViewBinder;
|
||||
import cn.rrg.rdv.binder.TitleTextViewBinder;
|
||||
|
||||
@@ -19,15 +19,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.NumberPicker;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import cn.dxl.common.util.AppUtil;
|
||||
import cn.dxl.common.util.AssetsUtil;
|
||||
import cn.dxl.common.util.LogUtils;
|
||||
import cn.dxl.common.util.RestartUtils;
|
||||
import cn.dxl.common.widget.ToastUtil;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.binder.ItemSingleTextBean;
|
||||
import cn.rrg.rdv.binder.ItemTextBinder;
|
||||
@@ -37,9 +31,7 @@ import cn.rrg.rdv.javabean.ItemTextBean;
|
||||
import cn.rrg.rdv.javabean.ItemToggleBean;
|
||||
import cn.rrg.rdv.javabean.TitleBean;
|
||||
import cn.rrg.rdv.util.Commons;
|
||||
import cn.rrg.rdv.util.Paths;
|
||||
import cn.rrg.rdv.util.Proxmark3Installer;
|
||||
import cn.rrg.rdv.widget.ProDialog1;
|
||||
import me.drakeet.multitype.Items;
|
||||
import me.drakeet.multitype.MultiTypeAdapter;
|
||||
|
||||
@@ -115,7 +107,7 @@ public class MainSettingsFragment
|
||||
languageItem.setMessage(languageTran());
|
||||
items.add(languageItem);
|
||||
|
||||
items.add(new TitleBean(getString(R.string.tips_res_init)));
|
||||
items.add(new TitleBean(getString(R.string.tips_pm3_settings)));
|
||||
|
||||
ItemTextBean pm3Res = new ItemTextBean(getString(R.string.title_pm3_res_init)) {
|
||||
@Override
|
||||
@@ -127,6 +119,36 @@ public class MainSettingsFragment
|
||||
pm3Res.setMessage(Commons.isPM3ResInitialled() ? getString(R.string.initialized) : getString(R.string.uninitialized));
|
||||
items.add(pm3Res);
|
||||
|
||||
ItemToggleBean pm3AutoGo = new ItemToggleBean(getString(R.string.title_pm3_autogo_setting)) {
|
||||
@Override
|
||||
public void onChange(View view, int pos, boolean checked) {
|
||||
Commons.setAutoGoToTerminal(checked);
|
||||
}
|
||||
};
|
||||
pm3AutoGo.setSubTitle(getString(R.string.title_sub_pm3_autogo_setting));
|
||||
pm3AutoGo.setChecked(Commons.getAutoGoToTerminal());
|
||||
items.add(pm3AutoGo);
|
||||
|
||||
ItemTextBean pm3TerminalTypeItem = new ItemTextBean(getString(R.string.title_terminal_type_setting)) {
|
||||
@Override
|
||||
public void onClick(View view, int pos) {
|
||||
String[] languages = new String[]{getString(R.string.item_full_terminal_view), getString(R.string.item_simple_terminal_view)};
|
||||
new AlertDialog.Builder(view.getContext())
|
||||
.setTitle(R.string.tips_terminal_select_like)
|
||||
.setItems(languages, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Commons.setTerminalType(which);
|
||||
setMessage(currentTerminalType());
|
||||
multiTypeAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
};
|
||||
pm3TerminalTypeItem.setSubTitle(getString(R.string.title_sub_terminal_type_setting));
|
||||
pm3TerminalTypeItem.setMessage(currentTerminalType());
|
||||
items.add(pm3TerminalTypeItem);
|
||||
|
||||
items.add(new TitleBean(getString(R.string.other)));
|
||||
|
||||
ItemTextBean openSourceItem = new ItemTextBean(getString(R.string.title_open_source)) {
|
||||
@@ -200,4 +222,16 @@ public class MainSettingsFragment
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private String currentTerminalType() {
|
||||
switch (Commons.getTerminalType()) {
|
||||
case -1:
|
||||
default:
|
||||
return getString(R.string.unselected);
|
||||
case 0:
|
||||
return getString(R.string.item_full_terminal_view);
|
||||
case 1:
|
||||
return getString(R.string.item_simple_terminal_view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.Set;
|
||||
|
||||
import cn.dxl.common.util.AppUtil;
|
||||
import cn.dxl.common.util.FileUtils;
|
||||
import cn.dxl.common.util.LogUtils;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.tools.DumpEditActivity;
|
||||
import cn.rrg.rdv.application.Properties;
|
||||
@@ -258,13 +257,30 @@ public class Commons {
|
||||
new File(Paths.PM3_IMAGE_BOOT_FILE).exists();
|
||||
}
|
||||
|
||||
public static void setAutoGoToTermux(boolean auto) {
|
||||
public static void setAutoGoToTerminal(boolean auto) {
|
||||
getPrivatePreferences().edit()
|
||||
.putBoolean(Properties.k_auto_goto_termux, auto)
|
||||
.putBoolean(Properties.k_auto_goto_terminal, auto)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static boolean getAutoGoToTermux() {
|
||||
return getPrivatePreferences().getBoolean(Properties.k_auto_goto_termux, false);
|
||||
public static boolean getAutoGoToTerminal() {
|
||||
return getPrivatePreferences().getBoolean(Properties.k_auto_goto_terminal, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set terminal type
|
||||
*
|
||||
* @param type 0 = full terminal view
|
||||
* 1= simple terminal view
|
||||
*/
|
||||
public static void setTerminalType(int type) {
|
||||
getPrivatePreferences().edit()
|
||||
.putInt(Properties.k_terminal_type, type)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static int getTerminalType() {
|
||||
return getPrivatePreferences()
|
||||
.getInt(Properties.k_terminal_type, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ public interface Paths {
|
||||
String MCT_PATH = "MifareClassicTool";
|
||||
String MTools_PATH = "MTools";
|
||||
String HARDNESTED_PATH = "hardnested";
|
||||
String TABLES_PATH = "tables";
|
||||
String LOG_PATH = "log";
|
||||
String PM3_PATH = "proxmark3";
|
||||
String COMMON_PATH = "common";
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
@@ -9,18 +9,63 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="500dp"
|
||||
<LinearLayout
|
||||
android:id="@+id/layout1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="480dp"
|
||||
android:layout_below="@id/sbh"
|
||||
android:src="@drawable/termux_view_example" />
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/termux_view_example" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/simple_console_view_example" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rdoGroupTerminalSelect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/layout1"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rdoBtnFullTerminal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/title_select_full_terminal" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rdoBtnSimpleTerminal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/title_select_simple_terminal" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/layout1"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_above="@id/layout3"
|
||||
android:layout_marginBottom="26dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
@@ -29,63 +74,63 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tips_fw_client_version_same"
|
||||
android:textColor="@color/colorTextNormal"
|
||||
android:textSize="16sp" />
|
||||
android:textColor="@color/colorTextWeaker"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/tips_check_auto_go_termux"
|
||||
android:textSize="16sp" />
|
||||
android:textColor="@color/colorTextWeaker"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout1"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/layout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:text="Client Update(Github)"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<TextView
|
||||
android:id="@+id/btnFwFlash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:padding="12dp"
|
||||
android:text="@string/title_flash_firmware_otg"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
android:textColor="@color/md_blue_800"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGoToTermux"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:text="@string/title_go_termux"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
android:gravity="end"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/ckBoxAutoGoTermux"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/auto_go" />
|
||||
<Button
|
||||
android:id="@+id/btnGoToTermux"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:text="@string/go2"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/ckBoxAutoGoTermux"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/auto_go" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user