You are not logged in.
im just watching dave gormans googlewach adventure and i was thinking that this would be perfect for a bash script. has any one tried doing this ?
wordlist=/path/to/word/list
word1=head -n $random $worklist tail -n 1
word2=head -n $random $worklist tail -n 1
curl http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2 > google.cach
if grep "Results 1 - 1" google.cache
then goto 1
else
echo google wach found $word1 $word2
fi
so far all i have is this not proper syntax, just mental planing
Last edited by markp1989 (2009-04-29 23:34:46)
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
Planning to do a million google searches? I don't think they will like that.
Anyway, you can get a random item with word1=$(sort -R "$wordlist" | head -n 1)
And you can look at a rendered google page like this:
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … &rlz=&=&q='"$word1+$word2" | html2text -ascii -nobs -style compact -width 80
You have to grep that for "1 out of 1 result", but I don't know what the string is, try this with an actual googlewhack:
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … ooglewhack' | html2text -ascii -nobs -style compact -width 80 | grep Results
After you get the grep, you can use grep -q and then if .......... | grep -q ........; then echo got a result for $word1 $word2; fi
EDIT:
And you might as well exchange the html2text command with just: tr '=' '\n'
EDIT2:
If you're going to make a new post, make a new post...
Last edited by Procyon (2009-04-29 23:45:34)
Offline
Planning to do a million google searches? I don't think they will like that.
Anyway, you can get a random item with word1=$(sort -R "$wordlist" | head -n 1)
And you can look at a rendered google page like this:
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … &rlz=&=&q='"$word1+$word2" | html2text -ascii -nobs -style compact -width 80
You have to grep that for "1 out of 1 result", but I don't know what the string is, try this with an actual googlewhack:
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … ooglewhack' | html2text -ascii -nobs -style compact -width 80 | grep ResultsAfter you get the grep, you can use grep -q and then if .......... | grep -q ........; then echo got a result for $word1 $word2; fi
EDIT:
And you might as well exchange the html2text command with just: tr '=' '\n'
EDIT2:
If you're going to make a new post, make a new post...
#!/bin/bash
wordlist=/home/mark/wordlist.txt
word1=$(sort -R "$wordlist" | head -n 1)
word2=$(sort -R "$wordlist" | head -n 1)
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2' | html2text -ascii -nobs -style compact -width 80 > google.cache
if grep -qw "Results 1 - 1" google.cache; then
echo google wack found
echo $word1
echo $word2
else
echo $word1
echo $word2
echo is not a google wack
grep Results google.cache
echo waiting 30 seconds and trying again
sleep 30; /home/mark/google.wack
fi
so far all that happens with this is that curl searches google for $word1 and $word2 how can i get curl to use the exports?
Thanks Markp1989
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
End the single quote before the first $, you don't even need double quotes either I guess.
BTW you get a long list of processes if you call the same script. You should wrap the entire thing in a while loop. (just put while true; do on line 2 and done on the last line). You could also background(&) the call to the new script, exec it, or maybe even source it.
Offline
End the single quote before the first $, you don't even need double quotes either I guess.
BTW you get a long list of processes if you call the same script. You should wrap the entire thing in a while loop. (just put while true; do on line 2 and done on the last line). You could also background(&) the call to the new script, exec it, or maybe even source it.
i tried this, and it only searches for 1 of the words
#!/bin/bash
while true; do
wordlist=/home/mark/wordlist.txt
word1=$(sort -R "$wordlist" | head -n 1)
word2=$(sort -R "$wordlist" | head -n 1)
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?hl=en&q='$word1+$word2 | html2text -ascii -nobs -style compact -width 80 > google.cache
if grep -qw "Results 1 - 1" google.cache; then
echo google wack found
echo $word1
echo $word2
else
echo " "
echo $word1
echo $word2
echo is not a google wack
grep Results google.cache
fi
echo waiting 30 seconds
sleep 30
done
edit : what i ment was that :
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?hl=en&q='$word1 | html2text -ascii -nobs -style compact -width 80 > google.cache
works
but if i have $word1+$word2 then it doesnt ?
Last edited by markp1989 (2009-05-01 20:08:35)
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
--> vara=testfor
--> varb=googlewhack
--> curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … &rlz=&=&q='$vara+$varb | tr '=' '\n' | grep Results
"-1">Results <b>1</b> - <b>10</b> of about <b>3,200</b> for <b>testfor googlewhack</b>. (<b>0.24</b> seconds)</font></td></tr></table></td></tr><tr><td><img height
Are you sure it only searched for one word? This should work.
Offline
[mark@markspc ~]$ wordlist=/home/mark/wordlist.txt
[mark@markspc ~]$ word1=$(sort -R "$wordlist" | head -n 1)
[mark@markspc ~]$ word2=$(sort -R "$wordlist" | head -n 1)
[mark@markspc ~]$ echo $word1
ovenproof
[mark@markspc ~]$ echo $word2
tale
[mark@markspc ~]$ curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?hl=en&q='$word1+$word2 | html2text -ascii -nobs -style compact -width 80
Google Error
****** Bad Request ******
Your client has issued a malformed or illegal request.
[mark@markspc ~]$
[mark@markspc ~]$ wordlist=/home/mark/wordlist.txt
[mark@markspc ~]$ word1=$(sort -R "$wordlist" | head -n 1)
[mark@markspc ~]$ word2=$(sort -R "$wordlist" | head -n 1)
[mark@markspc ~]$ echo $word1
sundew
[mark@markspc ~]$ echo $word2
predator
[mark@markspc ~]$ curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?hl=en&q='$word1 | html2text -ascii -nobs -style compact -width 80 | grep Results
Web Results 1 - 10 of about 345,000 for sundew. (0.09 seconds)
i dont understand why only it works if i only use 1 word, but as soon as i tell it to use both it doesnt, this doesnt make sence to me :S any ideas?
Last edited by markp1989 (2009-05-01 21:17:41)
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
You aren't using the same URL, I don't know what any of it means though.
Offline
You aren't using the same URL, I don't know what any of it means though.
i tried using your url, and it still does the same if i have 2 variables in the curl link, i dont understand why, is there any way i can combine the 2 variables together in to $word1+$word2 then i can just replace that part with $words on the curl line?
[mark@markspc ~]$ wordlist=/home/mark/wordlist.txt
[mark@markspc ~]$ word1=$(sort -R "$wordlist" | head -n 1)
[mark@markspc ~]$ word2=$(sort -R "$wordlist" | head -n 1)
[mark@markspc ~]$ curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q='$word1+$word2 | html2text -ascii -nobs -style compact -width 80 > google.cache
[mark@markspc ~]$ cat google.cache
Google Error
****** Bad Request ******
Your client has issued a malformed or illegal request.
[mark@markspc ~]$
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
Sure:
word=$(sort -R "$wordlist" | head -n 1)+$(sort -R "$wordlist" | head -n 1)
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … &rlz=&=&q='$word | html2text -ascii -nobs -style compact -width 80
Also try double quotes, those will be interpreted by bash and not google:
word="$(sort -R "$wordlist" | head -n 1)+$(sort -R "$wordlist" | head -n 1)"
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=i … &rlz=&=&q='"$word" | html2text -ascii -nobs -style compact -width 80
EDIT: do try echo $word after the one with quotes, maybe it will say:
word1
+word2
So a newline in the query might be the cause.
EDIT 2: echo "$word", the quotes are important.
Last edited by Procyon (2009-05-01 23:22:24)
Offline