Created
June 9, 2020 18:13
-
-
Save nfalliere/42fef0d8a0af75b314512008ae3f9c44 to your computer and use it in GitHub Desktop.
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
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileReader; | |
import java.math.BigInteger; | |
import java.nio.charset.Charset; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
import java.util.Set; | |
public class DexguardEmuDetectionPropertyHash { | |
static Set<BigInteger> chkset = new HashSet<>(); | |
static { | |
chkset.add(new BigInteger("86701cb958c69d64cd59322dfebacede", 16)); | |
chkset.add(new BigInteger("19385aafbb452f39b5079513f668bbeb", 16)); | |
chkset.add(new BigInteger("24ad686ec83d904347c5a916acbe1779", 16)); | |
chkset.add(new BigInteger("b8c8255febc6c46a3e43b369225ded3e", 16)); | |
chkset.add(new BigInteger("d76386ddf2c96a9a92fc4bc8f829173c", 16)); | |
chkset.add(new BigInteger("15fed45d5ca405da4e6aa9805daf2fbf", 16)); // unused | |
} | |
public static void main(String[] args) throws Exception { | |
Map<BigInteger, String> map = new HashMap<>(); | |
try(BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])))) { | |
String line; | |
while((line = reader.readLine()) != null) { | |
byte[] hash = md5OfString(line); | |
if(hash == null) { | |
break; | |
} | |
map.put(new BigInteger(1, hash), line); | |
} | |
} | |
map.keySet().retainAll(chkset); | |
for(Entry<BigInteger, String> e: map.entrySet()) { | |
System.out.format("Matched entry: %s (key: %s)\n", e.getValue(), e.getKey()); | |
} | |
} | |
static byte[] md5OfString(String line) { | |
try { | |
MessageDigest md = MessageDigest.getInstance("MD5"); | |
md.update(line.getBytes(Charset.forName("UTF-8"))); | |
return md.digest(); | |
} | |
catch(NoSuchAlgorithmException unused_ex) { | |
return new byte[0]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment