c - bruteforce-code is not running -
i tried code litle bruteforce programm. cant compile it. easy programmcode think , thats reason why bug me hard didnt compile. searched solutions couldnt strike bonanza...
`1 #include <stdio.h> 2 #include <string.h> 3 char pass; 4 strcpy(pass,"m"); 5 int pass_test(int argc, char *argv[]){ 6 char s_pass[2]; 7 argv[0] = s_pass; 8 if (s_pass == pass){ 9 printf("=================\n==access gained==\n================="); 10 } 11 else{ 12 printf("sth. went wrong"); 13 } 14 } 15 int main(){ 16 char solved_pass[2]; 17 char *op_abc; 18 int i, p, z; 19 strcpy(op_abc, "abcdefghijklmnopqrstuvwxyz"); 20 if ((strlen(pass)) == 1){ 21 for(i=0;i < strlen(op_abc);i++){ 22 pass_test(op_abc[i]); 23 } 24 } 25 if (strlen(pass) == 2){ 26 for(p=0;p < strlen(op_abc);p++){ 27 for(z=0;z < strlen(op_abc);z++){ 28 op_abc[p] = solved_pass[0]; 29 op_abc[z] = solved_pass[1]; 30 pass_test(solved_pass); 31 } 32 } 33 } 34 }`
this compiler says
bruteforce.c:4:13: error: expected ‘)’ before string constant bruteforce.c: in function ‘pass_test’: bruteforce.c:8:13: warning: comparison between pointer , integer [enabled default] bruteforce.c: in function ‘main’: bruteforce.c:20:2: warning: passing argument 1 of ‘strlen’ makes pointer integer without cast [enabled default] in file included bruteforce.c:2:0: /usr/include/string.h:399:15: note: expected ‘const char *’ argument of type ‘char’ bruteforce.c:22:4: error: few arguments function ‘pass_test’ bruteforce.c:5:5: note: declared here bruteforce.c:25:2: warning: passing argument 1 of ‘strlen’ makes pointer integer without cast [enabled default] in file included bruteforce.c:2:0: /usr/include/string.h:399:15: note: expected ‘const char *’ argument of type ‘char’ bruteforce.c:30:5: warning: passing argument 1 of ‘pass_test’ makes integer pointer without cast [enabled default] bruteforce.c:5:5: note: expected ‘int’ argument of type ‘char *’ bruteforce.c:30:5: error: few arguments function ‘pass_test’ bruteforce.c:5:5: note: declared here
could me please ?
one problem can't have statements or free expression in global scope.
another problem strcpy
function expects string (i.e. char*
) destination, not single char
.
you can solve both these problems doing definition , initialization in 1 line:
char pass = 'm';
Comments
Post a Comment