Advertisement
GordeyZhizhin

Untitled

Nov 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.net.MalformedURLException;
  6. import java.net.URL;
  7. import java.util.Scanner;
  8.  
  9. public class Main {
  10.     final static String API_URL = "http://172.16.11.21:8080/PadServer/decrypt.html?ID=1702843&MSG=";
  11.  
  12.     public static boolean get(String key) throws IOException {
  13.         URL weather_url = new URL(API_URL + key);
  14.         InputStream stream = (InputStream) weather_url.getContent();
  15.         Scanner in = new Scanner(stream);
  16.         while (in.hasNext()) {
  17.             String line = in.nextLine();
  18.             if (line.lastIndexOf("decryption correct") != -1)
  19.                 return true;
  20.         }
  21.         return false;
  22.     }
  23.  
  24.     public static void main(String[] args) throws IOException {
  25.         String begin = "a69721e942febfa6123deeb3e2906c430b6b429b72c1790cc374515613baf7d9";
  26.         String end = "44f72997824d103c21f2e7910e96ce01";
  27.  
  28.         for (int i = 0; i < 16; i++) {
  29.  
  30.             int v = Integer.valueOf(begin.substring(64 - i*2 - 2, 64 - i*2));
  31.  
  32.             for (int i = 0; i < 256; i++) {
  33.                 int r = v ^ 2 ^ i;
  34.                 String hex = Integer.toHexString(r);
  35.                 if (get(begin + hex + end)) {
  36.                     System.out.println(begin + hex + " " + end);
  37.                     System.out.println((char) i);
  38.                     System.out.println(Integer.toHexString(v ^ 3 ^ i));
  39.                 }
  40.             }
  41.         }
  42.     }
  43. }
  44. // mo    a69721e942febfa6123deeb3e2906c43 0b6b429b72c1790cc374515613baf7d9 44f72997824d103c21f2e7910e96ce01 8883b4167bd671d5932f99631445ee8c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement