Created
March 19, 2020 22:27
-
-
Save marcin-gryszkalis/e263b3bbf066a545d81b641a27e94019 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use Net::Curl::Easy qw(:constants); | |
my $user = "marcing"; | |
my $pass = "xxx"; | |
my $hit = "http://vps622506.ovh.net/ctf_1/index.php?u=$user&t=$pass"; | |
my $check = "http://vps622506.ovh.net/ctf_1/index.php"; | |
# external loop for easy error handling | |
while (1) | |
{ | |
my $res_hit = ''; | |
my $res_check = ''; | |
my $curl_hit = Net::Curl::Easy->new(); | |
my $curl_check = Net::Curl::Easy->new(); | |
$curl_hit->setopt( CURLOPT_URL, $hit ); | |
$curl_check->setopt( CURLOPT_URL, $check ); | |
$curl_hit->setopt( CURLOPT_FOLLOWLOCATION, 1 ); | |
$curl_check->setopt( CURLOPT_FOLLOWLOCATION, 1 ); | |
$curl_hit->setopt( CURLOPT_FILE, \$res_hit ); | |
$curl_check->setopt( CURLOPT_FILE, \$res_check ); | |
# serwer nie wspiera :( | |
# $curl_hit->setopt( CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0 ); | |
# $curl_check->setopt( CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0 ); | |
my $stime = time() - 1; | |
my $i = 0; | |
my $kills = 0; | |
while (1) | |
{ | |
$i++; | |
$res_check = ""; | |
eval | |
{ | |
$curl_check->perform(); | |
}; | |
last if ( ref $@ eq "Net::Curl::Easy::Code" ); | |
chomp $res_check; | |
next if $res_check eq $user; | |
$kills++; | |
$res_hit = ""; | |
eval | |
{ | |
$curl_hit->perform(); | |
}; | |
last if ( ref $@ eq "Net::Curl::Easy::Code" ); | |
my $t = time(); | |
my $speed = int($i / ($t - $stime)); | |
my $speeds = int($kills / ($t - $stime)); | |
next unless $kills % 20 == 0; | |
printf "%09d killed %d: %-4s %-20s -- %d req/s, %d kill/s\n", $i, $kills, $res_hit, $res_check, $speed, $speeds; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment