攻防世界 app1

简单 Xor

app1

关键信息

package com.example.yaphetshan.tencentgreat;

public final class BuildConfig {
    public static final String APPLICATION_ID = "com.example.yaphetshan.tencentgreat";
    public static final String BUILD_TYPE = "debug";
    public static final boolean DEBUG = Boolean.parseBoolean("true");
    public static final String FLAVOR = "";
    public static final int VERSION_CODE = 15;
    public static final String VERSION_NAME = "X<cP[?PHNB<P?aj";
}
            public void onClick(View v) {
                try {
                    String inputString = MainActivity.this.text.getText().toString(); //获取输入字符串
                    PackageInfo pinfo = MainActivity.this.getPackageManager().getPackageInfo(BuildConfig.APPLICATION_ID, 16384);
                    String versionCode = pinfo.versionName;
                    int versionName = pinfo.versionCode;
                    int i = 0;
                    while (i < inputString.length() && i < versionCode.length()) {
                        if (inputString.charAt(i) != (versionCode.charAt(i) ^ versionName)) {
                            Toast.makeText(MainActivity.this, "再接再厉,加油~", 1).show();
                            return;
                        }
                        i++;
                    }
                    if (inputString.length() == versionCode.length()) {
                        Toast.makeText(MainActivity.this, "恭喜开启闯关之门!", 1).show();
                        return;
                    }
                } catch (NameNotFoundException e) {
                }
                Toast.makeText(MainActivity.this, "年轻人不要耍小聪明噢", 1).show();
            }
  1. BuildConfig与build.gradle的关系
  2. Android Api getPackageInfo)

flag


name = "X<cP[?PHNB<P?aj"
code = 15

i = 0

for index in range(len(name)):
    tmp = ord(name[index]) ^ code  
    print(chr(tmp),end = "")  
W3l_T0_GAM3_0ne

python3 Xor

  1. python3 的 ^ 运算符,两个参数为int :: Python docs

The ^ operator yields the bitwise XOR (exclusive OR) of its arguments, which must be integers.

  1. ord() 函数是 chr() 函数(对于8位的ASCII字符串)或 unichr() 函数(对于Unicode对象)的配对函数,它以一个字符(长度为1的字符串)作为参数,返回对应的 ASCII 数值,或者 Unicode 数值,如果所给的 Unicode 字符超出了你的 Python 定义范围,则会引发一个 TypeError 的异常。:: 菜鸟教程 ord() 函数

添加新评论

请不要水评论

评论列表