2015-04-20 02:12:11 +00:00
|
|
|
from django.db import models
|
2016-03-23 08:36:55 +00:00
|
|
|
from juser.models import User
|
|
|
|
import time
|
2015-04-20 02:12:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Log(models.Model):
|
|
|
|
user = models.CharField(max_length=20, null=True)
|
2015-12-19 09:26:34 +00:00
|
|
|
host = models.CharField(max_length=200, null=True)
|
2015-04-20 02:12:11 +00:00
|
|
|
remote_ip = models.CharField(max_length=100)
|
2015-12-19 09:26:34 +00:00
|
|
|
login_type = models.CharField(max_length=100)
|
2015-04-20 02:12:11 +00:00
|
|
|
log_path = models.CharField(max_length=100)
|
|
|
|
start_time = models.DateTimeField(null=True)
|
2015-12-19 09:26:34 +00:00
|
|
|
pid = models.IntegerField()
|
2015-04-20 02:12:11 +00:00
|
|
|
is_finished = models.BooleanField(default=False)
|
|
|
|
end_time = models.DateTimeField(null=True)
|
2016-03-25 14:24:56 +00:00
|
|
|
'''
|
|
|
|
add by liuzheng
|
|
|
|
'''
|
|
|
|
userMM = models.ManyToManyField(User)
|
|
|
|
logPath = models.TextField()
|
|
|
|
filename = models.CharField(max_length=40)
|
|
|
|
logPWD = models.TextField() # log zip file's
|
|
|
|
nick = models.TextField(null=True) # log's nick name
|
|
|
|
log = models.TextField(null=True)
|
|
|
|
history = models.TextField(null=True)
|
|
|
|
timestamp = models.IntegerField(default=int(time.time()))
|
|
|
|
datetimestamp = models.DateTimeField(auto_now_add=True)
|
|
|
|
|
2015-04-20 02:12:11 +00:00
|
|
|
|
|
|
|
def __unicode__(self):
|
2015-04-24 10:19:43 +00:00
|
|
|
return self.log_path
|
|
|
|
|
|
|
|
|
|
|
|
class Alert(models.Model):
|
|
|
|
msg = models.CharField(max_length=20)
|
|
|
|
time = models.DateTimeField(null=True)
|
2015-12-19 09:26:34 +00:00
|
|
|
is_finished = models.BigIntegerField(default=False)
|
|
|
|
|
|
|
|
|
|
|
|
class TtyLog(models.Model):
|
|
|
|
log = models.ForeignKey(Log)
|
|
|
|
datetime = models.DateTimeField(auto_now=True)
|
|
|
|
cmd = models.CharField(max_length=200)
|
|
|
|
|
|
|
|
|
|
|
|
class ExecLog(models.Model):
|
|
|
|
user = models.CharField(max_length=100)
|
|
|
|
host = models.TextField()
|
|
|
|
cmd = models.TextField()
|
|
|
|
remote_ip = models.CharField(max_length=100)
|
|
|
|
result = models.TextField(default='')
|
|
|
|
datetime = models.DateTimeField(auto_now=True)
|
|
|
|
|
|
|
|
|
|
|
|
class FileLog(models.Model):
|
|
|
|
user = models.CharField(max_length=100)
|
|
|
|
host = models.TextField()
|
|
|
|
filename = models.TextField()
|
|
|
|
type = models.CharField(max_length=20)
|
|
|
|
remote_ip = models.CharField(max_length=100)
|
|
|
|
result = models.TextField(default='')
|
|
|
|
datetime = models.DateTimeField(auto_now=True)
|
|
|
|
|
|
|
|
|
2016-03-23 08:36:55 +00:00
|
|
|
class TermLog(models.Model):
|
|
|
|
user = models.ManyToManyField(User)
|
|
|
|
logPath = models.TextField()
|
|
|
|
filename = models.CharField(max_length=40)
|
|
|
|
logPWD = models.TextField() # log zip file's
|
|
|
|
nick = models.TextField(null=True) # log's nick name
|
|
|
|
log = models.TextField(null=True)
|
|
|
|
history = models.TextField(null=True)
|
|
|
|
timestamp = models.IntegerField(default=int(time.time()))
|
|
|
|
datetimestamp = models.DateTimeField(auto_now_add=True)
|