2018-05-04 13:53:29 +02:00
|
|
|
#!/usr/bin/env python3
|
2014-08-06 11:43:40 +02:00
|
|
|
# -*-coding:UTF-8 -*
|
|
|
|
|
|
|
|
import redis
|
|
|
|
import argparse
|
2018-04-16 14:50:04 +02:00
|
|
|
import configparser
|
2014-08-06 11:43:40 +02:00
|
|
|
import time
|
|
|
|
import os
|
|
|
|
from pubsublogger import publisher
|
|
|
|
import texttable
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
"""Main Function"""
|
|
|
|
|
|
|
|
# CONFIG #
|
2018-04-16 14:50:04 +02:00
|
|
|
cfg = configparser.ConfigParser()
|
2014-08-06 11:43:40 +02:00
|
|
|
cfg.read('./packages/config.cfg')
|
|
|
|
|
|
|
|
# SCRIPT PARSER #
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description='''This script is a part of the Assisted Information Leak framework.''',
|
|
|
|
epilog='''''')
|
|
|
|
|
|
|
|
parser.add_argument('-db', type=int, default=0,
|
|
|
|
help='The name of the Redis DB (default 0)',
|
|
|
|
choices=[0, 1, 2, 3, 4], action='store')
|
|
|
|
|
|
|
|
# REDIS #
|
|
|
|
r_serv = redis.StrictRedis(
|
|
|
|
host=cfg.get("Redis_Queues", "host"),
|
|
|
|
port=cfg.getint("Redis_Queues", "port"),
|
2018-05-04 13:53:29 +02:00
|
|
|
db=cfg.getint("Redis_Queues", "db"),
|
|
|
|
decode_responses=True)
|
2014-08-06 11:43:40 +02:00
|
|
|
|
|
|
|
# LOGGING #
|
2014-08-22 17:35:40 +02:00
|
|
|
publisher.port = 6380
|
2014-08-06 11:43:40 +02:00
|
|
|
publisher.channel = "Queuing"
|
|
|
|
|
|
|
|
while True:
|
|
|
|
table = texttable.Texttable()
|
|
|
|
table.header(["Queue name", "#Items"])
|
|
|
|
row = []
|
|
|
|
for queue in r_serv.smembers("queues"):
|
|
|
|
current = r_serv.llen(queue)
|
|
|
|
current = current - r_serv.llen(queue)
|
|
|
|
row.append((queue, r_serv.llen(queue)))
|
|
|
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
row.sort()
|
|
|
|
table.add_rows(row, header=False)
|
|
|
|
os.system('clear')
|
2018-04-16 14:50:04 +02:00
|
|
|
print(table.draw())
|
2014-08-06 11:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|