Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 23:05

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

Advertisement



[PHP] Clientless Silkroad Security + ServerStats

Discussion on [PHP] Clientless Silkroad Security + ServerStats within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1

 
elite*gold: 260
Join Date: Aug 2008
Posts: 560
Received Thanks: 3,751
[PHP] Clientless Silkroad Security + ServerStats

Short and sweet: this project allows you to have native server stats via PHP without having to use an external program to collect the server stats.

In other words, everyone should be able to host their own server stats on their site as long as they have a capable web server. I've tested locally and on a remote host, so it should be fine with most modern hosts. Unfortunately, as tricky as this code was to write, there is nothing that can be done if your server does not support all the components.

This is a bare minimal release, so you will need some web designing skills to make it look "pretty" or additional php/database skills to enhance it more.

readme.txt
Quote:
[PHP] Clientless Silkroad Security + ServerStats
pushedx

Please read "license.txt" first!

This is a native PHP port of my Silkroad Security API.
Included is a fully functional ServerStats example.
To use, your server must support: PHP, Sockets, BCMATH, and MCRYPT.
If your server does not support or allow use of all components, you cannot use this code.

To customize the ServerStats script, you must know PHP, HTML/CSS/etc.., and optionally database programming (MySQL/MSSQL).

*** No support will be provided for ServerStats customization. ***

To test ServerStats:

0. Demo "http://edxlabs.web44.net/rsro". This is a free host, so it might be down time to time...
1. Upload all *.php files to a folder on your website.
2. Access "index.php" in that folder (you might need to update the hard-coded version if it changes).

IMPORTANT: You will probably want to set file permissions or add additional security restrictions to the scripts to prevent any abuse. I cannot help you with this, but it should be looked into.

To use ServerStats:
1. Read and follow "examples.txt".
2. Open "index.php" and read through the concepts.
3. To understand what goes on behind the scenes go through "ServerStats.php".
4. For everything else, refer to the rest of the php files code.
Just a helpful hint: if you wonder how to "loop" updates, take a look into CRON jobs (your web host must support them!). If not, you will have to come up with another solution (such as using a program that always runs to force the refresh).

Also, using these concepts, you can use this code for other games and projects in a similar fashion! PHP is quite capable afterall.

Enjoy!

Troubleshooting:

Make a test page with the following code:
Code:
<?php
	phpinfo();
?>
Upload the page, run the script, and save the results. Delete the page afterwards.

Q. Why do I see an empty page when I try to use the server stats?
A. This usually means a needed php component is not there. Check for the following strings in "Configure Command": '--enable-sockets', '--with-mcrypt=', and '--enable-bcmath'.

Look for each section in the configuration. It should look something like the following.
BCMath:
mcrypt:
sockets:

Q. Can more/less debugging information be provided for PHP errors?
A. In short, no. It all depends on how PHP is configured and most hosts are really restrictive to changes made to PHP. Unless you are running your own server where you can reconfigure PHP!

Q. What do the different errors mean?
A. Most errors should be self descriptive. Try to search the text in the php files to see what they are associated with.

Q. I get a bunch of MCRYPT warnings when trying to run the stats?
A. Please see .

More Q/A will be added as they arise.
Attached Files
File Type: zip php_sro.zip (298.1 KB, 1209 views)
pushedx is offline  
Thanks
32 Users
Old 06/14/2011, 08:39   #2
 
* White *'s Avatar
 
elite*gold: 0
Join Date: Oct 2010
Posts: 717
Received Thanks: 330
i got this.
Code:
Array ( [0] => [1] => Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 174 [2] => [3] => Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 134 [4] => [5] => Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 231 [6] => [7] => Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 231 [8] => Error [9] => The version packet was rejected because the GatewayServer is closed. [10] => 
 [11] => )
* White * is offline  
Old 06/14/2011, 09:45   #3

 
elite*gold: 260
Join Date: Aug 2008
Posts: 560
Received Thanks: 3,751
Quote:
Originally Posted by White&Black View Post
Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 174
Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 134
Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 231
Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/site/test/SilkroadSecurity.php on line 231
This is due to how mcrypt is configured on your host.

You can try to add an "@" right before the 'mcrypt_ecb' function name on lines 134, 174, and 231. That is a PHP directive to suppress warning messages. The changed code would look like:
Code:
134:
$expected_challenge_key = @mcrypt_ecb( MCRYPT_BLOWFISH, bcbytearray( $this->key_array, 8 ), swap( bcbytearray( $expected_challenge_key, 8 ), 8 ), MCRYPT_ENCRYPT );

174:
$this->m_client_key = @mcrypt_ecb( MCRYPT_BLOWFISH, bcbytearray( $this->key_array, 8 ), swap( bcbytearray( $this->m_client_key, 8 ), 8 ), MCRYPT_ENCRYPT );

231:
$packet_payload_tmp = @mcrypt_ecb( MCRYPT_BLOWFISH, bcbytearray( $this->m_handshake_blowfish_key, 8 ), $packet_payload_tmp, MCRYPT_ENCRYPT );
Quote:
Error
The version packet was rejected because the GatewayServer is closed.
That's the real error message, although the warning messages would mess up the output parsing.

Also, what version of PHP is your host running? You can use the function in a script to find out.
pushedx is offline  
Thanks
2 Users
Old 06/14/2011, 13:10   #4
 
elite*gold: 0
Join Date: Mar 2009
Posts: 2,693
Received Thanks: 3,160
may i know what is this ?

Quote:
Array ( [0] => Error [1] => No host set. )
LastThief is offline  
Old 06/14/2011, 13:58   #5
 
