Advertisement
Guest User

Untitled

a guest
Apr 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.47 KB | None | 0 0
  1. #このスクリプトファイルはSJISで保存すること
  2.  
  3. use strict;
  4. use warnings;
  5. use LWP::UserAgent;
  6. use HTTP::Request::Common qw(POST);
  7. use HTTP::Cookies;
  8.  
  9. my $url='hhttps://matsuri.5ch.net/test/read.cgi/entrance/1516417594/'; #URL
  10. my $message="やめたれw"; #レス
  11. my $mail=''; #mail
  12. my $FROM=''; #名前
  13. my $sleep='15'; #間隔(秒)
  14. my $times='10'; #連投回数
  15. my $ua='Monazilla/4.0'; #User-Agent
  16. my $server;
  17. my $bbs;
  18. my $key;
  19.  
  20. if($url =~ /https?:\/\/([a-z0-9]+)\.5ch\.net\/test\/read\.cgi\/([a-z0-9]+)\/([0-9]+)\//){
  21.   $server=$1;
  22.   $bbs=$2;
  23.   $key=$3;
  24. } else {
  25.   die
  26. }
  27.  
  28. my %formdata = (
  29.   MESSAGE        => $message,
  30.   mail           => $mail,
  31.   FROM           => $FROM,
  32.   time           => '1',
  33.   key            => $key,
  34.   bbs            => $bbs,
  35. );
  36.  
  37. my $cookie_jar = HTTP::Cookies->new();
  38. my $hd = LWP::UserAgent->new;
  39. $hd->agent($ua);
  40. $hd->timeout('10');
  41. $hd->cookie_jar($cookie_jar);
  42.  
  43.  
  44. for (my $count=0; $count<$times; $count++){
  45.   sleep $sleep;
  46.   my $req = POST( "http://".$server.".5ch.net/test/bbs.cgi", [%formdata] );
  47.   $req->referer("http://".$server.".5ch.net/".$bbs."/");
  48.   $req->header( 'Accept' => 'text/html' );
  49.   my $res = $hd->request($req);
  50.   if ($res->is_success) {
  51.     $res = $hd->request($req);
  52.     if ($res->is_success) {
  53.       print $count.":success:".$res->status_line,"\n";
  54.     } else {
  55.       print $count.":faile:","\n";
  56.     }
  57.   } else {
  58.     print $res->status_line, "\n";
  59.   }
  60.   $cookie_jar->clear;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement