From patchwork Tue Sep 22 18:25:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 3485 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4BwqW25RMMz3x63 for ; Tue, 22 Sep 2020 18:25:50 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4BwqVz09Bwz134; Tue, 22 Sep 2020 18:25:46 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4BwqVy2r2Gz30XS; Tue, 22 Sep 2020 18:25:46 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4BwqVw3smGz2xhq for ; Tue, 22 Sep 2020 18:25:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4BwqVw1Mrzz12b; Tue, 22 Sep 2020 18:25:44 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1600799144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZrRiALBGszZZTyv7aSlhIYuCICtsZ63xY4LFkQLj24U=; b=u0kU/Y7d5EfHTwi/enJ3tLthTBNXmVhSZHIwN6nEKZt/IKEcT9Srdse3JP6tx7vLtMpDlB rzvtJ1yR+yCM9DAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1600799144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZrRiALBGszZZTyv7aSlhIYuCICtsZ63xY4LFkQLj24U=; b=BHQsHk5C6+W8bpj07PXXTPgt5hVFNLUxeXHAGS/cVBoHDo4eNhKpBoiSfb5YqoJmAc36LH jPeDOOAPJa7USx+5n01K7OBNk1ZaqqJKyyxgSCKq3IMP52sOl3VfBYjcx6vZgLDuxdz5YF Z6QSWrSwWJP18uhrBVMYlF3f1ipZY9H+Hbxeafm/6rp8BvS/X97Attx3MwrktD+0yRQeJY sNGh9WpZuHDamu4p6Sy+2QDrHF8LjC5p5DLz0+AB3PcaLLzV5RDhijccfMh9YcebzHXdvA BQ3nzNLLnUSDChY8B5/fH2YzPcxW3aBc1j7sdu4UvQQHCYCkFqOEcu1LBtAZaw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 08/11] ipinfo.cgi: Display network flags of the given addresses. Date: Tue, 22 Sep 2020 20:25:06 +0200 Message-Id: <20200922182509.18643-8-stefan.schantl@ipfire.org> In-Reply-To: <20200922182509.18643-1-stefan.schantl@ipfire.org> References: <20200922182509.18643-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Use the libloc data for gathering and displaying the stored network flags, like "Anonymous Proxy" for the addresses. The notice of a flag only will be displayed, if a flag is set for the network which contains the given address. Currently this notice text is "hardcoded" in englisch language, because the entire other content of the page is in Englisch (responses from RIR's) and also the flag names like "Anonymous Proxy" are only availabe in English. IMHO there is no need to to translate the string "This address is marked as" into different languages, because of the reasons abouve. Signed-off-by: Stefan Schantl --- html/cgi-bin/ipinfo.cgi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi index 978488cb1..cce6097ff 100644 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -64,6 +64,7 @@ if (&General::validip($addr)) { # enumerate location information for IP address... my $db_handle = &Location::Functions::init(); my $ccode = &Location::Functions::lookup_country_code($db_handle, $addr); + my $network_flag = &Location::Functions::address_has_flag($addr); # Try to get the continent of the country code. my $continent = &Location::get_continent_code($db_handle, $ccode); @@ -108,6 +109,17 @@ if (&General::validip($addr)) { } &Header::openbox('100%', 'left', $addr . " $ccode (" . $hostname . ') : '.$whois_server); + + # Check if the address has a flag. + if ($network_flag) { + # Get + my $network_flag_name = &Location::Functions::get_full_country_name($network_flag); + + # Display notice. + print "

This address is marked as $network_flag_name.

\n"; + print "
\n"; + } + print "
\n";
 	foreach my $line (@lines) {
 		print &Header::cleanhtml($line,"y");