def select_userid_auth(self, filters, table): if filters.have_only(firewall=False, user_id=False, username=False): return "SELECT username FROM authfail %s" % filters.getwhere() else: self.reset_raw_label(filters) return Ulogd2Request.select_userid_auth(self, filters)
def select_apps(self, filters, column): if filters.have_only(firewall=False, client_app=False): return "SELECT client_app, %s AS packets, first_time AS start_time, last_time AS end_time FROM apps_stats %s" % (column, filters.getwhere()) else: self.reset_raw_label(filters) return Ulogd2Request.select_apps(self, filters)
def select_userid(self, filters, column): if filters.have_only(firewall=False, user_id=False, username=False): return "SELECT username FROM users_stats %s" % filters.getwhere() else: self.reset_raw_label(filters) return Ulogd2Request.select_userid(self, filters)
def count_ip(self, filters, column, direction): """ Count all dropped packets """ if direction == 's' and filters.have_only(firewall=False, ip_saddr_str=False): return "SELECT SUM(%s) FROM hosts_stats %s" % (column, filters.getwhere()) else: self.reset_raw_label(filters) return Ulogd2Request.count_ip(self, filters, direction)
def select_ip(self, filters, column, direction): """ List all ips which matches filters """ if direction == 's' and filters.have_only(firewall=False, ip_saddr_str=False): return "SELECT ip_saddr_str, %s AS packets, first_time AS start_time, last_time AS end_time FROM hosts_stats %s" % (column, filters.getwhere()) else: self.reset_raw_label(filters) return Ulogd2Request.select_ip(self, filters, direction)
def count_user(self, filters, column): """ Count all users packets which are dropped """ if filters.have_only(firewall=False, user_id=False,username=False): return "SELECT SUM(%s) FROM users_stats %s" % (column, filters.getwhere()) else: self.reset_raw_label(filters) return Ulogd2Request.count_user(self, filters)
def select_user(self, filters, column): """ List all users who have dropped packets """ if filters.have_only(firewall=False, user_id=False, username=False): return "SELECT username, %s AS packets, first_time AS start_time, last_time AS end_time FROM users_stats %s" % (column, filters.getwhere()) else: self.reset_raw_label(filters) return Ulogd2Request.select_user(self, filters)
def count_apps(self, filters, column): """ Count all dropped packets """ if filters.have_only(firewall=False, client_app=False): return "SELECT SUM(%s) FROM apps_stats %s" % (column, filters.getwhere()) else: self.reset_raw_label(filters) return Ulogd2Request.count_apps(self, filters)
def __init__(self, database, tablename): Ulogd2Request.__init__(self, database, tablename) self.raw_label = None