-
-
[求助]这段代码有点难看懂
-
发表于:
2016-9-21 22:10
3120
-
因为学校宽带的认证方式改变了 从PPPOE变到了portal认证 于是想到了逆向安卓端应用看看加密方式结果就遇到了下面的代码 尤其是是中间那段加密
所以不是很懂这里大部分的代码 只能看懂一点-。-
package com.cndatacom.httppap;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.cndatacom.utils.Logger;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
public class PortalInfoMgr
{
private Map<String, String> infoKeys = null;
private boolean isInitial = false;
private Context mContext = null;
private String mHostname = null;
private String mMacaddr = null;
public static String genLocalTime()
{
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date(System.currentTimeMillis()));
}
public static String genMD5(byte[] paramArrayOfByte)
{
int i = 0;
char[] arrayOfChar = new char[16];
char[] tmp10_8 = arrayOfChar;
tmp10_8[0] = 48;
char[] tmp15_10 = tmp10_8;
tmp15_10[1] = 49;
char[] tmp20_15 = tmp15_10;
tmp20_15[2] = 50;
char[] tmp25_20 = tmp20_15;
tmp25_20[3] = 51;
char[] tmp30_25 = tmp25_20;
tmp30_25[4] = 52;
char[] tmp35_30 = tmp30_25;
tmp35_30[5] = 53;
char[] tmp40_35 = tmp35_30;
tmp40_35[6] = 54;
char[] tmp46_40 = tmp40_35;
tmp46_40[7] = 55;
char[] tmp52_46 = tmp46_40;
tmp52_46[8] = 56;
char[] tmp58_52 = tmp52_46;
tmp58_52[9] = 57;
char[] tmp64_58 = tmp58_52;
tmp64_58[10] = 97;
char[] tmp70_64 = tmp64_58;
tmp70_64[11] = 98;
char[] tmp76_70 = tmp70_64;
tmp76_70[12] = 99;
char[] tmp82_76 = tmp76_70;
tmp82_76[13] = 100;
char[] tmp88_82 = tmp82_76;
tmp88_82[14] = 101;
char[] tmp94_88 = tmp88_82;
tmp94_88[15] = 102;
tmp94_88;
try
{
Object localObject = MessageDigest.getInstance("MD5");
((MessageDigest)localObject).update(paramArrayOfByte);
paramArrayOfByte = ((MessageDigest)localObject).digest();
localObject = new char[32];
int j = 0;
for (;;)
{
if (i >= 16) {
return new String((char[])localObject);
}
int k = paramArrayOfByte[i];
int m = j + 1;
localObject[j] = arrayOfChar[(k >>> 4 & 0xF)];
j = m + 1;
localObject[m] = arrayOfChar[(k & 0xF)];
i += 1;
}
return null;
}
catch (Exception paramArrayOfByte)
{
paramArrayOfByte.printStackTrace();
}
}
private String getClientId()
{
Object localObject2 = ((TelephonyManager)this.mContext.getSystemService("phone")).getDeviceId();
Log.i("info1", "tmDevice=" + (String)localObject2);
Object localObject1;
if (localObject2 != null)
{
localObject1 = localObject2;
if (!"".equals(localObject2)) {}
}
else
{
localObject1 = getSerialNumber();
}
if (localObject1 != null)
{
localObject2 = localObject1;
if (!"".equals(localObject1)) {}
}
else
{
localObject2 = getDeviceId(this.mContext);
}
Log.i("info1", "tmDevice=" + (String)localObject2);
return new String(genMD5(((String)localObject2).getBytes()));
}
private String getDeviceId(Context paramContext)
{
return Settings.Secure.getString(paramContext.getContentResolver(), "android_id");
}
private String getHostname()
{
if (this.mHostname != null) {
return this.mHostname;
}
new Thread(new PortalInfoMgr.1(this)).start();
if (this.mHostname != null) {
return this.mHostname;
}
return new String("lmh-PC");
}
private String getIPv4()
{
return getIPV4();
}
private String getIPv6()
{
try
{
localObject = NetworkInterface.getNetworkInterfaces();
boolean bool = ((Enumeration)localObject).hasMoreElements();
if (bool) {
break label18;
}
}
catch (SocketException localSocketException)
{
for (;;)
{
Object localObject;
label18:
Enumeration localEnumeration;
InetAddress localInetAddress;
localSocketException.printStackTrace();
}
}
return "fe80::d59c:43f8:b941:28d3%11";
localEnumeration = ((NetworkInterface)((Enumeration)localObject).nextElement()).getInetAddresses();
do
{
if (!localEnumeration.hasMoreElements()) {
break;
}
localInetAddress = (InetAddress)localEnumeration.nextElement();
} while ((localInetAddress.isLoopbackAddress()) || (localInetAddress.isAnyLocalAddress()));
localObject = localInetAddress.getHostAddress().toString();
return localObject;
}
private String getMACAddr()
{
if (this.mMacaddr != null) {
return this.mMacaddr;
}
new Thread(new PortalInfoMgr.2(this)).start();
if (this.mMacaddr != null) {
return this.mMacaddr;
}
return new String("3C-97-0E-00-AF-34");
}
谢谢啦!
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)