예제 #1
0
   def help_cluster_hosts_dbscan():
       """Print help for cluster_hosts_dbscan command"""
       colorize_log(
           'usage', """cluster_hosts_dbscan [min_samples] [max_dist] [metric]
tmin_samples : minimum number of hosts to form a cluster
tmax_dist : maximum distance between two hosts to form a cluster
tmetric : can be "cityblock", "euclidean", "l1", "l2" or "manhattan" """)
예제 #2
0
 def preloop(self):
     context = Context()
     colorize_log('info', 'Initialization')
     self._build_filter(raw_input('Filter > '))
     colorize_log('info', 'Reading database..')
     context.dfilter = self._dfilter
     context.init_hosts()
     self.push(context)
예제 #3
0
 def preloop(self):
     context = Context()
     colorize_log('info', 'Initialization')
     self._build_filter(raw_input('Filter > '))
     colorize_log('info', 'Reading database..')
     context.dfilter = self._dfilter
     context.init_hosts()
     self.push(context)
예제 #4
0
 def do_remove_clusters(self, line):
     """Remove provided clusters"""
     try:
         cluster_labels = [int(idx) for idx in line.split()]
         if not cluster_labels:
             raise ValueError()
     except ValueError:
         self.help_select_clusters()
         return
     try:
         self.push(self.get_context().remove_clusters(cluster_labels))
     except (RuntimeError, AttributeError):
         colorize_log('warning', 'Cluster hosts first.')
예제 #5
0
 def do_remove_clusters(self, line):
     """Remove provided clusters"""
     try:
         cluster_labels = [int(idx) for idx in line.split()]
         if not cluster_labels:
             raise ValueError()
     except ValueError:
         self.help_select_clusters()
         return
     try:
         self.push(self.get_context().remove_clusters(cluster_labels))
     except (RuntimeError, AttributeError):
         colorize_log('warning', 'Cluster hosts first.')
예제 #6
0
 def postloop(self):
     colorize_log('info', 'Leaving..')
예제 #7
0
 def help_plot3d():
     """Print help for do_plot3d command"""
     colorize_log('usage', 'plot3d\n\tPlot hosts in three dimensions')
예제 #8
0
   def help_search_anomalies():
       """Print help for search_anomalies command"""
       colorize_log(
           'usage', """search_anomalies [N|N%]
tSearch N (or N%) most abnormal hosts""")
예제 #9
0
 def help_select_centers():
     """Print help for do_select_centers command"""
     colorize_log('usage', 'select_centers\n\tSelect cluster centers')
예제 #10
0
   def help_remove_anomalies():
       """Print help for do_remove_anomalies command"""
       colorize_log('usage', """remove_anomalies
tRemove anomalies from context""")
예제 #11
0
 def help_count():
     """Help for do_count command"""
     colorize_log('usage', 'count\n\tPrint host count to sdout')
예제 #12
0
   def help_cluster_hosts_kmeans():
       """Print help for cluster_hosts_kmeans command"""
       colorize_log('usage', """cluster_hosts_kmeans [nb_clusters]
tCluster hosts in [nb_clusters] groups using KMeans algorithm""")
예제 #13
0
   def help_search_anomalies():
       """Print help for search_anomalies command"""
       colorize_log('usage', """search_anomalies [N|N%]
tSearch N (or N%) most abnormal hosts""")
예제 #14
0
   def help_display_hosts():
       """Print help for do_display_hosts command"""
       colorize_log('usage', """display_hosts
tReturn current context host(s) ObjectID(s)""")
예제 #15
0
 def help_select_centers():
     """Print help for do_select_centers command"""
     colorize_log('usage', 'select_centers\n\tSelect cluster centers')
