mobile1(gctf)

img

下载下来是个apk

jadk打开查看源码

有两个关键方法

public static void main(String[] args){

​ TestActivity TestActivity=new TestActivity();

​ System.out.println(String.valueOf(TestActivity.checkSN(“Tenshine”,“Tenshine”)));

​ }

private boolean checkSN(String userName, String sn) {

if (userName == null) {

return false;

​ }

try {

// if (userName.length() == 0 || sn == null || sn.length() != 22) {

// return true;

// }

​ MessageDigest digest = MessageDigest.getInstance(“MD5”);

​ digest.reset();

​ digest.update(userName.getBytes());

​ String hexstr = toHexString(digest.digest(), “”);

​ StringBuilder sb = new StringBuilder();

for (int i = 0; i < hexstr.length(); i += 2) {

​ sb.append(hexstr.charAt(i));

​ }

​ System.out.println(“flag{“+sb.toString()+ “}”);

if ((“flag{“ + sb.toString() + “}”).equalsIgnoreCase(sn)) {

return true;

​ }

return false;

​ } catch (NoSuchAlgorithmException e) {

​ e.printStackTrace();

return false;

​ }

​ }

private static String toHexString(byte[] bytes, String separator) {

​ StringBuilder hexString = new StringBuilder();

for (byte b : bytes) {

​ String hex = Integer.toHexString(b & 255);

if (hex.length() == 1) {

​ hexString.append(‘0’);

​ }

​ hexString.append(hex).append(separator);

​ }

return hexString.toString();

​ }

运行输出

获得flag

flag{bc72f242a6af3857}

false

-——————————–