我正在開發一個perl腳本,用於檢查多個cpanel帳戶對弱密碼的授權,例如服務器所有者可以檢查他的用戶是否使用弱密碼,以及何時連接到一個寫/ public_html/dir中的文件來爲用戶提供信息。 我想用cPanel::PublicAPI
的:使用perl腳本檢查cPanel授權並寫入文件
my $cp = cPanel::PublicAPI->new(
'user' => $username,
'pass' => $password,
'host' => $host,
);
,但我不知道如何檢查連接以及如何在它(i've looked here)
我發現,檢查授權腳本寫入文件:
$authx = encode_base64($user.":".$passwd);
my $sock = IO::Socket::INET->new(Proto => "tcp",PeerAddr => "$host", PeerPort => "$port") || print " [-] Can not connect to the host";
print $sock "GET/HTTP/1.1";
print $sock "Authorization: Basic $authx";
print $sock "Connection: Close";
read $sock, $answer, 128;
close($sock);
if ($answer =~ /Moved/) {
print " passord is : $passwd\n";
}
但這太慢了,不能用它寫文件。 對不起,我的英語:)。至於
該授權腳本是不必要的低級別。我們已經爲像這樣的任務開發了諸如[LWP :: UserAgent](http://p3rl.org/LWP::UserAgent)之類的HTTP庫! – daxim