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 ($host, $port) = split(' ', $data);
- $server->command("/MSG ".$target." Checking host: ".$host." and port ".$port." ");
- my ($sock) = new
- IO::Socket::INET(PeerAddr=>$host,PeerPort=>$port,Proto=>'tcp');
- if($sock)
- {
- $server->command("/MSG ".$target." Online!");
- }
- else {
- }
- $server->command("/MSG ".$target." Offline!");
- }
- }
- 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