Author Topic: REFRESH/X fuzzer - admin clients testing script  (Read 1748 times)

0 Members and 1 Guest are viewing this topic.

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
REFRESH/X fuzzer - admin clients testing script
« on: January 09, 2010, 05:51:21 am »
Script Name: REFRESH/X fuzzer
Script Description: Sends to TCP admins random corrupted REFRESH/REFRESHX packets.
Original Author(s): VirtualTT
Server Version: 2.7.0c
Core Version: 3.0

Written for admin clients testing.
Will run only if Safe mode is disabled!
Start the server with -safe 0 to disable Safe Mode.

Output example:


Since Random() function appears to be not that random i'm looking for some means to make it so... Any ideas?
« Last Edit: January 09, 2010, 09:01:08 am by VirtualTT »

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #1 on: January 09, 2010, 06:58:46 am »
Try this:
Code: [Select]
function Random2(Min, Max: integer): integer;
var
  res: array[1..10] of integer;
  i: byte;
begin
  for i:= 1 to 10 do res[i]:= Random(Min, Max);
  Result:= res[Random(1,11)];
end;
I wrote this right now so fix it if there's anything wrong. It looks stupid but is more random.

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #2 on: January 09, 2010, 07:38:56 am »
Unfortunately casting Random() on some data generated by another Random() just before this one, isn't a way to overcome relatively short repetition period of Random() function.
I was thinking about adding some buffer to hold random data which will be modified with Random() function a bit every second. So calling Random() with longer interval will give better results.

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #3 on: January 09, 2010, 09:38:18 am »
Baka Admin? That looks great. When will you release?
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #4 on: January 09, 2010, 09:50:38 am »
Looks cool, what about finding some random algorithm and basing it on microtime?

edit
Have you heard about TCPAdminPM? http://devs.soldat.pl/wiki/index.php?title=TCPAdminPM
« Last Edit: January 09, 2010, 10:00:05 am by tk »

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #5 on: January 09, 2010, 10:05:23 am »
Looks cool, what about finding some random algorithm and basing it on microtime?

edit
Have you heard about TCPAdminPM? http://devs.soldat.pl/wiki/index.php?title=TCPAdminPM

Yes, but i didn't mess with it since i want to see output in console window. I think that normal Random() is also based on microtime, but this is the main problem since microtime doesn't change during packet generation.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #6 on: January 09, 2010, 10:12:52 am »
GetTickCount, and GetPlayerStat results don't change in ApponIdle even if you put Sleeps between them. Maybe it's the same with micro time. Only the way is threadfunc then which may be unstable.


Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #7 on: January 09, 2010, 10:19:51 am »
GetTickCount() (1/60 s), microtime() (1/1000) values aren't changed during packet generation since it hardly last even a 1 ms.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #8 on: January 09, 2010, 10:33:47 am »
Are you sure microtime is 1/1000?
Quote
Returns the current Unix timestamp with microseconds.
Microsecond is 10^-6 of a second.

If the script is used only for testing admin clients, you can use OnCommand (event where results of functions are changed during executing code) to send a single packet.

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: REFRESH/X fuzzer - admin clients testing script
« Reply #9 on: January 09, 2010, 10:56:42 am »
Yes, for me it returns time in milliseconds.
According to manual http://www.enesce.com/help/index.html?Functions/microtime.html it should return microseconds. Or maybe gettimeofday() system call is not supported under windows.
And btw, his example outputs
Quote
// Code executed in 5.385 seconds. Good for benchmarking stuff
This confuses me even more...