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

2017年陕西省网络空间安全技术大赛——人民的名义-抓捕赵德汉1——Writeup

时间:2017-04-20 10:40:56      阅读:369      评论:0      收藏:0      [点我收藏+]

标签:add   input   parent   clear   throws   display   定义   property   aaa   

  • 下载文件,die和binwalk都显示文件确实是jar包

    技术分享

  • 运行,观察外部特征:

    技术分享

    是一个要求输入正确password的程序

  • jd-jui打开jar包,分析代码逻辑,找到两端关键代码:

     
     
     
     
     
    x
     
     
     
      public static void main(String[] args)
        throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
      {
        CheckInterface checkerObject = loadCheckerObject();
        
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        for (;;)
        {
          System.out.println("Enter password:");
          String line = stdin.readLine();
          if (checkerObject.checkPassword(line))
          {
            System.out.println("Well done, that is the correct password");
            System.exit(0);
          }
          else
          {
            System.out.println("Incorrect password");
          }
        }
      }
     

     

     
     
     
     
     
    x
     
     
    publicbooleancheckPassword(Stringinput)
      {
        MessageDigestmd5Obj=null;
        try
        {
          md5Obj=MessageDigest.getInstance("MD5");
        }
        catch (NoSuchAlgorithmExceptione)
        {
          System.out.println("Hash Algorithm not supported");
          System.exit(-1);
        }
        byte[] hashBytes=newbyte[40];
        md5Obj.update(input.getBytes(), 0, input.length());
        hashBytes=md5Obj.digest();
        returnbyteArrayToHexString(hashBytes).equals("fa3733c647dca53a66cf8df953c2d539");
      }
     
  • 解题的思路如下:

    技术分享

  • 那么只需将字符串fa3733c647dca53a66cf8df953c2d539进行MD5解密即可

    技术分享

  • flag即为flag{monkey99}

 

本题中虽然定义的函数很多,但从主函数逐个分析可以看出关键的只有两个

checkPassword()函数中调用了大量的Java库函数,看不懂的函数百度即可

2017年陕西省网络空间安全技术大赛——人民的名义-抓捕赵德汉1——Writeup

标签:add   input   parent   clear   throws   display   定义   property   aaa   

原文地址:http://www.cnblogs.com/WangAoBo/p/6736915.html

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