Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Irssi;
- use Irssi::Irc;
- use strict;
- use vars qw($VERSION %IRSSI);
- use IO::Socket;
- $VERSION = '1.5';
- %IRSSI = (
- authors => 'Aha2Y alias Shiny',
- contact => 'Aha2Y@Hush.com',
- name => 'Port checker',
- description => 'Check if a port is open' .
- 'or closed' .
- 'Actualy my first script.',
- license => 'Aha2Y',
- );
- sub cmd_check {
- my ($text) = @_;
- my ($server, $data, $nick, $mask, $target, $channel) =@_;
- if ($data=~/^!check/){
- my ($message ,$host, $port) = split(' ', $data);
- if ($port == "blank") { $server->command("notice ".$nick." Fail, Its !check [host] [port] you idiot!"); }
- else {
- my ($sock) = new
- IO::Socket::INET(PeerAddr=>$host,PeerPort=>$port,Proto=>'tcp');
- if($sock)
- {
- $server->command("/MSG ".$target." ".$host.":".$port." = 3Online");
- }
- else
- {
- $server->command("/MSG ".$target." ".$host.":".$port." = 4Offline");
- }
- }
- }
- if ($data=~/^!isup/){
- my ($message ,$host) = split(' ', $data);
- my ($sock) = new
- IO::Socket::INET(PeerAddr=>$host,PeerPort=>80,Proto=>'tcp');
- if($sock)
- {
- $server->command("/MSG ".$target." ".$host." = 3Online");
- }
- else
- {
- $server->command("/MSG ".$target." ".$host." = 4Offline");
- }
- }
- }
- Irssi::signal_add_last('message public', 'cmd_check');
- Irssi::command_bind check => sub {
- my ($text) = @_;
- my ($args, $active_server, $witem) = @_;
- my ($host, $port) = split(' ', $text);
- Irssi::print("Checking host: $host and port: $port");
- my ($sock) = new
- IO::Socket::INET(PeerAddr=>$host,PeerPort=>$port,Proto=>'tcp');
- if($sock)
- {
- Irssi::print("Online");
- }
- else
- {
- Irssi::print("Offline");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement