summaryrefslogtreecommitdiffstats
path: root/perl-install/network/ifw.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-08-24 18:07:47 +0000
committerOlivier Blin <oblin@mandriva.org>2005-08-24 18:07:47 +0000
commit2f3080a06b1d957d3e2a122a131a799512f81741 (patch)
tree1bae8afb6d0118e56501f24f73fda1bb673c070b /perl-install/network/ifw.pm
parentaaf5534c4d867c7639bef95d45ff7bcfbab733a3 (diff)
downloaddrakx-2f3080a06b1d957d3e2a122a131a799512f81741.tar
drakx-2f3080a06b1d957d3e2a122a131a799512f81741.tar.gz
drakx-2f3080a06b1d957d3e2a122a131a799512f81741.tar.bz2
drakx-2f3080a06b1d957d3e2a122a131a799512f81741.tar.xz
drakx-2f3080a06b1d957d3e2a122a131a799512f81741.zip
- net_applet: stop icon blink when an Interactive Firewall alert isn't processed
- drakids: add log tab - drakids: allow to clear logs - net_applet: stop icon blinking when drakids is run or clear logs - net_applet: present drakids window on click on menu if drakids is already run - factorize packet reading to network::ifw::attack_to_hash
Diffstat (limited to 'perl-install/network/ifw.pm')
-rw-r--r--perl-install/network/ifw.pm43
1 files changed, 41 insertions, 2 deletions
diff --git a/perl-install/network/ifw.pm b/perl-install/network/ifw.pm
index 5be73cc59..8550ddcc5 100644
--- a/perl-install/network/ifw.pm
+++ b/perl-install/network/ifw.pm
@@ -2,6 +2,7 @@ package network::ifw;
use dbus_object;
use Socket;
+use common;
our @ISA = qw(dbus_object);
@@ -58,8 +59,9 @@ sub set_interactive {
}
sub get_reports {
- my ($o) = @_;
- $o->call_method('GetReports');
+ my ($o, $o_include_processed) = @_;
+ $o->call_method('GetReports',
+ Net::DBus::Binding::Value->new(&Net::DBus::Binding::Message::TYPE_UINT32, to_bool($o_include_processed)));
}
sub get_blacklist {
@@ -72,6 +74,21 @@ sub get_whitelist {
$o->call_method('GetWhitelist');
}
+sub clear_processed_reports {
+ my ($o) = @_;
+ $o->call_method('ClearProcessedReports');
+}
+
+sub send_alert_ack {
+ my ($o) = @_;
+ $o->call_method('SendAlertAck');
+}
+
+sub send_manage_request {
+ my ($o) = @_;
+ $o->call_method('SendManageRequest');
+}
+
sub format_date {
my ($timestamp) = @_;
require c;
@@ -106,4 +123,26 @@ sub resolve_address {
$hostname || $ip_addr;
}
+sub attack_to_hash {
+ my ($args) = @_;
+ my $attack = { mapn { $_[0] => $_[1] } [ 'timestamp', 'indev', 'prefix', 'sensor', 'protocol', 'addr', 'port', 'icmp_type', 'seq' ], $args };
+ $attack->{port} = unpack('S', pack('n', $attack->{port}));
+ $attack->{date} = format_date($attack->{timestamp});
+ $attack->{ip_addr} = get_ip_address($attack->{addr});
+ $attack->{hostname} = resolve_address($attack->{ip_addr});
+ $attack->{protocol} = get_protocol($attack->{protocol});
+ $attack->{service} = get_service($attack->{port});
+ $attack->{type} =
+ $attack->{prefix} eq 'SCAN' ? N("Port scanning")
+ : $attack->{prefix} eq 'SERV' ? N("Service attack")
+ : $attack->{prefix} eq 'PASS' ? N("Password cracking")
+ : undef;
+ $attack->{msg} =
+ $attack->{prefix} eq "SCAN" ? N("A port scanning attack has been attempted by %s.", $attack->{hostname})
+ : $attack->{prefix} eq "SERV" ? N("The %s service has been attacked by %s.", $attack->{service}, $attack->{hostname})
+ : $attack->{prefix} eq "PASS" ? N("A password cracking attack has been attempted by %s.", $attack->{hostname})
+ : undef;
+ $attack;
+}
+
1;