예제 #16
0
   def help_select_anomalies():
       """Print help for do_select_anomalies command"""
       colorize_log('usage', """select_anomalies
tRemove NON-anomalies from context""")
예제 #17
0
   def help_remove_anomalies():
       """Print help for do_remove_anomalies command"""
       colorize_log('usage', """remove_anomalies
tRemove anomalies from context""")
예제 #18
0
   def help_cluster_hosts_dbscan():
       """Print help for cluster_hosts_dbscan command"""
       colorize_log('usage', """cluster_hosts_dbscan [min_samples] [max_dist] [metric]
tmin_samples : minimum number of hosts to form a cluster
tmax_dist : maximum distance between two hosts to form a cluster
tmetric : can be "cityblock", "euclidean", "l1", "l2" or "manhattan" """)
예제 #19
0
 def do_select_centers(self, _):
     """Select cluster centers"""
     try:
         self.push(self.get_context().select_cluster_centers())
     except (RuntimeError, AttributeError):
         colorize_log('warning', 'Cluster hosts first.')
예제 #20
0
   def help_select_clusters():
       """Print help for select_clusters command"""
       colorize_log('usage', """select_clusters c1 [c2 [c3..]]
tSelect clusters c1, c2, c3.. for further analysis
tEnter -1 for noise if DBSCAN clusterring""")
예제 #21
0
 def help_plot3d():
     """Print help for do_plot3d command"""
     colorize_log('usage', 'plot3d\n\tPlot hosts in three dimensions')
예제 #22
0
   def help_remove_clusters():
       """Print help for remove_clusters command"""
       colorize_log('usage', """remove_clusters c1 [c2 [c3..]]
tRemove clusters c1, c2, c3.. from current context
tEnter -1 for noise if DBSCAN clusterring""")
예제 #23
0
   def help_select_anomalies():
       """Print help for do_select_anomalies command"""
       colorize_log(
           'usage', """select_anomalies
tRemove NON-anomalies from context""")
예제 #24
0
 def do_select_centers(self, _):
     """Select cluster centers"""
     try:
         self.push(self.get_context().select_cluster_centers())
     except (RuntimeError, AttributeError):
         colorize_log('warning', 'Cluster hosts first.')
예제 #25
0
   def help_display_hosts():
       """Print help for do_display_hosts command"""
       colorize_log(
           'usage', """display_hosts
tReturn current context host(s) ObjectID(s)""")
예제 #26
0
   def help_remove_clusters():
       """Print help for remove_clusters command"""
       colorize_log(
           'usage', """remove_clusters c1 [c2 [c3..]]
tRemove clusters c1, c2, c3.. from current context
tEnter -1 for noise if DBSCAN clusterring""")
예제 #27
0
   def help_cluster_hosts_kmeans():
       """Print help for cluster_hosts_kmeans command"""
       colorize_log(
           'usage', """cluster_hosts_kmeans [nb_clusters]
tCluster hosts in [nb_clusters] groups using KMeans algorithm""")
예제 #28
0
 def help_count():
     """Help for do_count command"""
     colorize_log('usage', 'count\n\tPrint host count to sdout')
예제 #29
0
   def help_select_clusters():
       """Print help for select_clusters command"""
       colorize_log(
           'usage', """select_clusters c1 [c2 [c3..]]
tSelect clusters c1, c2, c3.. for further analysis
tEnter -1 for noise if DBSCAN clusterring""")
예제 #30
0
 def postloop(self):
     colorize_log('info', 'Leaving..')
예제 #31
0
 def do_count(self, _):
     """Print host count to stdout"""
     colorize_log('info', "Number of hosts:\n\t%s" % '\n\t'.join(
         '%s:\t%s' % (key, value)
         for key, value in self.get_context().count().iteritems()
     ))
예제 #32
0
 def do_select_anomalies(self, _):
     """Select anomalies from hosts"""
     try:
         self.push(self.get_context().select_anomalies())
     except (RuntimeError, AttributeError):
         colorize_log('warning', 'Search anomalies first.')
예제 #33
0
 def do_count(self, _):
     """Print host count to stdout"""
     colorize_log(
         'info', "Number of hosts:\n\t%s" % '\n\t'.join(
             '%s:\t%s' % (key, value)
             for key, value in self.get_context().count().iteritems()))
예제 #34
0
 def do_select_anomalies(self, _):
     """Select anomalies from hosts"""
     try:
         self.push(self.get_context().select_anomalies())
     except (RuntimeError, AttributeError):
         colorize_log('warning', 'Search anomalies first.')