From 08179823849c92caa30c3c71ddb3cfd95b8a27e8 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 11 May 2016 20:59:46 -0400 Subject: Started work on bug creation --- ws2a/bugcomment.c | 15 +++- ws2a/bugs.html | 28 ++++---- ws2a/bugview.html | 4 +- ws2a/newbug.c | 182 +++++++++++++++++++++++++++++++++++++++++++++++++ ws2a/testhtmlreplace.c | 25 ++++--- 5 files changed, 225 insertions(+), 29 deletions(-) (limited to 'ws2a') diff --git a/ws2a/bugcomment.c b/ws2a/bugcomment.c index c15e6ab..bb789ad 100644 --- a/ws2a/bugcomment.c +++ b/ws2a/bugcomment.c @@ -65,7 +65,7 @@ unsigned long hash(unsigned char *str){ } char* useridhash(char* str){ - char* hash = malloc(sizeof(char)*20); + char* hash = calloc(sizeof(char)*20,sizeof(char)); int i = (int)str[0]; int len = strlen(str); int tloop = i*20; @@ -73,19 +73,25 @@ char* useridhash(char* str){ unsigned int strp = 0; i = 0; while(i < tloop){ + printf("i:%d hashp:%u strp:%u tloop:%d\n",i,hashp,strp,tloop); char tchar = str[strp%len]; hash[hashp%20] += str[strp%len]; + str[strp%len]+=1; hashp+=(int)tchar; strp+=(int)(hashp*hashp); i++; } i = 0; + printf("Before characterizeing the hash, it was: %s\n",hash); while(i < 20){ + //printf("Normalizeing %c(%u) as %c(%u)\n",hash[i],(unsigned int)hash[i],(hash[i] % 92) + 32,(hash[i] % 92) + 32); unsigned int hashnum = hash[i]; unsigned int modedhashnum = hashnum % 92; + //printf("hashnum was %u, after mod it is:%u\n",hashnum,modedhashnum); hash[i] = modedhashnum + 32; i++; } + printf("Resulting hash was:%s\n",hash); return hash; } @@ -97,7 +103,7 @@ int main(){ char name[15]; char userid[20]; char comment[2048]; - char captcha[25]; + char captcha[30]; char bugid[5]; char* iname = strtok(data,"&"); @@ -143,10 +149,12 @@ int main(){ printf("Captcha incorrect"); return; } - + fclose(captchafile); char command[100]; sprintf(command,"rm \"%s.txt\"",captchapath); system(command); + sprintf(command,"rm \"%s.png\"",inputhash); + system(command); //Add comment to bug file char filepath[100]; @@ -166,6 +174,7 @@ int main(){ //printf("

comment:%s

dcomment:%s",comment,dcomment); //printf("Everything ok, inserting comment!"); fprintf(bugfile,"\n%s\n%s\n%s\n",dname,duid,dcomment); + fclose(bugfile); free(dname); free(duid); free(dcomment); diff --git a/ws2a/bugs.html b/ws2a/bugs.html index 7833614..f62b304 100644 --- a/ws2a/bugs.html +++ b/ws2a/bugs.html @@ -57,20 +57,20 @@ -

- -
+
+ + + + + + + + +
+ + + +