-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathddns.cgi
executable file
·90 lines (70 loc) · 2.71 KB
/
ddns.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/perl -w
##############################################################################
# COPYLEFT NOTICE JPL ver.cgi #
##############################################################################
print "Content-type: text/html\n\n";
print "<html><head><META HTTP-EQUIV=\"REFRESH\" CONTENT=\"900;URL=http://ip.gnu.works/ddns.cgi\"><title>Controle de IP's</title></head>\n";
print "<body bgcolor=\"#000000\" text=\"#FFFFFF\">\n";
%hosts=( "01","cv:Cabo Verde:#00FF00",
"02","ge:Geral:#FF0080",
"03","ip:IP:#FF8373",
#"04","ro:Ross:#008080",
"05","sv:São Vicente:#FFFFFF",
#"06","st:Tilápia:#80A8FF",
#"07","ca:Carpa:#ffbd71",
#"08","st2:Cara:#8EFFAC",
#"09","el:Orsi:#FF8373",
#3"10","ci:Bene:#FF7F00",
#"11","pa:Papagaio:#C043FF",
#"12","eq:Embaquim:#8EFFAC",
#"13","dw:DWG:#008080",
#"14","ex:Calex:#FF8373",
#"15","ih:Ihm:#CO43FF",
#"16","ch:Chassi:#FF8373",
#"17","ad:Aglaw:#8EFFAC",
#"18","ce:Ceramic:#008080",
#"19","pi:Pipe:#C043FF",
);
$on = "<img src=\"imagens/on.png\" width=\"32\" height=\"32\" alt=\"On\" />";
$off = "<img src=\"imagens/off.png\" width=\"32\" height=\"32\" alt=\"Off\" />";
$agora = time;
$localtime = localtime;
print "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\">\n";
print "<tr>";
print "<td colspan=\"5\"><font color=\"#FFFFFF\">Controle de servidores: [$localtime]</font></td>";
print "</tr>\n";
print "<tr>";
print "<th>Estado</th>";
print "<th> Diferença</th>";
print "<th width=\"130\"><font color=\"$dados[2]\"> Servidor</font></th>";
print "<th width=\"170\"><font color=\"$dados[2]\"> IP</font></th>";
print "<th width=\"250\"><font color=\"$dados[2]\"> Horário</font></th>";
print "</tr>\n";
foreach $host (sort keys %hosts) {
@dados = split(":",$hosts{$host});
open (FILE,"logs/$dados[0].txt");
$linha = <FILE>;
close(FILE);
@info = split("#",$linha);
$hora = $info[0];
$hora_epoch = $info[2];
$diferenca = $agora - $hora_epoch;
if ( $diferenca < 1200 ) {
$status = "<font color=\"#00FF00\">On</font>";
} else {
$status = "<font color=\"#FF0000\">Off</font>";
}
print "<tr>";
print "<td>$status </td>";
print "<td> $diferenca</td>";
print "<td width=\"130\"><font color=\"$dados[2]\"> $dados[1]</font></td>";
print "<td width=\"170\"><font color=\"$dados[2]\"> $info[1]</font></td>";
print "<td width=\"250\"><font color=\"$dados[2]\"> $hora</font></td>";
print "</tr>\n";
}
#print "<font color=\"#ffbd71\" >";
#print "<font color=\"#0000FF\" >";
#print "<font color=\"#FF7F00\" >";
print "</table>";
print "</body></html>";
exit;