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 ($server, $data, $nick, $mask, $target, $channel) =@_;
- if ($data=~/^!check/){
- $server->command("/MSG ".$target.": test");
- }
- }
- 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