# # # #Set the three variables below. $user and $pass MUST correspond to # #the Google utility account you created. $cookie SHOULD reflect your # #existing browser cookie for google.com, but the default value will # #probably work if you don't have an existing google.com cookie. # # # #Once you've created your message-ids.txt file and set the variables, # #execute the script. You will get a success or failure message for # #each Message-ID that the script attempts to nuke. If all you see are # #failures, either you have something setup wrong or Google has made # #changes to their system. # # # #LICENSE # #This script is donate-ware. You can use, modify, and redistribute it # #freely, so long as this entire notice remains intact. The author is # #not liable for any damage or other problems which result from using # #this script. If this script saves you some time and wrist pain, and # #you'd like to send me a buck or two, paypal to s at shat.net. # ####################################################################### ####################################################################### #Set up these variables #Your Google utility account email address $user = "foobar@example.com"; #Your Google utility account password $pass = "p455w0rd"; #You really should replace the ID=, TM=, LM= and S= fields in the #cookie data to reflect your own existing google.com cookie. If #your browser is set to refuse cookies or you don't want to bother #looking the cookie up, the default will probably work unless Google #starts getting too many hits from this cookie :) $cookie = "Cookie: PREF=ID=0aae2daf30ac9774:" . "TM=1021816871:LM=1021816871:S=r4gAaEGDbjQ"; #End of configuration ####################################################################### #Until I rewrite my scripts, this will suffice for bg-compatibility; if(phpversion() >= "4.2.0"){ extract($_POST); extract($_SERVER); extract($_ENV); } #Format output for console or web? $nl = ((isset($REMOTE_ADDR)) ? "
" : "\n"); #Get the Message-IDs if(!$mids = file("message-ids.txt")) die("Couldn't read in the Message-IDs from message-ids.txt"); #Open a connection if(!$sock=fsockopen("services.google.com", 8882, &$errno, &$err, 10)) die("Couldn't connect to Google"); #Build the standard headers that we'll use every time $accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, */*"; $acclang = "Accept-Language: en-us"; $accenc = "Accept-Encoding: gzip, deflate"; $agent = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98;" . " Win 9x 4.90)"; $conn = "Connection: close"; $cache = "Cache-Control: no-cache"; #Send a primary request $req = "GET /urlconsole/controller HTTP/1.1\r\n" . "$accept\r\n" . "Referer: http://groups.google.com/googlegroups/help.html\r\n" . "$acclang\r\n" . "$accenc\r\n" . "$agent\r\n" . "Host: services.google.com:8882\r\n" . "$conn\r\n" . "$cookie\r\n\r\n"; fputs($sock, $req); while(!feof($sock)){ $reply .= fgets($sock, 10240); if(feof($sock)) break; } fclose($sock); unset($sock); #Determine the JSESSIONID variable sent by Google if(preg_match("/Set-Cookie: JSESSIONID=.*;/i", $reply, $matches)>0){ $jsid = str_replace("Set-Cookie: JSESSIONID=", "", $matches[0]); $jsid = str_replace(";", "", $jsid); } else die("Couldn't get the JSESSIONID from Google"); $cookie = str_replace("PREF", "JSESSIONID=$jsid; PREF", $cookie); if(ereg("Refresh", $reply)){ #Follow the refresh command if(!$sock=fsockopen("services.google.com", 8882, &$errno, &$err, 10)) die("Couldn't connect to Google"); $req = "GET /urlconsole/controller?cmd=reload&lastcmd=login HTTP/1.1\r\n" . "$accept\r\n" . "Referer: http://services.google.com:8882/urlconsole/controller\r\n" . "$acclang\r\n" . "$accenc\r\n" . "$agent\r\n" . "Host: services.google.com:8882\r\n" . "$conn\r\n" . "$cookie\r\n\r\n"; fputs($sock, $req); $reply = ""; while(!feof($sock)){ $reply .= fgets($sock, 10240); if(feof($sock)) break; } fclose($sock); unset($sock); } #Log in to the Groups Console interface if(!$sock=fsockopen("services.google.com", 8882, &$errno, &$err, 10)) die("Couldn't connect to Google"); $clength = 55 + strlen($user) + strlen($pass); $cmd = "cmd=authenticateUser&LoginEmail=$user&Password=$pass&SUBMIT=Login"; $req = "POST /urlconsole/controller HTTP/1.1\r\n" . "$accept\r\n" . "Referer: http://services.google.com:8882/urlconsole/controller\r\n" . "$acclang\r\n" . "Content-Type: application/x-www-form-urlencoded\r\n" . "Host: services.google.com:8882\r\n" . "$accenc\r\n$agent\r\n" . "Content-Length: $clength\r\n" . "$conn\r\n$cache\r\n$cookie\r\n" . "\r\n$cmd\r\n\r\n"; $reply = ""; fputs($sock, $req); while(!feof($sock)){ $reply .= fgets($sock, 10240); if(feof($sock)) break; } fclose($sock); unset($sock); #Now we loop through the Message-IDs, submitting each one for($i=0; $i", "%3E", $currmid); #Retrieve the Usenet Removal page if(!$sock=fsockopen("services.google.com", 8882, &$errno, &$err, 10)) die("Couldn't connect to Google"); if(strlen($currmid)<5) continue; $req = "GET /urlconsole/controller?cmd=usenetRemoval HTTP/1.1" . "$accept\r\n" . "Referer: http://services.google.com:8882/urlconsole/controller\r\n" . "$acclang\r\n" . "Host: services.google.com:8882\r\n" . "$accenc\r\n$agent\r\n" . "$conn\r\n$cache\r\n$cookie\r\n\r\n"; $reply = ""; fputs($sock, $req); while(!feof($sock)){ $reply .= fgets($sock, 10240); if(feof($sock)) break; } fclose($sock); unset($sock); #Submit the form for a specific Message-ID if(!$sock=fsockopen("services.google.com", 8882, &$errno, &$err, 10)) die("Couldn't connect to Google"); $clength = 36 + strlen($currmid); $cmd = "cmd=usenetPostValidation&url=&msgid=$currmid"; $req = "POST /urlconsole/controller HTTP/1.1\r\n" . "$accept\r\n" . "Referer: http://services.google.com:8882/urlconsole/controller?" . "cmd=usenetRemoval\r\n" . "$acclang\r\n" . "Content-Type: application/x-www-form-urlencoded\r\n" . "Host: services.google.com:8882\r\n" . "$accenc\r\n$agent\r\n" . "Content-Length: $clength\r\n" . "$conn\r\n$cache\r\n$cookie\r\n" . "\r\n$cmd\r\n\r\n"; $reply = ""; fputs($sock, $req); while(!feof($sock)){ $reply .= fgets($sock, 10240); if(feof($sock)) break; } fclose($sock); unset($sock); #Make sure the post was retrieved before proceeding if(!ereg("shown", $reply)){ echo "Failure (retrieve) on $currmid$nl"; continue; } #Confirm deletion of the post if(!$sock=fsockopen("services.google.com", 8882, &$errno, &$err, 10)) die("Couldn't connect to Google"); $clength = 20; $cmd = "cmd=usenetSubmission"; $req = "POST /urlconsole/controller HTTP/1.1\r\n" . "$accept\r\n" . "Referer: http://services.google.com:8882/urlconsole/controller\r\n" . "$acclang\r\n" . "Content-Type: application/x-www-form-urlencoded\r\n" . "Host: services.google.com:8882\r\n" . "$accenc\r\n$agent\r\n" . "Content-Length: $clength\r\n" . "$conn\r\n$cache\r\n$cookie\r\n" . "\r\n$cmd\r\n\r\n"; $reply = ""; fputs($sock, $req); while(!feof($sock)){ $reply .= fgets($sock, 10240); if(feof($sock)) break; } fclose($sock); unset($sock); #Determine the outcome if(!eregi("submitted", $reply)){ echo "Failure (confirm) on $currmid$nl"; continue; } else echo "Success on $currmid$nl"; } ?>