Defect fixes following testing.
This commit is contained in:
parent
46d895d900
commit
2e04b5eeb8
5 changed files with 12 additions and 12 deletions
|
@ -75,23 +75,23 @@ class rabbitMQClient:
|
|||
result = body.split('|')
|
||||
|
||||
if result[3] == 'cpumem':
|
||||
|
||||
|
||||
result[2] = datetime.datetime.fromisoformat(result[2])
|
||||
manager = log.logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
|
||||
manager.insertHostLog(result[0], result[1], result[2], result[4], result[5])
|
||||
ch.basic_ack(delivery_tag=method.delivery_tag)
|
||||
|
||||
if result[3] == 'url':
|
||||
|
||||
|
||||
result[2] = datetime.datetime.fromisoformat(result[2])
|
||||
manager = log.logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
|
||||
manager.insertURLLog(result[0], result[1], result[2], result[4], result[5])
|
||||
ch.basic_ack(delivery_tag=method.delivery_tag)
|
||||
|
||||
if result[3] == 'ipBlock':
|
||||
|
||||
|
||||
result[2] = datetime.datetime.fromisoformat(result[2])
|
||||
manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
|
||||
manager = log.logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
|
||||
manager.insertIPBlock(result[0], result[1], result[4], result[5], result[6], result[2], config.ipinfoAPIToken)
|
||||
|
||||
context = ssl.create_default_context(
|
||||
|
|
|
@ -16,9 +16,6 @@ def main():
|
|||
jail = sys.argv[2]
|
||||
live = int(sys.argv[3])
|
||||
logTime = datetime.datetime.now()
|
||||
token = config.ipinfoAPIToken
|
||||
|
||||
print(hostname, ipAddress, blockedIPAddress, jail, live, logTime, token)
|
||||
|
||||
if not config.loggingMode == 'none' and not config.loggingMode == 'rabbitmq':
|
||||
|
||||
|
@ -26,8 +23,11 @@ def main():
|
|||
manager.insertIPBlock(hostname, ipAddress, blockedIPAddress, jail, live, logTime, token)
|
||||
|
||||
if config.loggingMode == 'rabbitmq':
|
||||
|
||||
rabbitmq.publish(hostname + '|' + socket.gethostbyname(socket.gethostname()) + '|' + str(logTime) + '|' + 'ipBlock' + '|' + str(blockedIPAddress) + '|' + str(jail) + '|' str(live)
|
||||
|
||||
import rabbitmq
|
||||
|
||||
rabbitmq = rabbitmq.rabbitMQClient(config.rabbitmqca,config.rabbitmqcacert,config.rabbitmqcakey,config.rabbitmqHost,config.rabbitmqPort,config.rabbitmqRoutingKey)
|
||||
rabbitmq.publish(hostname + '|' + socket.gethostbyname(socket.gethostname()) + '|' + str(logTime) + '|' + 'ipBlock' + '|' + str(blockedIPAddress) + '|' + str(jail) + '|' + str(live))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -34,7 +34,7 @@ CREATE TABLE monutil_ipblock (
|
|||
CREATE TABLE monutil_geoip (
|
||||
geoID BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
logID BIGINT NOT NULL,
|
||||
hostname VARCHAR(255) NOT NULL,
|
||||
hostname VARCHAR(255),
|
||||
city VARCHAR(255),
|
||||
region VARCHAR(255),
|
||||
country VARCHAR(255),
|
||||
|
|
|
@ -34,7 +34,7 @@ CREATE TABLE monutil_ipblock (
|
|||
CREATE TABLE monutil_geoip (
|
||||
geoID BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
logID BIGINT NOT NULL,
|
||||
hostname NVARCHAR(255) NOT NULL,
|
||||
hostname NVARCHAR(255),
|
||||
city NVARCHAR(255),
|
||||
region NVARCHAR(255),
|
||||
country NVARCHAR(255),
|
||||
|
|
|
@ -34,7 +34,7 @@ CREATE TABLE monutil_ipblock (
|
|||
CREATE TABLE monutil_geoip (
|
||||
geoID BIGSERIAL PRIMARY KEY,
|
||||
logID BIGINT NOT NULL,
|
||||
hostname VARCHAR(255) NOT NULL,
|
||||
hostname VARCHAR(255),
|
||||
city VARCHAR(255),
|
||||
region VARCHAR(255),
|
||||
country VARCHAR(255),
|
||||
|
|
Loading…
Reference in a new issue