38618251373894e4a5bdfaf1709d3daea5b63d69
   1#!/bin/bash
   2
   3clear
   4echo ""
   5echo ".=========================================================."
   6echo "|                                                         |"
   7echo "|  COMMAND LINE GOOGLE SEARCH                             |"
   8echo "|  ---------------------------------------------------    |"
   9echo "|                                                         |"
  10echo "|  Version: 1.0                                           |"
  11echo "|  Developed by: Rishi Narang                             |"
  12echo "|  Blog: www.wtfuzz.com                                   |"
  13echo "|                                                         |"
  14echo "|  Usage: ./gocmd.sh <search strings>                     |"
  15echo "|  Example: ./gocmd.sh example and test                   |"
  16echo "|                                                         |"
  17echo ".=========================================================."
  18echo ""
  19
  20if [ -z $1 ]
  21then
  22 echo "ERROR: No search string supplied."
  23 echo "USAGE: ./gocmd.sh <search srting>"
  24 echo ""
  25 echo -n "Anyways for now, supply the search string here: "
  26 read SEARCH
  27else
  28 SEARCH=$@
  29fi
  30
  31URL="http://google.com/search?hl=en&safe=off&q="
  32STRING=`echo $SEARCH | sed 's/ /%20/g'`
  33URI="$URL%22$STRING%22"
  34
  35lynx -dump $URI > gone.tmp
  36sed 's/http/\^http/g' gone.tmp | tr -s "^" "\n" | grep http| sed 's/\ .*//g' > gtwo.tmp
  37rm gone.tmp
  38sed '/google.com/d' gtwo.tmp > urls
  39rm gtwo.tmp
  40
  41echo "SUCCESS: Extracted `wc -l urls` and listed them in '`pwd`/urls' file for reference."
  42echo ""
  43cat urls
  44echo ""