2023-05-16

Guess-the-Number

Guess-the-Number

image.png

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • /* Copyright (c) 2010 Ant Kutschera, maxant The code belo...
    BenjaminCool阅读 3,294评论 0 0
  • 什么是Socket Socket的概念很简单,它是网络上运行的两个程序间双向通讯的一端,既可以接收请求,也可以发送...
    墨雨轩夏阅读 4,090评论 0 23
  • 一、流的概念和作用。 流是一种有顺序的,有起点和终点的字节集合,是对数据传输的总成或抽象。即数据在两设备之间的传输...
    布鲁斯不吐丝阅读 13,408评论 2 95
  • 这周准备了四级,但是更重要的是,那个毛概要补考了,一会儿晚上考试,水一篇,这周的东西都总结完了。 符 比如: 3<...
    Hello_word_李阳阅读 3,846评论 4 9
  • 一. StringBuffer 定义线程安全的可变字符序列, 一个类似于String的字符缓冲区, 我们可以将St...
    拼搏男孩阅读 1,189评论 0 1