* Digest-HMAC-1.01
* Digest-SHA1-2.10
* GD-2.12
+ * Geo-IP-PurePerl-1.17
* HTML-Parser-3.45
* HTML-Tagset-3.04
* IO-stringy-2.110
--- /dev/null
+#!/usr/bin/perl
+#
+#
+# This code is distributed under the terms of the GPL
+#
+# Country Codes
+#
+# 01.01.2006 Stephen Crooks
+
+use strict;
+
+use Locale::Country;
+
+my $flagdir = '/home/httpd/html/images/flags';
+my $lines = '1';
+my $lines2 = '';
+my @flaglist=();
+my @flaglistfiles=();
+my $flag = '';
+
+require '/var/ipcop/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+&Header::showhttpheaders();
+
+&Header::openpage('Country Codes', 1, '');
+&Header::openbigbox('100%', 'LEFT');
+
+&Header::openbox('100%', 'LEFT', 'Flags & Country Codes:');
+print "<TABLE WIDTH='100%'>";
+print "<tr><td width='5%'><b>Flag</b></td>";
+print "<td width='5%'><b>Code</b></td>";
+print "<td width='40%'><b>Country</b></td>";
+print "<td><b> </b></td>";
+print "<td width='5%'><b>Flag</b></td>";
+print "<td width='5%'><b>Code</b></td>";
+print "<td width='40%'><b>Country</b></td></tr>";
+
+@flaglist = <$flagdir/*>;
+
+undef @flaglistfiles;
+
+foreach (@flaglist)
+{
+ if (!-d) { push(@flaglistfiles,substr($_,rindex($_,"/")+1)); }
+}
+
+foreach $flag (@flaglistfiles)
+{
+ $lines++;
+
+ my $flagcode = uc(substr($flag, 0, 2));
+ my $fcode = lc($flagcode);
+ my $country = Locale::Country::code2country($fcode);
+ if($fcode eq 'eu') { $country = 'Europe'; }
+ if($fcode eq 'tp') { $country = 'East Timor'; }
+ if($fcode eq 'yu') { $country = 'Yugoslavia'; }
+ if ($lines % 2) {
+ print "<td><a name='$fcode'/><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$flagcode'</td>";
+ print "<td>$flagcode</td>";
+ print "<td>$country</td></tr>\n";
+ }
+ else {
+ $lines2++;
+ if($lines2 % 2) {
+ print "<tr bgcolor='${Header::table1colour}'>";
+ } else {
+ print "<tr bgcolor='${Header::table2colour}'>";
+ }
+ print "<td><a name='$fcode'/><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$flagcode'</td>";
+ print "<td>$flagcode</td>";
+ print "<td>$country</td>";
+ #print "<td><img src='/blob.gif' alt='*' /></td>";
+ print "<td> </td>";
+ }
+}
+
+
+print "</TABLE>";
+&Header::closebox();
+
+&Header::closebigbox();
+
+print <<END
+<div align='center'>
+<table width='80%'>
+<tr>
+<td align='center'><a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a></td>
+</tr>
+</table>
+</div>
+END
+;
+
+&Header::closepage();
+
+
#
use strict;
+use Geo::IP::PurePerl;
+use Getopt::Std;
+
# enable only the following on debugging purpose
#use warnings;
#use CGI::Carp 'fatalsToBrowser';
<td width='5%' align='center' class='boldbase'><b>$Lang::tr{'iface'}</b></td>
<td width='5%' align='center' class='boldbase'><b>$Lang::tr{'proto'}</b></td>
<td width='16%' align='center' class='boldbase'><b>$Lang::tr{'source'}</b></td>
+ <td align='center' class='boldbase'><b>Flag</b></td>
<td width='10%' align='center' class='boldbase'><b>$Lang::tr{'src port'}</b></td>
<td width='5%' align='center' class='boldbase'><b>$Lang::tr{'mac address'}</b></td>
<td width='16%' align='center' class='boldbase'><b>$Lang::tr{'destination'}</b></td>
my $comment = $3;
my $packet = $4;
-
$packet =~ /IN=(\w+)/; my $iface=$1;
$packet =~ /SRC=([\d\.]+)/; my $srcaddr=$1;
$packet =~ /DST=([\d\.]+)/; my $dstaddr=$1;
$packet =~ /PROTO=(\w+)/; my $proto=$1;
$packet =~ /SPT=(\d+)/; my $srcport=$1;
$packet =~ /DPT=(\d+)/; my $dstport=$1;
+
+ my $gi = Geo::IP::PurePerl->new();
+ my $ccode = $gi->country_code_by_name($srcaddr);
+ my $fcode = lc($ccode);
+
my $servi = uc(getservbyport($srcport, lc($proto)));
if ($servi ne '' && $srcport < 1024) {
$srcport = "$srcport($servi)"; }
<td align='center'>$comment</td>
<td align='center'>$iface</td>
<td align='center'>$proto</td>
- <td align='center'>
- <table width='100%' cellpadding='0' cellspacing='0'><tr>
<td align='center'><a href='/cgi-bin/ipinfo.cgi?ip=$srcaddr'>$srcaddr</a></td>
- </tr></table>
- </td>
+ <td align='center'><a href='../country.cgi#$fcode'><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$ccode'></a></td>
<td align='center'>$srcport</td>
<td align='center'>$macaddr</td>
<td align='center'>
--- /dev/null
+###############################################################################
+# This file is part of the IPCop Firewall. #
+# #
+# IPCop is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation; either version 2 of the License, or #
+# (at your option) any later version. #
+# #
+# IPCop is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with IPCop; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+# #
+# Makefiles are based on LFSMake, which is #
+# Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER = 1.17
+
+THISAPP = Geo-IP-PurePerl-$(VER)
+DL_FILE = $(THISAPP).tar.gz
+DL_FROM = $(URL_IPFIRE)
+DIR_APP = $(DIR_SRC)/$(THISAPP)
+TARGET = $(DIR_INFO)/$(THISAPP)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE) GeoIP.dat
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+GeoIP.dat = $(DL_FROM)/GeoIP.dat
+
+$(DL_FILE)_MD5 = 42a6b9d4dd2563a20c8998556216e1de
+GeoIP.dat_MD5 = 757ef6d020a81dae0db2926c48f4a931
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+#dist:
+# make-packages.sh GeoIP $(THISAPP)-ipfire-beta-1
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+ @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+ @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+ @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+ @$(PREBUILD)
+ @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+ cd $(DIR_APP) && perl Makefile.PL
+ cd $(DIR_APP) && make
+ cd $(DIR_APP) && make install
+ cd $(DIR_APP) && mkdir -p /usr/local/share/GeoIP && mv $(DIR_DL)/GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat
+ @rm -rf $(DIR_APP)
+ @$(POSTBUILD)
ipcopmake Convert-UUlib
ipcopmake Archive-Tar
ipcopmake Archive-Zip
+ ipcopmake GeoIP
ipcopmake noip_updater
ipcopmake ntp
ipcopmake oinkmaster