	
	lgool-1.c

lgool is written to supply as much result-urls as you want to have. there is one
parameter needed which has to be the request for google. other paramters:
-m <int> 	: number of result-urls
-p <host:port>	: proxy
-w <int>	: max wait seconds for client answer

     1	#include <stdio.h>
     2	#include <stdlib.h>
     3	#include <errno.h>
     4	#include <sys/time.h>
     5	
     6	#include "goo.h"
     7	

     8	int main(int argc, char **argv)
     9	{
    10		int i, max, wait = 10, res = 20;
    11		
    12		char *pxy = NULL, *req;
    13		goo_t goo;
    14		cli_ans ans;
    15		time_t thetime;

    16	
    17		if(argc > 1) {
    18			for(i = 1; i < argc; i++)
    19				if(argv[i][0] == '-')
    20					switch(argv[i][1]) {
    21						case 'm':
    22							res = atoi(argv[i+1]);
    23							if(!res || res < 0) {
    24								printf("%s illegal value\n",argv[i+1]);
    25								return 0;
    26							}
    27							break;
    28						case 'w':
    29							wait = atoi(argv[i+1]);
    30							if(!wait || wait < 0) {
    31								printf("%s illegal value\n",argv[i+1]);
    32								return 0;
    33							}
    34							break;
    35						case 'p':
    36							pxy = argv[i+1];
    37							break;
    38						default:
    39							printf(">> %s << unknown\n",argv[i]);
    40							return 0;
    41						}
    42				else req = argv[i];
    43		} 
    44		else {
    45			printf("%s <request> [options]\n",argv[0]);
    46			return 0;
    47		}

    48	
    49		goo = init_goo();
    50		if(goo.resultc != SUCCESS) {
    51			goo_prnt_er(&goo);
    52			return 0;
    53		}

    54		goo_cli(1,&goo);
    55		if(!goo_cli_cnt(&goo)) {
    56			goo_prnt_er(&goo);
    57			return 0;
    58		}

    59		goo_cli_set(1, GETURLS, NULL, &goo);
    60		if(pxy != NULL)
    61			goo_cli_set(1, SETPRXY, pxy, &goo);
    62	

    63		goo_cli_req(1, req, &goo, res);
    64

    65		thetime = time(NULL);
    66		while(res > 0) {
    67			if(thetime < (time(NULL)-wait)) break;
    68			ans = goo_results(&goo);	//check for clients answer
    69			if(goo.resultc != NOANSWER)   {  // if there is an answer
    70				if(goo.resultc != SUCCESS) {  //it is not successed?
    71					goo_prnt_er(&goo);	//print error message
    72					break;			//stop loop
    73				}
    74				for(i = 0; i < ans.urls; i++)	//there is an answer
    75					printf("%s\n",ans.data[i]);	//print
    76				res -= ans.urls;		
    77				if(ans.urls < 10) break;	
    78			}
    79			usleep(100000);
    80		}

    81		delete_goo(&goo);
    82		return 1;
    83	}

line 1-7:
	include the needed headerfiles. the goo.c has to be in the working directory in 
	this case.
line 8-15:
	declarate the needed data types. "goo_t" is always needed if you are woring with gool
	and "cli_ans" is for receiving the clients answers.
line 16-47:
	work with the given program parameters
line 48-53
	initializies the goo with goo_init(). this fuction might fail in some special cases
	and will return a result-code which is not SUCCESS. then it might be helpful to print
	out the error message with the goo_print_er fuction.
line 54-58
	goo_cli with the parameter "1" will create one child. we dont check the return value
	of the function here cause we want to use the goo_cli_cnt function which returns the
	number of successfully created clients. if the return value is zero we print the 
	error message and exit with 0.
line 59-62
	in line 59 we tell the client with id 1 to give us URLS as results. line 61 sets a
	proxy if wanted. the proxy has to be of a syntax of "proxy.domain.de:4444" where
	4444 is the port to connect to ;)
line 63
	send the request to the client and the fourth paramter is the number of results we want
line 65-80
	remember the values of the variables. res keeps the number of results we like to have
	and wait tells the program to wait this maximal this seconds for an answer.
	ans.urls keeps the number of results the client supplied. there putting it in a loop
	is the easiest way to work with the results. for normal you  should receive 10 results
	per google response. if you get less than 10 results you might have reached the end
	of the result list. therefor it might be a good idea to stop if we get there.
line 81-83
	with delete_goo we will free the mallocs and close opened message queues for the
        ipc. dont forget to clean up the gool stuff!

badass@badhost:~/goo/testlab> gcc -o lgool lgool-1.c goo.c
badass@badhost:~/goo/testlab> time ./lgool -m 30 "johnny.long"
http://johnny.ihackstuff.com/
http://johnny.ihackstuff.com/ghdb.php
http://www.parabrisas.com/d_longj.php
http://www.oreillynet.com/pub/au/1918
http://www.blackhat.com/presentations/bh-usa-05/bh-us-05-long.pdf
http://nfo.net/usa/l2.html
http://www.amazon.co.uk/Google-Hacking-Penetration-Testers-Johnny/dp/1931836361
http://www.imdb.com/title/tt0364624/
http://www.informit.com/authors/bio.asp?a=4bbb8504-911e-45c2-b301-35457508c2cc
http://taosecurity.blogspot.com/2007/03/help-johnny-long-go-to-uganda.html
http://www.amazon.com/s?ie=UTF8&search-type=ss&index=books&field-author=Johnny%20Long&page=1
http://www.amazon.com/Google-Hacking-Penetration-Testers-1/dp/1931836361
http://www.blackhat.com/presentations/bh-europe-05/BH_EU_05-Long.pdf
http://www.networkworld.com/news/2005/090505-google-hacking.html
http://www.itoc.usma.edu/Workshop/2006/Program/Speakers/Long.htm
http://www.longrangerfishingcharters.com/
http://www.jonnylonglife.com/
http://www.johnnylong.com/
http://netsecurity.about.com/od/readbookreviews/fr/aabrgooglehack.htm
http://www.rhapsody.com/johnnylongorchestra
http://www.amazon.ca/s?ie=UTF8&search-type=ss&index=books-ca&field-author=Johnny%20Long&page=1
http://www.amazon.ca/Google-Hacking-Penetration-Testers-Johnny/dp/1931836361
http://www.amazon.co.uk/s?ie=UTF8&search-type=ss&index=books-uk&field-author=Johnny%20Long&page=1
http://www.cduniverse.com/search/xx/music/pid/1125099/a/At+The+Hotel+New+Yorker.htm
http://www.cduniverse.com/search/xx/music/pid/1982982/a/More:+1941-1942+Vol.+II.htm
http://www.rottentomatoes.com/p/johnny_long/
http://www.imdb.com/name/nm0998470/
http://www.mp3.com/artist/johnny-long/summary/
http://www.filmspot.com/people/503744/johnny-long/index.html
http://www.allbookstores.com/author/Johnny_Long.html
real    0m2.126s
user    0m0.002s
sys     0m0.000s

badass@badhost:~/goo/testlab> for i in `./lgool -m 10 "inurl:shop.mdb ext:mdb"`; do wget $i; done
badass@badhost:~/goo/testlab> got it?!
bash: got: command not found


