| | 1 | = Traffic Feature Statistics = |
|---|
| | 2 | |
|---|
| | 3 | Once an alarm is triggered in an intrusion detection system which is monitoring metrics, one of the quickest ways to determine the source of the alarm is by examining the ''top-k'' of a metric. This is the top hosts, ports, flow size distributions, etc... for a given interval. In the simplest case, when an alarm is generated by traffic volume the ''top-k'' addresses can be examined to see which host generated the most amount of traffic. If no host stands out as generating a large amount of traffic individual, it could be typical of a DDoS attack and the ''top-k'' for degree in should be checked. If it is a DDoS attack one could find a new host introduced in the top hosts for in degree which could be the host being attacked. To examine these features of each metric, we provide ordered results by rank for each. |
|---|
| | 4 | |
|---|
| | 5 | == Methods == |
|---|
| | 6 | |
|---|
| | 7 | Each of the following methods, which are defined in [source:scripts/ruby/include/sql_queries.rb sql_queries.rb], returns a sorted array indexed by rank descending in terms of value. At each index is an array whose index and value varies for each method: |
|---|
| | 8 | |
|---|
| | 9 | * stats_addr_degree_in(timestamp,table) - result indexed by ''host address'' with values being the associated ''in degree'' |
|---|
| | 10 | |
|---|
| | 11 | * stats_addr_degree_out(timestamp,table) - result indexed by ''host address'' with values being the associated ''out degree'' |
|---|
| | 12 | |
|---|
| | 13 | * stats_degree_in(timestamp,table) - result indexed by ''in degree'' with values being the ''number of hosts'' with the indexed degree |
|---|
| | 14 | |
|---|
| | 15 | * stats_degree_out(timestamp,table) - result indexed by ''out degree'' with values being the ''number of hosts'' with the indexed degree |
|---|
| | 16 | |
|---|
| | 17 | * stats_addr_src(timestamp,table) - result indexed by ''host address'' with values being the associated ''source packets'' |
|---|
| | 18 | |
|---|
| | 19 | * stats_addr_dst(timestamp,table) - result indexed by ''host address'' with values being the associated ''destination packets'' |
|---|
| | 20 | |
|---|
| | 21 | * stats_ports_src(timestamp,table) - result indexed by ''port'' with values being the associated ''source packets'' |
|---|
| | 22 | |
|---|
| | 23 | * stats_ports_dst(timestamp,table) - result indexed by ''port'' with values being the associated ''destination packets'' |
|---|
| | 24 | |
|---|
| | 25 | * stats_fsd(timestamp,table) - result indexed by ''flow size distribution'' with values being the ''number of flows'' with the given flow size distribution |
|---|
| | 26 | |
|---|
| | 27 | == Example Usage == |
|---|
| | 28 | |
|---|
| | 29 | ''Display the top 3 hosts in terms of degree in.'' ie. host ''191102'' had ''5393'' unique hosts contact it within the 2005-02-01 00:00:00 interval |
|---|
| | 30 | {{{ |
|---|
| | 31 | irb> stats_addr_degree_in("2005-02-01 00:00:00","flows").first(3).each {|host,degree_in| puts "#{host} #{degree_in}"} |
|---|
| | 32 | 191102 5393 |
|---|
| | 33 | 16085133 3855 |
|---|
| | 34 | 180751 3309 |
|---|
| | 35 | }}} |
|---|
| | 36 | |
|---|
| | 37 | ''How many unique hosts did 191102 contact?'' hmmm... could he be a server? ;) |
|---|
| | 38 | {{{ |
|---|
| | 39 | irb> stats_addr_degree_out("2005-02-01 00:00:00","flows").assoc(191102).last |
|---|
| | 40 | => 62 |
|---|
| | 41 | }}} |
|---|
| | 42 | |
|---|
| | 43 | ''Get the number of hosts who only contacted 3 other unique hosts.'' Since the association result is an array with index being the degree and value being the number of hosts, and we only want the number of hosts, we use ''.last'' |
|---|
| | 44 | {{{ |
|---|
| | 45 | irb> stats_degree_out("2005-02-01 00:00:00","flows").assoc(3).last |
|---|
| | 46 | => 989 |
|---|
| | 47 | }}} |
|---|
| | 48 | |
|---|
| | 49 | ''How many packets were sourced from port 80?'' |
|---|
| | 50 | {{{ |
|---|
| | 51 | irb> stats_ports_src("2005-02-01 00:00:00","flows").assoc(80).last |
|---|
| | 52 | => 1769099 |
|---|
| | 53 | }}} |
|---|
| | 54 | |
|---|
| | 55 | == Statistic Scripts == |
|---|
| | 56 | |
|---|
| | 57 | |
|---|
| | 58 | '''[source:scripts/ruby/dp_metric_stats.rb dp_metric_stats.rb]''' |
|---|
| | 59 | * ''Usage'': ./dp_metric_stats.rb |
|---|
| | 60 | * ''Description'': returns the complete ranked list for a given [wiki:TrafficFeatures traffic feature] and interval. |
|---|
| | 61 | * ''Output Format'': dependent on metric, follow result formats for each method listed above |
|---|
| | 62 | * ''Example usage'': |
|---|
| | 63 | {{{ |
|---|
| | 64 | $ ./dp_metric_stats.rb "2005-02-01 00:00:00" addr_src | head -n 5 |
|---|
| | 65 | 134619 1564472 |
|---|
| | 66 | 189143 1464679 |
|---|
| | 67 | 173376 1090653 |
|---|
| | 68 | 180487 915830 |
|---|
| | 69 | 133104 848064 |
|---|
| | 70 | }}} |