#!/usr/bin/perl -w use IO::Socket; ## ini adalah server tempat meletakkan daftar neighbor terbaru #$server = 'voipm.i-ummah.com'; $server = 'www.apjii.or.id'; $port = 80; ## nama file konfigurasi yang hendak diambil dari server $inifile = 'gnugk.ini'; ## nama file konfigurasi yang akan dipakai oleh gnugk Anda $outputfile = 'mygnugk.ini'; # Patch untuk versi 2.0a by judhi@prasetyo.net # Tidak digunakan jika menggunakan versi 2.0.2 $version = "2.0.2"; # End of Patch untuk versi 2.0a # jangan ubah apa-apa lagi setelah baris ini ############################################# $start = 0; $socket = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => $server, PeerPort => $port, Timeout => 10, ); unless($socket) { die("Could not connect to $server:$port"); } $socket->autoflush(1); #print $socket ("GET /$inifile HTTP/1.0\nHost: $server\nReferer: http://judhi.i-umm ah.com\nUser-Agent: Simple Socket 1.2b\n\n"); print $socket ("GET /$inifile HTTP/1.0\nHost: $server\nReferer: http://www.apjii.or.id\nUser-Agent: Simple Socket 1.2b\n\n"); $off = 1; while ($line = <$socket>) { if ($line =~ /^\s*$/) { $off = 0; } unless ($off) { if (rindex($line,"\# gatekeeper VoIP Merdeka") == 0) { $start=1; } if ($start==1) {$content.=$line;} } } $timeupdate = `date`; open (HEADERFILE, "header.ini")|| die "\nERROR: No header.ini found! Please create one first.\n\n"; @headerfile = ; close (HEADERFILE); open (FILE, ">$outputfile"); foreach $headerline (@headerfile) { print FILE $headerline; } # Patch untuk versi 2.0a by judhi@prasetyo.net # Tidak digunakan jika menggunakan versi 2.0.2 if ($version eq "2.0.2") { $content=~ s/\[RasSrv/\[RasSvr/g; } # End of Patch untuk versi 2.0a print FILE $content; # modified by harijanto@uptkom.cic.ac.id, 29 january 2003 print FILE "#Successfull updated = "; print FILE $timeupdate; # modified by harijanto@uptkom.cic.ac.id, 29 January 2003 close (FILE); # modified by harijanto@uptkom.cic.ac.id, 29 january 2003 # For automatic reload gnugk configuration # Based on reportgk.pl by judhi@prasetyo.net #------------------------------------------- use IO::Socket; # ganti setting ini jika tidak sesuai dgn setting # port kontrol di GK Anda $current_host = "localhost"; $portgk = "7000"; # jangan ubah apa-apa lagi setelah baris ini $remote =IO::Socket::INET->new(Proto => "tcp", PeerAddr => $current_host, PeerPort => $portgk, ); if (!$remote) {die "cannot connect to $current_host $port"} $remote->autoflush(1); # modified by harijanto@uptkom.cic.ac.id, 29 january 2003 print $remote "reload\n"; # modified by harijanto@uptkom.cic.ac.id, 29 january 2003 print $remote "q\n"; close $remote; print "Done!\n"; exit();