Auto-Verify at Spamcop

Discussion in 'Programming/Scripts' started by sjau, May 9, 2006.

  1. sjau

    sjau Local Meanie Moderator

    Hiya

    I have gotten myself now a spamcop account where I just can forward spam to. However for spamcop to finally accept the spams I do have to go on their site and then manually submit (just pressing a button) my spam.

    Now, I thought this should be automated:

    1.) I put the spam into a "spamfolder"
    2.) A cron goes through the spamfolder and forwards all spam to the special spamcop email address that I was given upon registration
    3.) Spamcop.net returns an email containing a link to manually verify this is spam
    --> Now comes the tricky part
    4.) Open that link and then submit the form (if any is present)

    Any suggestions on how this can be done (especially part 4)?
     
  2. falko

    falko Super Moderator ISPConfig Developer

  3. sjau

    sjau Local Meanie Moderator

    Back from the hospital - server still running - and having some "nice" amount of spam accumulated I will ahve a look at snoopy and try to automate this :)

    Thx for pointing this out to me.
     
  4. sjau

    sjau Local Meanie Moderator

    Hmmm, I'm at a deadend right now.

    I have this spam here (not yet submitted) and DON'T SUBMIT IT!!!:
    http://www.spamcop.net/sc?id=z948064691z38ad9d3140eadae66c30cd56c1bd80f5z

    and I have written a small php script to be found here:

    http://www.roleplayer.org/spamcop/i...=z948064691z38ad9d3140eadae66c30cd56c1bd80f5z

    which is looks like this:

    PHP:
    <?php

    function displayArray($aArray) {
        if (
    is_array($aArray) && (count($aArray) > 0)) {
            print(
    "<table border=1>");
            print(
    "<tr><th>Key</th><th>Value</th></tr>");
            foreach (
    $aArray as $aKey => $aValue) {
                print(
    "<tr>");
                if (!
    is_array($aValue)) {
                    if (empty(
    $aValue)) {
                        print(
    "<td>$aKey</td><td><i>$aValue</i></td>");
                    } else {
                        print(
    "<td>$aKey</td><td>$aValue</td>");
                    }
                } else {
                    print(
    "<td>$aKey(array)</td><td>");
                    
    displayArray($aValue);
                    print(
    "</td>");
                }
                print(
    "</tr>");
            }
            print(
    "</table>");
        } else {
            print(
    "<i>empty or invalid</i>");
        }
    }

    $offender = array("type""master""info""sc_comment");
    $form_vars = array("action""spamid""crc""date""source""reports");

    $data $_GET["data"];

    $data explode("sc?id="$data);
    $data $data[1];

    echo 
    "SC-ID: " $data;

    if(
    $data == "") {
        echo 
    "done";
        exit;
    }

    echo 
    "<hr>";

    require_once(
    "Snoopy.class.php");

    $snoopy = new Snoopy;

    $snoopy->fetch("http://www.spamcop.net/sc?id=" $data);

    $results $snoopy->results;

    $results explode('<form action="/sc"'$results);
    $results $results[1];

    if(
    $results == "") {
        echo 
    "done";
        exit;
    }

    $i substr_count($results'name="send');

    while (
    $i 0) {

        foreach(
    $offender as $val) {

            
    // Get Field Value
            
    $findme 'name="' $val $i '"';
            
    $offset strlen($findme);
            
    $pos_start strpos($results$findme) + $offset;
            
    $pos_end strpos($results">"$pos_start);
            
    $res substr($results$pos_start$pos_end);    
            
    $res explode('"'$res);
            
    $res $res[1];

            
    $submit_vars["send".$i] = "on";
            
    $submit_vars[$val.$i] = $res;

        }

        
    $i--;

    }

    $submit_vars["submit"] = "Send Spam Report(s) Now";

    foreach(
    $form_vars as $val) {

        
    // Get Field Value
        
    $findme   'name="' $val '"';
        
    $offset strlen($findme);
        
    $pos_start strpos($results$findme) + $offset;
        
    $pos_end strpos($results">"$pos_start);
        
    $res substr($results$pos_start$pos_end);    
        
    $res explode('"'$res);
        
    $res $res[1];

        
    $submit_vars[$val] = $res;

    }

    displayArray($submit_vars);


    $snoopy = new Snoopy;
        
    $submit_url "http://www.spamcop.net/sc";


    if(
    $snoopy->submit($submit_url,$submit_vars)) {
        while(list(
    $key,$val) = each($snoopy->headers)) {
            echo 
    $key.": ".$val."<br>\n";
        }
        echo 
    "<p>\n";
        echo 
    "<PRE>".htmlspecialchars($snoopy->results)."</PRE>\n";
    } else {
        echo 
    "error fetching document: ".$snoopy->error."\n";
    }


    ?>
    So I'm parsing all the relevant information and submit that stuff through putty however it does not work. You see in the array all data that is being posted by POST
     
  5. sjau

    sjau Local Meanie Moderator

Share This Page