Register for your free account! | Forgot your password?

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

  • 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 07/13/2011, 14:12   #46
 
inv123's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 968
Received Thanks: 228
Quote:
Originally Posted by S3cret View Post
Hi there it's me again.

I wanna update the serverstats all 10 seconds in my db. I wanted to use a cronjob but my server does only allow them in a 1 minute interval. So I thought I could make the updatescript update the stats 5 times (all 10 secs) and close then. I wanted to make use of a for loop and timers but this doesn't work:
Heres the code (is there no way in this board to use an expander?)
PHP Code:
<?php
    $_REQUEST
["host"] = "gwgt1.joymax.com";
    
$_REQUEST["port"] = 15779;
    
$_REQUEST["locale"] = 18;
    
$_REQUEST["version"] = 314;
    
$_REQUEST["timeout"] = 5;

    
$db mysqli_connect(blabla);

    if (
mysqli_connect_errno() == 0) { //DB-Connection successful

        
for ($i 1$i <= 5$i++) {
            
$Timer microtime(TRUE);

            
// Execute the server stats page and store the results. This code doesn't change.
            
ob_start();
            include( 
"ServerStats.php" );
            
$result ob_get_contents();
            
ob_end_clean();



            
//code that updates the db, definitely works!



            //let 10 seconds pass
            
while (microtime(TRUE) - $Timer <= 10000) {
                
usleep(500000); //0.5 secs sleeping
            
}

        }

    }

?>
WAt the moment when i run this script the page is loading for years and the stats are not updated a single time.

Any idea what could be the issue? I'm really not a pro in php^^

Regards
Try this one if you cant or not able to set CRON jobs.
But there are also some web based cron job websites, but they are not realy helpfull
inv123 is offline  
Old 07/13/2011, 14:13   #47
 
S3cret's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 111
Received Thanks: 65
Quote:
Originally Posted by inv123 View Post
Try this one if you cant or not able to set CRON jobs.
But there are also some web based cron job websites, but they are not realy helpfull
Alright, I will test this out. Thank you.
S3cret is offline  
Old 07/13/2011, 14:16   #48
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
Quote:
Originally Posted by S3cret View Post
Wow ur so freaking funny. May I expect a serious answer from you or are u just searching for attention?
I know I am.

And I don't need attention, I have enough already.
Just a bit bored atm.

Oh and no, you may not expect a serious answer.
lesderid is offline  
Old 07/15/2011, 12:32   #49
 
S3cret's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 111
Received Thanks: 65
Hi it's me again.
For testing I always used a server of a friend and it always worked.

Now when I wanted to put everything to my server I got errors, sometimes just 1, sometimes more...

This error comes more often.
Code:
Array ( [0] => [1] => Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend in /var/www/***/html/silkroad/serverstats/SilkroadSecurity.php on line 174 [2] => Error [3] => Could not receive data. )
The other one doesn't want to display right now. It's longer containing all mcrypt lines and also the 'Could not receive data.' error at the end.

This is 100% my server but what makes it block?
S3cret is offline  
Old 07/15/2011, 12:47   #50
 
theoneofgod's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 3,940
Received Thanks: 2,211
@S3cret
Your server is lacking certain functionality that is required.
theoneofgod is offline  
Old 07/15/2011, 13:00   #51
 
S3cret's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 111
Received Thanks: 65
Before I got another error and the operator of my webspace had to move it to a different server. This is done and I just checked the phpinfo again.
BCMath support: enabled
Sockets Support: enabled
mcrypt support: enabled (but only version 2.5.7, not 2.5.8, can this be the reason?)
S3cret is offline  
Old 07/15/2011, 16:21   #52

 
elite*gold: 260
Join Date: Aug 2008
Posts: 560
Received Thanks: 3,778
Quote:
Originally Posted by S3cret View Post
Before I got another error and the operator of my webspace had to move it to a different server. This is done and I just checked the phpinfo again.
BCMath support: enabled
Sockets Support: enabled
mcrypt support: enabled (but only version 2.5.7, not 2.5.8, can this be the reason?)
Doubtful, as long as you have a modern MCRYPT it should be ok. Use to get rid of the MCrypt warnings.

It's possible the way a web server is setup it might have all the components needed, but actually performs differently. There's too much going on to really say why it works on some hosts and not on others really. For example, I tested on one free host and it worked fine always but others have tried getting the same from them and it didn't.

