Я пытаюсь написать скрипт, который меняет реальный ip при подключении к irc серверу.
после многих попыток я не смог изменить ip, он все тот же
Есть личто-нибудь, что я могу изменить или какие-либо инструменты для использования?
Я пробовал команду tor torsocks perl bot.pl, но тоже не удалось
Спасибо
Вот код
#!/usr/local/bin/perl -w
# irc.pl
# A simple IRC robot.
# Usage: perl irc.pl
use strict;
use IO::Socket::Socks qw(:constants $SOCKS_ERROR);
use IO::Socket;
use IO::Socket::INET;
# We will use a raw socket to connect to the IRC server.
if (my $socket = new IO::Socket::INET(
'PeerHost' => '127.0.0.1',
'PeerPort' => '9050',
'Proto' => 'torsocks')) {
my @requ = ('authenticate ""','SIGNAL NEWNYM','QUIT');
foreach my $requ (@requ) {
print $socket $requ."\n";
my $dummy = <$socket>;
}
$socket->close();
print "OK: New circuit established\n";
} else {
print "ERROR: couldn't connect with socket\n";
}
# The server to connect to and our details.
my $server = "Yourserver";
my $nick = "YourNick";
my $login = "YourLogin";
# The channel which the bot will join.
my $channel = "#bot";
# Connect to the IRC server.
my $sock = new IO::Socket::INET(PeerAddr => $server,
PeerPort => 6667,
Proto => 'tcp') or
die "Can't connect\n";
# Log on to the server.
print $sock "NICK $nick\r\n";
print $sock "USER $login 8 * :Perl IRC Hacks Robot\r\n";
# Read lines from the server until it tells us we have connected.
while (my $input = <$sock>) {
# Check the numerical responses from the server.
if ($input =~ /004/) {
# We are now logged in.
last;
}
elsif ($input =~ /433/) {
die "Nickname is already in use.";
}
}
# Join the channel.
print $sock "JOIN $channel\r\n";
# Keep reading lines from the server.
while (my $input = <$sock>) {
chop $input;
if ($input =~ /^PING(.*)$/i) {
# We must respond to PINGs to avoid being disconnected.
print $sock "PONG $1\r\n";
}
else {
# Print the raw line received by the bot.
print "$input\n";
}
}