11package me .checkium .vhackapi ;
22
3- import java .io .BufferedReader ;
4- import java .io .IOException ;
5- import java .io .InputStream ;
6- import java .io .InputStreamReader ;
7- import java .io .Reader ;
8- import java .net .MalformedURLException ;
3+ import org .json .JSONException ;
4+ import org .json .JSONObject ;
5+
6+ import java .io .*;
97import java .net .URL ;
108import java .nio .charset .Charset ;
119import java .security .MessageDigest ;
1210import java .security .NoSuchAlgorithmException ;
1311
14- import org .json .JSONException ;
15- import org .json .JSONObject ;
16-
1712public class Utils {
18- public static String url ;
19- public static String md5s ;
20- public static String secret ;
2113 static final boolean assertionstatus ;
2214 private static final byte [] byt ;
15+ public static String url ;
16+ public static String md5s ;
17+ public static String secret ;
2318
2419 static {
2520 assertionstatus = !Utils .class .desiredAssertionStatus ();
@@ -28,39 +23,37 @@ public class Utils {
2823 secret = "aeffl" ;
2924 byt = new byte []{(byte ) 65 , (byte ) 66 , (byte ) 67 , (byte ) 68 , (byte ) 69 , (byte ) 70 , (byte ) 71 , (byte ) 72 , (byte ) 73 , (byte ) 74 , (byte ) 75 , (byte ) 76 , (byte ) 77 , (byte ) 78 , (byte ) 79 , (byte ) 80 , (byte ) 81 , (byte ) 82 , (byte ) 83 , (byte ) 84 , (byte ) 85 , (byte ) 86 , (byte ) 87 , (byte ) 88 , (byte ) 89 , (byte ) 90 , (byte ) 97 , (byte ) 98 , (byte ) 99 , (byte ) 100 , (byte ) 101 , (byte ) 102 , (byte ) 103 , (byte ) 104 , (byte ) 105 , (byte ) 106 , (byte ) 107 , (byte ) 108 , (byte ) 109 , (byte ) 110 , (byte ) 111 , (byte ) 112 , (byte ) 113 , (byte ) 114 , (byte ) 115 , (byte ) 116 , (byte ) 117 , (byte ) 118 , (byte ) 119 , (byte ) 120 , (byte ) 121 , (byte ) 122 , (byte ) 48 , (byte ) 49 , (byte ) 50 , (byte ) 51 , (byte ) 52 , (byte ) 53 , (byte ) 54 , (byte ) 55 , (byte ) 56 , (byte ) 57 , (byte ) 45 , (byte ) 95 };
3025 }
31-
26+
3227 public static String readJson (Reader rd ) throws IOException {
3328 StringBuilder sb = new StringBuilder ();
3429 int cp ;
3530 while ((cp = rd .read ()) != -1 ) {
36- sb .append ((char ) cp );
31+ sb .append ((char ) cp );
3732 }
3833 return sb .toString ();
39- }
34+ }
35+
36+ public static JSONObject JSONRequest (String format , String data , String php ) {
37+ JSONObject json = null ;
38+ InputStream is ;
39+ try {
40+ URL url = new URL (Utils .generateURL (format , data , php ));
41+ is = url .openStream ();
42+ BufferedReader rd = new BufferedReader (new InputStreamReader (is , Charset .forName ("UTF-8" )));
43+ String jsonText = Utils .readJson (rd );
44+ if (jsonText .length () == 1 ) {
45+ return null ;
46+ }
47+ json = new JSONObject (jsonText );
48+
49+ } catch (IOException | JSONException e ) {
50+
51+ // TODO Auto-generated catch block
52+ e .printStackTrace ();
53+ }
54+ return json ;
55+ }
4056
41- public static JSONObject JSONRequest (String format , String data , String php ){
42- JSONObject json = null ;
43- InputStream is ;
44- try {
45- is = new URL (Utils .generateURL (format , data , php )).openStream ();
46- BufferedReader rd = new BufferedReader (new InputStreamReader (is , Charset .forName ("UTF-8" )));
47- String jsonText = Utils .readJson (rd );
48- if (jsonText .length () == 1 ) {
49- return null ;
50- }
51- json = new JSONObject (jsonText );
52-
53- } catch (MalformedURLException e ) {
54- // TODO Auto-generated catch block
55- e .printStackTrace ();
56- } catch (IOException e ) {
57-
58- // TODO Auto-generated catch block
59- e .printStackTrace ();
60- }
61- return json ;
62- }
63-
6457 private static byte [] m9179a (byte [] bArr , int i , int i2 , byte [] bArr2 , int i3 , byte [] bArr3 ) {
6558 int i4 = 0 ;
6659 int i5 = (i2 > 1 ? (bArr [i + 1 ] << 24 ) >>> 16 : 0 ) | (i2 > 0 ? (bArr [i ] << 24 ) >>> 8 : 0 );
@@ -158,7 +151,7 @@ public static byte[] assertion(byte[] bArr, int i, int i2, byte[] bArr2, int i3)
158151 }
159152
160153
161- public static String generateURL (String str , String str2 , String str3 ) {
154+ public static String generateURL (String str , String str2 , String str3 ) {
162155 String [] strArr = new String [2 ];
163156 String [] split = str .split ("::::" );
164157 String [] split2 = str2 .split ("::::" );
0 commit comments