Skip to content
Snippets Groups Projects
sender.pl 2.31 KiB
#!/usr/bin/perl -w
#
# sender.pl
#
# Copyright (C) 2011-2012 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.

use Switch;
use strict;
use DateTime;

my $warden_path = '/opt/warden-client';
require $warden_path . '/lib/WardenClientSend.pm';

my $service = "";
switch (int(rand(2) + 0.5)) {
  case 0 { $service = 'ScanDetector'; }
  case 1 { $service = 'PhiGaro'; }
  case 2 { $service = 'HoneyScan'; }
  }

my $detected = DateTime->from_epoch(epoch => time());

my $type = "";
switch (int(rand(9) + 0.5)) {
  case 0 { $type = 'portscan'; }
  case 1 { $type = 'bruteforce'; }
  case 2 { $type = 'spam'; }
  case 3 { $type = 'phishing'; }
  case 4 { $type = 'botnet_c_c'; }
  case 5 { $type = 'dos'; }
  case 6 { $type = 'malware'; }
  case 7 { $type = 'copyright'; }
  case 8 { $type = 'webattack'; }
  case 9 { $type = 'other'; }
  }

my $source_type = "";
switch (int(rand(2) + 0.5)) {
  case 0 { $source_type = 'IP'; }
  case 1 { $source_type = 'url'; }
  case 2 { $source_type = 'Reply-To:'; }
  }

my $source = (int(rand(254) + 0.5) + 1) . "." . (int(rand(254) + 0.5) + 1) . "." . (int(rand(254) + 0.5) + 1) . "." . (int(rand(254) + 0.5) + 1);

my $target_proto = "";
switch (int(rand(1) + 0.5)) {
  case 0 { $target_proto = 'TCP'; }
  case 1 { $target_proto = 'UDP'; }
  }

my $target_port = "";
switch (int(rand(5) + 0.5)) {
  case 0 { $target_port = '22'; }
  case 1 { $target_port = '23'; }
  case 2 { $target_port = '25'; }
  case 3 { $target_port = '443'; }
  case 4 { $target_port = '3389'; }
  case 5 { $target_port = undef; }
  }

my $attack_scale = (int(rand(100000) + 0.5) + 1000);

my $note = "tohle je takova normalni jednoducha poznamka";

my $priority = "";
switch (int(rand(1) + 0.5)) {
  case 0 { $priority = int(rand(255) + 0.5); }