Solved

This output is given from : sflowtool -4 -p 3601  | /scripts/DoSTargets

Posted on 2013-12-21
2
406 Views
Last Modified: 2013-12-22
I have 2 databases
1. ip.whitelist have only one column with ip name
2. ip.Block have 3 columns ip,reason,zaman

i have a sample output on flow as given below

sflowtool -4 -p 3601  | /scripts/DoSTargets


1387652837 178.20.228.47 15 mbps
1387652837 178.20.228.47 1792 pps
1387652837 185.9.156.35 11 mbps
1387652837 185.9.159.233 1536 pps
1387652838 185.9.156.35 11 mbps
1387652839 178.20.228.47 26 mbps
1387652839 178.20.228.47 2560 pps
1387652839 85.100.207.114 8 mbps
1387652840 178.20.228.47 27 mbps
1387652840 178.20.228.47 3072 pps
1387652840 185.9.159.233 12 mbps
1387652840 185.9.159.233 2304 pps
1387652841 178.20.228.47 20 mbps
1387652841 178.20.228.47 2048 pps
1387652841 89.253.155.97 8 mbps
1387652842 178.20.228.47 20 mbps
1387652842 178.20.228.47 1792 pps
1387652843 178.20.228.47 15 mbps
1387652843 178.20.228.47 1792 pps

Open in new window




i want sth. like this.

sflowtool -4 -p 3601  | /scripts/DoSTargets  | perl DDOSrecorder.pl

and if the traffic is bigger then 100mbps or 25000 pps it will check the ip.whitelist
and if it is not in white listed table it will only add the ip address to the ip.block table
reason column will only include the Xmbps or Xpps  to understand the blocking
0
Comment
Question by:3XLcom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39735081
my %X=(
mbps => 100,
pps => 25000,
);
open W,"<ip.whitelist" or die "<ip.whitelist $!";
chomp,++$w{$_} while <W>;
close W;
open STDOUT,">>ip.block" or die ">>ip.block $!";
while( <> ){
  my @F=split;
  print "$F[1,2,3]\n" if !$w{$F[1]} && $F[2]>$X{$F[3]};
}
0
 

Author Closing Comment

by:3XLcom
ID: 39735095
thnx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question