Changeset 417 for trunk/cgi-bin/extras
- Timestamp:
- 06/30/10 17:48:03 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/extras/db2rwhois.pl
r380 r417 10 10 # Last update by $Author$ 11 11 ### 12 # Copyright (C) 2004-20 07- Kris Deugau12 # Copyright (C) 2004-2010 - Kris Deugau 13 13 14 14 use strict; … … 16 16 use DBI; 17 17 use NetAddr::IP; 18 use File::Path 'rmtree'; 19 use POSIX qw(strftime); 20 21 # don't remove! required for GNU/FHS-ish install from tarball 22 ##uselib## 23 18 24 use MyIPDB; 19 use File::Path 'rmtree'; 20 21 $ENV{"PATH"} = "/bin;/usr/bin"; 25 26 #$ENV{"PATH"} = "/bin;/usr/bin"; 22 27 23 28 my $rwhoisDataPath = "/etc/rwhoisd"; … … 91 96 print "$masterblocks[$i] $ctime $mtime\n"; 92 97 93 my $date; 94 chomp ($date = `/bin/date +"%Y-%m-%d"`); 98 my $date = strftime("%Y-%m-%d", localtime); 95 99 96 100 my $rwnet = "net-".$masterblocks[$i]->addr."-".$masterblocks[$i]->masklen; … … 111 115 mkdir "$netdatadir/data/referral"; 112 116 113 my $serial ;114 chomp ($serial = `/bin/date '+%Y%m%d'000000000`); 115 117 my $serial = strftime("%Y%m%d%H%M%S000", localtime); 118 119 ##fixme: SOA should be different every time data changes, therefore need to rewrite this ~~ every export :( 116 120 print " Creating SOA...\n"; 117 121 open SOAFILE, ">$netdatadir/soa"; … … 147 151 148 152 print " Copying template files...\n"; 153 ##fixme: find a way to do this without a shell (or functional equivalent) 149 154 qx { /bin/cp $rwhoisDataPath/skel/attribute_defs/* $netdatadir/attribute_defs/ }; 150 155 156 ##fixme: not sure if this is even necessary, since it's not referenced anywhere I can recall... 151 157 print " Creating org data...\n"; 152 open ORGDATAFILE, ">$netdatadir/data/org/ friendlyisp.txt";158 open ORGDATAFILE, ">$netdatadir/data/org/ourorg.txt"; 153 159 print ORGDATAFILE qq(ID: NETBLK-ISP.$masterblocks[$i] 154 160 Auth-Area: $masterblocks[$i] 155 Org-Name: Friendly ISP156 Street-Address: 123 4th Street157 City: Anytown158 State: ON159 Postal-Code: H0H 0H0160 Country-Code: CA161 Phone: 000-555-1234161 Org-Name: $IPDB::org_name 162 Street-Address: $IPDB::org_street 163 City: $IPDB::org_city 164 State: $IPDB::org_prov_state 165 Postal-Code: $IPDB::org_pocode 166 Country-Code: $IPDB::org_country 167 Phone: $IPDB::org_phone 162 168 Created: 20040308 163 169 Updated: 20040308 … … 189 195 "IP-Network: $masterblocks[$i]\n". 190 196 "IP-Network-Block: ".$masterblocks[$i]->range."\n". 191 "Org-Name: Friendly ISP\n".192 "Street-Address: 123 4th Street\n".193 "City: Anytown\n".194 "StateProv: Ontario\n".195 "Postal-Code: H0H 0H0\n".196 "Country-Code: CA\n".197 "Tech-Contact: ISP-ARIN-HANDLE\n".197 "Org-Name: $IPDB::org_name\n". 198 "Street-Address: $IPDB::org_street\n". 199 "City: $IPDB::org_city\n". 200 "StateProv: $IPDB::org_prov_state\n". 201 "Postal-Code: $IPDB::org_pocode\n". 202 "Country-Code: $IPDB::org_country\n". 203 "Tech-Contact: $IPDB::org_techhandle\n". 198 204 "Created: $ctime\n". 199 205 "Updated: $mtime\n". … … 226 232 227 233 # Fill in a generic entry for nameless allocations 228 if ($desc =~ /^\s*$/) { $desc = 'Friendly ISP'; }234 if ($desc =~ /^\s*$/) { $desc = $IPDB::org_name; } 229 235 230 236 # Fix up datestamps. We don't *really* need sub-microsecond resolution on our exports... … … 257 263 "IP-Network: $net\n". 258 264 "IP-Network-Block: ".$net->range."\n". 259 "Org-Name: Friendly ISP\n".260 "Street-Address: 123 4th Street\n".261 "City: Anytown\n".262 "StateProv: Ontario\n".263 "Postal-Code: H0H 0H0\n".264 "Country-Code: CA\n".265 "Tech-Contact: ISP-ARIN-HANDLE\n".265 "Org-Name: $IPDB::org_name\n". 266 "Street-Address: $IPDB::org_street\n". 267 "City: $IPDB::org_city\n". 268 "StateProv: $IPDB::org_prov_state\n". 269 "Postal-Code: $IPDB::org_pocode\n". 270 "Country-Code: $IPDB::org_country\n". 271 "Tech-Contact: $IPDB::org_techhandle\n". 266 272 "Created: $ctime\n". 267 273 "Updated: $mtime\n". … … 281 287 "IP-Network: $net\n". 282 288 "IP-Network-Block: ".$net->range."\n". 283 "Org-Name: ".($name ? $name : 'Friendly ISP')."\n".284 "Street-Address: ".($street ? $street : '123 4th Street')."\n".285 "City: ".($city ? $city : 'Anytown')."\n".286 "StateProv: ".($prov ? $prov : 'Ontario')."\n".287 "Postal-Code: ".($pocode ? $pocode : 'H0H 0H0')."\n".288 "Country-Code: ".($country ? $country : 'CA')."\n".289 "Tech-Contact: ".($tech ? $tech : 'ISP-ARIN-HANDLE')."\n".289 "Org-Name: ".($name ? $name : $IPDB::org_name)."\n". 290 "Street-Address: ".($street ? $street : $IPDB::org_street)."\n". 291 "City: ".($city ? $city : $IPDB::org_city)."\n". 292 "StateProv: ".($prov ? $prov : $IPDB::org_prov_state)."\n". 293 "Postal-Code: ".($pocode ? $pocode : $IPDB::org_pocode)."\n". 294 "Country-Code: ".($country ? $country : $IPDB::org_country)."\n". 295 "Tech-Contact: ".($tech ? $tech : $IPDB::org_techhandle)."\n". 290 296 "Created: $ctime\n". 291 297 "Updated: $mtime\n".
Note:
See TracChangeset
for help on using the changeset viewer.