It's possible it's something in the code, but there's not much to change really with the socket code. There are a very limited number of ways to use the socket_write and socket_recv functions.

Try this:

Replace lines 110 - 116
Code:
$response = socket_recv_buffer( $socket, 2 );
if( $response == false )
{
	@socket_close( $socket );
	echo( "Error" . PHP_EOL . "<br />" . PHP_EOL . "Could not receive data.");
return;
}
with this:
Code:
$r = false;
for($x = 0; $x < 5; ++$x)
{
	$response = socket_recv_buffer( $socket, 2 );
	if( $response === false )
	{
		sleep(1);
	}
	else
	{
		$r = true;
		break;
	}
}
if( $r == false )
{
	@socket_close( $socket );
	echo( "Error" . PHP_EOL . "<br />" . PHP_EOL . "Could not receive data." );
	return;
}
That should give it up to 5 seconds to receive data that select said was there. I'm not sure if it'll actually do anything, but I'll try to mess with some possible changes later when I get back around to PHP stuff.
pushedx is offline  
Old 07/15/2011, 17:27   #53
 
S3cret's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 111
Received Thanks: 65
Thanks for your effort.
Your codechange didn't make it work so far.

I'm thinking about contacting my operator again...
S3cret is offline  
Old 08/18/2011, 20:58   #54
 
elite*gold: 0
Join Date: Feb 2010
Posts: 41
Received Thanks: 6
Can anyone tell me if i can use this with bplaced.net? Or am I wasting my time trying to get it to work? Is the standart freeware bplaced.net server capable of running this?
Evil_Warlock is offline  
Old 08/18/2011, 21:29   #55

 
elite*gold: 260
Join Date: Aug 2008
Posts: 560
Received Thanks: 3,778
Quote:
Originally Posted by Evil_Warlock View Post
Can anyone tell me if i can use this with bplaced.net? Or am I wasting my time trying to get it to work? Is the standart freeware bplaced.net server capable of running this?
I'll give it a try later today after my site is activated there. I made an account but the site doesn't load yet.
pushedx is offline  
Thanks
1 User
Old 08/19/2011, 15:46   #56
 
elite*gold: 0
Join Date: Feb 2010
Posts: 41
Received Thanks: 6
Quote:
Originally Posted by pushedx View Post
I'll give it a try later today after my site is activated there. I made an account but the site doesn't load yet.
Thanks you so much for your help! =)
Evil_Warlock is offline  
Old 08/19/2011, 20:41   #57

 
elite*gold: 260
Join Date: Aug 2008
Posts: 560
Received Thanks: 3,778
To anyone that couldn't run the first version, try this second version. The socket functions have been changed to the file socket functions. You still need sockets enabled on the server, but not having regular socket access won't matter as long as file sockets are allowed.

That host, bplaced, allows file sockets, fsockopen, but not regular sockets, socket_connect. I changed a little of the socket code to work with the new style and I think it works as it should: .

However, as with the previous version, this type of code on PHP servers like this isn't really stable so some problems may arise. bplaced only allows a script execution time of 12s, so you won't be able to use this on a lot of servers that have longer delays because the script takes longer to execute. Most sites default to 30s I think, so you might need to try another host if that is a problem.
Attached Files
File Type: zip php_sro_v2.zip (298.2 KB, 122 views)
pushedx is offline  
Thanks
5 Users
Old 10/02/2011, 01:06   #58
 
elite*gold: 0
Join Date: Feb 2008
Posts: 158
Received Thanks: 15
Array ( [0] => Error [1] => The version packet was rejected because the version is too new. [2] =>
[3] => )
EuSouHunteR is offline  
Old 10/02/2011, 23:48   #59
 
inv123's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 968
Received Thanks: 228
Quote:
Originally Posted by EuSouHunteR View Post
Array ( [0] => Error [1] => The version packet was rejected because the version is too new. [2] =>
[3] => )
The error says itselfs, you have to change the version variable in index.php
inv123 is offline  
Old 10/03/2011, 16:56   #60
 
* White *'s Avatar
 
elite*gold: 0
Join Date: Oct 2010
Posts: 717
Received Thanks: 330
Code:
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in c:\appserv\www\SilkroadSecurity.php on line 7
Trying on localhost with appserver and get this.

on line 7 i have
Code:
public $m_initial_blowfish_key = 0;
* White * 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 +1. The time now is 07:33.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.