Cygwin file generator

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2006
Posts: 9
Reputation: muhaa is an unknown quantity at this point 
Solved Threads: 0
muhaa muhaa is offline Offline
Newbie Poster

Cygwin file generator

 
0
  #1
Oct 18th, 2006
Hi guy's i was wondering if any one can help i wat to make a random file generator which will be able to create random file's with random string's in them also i wilkl have to be able to control the file extension..Its for a file fuzzer im working on any help would be much apriciated also would like to use cygwin..Random string's like

AAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDEEEEE//////\\\\----===\\\\|=
CCCCCCCDDDDEEEEEEEEWWWWWWAAAAAAAAAAAA[[[[[]]]]

so the aboved is just an example i want to fill the file with any thing realy i want to let the program decide but i also will ne to control the amount of byte's that is wrote to the file basicaly every thing will be random so it will print 40 file's of a file extension i chose and write diffrent string's to the file any help would be grate:eek: .
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,619
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 468
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Cygwin file generator

 
0
  #2
Oct 18th, 2006
Any leads you have got so far, post your code or your algorithm and we will help you out. Posting out what you want to do is no good to us in helping you.

PS: If you want to write random data, use the normal random function which will generate random numbers between 1 and 128. Cast those numbers to "char" data type and write them to your file. This way you will get random chars in your data file.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 9
Reputation: muhaa is an unknown quantity at this point 
Solved Threads: 0
muhaa muhaa is offline Offline
Newbie Poster

Re: Cygwin file generator

 
0
  #3
Oct 18th, 2006
Hi thnx for the rely i am just starting to code the application any chance you got any link's that might give me a good start thnx in advance.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,619
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 468
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Cygwin file generator

 
0
  #4
Oct 19th, 2006
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int
  6. main (int argc, char *argv[])
  7. {
  8. /* Simple "srand()" seed: just use "time()" */
  9. unsigned int iseed = (unsigned int)time(NULL);
  10. srand (iseed);
  11.  
  12. /* Now generate 5 pseudo-random numbers */
  13. int i;
  14. for (i=0; i<5; i++)
  15. {
  16. printf ("rand[%d]= %u\n",
  17. i, rand ());
  18. }
  19. return 0;
}

Also Maybe the foll:
random number generate and outpt to file
Random number detailed theory
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 9
Reputation: muhaa is an unknown quantity at this point 
Solved Threads: 0
muhaa muhaa is offline Offline
Newbie Poster

Re: Cygwin file generator

 
0
  #5
Oct 19th, 2006
~s.o.s~ what can i say man you are great very much apriciated m8..I know alot of language's a bit of c c++ but i know more of perl python ruby any way's if i have any further question i will post cant thank you enough m8..Just got to find out haw i can restrict the file size also and write to multiple file's instead of just the one..
Last edited by muhaa; Oct 19th, 2006 at 7:17 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,619
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 468
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Cygwin file generator

 
0
  #6
Oct 19th, 2006
Originally Posted by muhaa View Post
..write to multiple file's instead of just the one..
Create multiple file streams, and what you are doign to one file, make that applicable to multiple files.. simple.

  1. FILE *output1;
  2. FILE* output2;
  3. FILE* output3; // ......
  4.  
  5. // do something with these files
  6.  
  7. // close the above files
Last edited by ~s.o.s~; Oct 19th, 2006 at 12:38 pm.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 9
Reputation: muhaa is an unknown quantity at this point 
Solved Threads: 0
muhaa muhaa is offline Offline
Newbie Poster

Re: Cygwin file generator

 
0
  #7
Oct 19th, 2006
Ok thnx man this is what i have got so far using your examples to help
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int rrand(int min,int max)
  6. {
  7. static int init = 0;
  8. int ret;
  9.  
  10. if(init==0){
  11. srand(time(NULL));
  12. init=1;
  13. }
  14. ret = (rand() % (max-min+1) + min);
  15. return ret;
  16. }
  17.  
  18. int main(void)
  19. {
  20. int i, r;
  21. for(i=0;i<20;i++){
  22. r = rrand(65,90); /* 65 = A, 90 = Z. get it? */
  23. printf("Random char = %c\n",r);
  24. }
  25. return 0;
  26. }
Last edited by Salem; Oct 19th, 2006 at 2:05 pm. Reason: Changed inlinecode to code for multi-line code
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC