report_attacks
This commit is contained in:
21
waf3.py
21
waf3.py
@@ -62,6 +62,27 @@ class Attack(peewee.Model):
|
|||||||
Attack.create_table(True)
|
Attack.create_table(True)
|
||||||
|
|
||||||
# Utils
|
# Utils
|
||||||
|
def report_attacks():
|
||||||
|
click.echo(
|
||||||
|
click.style(
|
||||||
|
f"Attacks in database: {Attack.select().count()}",
|
||||||
|
fg="cyan"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
hosts = {}
|
||||||
|
for a in Attack.select():
|
||||||
|
# print(a.host)
|
||||||
|
if a.host in hosts:
|
||||||
|
hosts[a.host] = hosts[a.host] + 1
|
||||||
|
else:
|
||||||
|
hosts[a.host] = 1
|
||||||
|
|
||||||
|
sorted_hosts = dict(sorted(hosts.items(), key=lambda x:x[1]))
|
||||||
|
|
||||||
|
for h, v in sorted_hosts.items():
|
||||||
|
print(h, v)
|
||||||
|
|
||||||
|
|
||||||
def report():
|
def report():
|
||||||
click.echo(
|
click.echo(
|
||||||
click.style(
|
click.style(
|
||||||
|
|||||||
Reference in New Issue
Block a user