码迷,mamicode.com
首页 > 其他好文 > 详细

攻防世界 reverse Guess-the-Number

时间:2020-01-13 12:44:50      阅读:341      评论:0      收藏:0      [点我收藏+]

标签:int   pre   ddb   mpi   rgs   for   example   ebe   ref   

Guess-the-Number  su-ctf-quals-2014

使用jd-gui 反编译jar          

import java.math.BigInteger;

public class guess {
  static String XOR(String _str_one, String _str_two) {
    BigInteger i1 = new BigInteger(_str_one, 16);
    BigInteger i2 = new BigInteger(_str_two, 16);
    BigInteger res = i1.xor(i2);
    String result = res.toString(16);
    return result;
  }
  
  public static void main(String[] args) {
    int guess_number = 0;
    int my_num = 349763335;
    int my_number = 1545686892;
    int flag = 345736730;
    if (args.length > 0) {
      try {
        guess_number = Integer.parseInt(args[0]);
        if (my_number / 5 == guess_number) {//可求得guess_number为309137378,
          String str_one = "4b64ca12ace755516c178f72d05d7061";
          String str_two = "ecd44646cfe5994ebeb35bf922e25dba";
          my_num += flag;
          String answer = XOR(str_one, str_two);
          System.out.println("your flag is: " + answer);
        } else {
          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;
      num++;
      System.exit(1);
    } 
  }
}

java -jar guess.jar 309137378

技术图片

 

 your flag is: a7b08c546302cc1fd2a4d48bf2bf2ddb

攻防世界 reverse Guess-the-Number

标签:int   pre   ddb   mpi   rgs   for   example   ebe   ref   

原文地址:https://www.cnblogs.com/DirWang/p/12186690.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!