* White *'s Avatar
 
elite*gold: 0
Join Date: Oct 2010
Posts: 717
Received Thanks: 330
thirst when i added all files i get
Quote:
Quote:
Originally Posted by LastThief View Post
Array ( [0] => Error [1] => No host set. )
this. Later i do somthing and get The version packet was rejected because the GatewayServer is closed.

i using gamerzcorp.com hosting
* White * is offline  
Old 06/14/2011, 14:15   #6
 
bootdisk's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 41
lol how long have it been? a week? xD
awesome work pushedx!
bootdisk is offline  
Old 06/14/2011, 16:35   #7
 
Kape7's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 3,210
Received Thanks: 6,289
This is totally awesome.
rayko just told me that he loves you XD
Now we can get rid of the 24/7 running PC with the stats for our site and run it directly on the webhost! No words for this.


Testing... soon telling the results.
<3
Kape7 is offline  
Old 06/14/2011, 17:13   #8
 
* White *'s Avatar
 
elite*gold: 0
Join Date: Oct 2010
Posts: 717
Received Thanks: 330
Quote:
Originally Posted by Synx7 View Post
This is totally awesome.
rayko just told me that he loves you XD
Now we can get rid of the 24/7 running PC with the stats for our site and run it directly on the webhost! No words for this.


Testing... soon telling the results.
<3
it working on gamerzcorp.com host? Good for you

Quote:
Originally Posted by prot3ctor View Post
Array ( [0] => Error [1] => A connection could not be established. )
same here
* White * is offline  
Old 06/14/2011, 17:14   #9
 
elite*gold: 0
Join Date: May 2010
Posts: 14
Received Thanks: 0
Array ( [0] => Error [1] => A connection could not be established. )
prot3ctor is offline  
Old 06/14/2011, 17:19   #10
 
Kape7's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 3,210
Received Thanks: 6,289


Works fine so far, I had to hide some warnings, but overall is awesome <3
Kape7 is offline  
Old 06/14/2011, 17:28   #11
 
* White *'s Avatar
 
elite*gold: 0
Join Date: Oct 2010
Posts: 717
Received Thanks: 330
Quote:
Originally Posted by Synx7 View Post


Works fine so far, I had to hide some warnings, but overall is awesome <3


why this bad ?.
* White * is offline  
Old 06/14/2011, 17:34   #12
 
Kape7's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 3,210
Received Thanks: 6,289
Quote:
Originally Posted by White&Black View Post


why this bad ?.
The way it works actually its pretty unstable. We have the statistics program running on my home computer 24/7 (doesn't matter at all since I normally left my PC running 24/7 even when the website didn't exist).
Well, the stat program generates a .txt files with the stats, we have another script running every 3 secs gathering the stats from my PC and storing them into the DB. Then, when an user check the capacity page, the php script takes the capacity from the DB and shows to the user. The problem is that this process takes around 10 secs, so the end-user will get statistics from 10 seconds ago as max, which is not very accurate, and also there are some times when I have to restart my PC, so the stats are static for 2 mins or so.
We planned to buy an VPS for the statistics tools the next month, but with this new script we can save that and run the stats directly on the web host.

^The stat tools from klevre.
Kape7 is offline  
Thanks
1 User
Old 06/14/2011, 19:53   #13
 
inv123's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 968
Received Thanks: 228
My only prob that suddenly after some changes stats changed to ratios, hehe
inv123 is offline  
Old 06/14/2011, 20:00   #14
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
Quote:
Originally Posted by inv123 View Post
My only prob that suddenly after some changes stats changed to ratios, hehe
as far as I know,isro has a different structure in that packet and it doesn't send the actual number of people,it just sends the percent..so that's why,I really think so^^
vorosmihaly is offline  
Old 06/14/2011, 20:13   #15
 
elite*gold: 0
Join Date: May 2009
Posts: 67
Received Thanks: 36
Impressive as always.
theonly112 is offline  
Reply


Similar Threads Similar Threads
Silkroad Security API
06/09/2011 - SRO Coding Corner - 5 Replies
i was trying to run the server_stats example but it just immediately closeed and i cant figure out why.. also i think i need ti configure the ip or port? where can i do this? edit: I've found the error.. Index was Outside the bounds of the array line 33 the code:
[HELP]silkroad security
05/09/2011 - SRO Coding Corner - 6 Replies
what it silkroad security??? what is the packet analyzing???
Silkroad New security?
01/24/2010 - Silkroad Online - 68 Replies
This must be a joke or something another wanna be Game Guard? cus silkroad added a new folder called hackshield to the game directory... lol anyone have any inputs on this? maybe for once they trying to do something lol kinda funny... :rtfm:
[Tips] Silkroad Account Security
08/24/2009 - SRO Guides & Templates - 12 Replies
Hey, I know there are some threads about this out there but I think this will be useful though. Your password should contain at least 7 letters and/or numbers. Hint: Come up with some really senseless sentence with letters and numbers. Here an example : I look forward to the Simpsos Halloween Special on October 31th., Now take the first letter of every word and your password is: “ilfttshsoo31” For a password like this a bruter needs about 107 years and you can remember it easily. ...
Silkroad Security Video
11/06/2008 - SRO Hacks, Bots, Cheats & Exploits - 10 Replies
Hi guys, i just played a bit with Silkroad and c++. The result was a Undetected Silkroad Keylogger. I was Scanning it for fun on Virustotal.com the result was 1/36 The 1 Antivir who said anythink was Panda - Suspicous File Maybe you have the Question now why did you post this here?



All times are GMT +2. The time now is 23:05.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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