Guess-the-Number
Guess-the-Number
GFSJ0321积分 2金币 2
14最佳Writeup由 kyzok 提供
收藏
反馈
难度:2
方向:Reverse
题解数:12
解出人数:1948
题目来源: CTF
题目描述:
猜个数字然后找到flag.
1.using jadx-gui
[图片上传失败...(image-6d096e-1684248539616)]
2.using eclipse
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="java" cid="n25" mdtype="fences" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background-color: rgb(51, 51, 51); padding: 10px 10px 10px 30px; width: inherit; caret-color: rgb(184, 191, 198); color: rgb(184, 191, 198); position: relative !important;">import java.math.BigInteger;
/* renamed from: guess reason: default package */
public class guess {
static String XOR(String _str_one, String _str_two) {
return new BigInteger(_str_one, 16).xor(new BigInteger(_str_two, 16)).toString(16);
}
public static void main(String[] args) {
if (args.length > 0) {
try {
if (309137378 == Integer.parseInt(args[0])) {
int my_num = 349763335 + 345736730;
System.out.println("your flag is: " +XOR("4b64ca12ace755516c178f72d05d7061", "ecd44646cfe5994ebeb35bf922e25dba"));
return;
}
System.err.println("wrong guess!");
System.exit(1);
} catch (NumberFormatException e) {
System.err.println("please enter an integer \nexample: java -jar guess 12");
System.exit(1);
}
} else {
System.err.println("wrong guess!");
int num = 1000000 + 1;
System.exit(1);
}
}
}
//a7b08c546302cc1fd2a4d48bf2bf2ddb</pre>
edit
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="" cid="n30" mdtype="fences" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background-color: rgb(51, 51, 51); padding: 10px 10px 10px 30px; width: inherit; caret-color: rgb(184, 191, 198); color: rgb(184, 191, 198); position: relative !important;">import java.math.BigInteger;
/* renamed from: guess reason: default package */
public class guess {
static String XOR(String _str_one, String _str_two) {
return new BigInteger(_str_one, 16).xor(new BigInteger(_str_two, 16)).toString(16);
}
public static void main(String[] args) {
if (args.length > 0) {
try {
if (309137378 == Integer.parseInt(args[0])) {
int my_num = 349763335 + 345736730;
System.out.println("your flag is: " + XOR("4b64ca12ace755516c178f72d05d7061", "ecd44646cfe5994ebeb35bf922e25dba"));
return;
}
System.err.println("wrong guess!");
System.exit(1);
} catch (NumberFormatException e) {
System.err.println("please enter an integer \nexample: java -jar guess 12");
System.exit(1);
}
} else {
System.err.println("wrong guess!");
int my_num = 349763335 + 345736730;
System.out.println("your flag is: " + XOR("4b64ca12ace755516c178f72d05d7061", "ecd44646cfe5994ebeb35bf922e25dba"));
//return;
int num = 1000000 + 1;
System.exit(1);
}
}
}</pre>
wrong guess!
your flag is: a7b08c546302cc1fd2a4d48bf2bf2ddb