-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathgoogleSearch.pl
35 lines (30 loc) · 1.13 KB
/
googleSearch.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl
########################################################################
# googleSearch.pl --- Squid Script (Modifies Google search queries)#
# g0tmi1k 2011-03-25 --- Original Idea: http://prank-o-matic.com #
########################################################################
use IO::Handle;
use POSIX strftime;
$debug = 0; # Debug mode - create log file
$extraText = "in+my+pants";
$|=1;
if ($debug == 1) { open (DEBUG, '>>/tmp/googleSearch_debug.log'); }
autoflush DEBUG 1;
print DEBUG "########################################################################\n";
print DEBUG strftime ("%d%b%Y-%H:%M:%S\n",localtime(time()));
print DEBUG "########################################################################\n";
while (<>) {
chomp $_;
if ($debug == 1) { print DEBUG "Input: $_\n"; }
if ($_ =~ m/.google\.*/) {
$url = $_;
$url =~ s/(q=.+?)&/$1+$extraText&/;
print "$url\n";
if ($debug == 1) { print DEBUG "Output: $url\n"; }
}
else {
print "$_\n";
if ($debug == 1) { print DEBUG "Pass: $_\n"; }
}
}
close (DEBUG);