- #!/usr/local/bin/perl
- # Written by Ilker TEMIR
- $image="/gif/mweb.gif";
- $myself="/cgi-bin/lg.cgi";
- $gatedaliases="Ankara-GRF400";
- $gatedhosts="grf.marketweb.net.tr";
- $gatedpasswords="password";
- if ($ENV{'REQUEST_METHOD'} eq "POST") {
- } else {
- $buffer=$ENV {'QUERY_STRING'};
- }
- foreach $pair (@pairs) {
- $value=~ tr/+/ /;
- $value=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
- $contents{$name}=$value;
- }
- }
- $query=$contents{'query'};
- $address=$contents{'address'};
- $gatedserver=$contents{'gatedserver'};
- # Check unallowed characters in address
- foreach $ch ('a'..'z',';',':','\>','\<','=') {
- if ($address =~ /$ch/i) {
- exit;
- }
- }
- # Now check query in case of an intruders alternate try
- if ($query ne "") {
- $checkpass=0;
- foreach $check ('show bgp summary','show ip exact','show ip consume','show ip refines bgp','show ip less bgp','show bgp detail as','show bgp detail ptx','show bgp detail prx') {
- if ($query eq $check) {
- $checkpass=1;
- }
- }
- if (!($checkpass)) {
- exit;
- }
- }
- # Check if the gated server is valid
- if (($gatedserver ne "") && (($gatedhost{"$gatedserver"} eq "") || ($gatedpassword{"$gatedserver"} eq ""))) {
- exit;
- }
- if (($query eq "") || ($gatedserver eq "")) {
- }
- print "<DD><INPUT TYPE=radio NAME=query VALUE='show ip refines bgp'>Show IP refines bgp ... [x.x.x.x/y]\n";
- print "<DD><INPUT TYPE=radio NAME=query VALUE='show ip less bgp'>Show IP less bgp ... [x.x.x.x/y]\n";
- print "<DD><INPUT TYPE=radio NAME=query VALUE='show bgp detail as'>Show bgp detail as ... [gated regexp]\n";
- print "<DD><INPUT TYPE=radio NAME=query VALUE='show bgp detail ptx'>Show bgp detail ptx ... [AS Peer_IP x.x.x/y]\n";
- print "<DD><INPUT TYPE=radio NAME=query VALUE='show bgp detail prx'>Show bgp detail prx ... [AS Peer_IP x.x.x/y]\n";
- print "<BR><BR>GateD durum monitor yazilimi v0.1 - Ilker TEMIR (<A HREF=mailto:ilker\@marketweb.net.tr>ilker\@marketweb.net.tr</A>)\n";
- }
- elsif ($ENV {'HTTP_REFERER'} eq $myself) {
- gatedexec ($gatedserver,"$query $address");
- print "<BR><A HREF=http://ilker.marketweb.net.tr/gdm>GDM v0.1</A> - Ilker TEMIR (<A HREF=mailto:ilker\@marketweb.net.tr>ilker\@marketweb.net.tr</A>)\n";
- }
- else {
- }
- sub gatedexec {
- use Socket;
- $port = '';
- $hostname='';
- $remote_host=$gatedhost{$_[0]};
- $password=$gatedpassword{$_[0]};
- $sockaddr = 'S n a4 x8';
- $port = 616;
- exit;
- }
- exit;
- }
- exit;
- }
- $gatedout=<S>; # Skip first line
- $gatedout=<S>; # Skip second line
- while ($gatedout = <S>) {
- if (!($gatedout =~ /password/i)) {
- if ($gatedout =~ /gated/i) {
- }
- }
- }
- }
Raw Paste