this.btn.setOnClickListener(new View.OnClickListener() { // from class: com.example.yaphetshan.tencentgreat.MainActivity.1
@Override // android.view.View.OnClickListener
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;
for (int i = 0; i < inputString.length() && i < versionCode.length(); i++) {
if (inputString.charAt(i) != (versionCode.charAt(i) ^ versionName)) {
Toast.makeText(MainActivity.this, "再接再厉,加油~", 1).show();
return;
}
}
if (inputString.length() == versionCode.length()) {
Toast.makeText(MainActivity.this, "恭喜开启闯关之门!", 1).show();
return;
}
} catch (PackageManager.NameNotFoundException e) {
}
Toast.makeText(MainActivity.this, "年轻人不要耍小聪明噢", 1).show();
}
});
}
这里要获取versionName 和versionCode,直接取AndroidManifest.xml里面找
android:versionCode="15" android:versionName="X<cP[?PHNB<P?aj"
这里要稍微转化一下,写出以下代码
version_code = 15
version_name = "X<cP[?PHNB<P?aj"
result = ""
for c in version_name:
t_cc = ord(c)
tt = t_cc^version_code
print(tt)
result += chr(tt)
print(result)
# 日志
W3l_T0_GAM3_0ne
成功得到flag