1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Limit/throttle likes

Discussion in 'Closed Suggestions' started by Kent, Jun 24, 2013.

  1. Kent

    Kent Active Member

    It's reasonable that someone may end up liking many posts quickly.
    It's not reasonable that someone may like 100 posts within a minute.

    Tested on XenForo 1.1.5 without any addons enabled.

    A reasonable throttle should be added to prevent something like...
    Code:
    use warnings;
    use strict;
    
    use LWP::UserAgent;
    
    my $ua = LWP::UserAgent->new;
    $ua->timeout(10);
    $ua->agent('SpammerBot/1.0');
    $ua->max_redirect(0);
    
    my $xf_path = 'http://xenforo.deb.vm/';
    my $xf_session = '5422ff207bb42d1afc5f289cfbe37f09';
    my $xf_token = '136462,1372048715,b45f5397626599cadfcfe566ed4f00e5efa9f955'; # valid for 24 hours(?), session agnostic
    
    $ua->default_header(
        'Cookie' => 'xf_session=' . $xf_session
    );
    
    my %params;
    $params{'_xfToken'} = $xf_token;
    
    my $like_target = 'posts'; # posts, profile-posts
    my $post_id     = 1;
    my $max_post_id = 100;
    my $step = 10; # update interval
    my $pass = 0;
    my $total = 0;
    
    my $max_post_id_length = length($max_post_id);
    my $step_length = length($step);
    my $progress = "Progress: [ %".$max_post_id_length."d / %".$max_post_id_length."d ] Pass: [ %".$step_length."d / %".$step_length."d ]\n";
    
    while($post_id++ < $max_post_id) {
        my $response = $ua->post($xf_path . $like_target . '/' . $post_id . '/like', \%params);
    
        $total++;
        if ($response->code == '303') { # "See other" redirect assumes success
            $pass++;
        }
    
        if ($post_id % $step == 0 || $post_id == $max_post_id) {
            printf($progress, $post_id, $max_post_id, $pass, $total);
            $pass = 0;
            $total = 0;
        }
    }
     

Share This Page