2022-01-18 10:04:11 +00:00
|
|
|
# Copyright (C) 2021 Veez Project
|
|
|
|
|
|
|
|
import re
|
|
|
|
import uuid
|
|
|
|
import socket
|
|
|
|
|
|
|
|
import psutil
|
|
|
|
import platform
|
|
|
|
from config import BOT_USERNAME
|
|
|
|
from driver.filters import command
|
|
|
|
from pyrogram import Client, filters
|
|
|
|
from driver.decorators import sudo_users_only, humanbytes
|
|
|
|
|
|
|
|
|
|
|
|
# FETCH SYSINFO
|
|
|
|
|
|
|
|
@Client.on_message(command(["sysinfo", f"sysinfo@{BOT_USERNAME}"]) & ~filters.edited)
|
|
|
|
@sudo_users_only
|
|
|
|
async def give_sysinfo(client, message):
|
|
|
|
splatform = platform.system()
|
|
|
|
platform_release = platform.release()
|
|
|
|
platform_version = platform.version()
|
|
|
|
architecture = platform.machine()
|
|
|
|
hostname = socket.gethostname()
|
|
|
|
ip_address = socket.gethostbyname(socket.gethostname())
|
|
|
|
mac_address = ":".join(re.findall("..", "%012x" % uuid.getnode()))
|
|
|
|
processor = platform.processor()
|
|
|
|
ram = humanbytes(round(psutil.virtual_memory().total))
|
|
|
|
cpu_freq = psutil.cpu_freq().current
|
|
|
|
if cpu_freq >= 1000:
|
|
|
|
cpu_freq = f"{round(cpu_freq / 1000, 2)}GHz"
|
|
|
|
else:
|
|
|
|
cpu_freq = f"{round(cpu_freq, 2)}MHz"
|
|
|
|
du = psutil.disk_usage(client.workdir)
|
|
|
|
psutil.disk_io_counters()
|
|
|
|
disk = f"{humanbytes(du.used)} / {humanbytes(du.total)} " f"({du.percent}%)"
|
|
|
|
cpu_len = len(psutil.Process().cpu_affinity())
|
|
|
|
somsg = f"""🖥 **System Information**
|
|
|
|
|
|
|
|
**PlatForm :** `{splatform}`
|
|
|
|
**PlatForm - Release :** `{platform_release}`
|
2022-01-22 08:00:04 +00:00
|
|
|
**PlatForm - Version :** `{platform_version}`
|
2022-01-18 10:04:11 +00:00
|
|
|
**Architecture :** `{architecture}`
|
2022-01-22 08:00:04 +00:00
|
|
|
**HostName :** `{hostname}`
|
2022-01-18 10:04:11 +00:00
|
|
|
**IP :** `{ip_address}`
|
|
|
|
**Mac :** `{mac_address}`
|
|
|
|
**Processor :** `{processor}`
|
|
|
|
**Ram : ** `{ram}`
|
|
|
|
**CPU :** `{cpu_len}`
|
|
|
|
**CPU FREQ :** `{cpu_freq}`
|
|
|
|
**DISK :** `{disk}`
|
|
|
|
"""
|
|
|
|
await message.reply(somsg)
|