Register for your free account! | Forgot your password?

You last visited: Today at 04:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



PSM_Agent

Discussion on PSM_Agent within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old   #1


 
GM Wifo's Avatar
 
elite*gold: 63
Join Date: Feb 2017
Posts: 82
Received Thanks: 51
PSM_Agent

Hello everyone,

I’ve created this GitHub repository to share open‑source work.
This space will include meaningful developments, experiments, and other projects that I want to make available to the community.

My goal is to document progress, share code, and provide resources that others may find useful or inspiring.


SecureTech CLR Command Procedure
This project provides a SQL Server CLR stored procedure that acts as a secure bridge between SQL Server and the Shaiya game server.

It enables administrators to send server commands directly from SQL while enforcing strict validation, logging, and security controls.

Environment
Windows
Visual Studio 2026
.NET Framework 4.8.1
C#


AgentProcedures.cs
*Entry point for SQL Server.

Exposes RunServiceCommand as a SQL CLR procedure
Receives parameters from SQL
Calls CommandExecutor
Sends output back via SqlPipe

CommandExecutor.cs
*Core execution logic.

Validates the command via CommandRules
Enforces rate limits via RequestThrottle
Builds the packet via PacketFactory
Sends it to ps_game via socket
Logs the result via ActivityLogger
Uses centralized constants (BufferSize, Host, Port) from ServiceConfig

CommandRules.cs
*Ensures commands are safe.

Checks format and length
Requires that all commands start with /
Throws exceptions for invalid input
Uses ServiceConfig.MaxCommandLength for length validation

ActivityLogger.cs
*Handles logging of command attempts.

Appends success or error entries to the log file
Records timestamp, service, command, and error message
Uses ServiceConfig.LogFilePath for centralized log location

PacketFactory.cs
*Constructs the binary packet to send to ps_game.

Uses fixed header size and marker from ServiceConfig
Combines header, service name, and command text
Produces correct byte structure

RequestThrottle.cs
*Prevents flooding.

Reads the last log entry timestamp from ServiceConfig.LogFilePath
Blocks if a new command is issued within ServiceConfig.MinIntervalSeconds

SocketHelper.cs
*Handles socket communication.

Connects to ServiceConfig.Host:ServiceConfig.Port
Sends packet data
Receives server response

ServiceConfig.cs
*Centralized configuration.

Host, Port, HeaderSize, HeaderMarker
MaxCommandLength
BufferSize
LogFilePath (combines directory + filename)
MinIntervalSeconds

ErrorHandler.cs
*Standardized error formatting.

Produces consistent error strings for logging and SQL output

Utilities.cs
*Helper methods.

Timestamp formatting
String checks and other small utilities

Attached Files
File Type: rar PSM_Agent.rar (8.0 KB, 3 views)
GM Wifo is offline  
Thanks
1 User
Old   #2
 
[DEV]Elessar's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 120
Received Thanks: 108
Why are you reposting topics from 10 years ago?
[DEV]Elessar is offline  
Old   #3


 
GM Wifo's Avatar
 
elite*gold: 63
Join Date: Feb 2017
Posts: 82
Received Thanks: 51
Quote:
Originally Posted by [DEV]Elessar View Post
Why are you reposting topics from 10 years ago?
I didn’t repost the topic because my release was described as open source, while Betalfa’s topic focused only on DLLs and databases. I replicated the other functions so that the scripts and procedures from other developers would still work. Developers can also change the @cmmd and @servicename values to help prevent SQL Server hacking. In addition, I included built‑in security features in my release.
GM Wifo is offline  
Thanks
1 User
Old   #4
 
[DEV]Elessar's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 120
Received Thanks: 108
That topic already has source code?
[DEV]Elessar is offline  
Old   #5


 
GM Wifo's Avatar
 
elite*gold: 63
Join Date: Feb 2017
Posts: 82
Received Thanks: 51
I’ve organized the context and attached the
Quote:
PSM_Agent.rar
so you can download them directly here. If you notice any problems, please leave a comment so I can fix them. Thank you!
GM Wifo is offline  
Reply




All times are GMT +2. The time now is 04:03.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.