java转smali,动手撸了一个(改版界面更新功能更新)
本帖最后由 AcsZeg 于 2019-6-25 09:27 编辑最近在破解时用到之前下载的java2smali,发现jdk升级后运用别人软件就报错了,所以自己动手写了个,
java2smaliv1.0.2版 功能
当前支持java转smali 支持代码中import android.*
配置好java运行环境
.net 4.0
java2smaliv1.0.3版 功能增加
0.正常功能同上。
1.有人在帖子提到要增加smali转java的 所以加上了 直接调用新版jadx 可以打开apk文件 smali文件 。
(注意:打开apk文件 总所周知jadx分析占用内存很大所以在bat中直接设置9G的内存建议90M以上apk要有9G的内存;打开单个smali文件:没有内存建议)
2.增加了android killer分析后的smali文件转dex的功能 emmm你懂的 整个编译不过时候该菊部编译了。
改名AndroidACS
0.由于有人说界面太丑 所以学了下界面的 改了点(因为图标啥的都是自己ps的,略微简陋,有学ui的可以教教我),加了代码高亮
1.增加了smali,apk转java自定义内存大小
2.修复了上个版本的关闭进程bug,【预】增加安卓7.0抓包证书导入系统(测试中)。
2019.06.25测试:最高兼容Jdk1.8 如果报错Version56之类的麻烦设置下jdk的专用路径或者将jdk12改成1.8
下载:https://www.lanzouj.com/i4fab9e 密码:acszeg
链接:https://pan.baidu.com/s/14uQMysRn7Kl7V1azu3Qz0A密码:tlai AcsZeg 发表于 2019-8-8 18:22
贴个代码吧
package com.cyjh.elfin.floatview;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.graphics.Point;
import android.os.Build.VERSION;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.cyjh.elfin.AppContext;
import com.cyjh.elfin.dialog.HideFWDialog;
import com.cyjh.elfin.dialog.HideFWDialog.OnHideCancelClickListener;
import com.cyjh.elfin.dialog.HideFWDialog.OnHideOKClickListener;
import com.cyjh.elfin.dialog.ScriptRTDDialog;
import com.cyjh.elfin.dialog.ScriptUIDialog;
import com.cyjh.elfin.log.CommonLog;
import com.cyjh.elfin.util.AppDeviceUtils;
import com.cyjh.elfin.util.NetworkUtils;
import com.cyjh.mq.sdk.MqRunner;
import com.cyjh.share.bean.response.ScriptStartRunResponse;
import com.cyjh.share.mvp.presenter.AppStatisticsPresenter;
import com.cyjh.share.mvp.presenter.AppStatisticsPresenter.OnClickScriptRunCallback;
import com.cyjh.share.util.GsonExUtil;
import com.cyjh.share.util.ToastUtils;
public class ElfinFloatView
extends LinearLayout
implements View.OnClickListener
{
private static final int ELFIN_ORIENTATION_DOWN = 3;
private static final int ELFIN_ORIENTATION_LEFT = 4;
private static final int ELFIN_ORIENTATION_RIGHT = 2;
private static final int ELFIN_ORIENTATION_UP = 1;
private static final int LIMIT_ANGLE = 60;
private static final int LIMIT_COUNT = 2;
private static final int TIME_ADSORPTION = 2000;
private static final int TIME_INTERVAL = 1000;
private static final int TIME_TRANSLUCENT = 5000;
private CommonLog commonLog = new CommonLog();
private boolean isPreventRepeatedClick = false;
private AppContext mAppContext;
private Context mContext;
private CountDownTimer mCountDownTimer = new CountDownTimer(7000L, 1000L)
{
public void onFinish()
{
int[] arrayOfInt = new int;
ElfinFloatView.this.mImageViewElfin.getLocationOnScreen(arrayOfInt);
if (arrayOfInt >= (AppDeviceUtils.getResolution(ElfinFloatView.this.getContext()).x - ElfinFloatView.this.mDownX) / 2.0F)
{
if (ElfinFloatView.this.mAppContext.STATE_SCRIPT == 2)
{
ElfinFloatView.this.mImageViewElfin.setImageResource(2130837667);
return;
}
ElfinFloatView.this.mImageViewElfin.setImageResource(2130837656);
return;
}
if (ElfinFloatView.this.mAppContext.STATE_SCRIPT == 2)
{
ElfinFloatView.this.mImageViewElfin.setImageResource(2130837669);
return;
}
ElfinFloatView.this.mImageViewElfin.setImageResource(2130837660);
}
public void onTick(long paramAnonymousLong)
{
if ((paramAnonymousLong <= 3000L) && (paramAnonymousLong > 2000L))
{
ElfinFloatView.this.mImageViewElfin.setAlpha(0.5F);
ElfinFloatView.this.changeToolBarState(false);
}
}
};
private DeleteFloatView mDeleteFloatView;
private float mDownX;
private float mDownY;
private MyHandler mHandler;
private ImageView mImageViewElfin;
public ImageView mImgRunAndStop;
private float mLastX;
private float mLastY;
private LinearLayout mLinearLayoutElfin;
private LinearLayout mLinearLayoutInfo;
private LinearLayout mLinearLayoutRun;
private LinearLayout mLinearLayoutSetting;
private LinearLayout mLinearLayoutTools;
private int mLockState;
private float mRawCurrentX;
private float mRawCurrentY;
private ScriptRTDDialog mScriptRTDDialog;
private ScriptUIDialog mScriptUIDialog;
public TextView mTvRunScript;
private WindowManager mWindowManager;
private WindowManager.LayoutParams mWindowManagerParams;
private HideFWDialog.OnHideCancelClickListener onHideCancelClickListener = new HideFWDialog.OnHideCancelClickListener()
{
public void onClick(View paramAnonymousView)
{
ElfinFloatView.this.moveToEdge();
}
};
private HideFWDialog.OnHideOKClickListener onHideOKClickListener = new HideFWDialog.OnHideOKClickListener()
{
public void onClick(View paramAnonymousView)
{
ElfinFloatView.this.toggleElfinVisbility();
}
};
private final View.OnTouchListener onTouchListener = new View.OnTouchListener()
{
private static final int MIN_MOVEMENT = 5;
private GestureDetector gestureDetector = new GestureDetector(ElfinFloatView.this.getContext(), this.gestureListener);
private ElfinFloatView.ElfinGestureListener gestureListener = new ElfinFloatView.ElfinGestureListener(ElfinFloatView.this, null);
public float getDistance(float paramAnonymousFloat1, float paramAnonymousFloat2, float paramAnonymousFloat3, float paramAnonymousFloat4)
{
return (float)Math.sqrt(Math.pow(paramAnonymousFloat1 - paramAnonymousFloat3, 2.0D) + Math.pow(paramAnonymousFloat2 - paramAnonymousFloat4, 2.0D));
}
public boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent)
{
if (this.gestureDetector.onTouchEvent(paramAnonymousMotionEvent)) {
return true;
}
switch (paramAnonymousMotionEvent.getAction())
{
default:
return false;
case 2:
if (ElfinFloatView.this.mLinearLayoutTools.getVisibility() == 0) {
return true;
}
ElfinFloatView.access$1102(ElfinFloatView.this, ElfinFloatView.this.mRawCurrentX);
ElfinFloatView.access$1202(ElfinFloatView.this, ElfinFloatView.this.mRawCurrentY);
ElfinFloatView.access$702(ElfinFloatView.this, paramAnonymousMotionEvent.getRawX());
ElfinFloatView.access$802(ElfinFloatView.this, paramAnonymousMotionEvent.getRawY() - AppDeviceUtils.getStatusBarHeight(ElfinFloatView.this.getContext()));
if (getDistance(ElfinFloatView.this.mLastX, ElfinFloatView.this.mLastY, ElfinFloatView.this.mRawCurrentX, ElfinFloatView.this.mRawCurrentY) <= 5.0F) {
return true;
}
double d = Math.toDegrees(Math.atan2(ElfinFloatView.this.mRawCurrentY - ElfinFloatView.this.mLastY, ElfinFloatView.this.mRawCurrentX - ElfinFloatView.this.mLastX));
if ((d < -60.0D) && (d > -120.0D)) {}
do
{
i = 1;
break;
if ((d >= -60.0D) && (d <= 60.0D))
{
i = 2;
break;
}
if ((d > 60.0D) && (d < 120.0D))
{
i = 3;
break;
}
} while ((d < 120.0D) && (d > -120.0D));
int i = 4;
ElfinFloatView.this.updateFloatViewDirection(i);
ElfinFloatView.this.updateFloatViewPosition((int)(ElfinFloatView.this.mRawCurrentX - ElfinFloatView.this.mDownX), (int)(ElfinFloatView.this.mRawCurrentY - ElfinFloatView.this.mDownY));
if (ElfinFloatView.this.mDeleteFloatView.getVisibility() == 8) {
ElfinFloatView.this.mDeleteFloatView.setVisibility(0);
}
if (ElfinFloatView.this.isHide())
{
ElfinFloatView.this.mDeleteFloatView.setHide();
return true;
}
ElfinFloatView.this.mDeleteFloatView.setNormal();
return true;
case 1:
ElfinFloatView.access$702(ElfinFloatView.this, paramAnonymousMotionEvent.getRawX());
ElfinFloatView.access$802(ElfinFloatView.this, paramAnonymousMotionEvent.getRawY() - AppDeviceUtils.getStatusBarHeight(ElfinFloatView.this.getContext()));
if (ElfinFloatView.this.isHide())
{
paramAnonymousView = new HideFWDialog(ElfinFloatView.this.getContext());
paramAnonymousView.setOnHideOKClickListener(ElfinFloatView.this.onHideOKClickListener);
paramAnonymousView.setOnHideCancelClickListener(ElfinFloatView.this.onHideCancelClickListener);
paramAnonymousView.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface paramAnonymous2DialogInterface)
{
ElfinFloatView.this.moveToEdge();
}
});
paramAnonymousView.show();
return false;
}
if (ElfinFloatView.this.mLinearLayoutTools.getVisibility() == 8) {
ElfinFloatView.this.moveToEdge();
}
ElfinFloatView.this.mDeleteFloatView.setVisibility(8);
ElfinFloatView.this.mCountDownTimer.start();
return false;
}
ElfinFloatView.this.resetElfinState();
ElfinFloatView.access$702(ElfinFloatView.this, paramAnonymousMotionEvent.getRawX());
ElfinFloatView.access$802(ElfinFloatView.this, paramAnonymousMotionEvent.getRawY() - AppDeviceUtils.getStatusBarHeight(ElfinFloatView.this.getContext()));
ElfinFloatView.access$102(ElfinFloatView.this, paramAnonymousMotionEvent.getX());
ElfinFloatView.access$902(ElfinFloatView.this, paramAnonymousMotionEvent.getY());
return false;
}
};
public ElfinFloatView(Context paramContext, DeleteFloatView paramDeleteFloatView)
{
super(paramContext);
this.mAppContext = ((AppContext)paramContext);
initView();
initWindow();
this.mDeleteFloatView = paramDeleteFloatView;
this.mCountDownTimer.start();
}
private void initElfinImageView()
{
this.mImageViewElfin = ((ImageView)findViewById(2131755300));
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837662);
this.mTvRunScript.setText(getContext().getString(2131296412));
this.mImgRunAndStop.setImageResource(2130837678);
}
else
{
this.mImageViewElfin.setImageResource(2130837649);
this.mTvRunScript.setText(getContext().getString(2131296410));
this.mImgRunAndStop.setImageResource(2130837676);
}
this.mImageViewElfin.setOnClickListener(null);
this.mImageViewElfin.setOnTouchListener(this.onTouchListener);
}
private void initView()
{
LayoutInflater.from(getContext()).inflate(2130968659, this);
this.mLinearLayoutElfin = ((LinearLayout)findViewById(2131755291));
this.mLinearLayoutTools = ((LinearLayout)findViewById(2131755292));
this.mLinearLayoutRun = ((LinearLayout)findViewById(2131755293));
this.mLinearLayoutInfo = ((LinearLayout)findViewById(2131755296));
this.mLinearLayoutSetting = ((LinearLayout)findViewById(2131755298));
this.mTvRunScript = ((TextView)findViewById(2131755295));
this.mImgRunAndStop = ((ImageView)findViewById(2131755294));
this.mLinearLayoutRun.setOnClickListener(this);
this.mLinearLayoutInfo.setOnClickListener(this);
this.mLinearLayoutSetting.setOnClickListener(this);
initElfinImageView();
}
private void initWindow()
{
this.mWindowManager = ((WindowManager)getContext().getSystemService("window"));
this.mWindowManagerParams = new WindowManager.LayoutParams();
if (Build.VERSION.SDK_INT >= 26) {
this.mWindowManagerParams.type = 2038;
} else if ((Build.VERSION.SDK_INT >= 19) && (Build.VERSION.SDK_INT < 24)) {
this.mWindowManagerParams.type = 2005;
} else {
this.mWindowManagerParams.type = 2002;
}
this.mWindowManagerParams.format = 1;
this.mWindowManagerParams.flags = 40;
this.mWindowManagerParams.gravity = 51;
this.mWindowManagerParams.x = (AppDeviceUtils.getResolution(getContext()).x - this.mLinearLayoutElfin.getLayoutParams().width);
this.mWindowManagerParams.y = (AppDeviceUtils.getResolution(getContext()).y / 4);
this.mRawCurrentY = (AppDeviceUtils.getResolution(getContext()).y / 4);
this.mWindowManagerParams.width = this.mLinearLayoutElfin.getLayoutParams().width;
this.mWindowManagerParams.height = this.mLinearLayoutElfin.getLayoutParams().height;
}
private boolean isHide()
{
int[] arrayOfInt1 = new int;
this.mImageViewElfin.getLocationOnScreen(arrayOfInt1);
int[] arrayOfInt2 = new int;
this.mDeleteFloatView.getLocationOnScreen(arrayOfInt2);
return (arrayOfInt1 > arrayOfInt2) && (arrayOfInt1 < arrayOfInt2 + this.mDeleteFloatView.geTextViewtWidth()) && (arrayOfInt1 > arrayOfInt2);
}
private void moveToEdge()
{
if (this.mDeleteFloatView.getVisibility() == 0)
{
this.mDeleteFloatView.setVisibility(8);
this.mDeleteFloatView.setNormal();
}
int[] arrayOfInt = new int;
this.mImageViewElfin.getLocationOnScreen(arrayOfInt);
if (arrayOfInt >= (AppDeviceUtils.getResolution(getContext()).x - this.mDownX) / 2.0F)
{
updateFloatViewPosition(AppDeviceUtils.getResolution(getContext()).x, (int)(this.mRawCurrentY - this.mDownY));
this.mLinearLayoutElfin.removeView(this.mLinearLayoutTools);
this.mLinearLayoutElfin.addView(this.mLinearLayoutTools, 0);
}
else
{
updateFloatViewPosition(0, (int)(this.mRawCurrentY - this.mDownY));
this.mLinearLayoutElfin.removeView(this.mLinearLayoutTools);
this.mLinearLayoutElfin.addView(this.mLinearLayoutTools, 1);
}
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837662);
return;
}
this.mImageViewElfin.setImageResource(2130837649);
}
private void resetElfinState()
{
this.mCountDownTimer.cancel();
this.mImageViewElfin.setAlpha(1.0F);
}
private void updateFloatViewDirection(int paramInt)
{
switch (paramInt)
{
default:
return;
case 4:
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837668);
return;
}
this.mImageViewElfin.setImageResource(2130837657);
return;
case 3:
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837666);
return;
}
this.mImageViewElfin.setImageResource(2130837653);
return;
case 2:
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837670);
return;
}
this.mImageViewElfin.setImageResource(2130837661);
return;
}
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837662);
return;
}
this.mImageViewElfin.setImageResource(2130837649);
}
public void changeToolBarState(boolean paramBoolean)
{
updateFloatViewDirection(1);
if (paramBoolean)
{
if (this.mLinearLayoutTools.getVisibility() == 8) {
this.mLinearLayoutTools.setVisibility(0);
}
}
else if (this.mLinearLayoutTools.getVisibility() == 0) {
this.mLinearLayoutTools.setVisibility(8);
}
}
public WindowManager.LayoutParams getLayoutParams()
{
return this.mWindowManagerParams;
}
public Context getmContext()
{
return this.mContext;
}
public void onClick(View paramView)
{
resetElfinState();
int i = paramView.getId();
if (i != 2131755293)
{
if (i != 2131755296)
{
if (i == 2131755298)
{
this.mScriptUIDialog = new ScriptUIDialog(getContext());
this.mScriptUIDialog.mContext = this.mContext;
this.mScriptUIDialog.show();
}
}
else
{
this.mScriptRTDDialog = new ScriptRTDDialog(getContext());
this.mScriptRTDDialog.show();
}
}
else
{
if (this.isPreventRepeatedClick) {
return;
}
this.isPreventRepeatedClick = true;
if (MqRunner.getInstance().isScriptStarted())
{
MqRunner.getInstance().stop();
this.isPreventRepeatedClick = false;
}
else
{
if (!NetworkUtils.isAvailable(paramView.getContext()))
{
ToastUtils.showToastLong(getContext(), getContext().getString(2131296450));
this.isPreventRepeatedClick = false;
return;
}
AppStatisticsPresenter.getStatisticsPresenter().setClickScriptRunCallback(new AppStatisticsPresenter.OnClickScriptRunCallback()
{
public void onCallbackFail()
{
ElfinFloatView.access$302(ElfinFloatView.this, false);
}
public void onCallbackSuc(Object paramAnonymousObject)
{
paramAnonymousObject = (String)paramAnonymousObject;
if (!TextUtils.isEmpty(paramAnonymousObject))
{
paramAnonymousObject = (ScriptStartRunResponse)GsonExUtil.parsData(paramAnonymousObject, ScriptStartRunResponse.class);
if ((paramAnonymousObject != null) && (paramAnonymousObject.Code == 200))
{
if (ElfinFloatView.this.mAppContext.STATE_SCRIPT == 1) {
ElfinFloatView.this.mAppContext.runScript();
}
}
else if (paramAnonymousObject != null) {
ToastUtils.showToastLong(AppContext.getInstance(), paramAnonymousObject.Message);
} else {
ToastUtils.showToastLong(AppContext.getInstance(), 2131296429);
}
}
else
{
ToastUtils.showToastLong(AppContext.getInstance(), 2131296428);
}
AppStatisticsPresenter.getStatisticsPresenter().cleanCallback();
ElfinFloatView.access$302(ElfinFloatView.this, false);
}
}).loadScriptStartRunStatistics(AppContext.getInstance(), "", "PreStart");
}
if (this.mHandler == null) {
this.mHandler = new MyHandler(null);
}
this.mHandler.removeCallbacksAndMessages(null);
this.mHandler.postDelayed(new Runnable()
{
public void run()
{
ElfinFloatView.access$302(ElfinFloatView.this, false);
}
}, 3000L);
}
this.mCountDownTimer.start();
}
protected void onDetachedFromWindow()
{
if (this.mHandler != null) {
this.mHandler.removeCallbacksAndMessages(null);
}
super.onDetachedFromWindow();
}
public void posContorlbar(float paramFloat, int paramInt)
{
CommonLog localCommonLog = this.commonLog;
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("postion>>>");
localStringBuilder.append(paramFloat);
localCommonLog.e(localStringBuilder.toString());
this.mLockState = paramInt;
if (this.mLockState != 0) {
this.mImageViewElfin.setOnTouchListener(null);
}
if (this.mDeleteFloatView.getVisibility() == 0)
{
this.mDeleteFloatView.setVisibility(8);
this.mDeleteFloatView.setNormal();
}
updateFloatViewPosition(AppDeviceUtils.getResolution(getContext()).x, (int)(AppDeviceUtils.getResolution(getContext()).y * paramFloat - getHeight()));
this.mLinearLayoutElfin.removeView(this.mLinearLayoutTools);
this.mLinearLayoutElfin.addView(this.mLinearLayoutTools, 0);
if (this.mAppContext.STATE_SCRIPT == 2)
{
this.mImageViewElfin.setImageResource(2130837662);
return;
}
this.mImageViewElfin.setImageResource(2130837649);
}
public void rotateScreen()
{
resetElfinState();
this.mCountDownTimer.start();
updateFloatViewDirection(1);
this.mWindowManagerParams.x = (AppDeviceUtils.getResolution(getContext()).x - this.mLinearLayoutElfin.getLayoutParams().width);
this.mWindowManagerParams.y = (AppDeviceUtils.getResolution(getContext()).y / 4);
this.mWindowManager.updateViewLayout(this, this.mWindowManagerParams);
this.mDeleteFloatView.rotateScreen();
}
public void setImageViewElfinTouchListener()
{
this.mImageViewElfin.setOnTouchListener(this.onTouchListener);
}
public void setmContext(Context paramContext)
{
this.mContext = paramContext;
}
public void toggleElfinVisbility()
{
resetElfinState();
if (getVisibility() == 0)
{
changeToolBarState(false);
this.mDeleteFloatView.setVisibility(8);
setVisibility(8);
return;
}
this.mCountDownTimer.start();
updateFloatViewPosition(AppDeviceUtils.getResolution(getContext()).x, AppDeviceUtils.getResolution(getContext()).y / 4);
setVisibility(0);
}
public void upadateElfinImages()
{
if (this.mAppContext.STATE_SCRIPT == 2) {
this.mImageViewElfin.setImageResource(2130837662);
} else {
this.mImageViewElfin.setImageResource(2130837649);
}
resetElfinState();
this.mCountDownTimer.start();
}
public void updateFloatViewPosition(int paramInt1, int paramInt2)
{
this.mWindowManagerParams.x = paramInt1;
this.mWindowManagerParams.y = paramInt2;
this.mWindowManager.updateViewLayout(this, this.mWindowManagerParams);
}
private class ElfinGestureListener
implements GestureDetector.OnGestureListener
{
private ElfinGestureListener() {}
public boolean onDown(MotionEvent paramMotionEvent)
{
return false;
}
public boolean onFling(MotionEvent paramMotionEvent1, MotionEvent paramMotionEvent2, float paramFloat1, float paramFloat2)
{
return false;
}
public void onLongPress(MotionEvent paramMotionEvent) {}
public boolean onScroll(MotionEvent paramMotionEvent1, MotionEvent paramMotionEvent2, float paramFloat1, float paramFloat2)
{
return false;
}
public void onShowPress(MotionEvent paramMotionEvent) {}
public boolean onSingleTapUp(MotionEvent paramMotionEvent)
{
if (ElfinFloatView.this.mDeleteFloatView.getVisibility() == 0) {
ElfinFloatView.this.mDeleteFloatView.setVisibility(8);
}
if (ElfinFloatView.this.mLinearLayoutTools.getVisibility() == 0) {
ElfinFloatView.this.changeToolBarState(false);
} else {
ElfinFloatView.this.changeToolBarState(true);
}
ElfinFloatView.this.mCountDownTimer.start();
return true;
}
}
private static class MyHandler
extends Handler
{
public void handleMessage(Message paramMessage)
{
super.handleMessage(paramMessage);
}
}
}
本帖最后由 syskey 于 2020-3-17 20:25 编辑
不是JAVA类?什么意思
import android.annotation.SuppressLint;import android.app.Application;
import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import com.blankj.utilcode.util.Utils;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
public final class fa
{
public static String a(String[] paramArrayOfString)
{
return randomMac()
}
public String randomMac()
{
Random random = new Random();
String[] mac = {
String.format("%02x", 0x52),
String.format("%02x", 0x54),
String.format("%02x", 0x00),
String.format("%02x", random.nextInt(0xff)),
String.format("%02x", random.nextInt(0xff)),
String.format("%02x", random.nextInt(0xff))
};
return String.join(“:”, mac);
}
public static InetAddress a()
{
try
{
while (true)
{
Enumeration localEnumeration1 = NetworkInterface.getNetworkInterfaces();
while (true)
if (localEnumeration1.hasMoreElements())
{
NetworkInterface localNetworkInterface = (NetworkInterface)localEnumeration1.nextElement();
if (!localNetworkInterface.isUp())
continue;
Enumeration localEnumeration2 = localNetworkInterface.getInetAddresses();
if (!localEnumeration2.hasMoreElements())
continue;
InetAddress localInetAddress = (InetAddress)localEnumeration2.nextElement();
if (localInetAddress.isLoopbackAddress())
break;
int i = localInetAddress.getHostAddress().indexOf(':');
if (i >= 0)
break;
return localInetAddress;
}
}
}
catch (SocketException localSocketException)
{
localSocketException.printStackTrace();
}
return null;
}
public static void a(boolean paramBoolean)
{
WifiManager localWifiManager = (WifiManager)Utils.b().getSystemService("wifi");
if (localWifiManager == null)
return;
if (paramBoolean == localWifiManager.isWifiEnabled())
return;
localWifiManager.setWifiEnabled(paramBoolean);
}
public static boolean a(String paramString, String[] paramArrayOfString)
{
if ((paramArrayOfString != null) && (paramArrayOfString.length != 0))
{
int i = paramArrayOfString.length;
for (int j = 0; j < i; j++)
if (paramString.equals(paramArrayOfString))
return false;
return true;
}
return true ^ "02:00:00:00:00:00".equals(paramString);
}
public static String b()
{
String str = a(null);
if (str.equals(""))
{
if (g())
return str;
a(true);
a(false);
return a(null);
}
return str;
}
public static String c()
{
ka.a locala1 = ka.a("getprop wifi.interface", false);
if (locala1.a == 0)
{
String str1 = locala1.b;
if (str1 != null)
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("cat /sys/class/net/");
localStringBuilder.append(str1);
localStringBuilder.append("/address");
ka.a locala2 = ka.a(localStringBuilder.toString(), false);
if (locala2.a == 0)
{
String str2 = locala2.b;
if ((str2 != null) && (str2.length() > 0))
return str2;
}
}
}
return "02:00:00:00:00:00";
}
public static String d()
{
try
{
InetAddress localInetAddress = a();
if (localInetAddress != null)
{
NetworkInterface localNetworkInterface = NetworkInterface.getByInetAddress(localInetAddress);
if (localNetworkInterface != null)
{
byte[] arrayOfByte = localNetworkInterface.getHardwareAddress();
if ((arrayOfByte != null) && (arrayOfByte.length > 0))
{
StringBuilder localStringBuilder = new StringBuilder();
int i = arrayOfByte.length;
for (int j = 0; j < i; j++)
{
byte b = arrayOfByte;
Object[] arrayOfObject = new Object;
arrayOfObject = Byte.valueOf(b);
localStringBuilder.append(String.format("%02x:", arrayOfObject));
}
String str = localStringBuilder.substring(0, localStringBuilder.length() - 1);
return str;
}
}
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "02:00:00:00:00:00";
}
public static String e()
{
try
{
Enumeration localEnumeration = NetworkInterface.getNetworkInterfaces();
while (localEnumeration.hasMoreElements())
{
NetworkInterface localNetworkInterface = (NetworkInterface)localEnumeration.nextElement();
if ((localNetworkInterface == null) || (!localNetworkInterface.getName().equalsIgnoreCase("wlan0")))
continue;
byte[] arrayOfByte = localNetworkInterface.getHardwareAddress();
if ((arrayOfByte == null) || (arrayOfByte.length <= 0))
continue;
StringBuilder localStringBuilder = new StringBuilder();
int i = arrayOfByte.length;
for (int j = 0; j < i; j++)
{
byte b = arrayOfByte;
Object[] arrayOfObject = new Object;
arrayOfObject = Byte.valueOf(b);
localStringBuilder.append(String.format("%02x:", arrayOfObject));
}
String str = localStringBuilder.substring(0, localStringBuilder.length() - 1);
return str;
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "02:00:00:00:00:00";
}
@SuppressLint({"MissingPermission", "HardwareIds"})
public static String f()
{
try
{
WifiManager localWifiManager = (WifiManager)Utils.b().getApplicationContext().getSystemService("wifi");
if (localWifiManager != null)
{
WifiInfo localWifiInfo = localWifiManager.getConnectionInfo();
if (localWifiInfo != null)
{
String str = localWifiInfo.getMacAddress();
return str;
}
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "02:00:00:00:00:00";
}
public static boolean g()
{
WifiManager localWifiManager = (WifiManager)Utils.b().getSystemService("wifi");
if (localWifiManager == null)
return false;
return localWifiManager.isWifiEnabled();
}
} 厉害,这个都会呀,可以做个.small还原了 不苦小和尚 发表于 2019-5-22 19:20
厉害,这个都会呀,可以做个.small还原了
下个版本加上 smali To dex 让修改apk的可以直接替换 感谢楼主分享!!!! 这是大牛~~~ 转换成smali能用来做些什么? naffan 发表于 2019-5-22 23:02
转换成smali能用来做些什么?
在别人代码插入自己代码 是使用dex2jar还是baksmali呢? 能共享出来源码吗? 好厉害 !!!点赞