⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcp-banger.pl

📁 -
💻 PL
字号:
#!/usr/local/bin/perl# tcp-banger.pl	## Duane Wessels, Dec 1995## Usage: tcp-banger.pl [host [port]] < url-list## Sends a continuous stream of HTTP proxy requests to a cache.  Stdin is a# list of URLs to request.  Run N of these at the same time to simulate a# heavy client load.## NOTE: does not simulate "real-world" events such as aborted requests# (connections) and other network problems.$|=1;$host=(shift || 'localhost') ;$port=(shift || '3128') ;require 'sys/socket.ph';$sockaddr = 'S n a4 x8';($name, $aliases, $proto) = getprotobyname("tcp");($fqdn, $aliases, $type, $len, $thataddr) = gethostbyname($host);$thissock = pack($sockaddr, &AF_INET, 0, "\0\0\0\0");$that = pack($sockaddr, &AF_INET, $port, $thataddr);while (<>) {	chop ($url = $_);	die "socket: $!\n" unless        	socket (SOCK, &AF_INET, &SOCK_STREAM, $proto);	die "bind: $!\n" unless        	bind (SOCK, $thissock);        die "$host:$port: $!\n" unless		connect (SOCK, $that);        select (SOCK); $| = 1;        select (STDOUT);	print SOCK "GET $url HTTP/1.0\r\nAccept: */*\r\n\r\n";	$_ = <SOCK>;	($ver,$code,$junk) = split;	printf "%s %s\n", $code ? $code : 'FAIL', $url;	1 while (read(SOCK,$_,4096));	close SOCK;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -