android客户端手机号码解密方法
由于58同城在页面上抓取二手房信息的时候,用户的联系电话是图片的,本人水平关系无法进行很好的识别,所以转为抓取其android客户端比较容易,之前都是好好的,最近发现其升级到1.3.0.0后手机号码进行了加密,所以直接反编译其android客户端,查到其用的是des加密,而且加密的key很容易就拿到,下面贴出解密方法。(des加解密比较简单下面贴出来)
Java代码
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
public class Decode458 {
static byte[] key = null; //这个key如果有需要请反编译58客户端获取这里不便贴出
public static void main(String[] args) throws Exception {
System.out.println(new String(Decode458.decode(Decode458.convertHexString("002E674657AE8239982087DCB2E6A99B"))));
System.out.println(Decode458.toHexString(Decode458.encode("13219863008".getBytes())));
}
public static byte[] decode(byte[] paramArrayOfByte) {
try {
SecureRandom localSecureRandom = new SecureRandom();
DESKeySpec localDESKeySpec = new DESKeySpec(key);
SecretKey localSecretKey = SecretKeyFactory.getInstance("DES")
.generateSecret(localDESKeySpec);
Cipher localCipher = Cipher.getInstance("DES");
localCipher.init(2, localSecretKey, localSecureRandom);
return localCipher.doFinal(paramArrayOfByte);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static byte[] encode(byte[] paramArrayOfByte) {
try {
SecureRandom localSecureRandom = new SecureRandom();
相关新闻>>
- 发表评论
-
- 最新评论 更多>>