- Timestamp:
- Nov 3, 2010, 9:33:06 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r71 r72 928 928 print <<'END_HTML'; 929 929 <table class="sortable" summary="Klask export database"> 930 <caption>Klask database</caption>930 <caption>Klask Host Database</caption> 931 931 <thead> 932 932 <tr> … … 1165 1165 ); 1166 1166 1167 my %possible_format = ( 1168 txt => \&cmd_ip_free_txt, 1169 html => \&cmd_ip_free_html, 1170 ); 1171 $format = 'txt' if not defined $possible_format{$format}; 1172 1167 1173 @vlan_name = get_list_network() if not @vlan_name; 1168 1169 # my %possible_format = (1170 # txt => \&cmd_exportdb_txt,1171 # html => \&cmd_exportdb_html,1172 # );1173 #1174 # $format = 'txt' if not defined $possible_format{$format};1175 #1176 # $possible_format{$format}->(@ARGV);1177 1174 1178 1175 my $computerdb = {}; … … 1182 1179 my $timestamp_barrier = $timestamp - (3600 * 24 * $days_to_dead ); 1183 1180 1184 my %result_ip = ();1181 my %result_ip = (); 1185 1182 1186 1183 ALL_NETWORK: … … 1217 1214 } 1218 1215 1216 $possible_format{$format}->(%result_ip); 1217 } 1218 1219 sub cmd_ip_free_txt { 1220 my %result_ip = @_; 1221 1219 1222 printf "%-15s %-40s %-16s %s\n", qw(IPv4-Address Hostname-FQ Date VLAN); 1220 1223 print "-------------------------------------------------------------------------------\n"; 1221 LOOP_ON_ RESULT:1224 LOOP_ON_IP_ADDRESS: 1222 1225 foreach my $ip (Net::Netmask::sort_by_ip_address(keys %result_ip)) { 1223 1226 printf "%-15s %-40s %-16s %s\n", $ip, $result_ip{$ip}->{hostname_fq}, $result_ip{$ip}->{date_last_detection}, $result_ip{$ip}->{vlan}; 1224 1227 } 1228 } 1229 1230 sub cmd_ip_free_html { 1231 my %result_ip = @_; 1232 1233 print <<'END_HTML'; 1234 <table class="sortable" summary="Klask export database"> 1235 <caption>Klask IP Free Database</caption> 1236 <thead> 1237 <tr> 1238 <th scope="col" class="hklask-ipv4">IPv4-Address</th> 1239 <th scope="col" class="sorttable_alpha">Hostname-FQ</th> 1240 <th scope="col" class="sorttable_alpha">VLAN</th> 1241 <th scope="col" class="hklask-date">Date</th> 1242 </tr> 1243 </thead> 1244 <tfoot> 1245 <tr> 1246 <th scope="col" class="fklask-ipv4">IPv4-Address</th> 1247 <th scope="col" class="fklask-hostname">Hostname</th> 1248 <th scope="col" class="fklask-vlan">VLAN</th> 1249 <th scope="col" class="fklask-date">Date</th> 1250 </tr> 1251 </tfoot> 1252 <tbody> 1253 END_HTML 1254 1255 my $typerow = 'even'; 1256 1257 LOOP_ON_IP_ADDRESS: 1258 foreach my $ip (Net::Netmask::sort_by_ip_address(keys %result_ip)) { 1259 1260 $typerow = $typerow eq 'even' ? 'odd' : 'even'; 1261 1262 my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ip; 1263 my ( $host_short ) = split m/ \. /xms, $result_ip{$ip}->{hostname_fq}; 1264 1265 print <<"END_HTML"; 1266 <tr class="$typerow"> 1267 <td sorttable_customkey="$ip_sort">$ip</td> 1268 <td sorttable_customkey="$host_short">$result_ip{$ip}->{hostname_fq}</td> 1269 <td>$result_ip{$ip}->{vlan}</td> 1270 <td>$result_ip{$ip}->{date_last_detection}</td> 1271 </tr> 1272 END_HTML 1273 } 1274 print <<'END_HTML'; 1275 </tbody> 1276 </table> 1277 END_HTML 1225 1278 } 1226 1279
Note: See TracChangeset
for help on using the changeset viewer.