1 | 1 | simandl | #!/usr/bin/perl |
2 | | | # |
3 | | | # Petr Simandl, www.simandl.cz |
4 | | | # |
5 | | | |
6 | | | print "Content-type: text/html\n\n"; |
7 | | | |
8 | | | print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache></HEAD><BODY>\n"; |
9 | | | |
10 | | | print "Porovnani obsahu wiki <a href=\"http://czfree.net/wiki/Registrovane_cloudy\">Registrovane_cloudy</a> |
11 | | | s aktualnima <a href=\"/cgi-bin/route.cgi\">routama</a>"; |
12 | | | |
13 | | | print "<pre>"; |
14 | | | |
15 | | | $date = `date`; |
16 | | | @gl_cloudy=`wget -q -O - http://czfree.net/wiki/Registrovane_cloudy`; |
17 | | | @gl_routy=`ip ro ls | grep ^10 `; |
18 | | | |
19 | | | @ol_ips=(); |
20 | | | @ol_=(); |
21 | | | |
22 | | | foreach $gl_line (@gl_cloudy) |
23 | | | { |
24 | | | if ($gl_line =~ /^\<td\> AS6/) |
25 | | | {#print "$gl_pole[4] $gl_pole[5]\n"; |
26 | | | $gl_line =~ s/<td> //; |
27 | | | $gl_line =~ s/<\/td><td>/\t/g; |
28 | | | |
29 | | | @gl_pole=split("\t",$gl_line); |
30 | | | $gl_as = $gl_pole[0]; |
31 | | | $gl_as =~ s/ //g; |
32 | | | $gl_rozsah = $gl_pole[1]; |
33 | | | $gl_rozsah =~ s/ //g; |
34 | | | @gl_rozsah=split("a",$gl_rozsah); |
35 | | | |
36 | | | $gl_zastupce = $gl_pole[2]; |
37 | | | $gl_udaje = $gl_pole[3]; |
38 | | | $gl_online = $gl_pole[4]; |
39 | | | $gl_pritomno = 0; |
40 | | | $gl_podobne = ""; |
41 | | | |
42 | | | print "<a href=\"http://ripe.czfree.net/index.php?action=object.search¶mvalue=$gl_rozsah\">$gl_as</a> ma mit @gl_rozsah a nalezeno: "; |
43 | | | |
44 | | | foreach $gl_routa (@gl_rozsah) |
45 | | | { |
46 | | | foreach $gl_iprouta (@gl_routy) |
47 | | | { |
48 | | | @gl_linka=split(" ",$gl_iprouta); |
49 | | | if ("$gl_linka[0]" eq "$gl_routa") |
50 | | | { |
51 | | | $gl_pritomno += 1; |
52 | | | print "$gl_routa "; |
53 | | | } else { |
54 | | | @gl_ipnum=split("\\.",$gl_linka[0]); |
55 | | | @gl_ronum=split("\\.",$gl_routa); |
56 | | | if ("$gl_ipnum[1]" eq "$gl_ronum[1]") |
57 | | | { |
58 | | | $gl_podobne .= "<a href=\"http://ripe.czfree.net/index.php?action=object.search¶mvalue=$gl_linka[0]\">$gl_linka[0]</a> "; |
59 | | | } |
60 | | | } |
61 | | | } |
62 | | | } |
63 | | | if ($gl_pritomno == 0) |
64 | | | { print "nic<blink>!</blink>\t"; |
65 | | | } |
66 | | | if ($gl_podobne) |
67 | | | { |
68 | | | print "\tpodobne routy: $gl_podobne "; |
69 | | | } |
70 | | | print " \n"; |
71 | | | |
72 | | | } |
73 | | | } |
74 | | | |
75 | | | print "</pre></body></html>"; |