Register for your free account! | Forgot your password?

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

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

Advertisement



[C#][developers] read sv.t & create a sv.t

Discussion on [C#][developers] read sv.t & create a sv.t within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2007
Posts: 79
Received Thanks: 19
[C#][developers] read sv.t & create a sv.t

Here is a little snippet how to read the silkroad version from the sv.t
and create a sv.t in C#.

Thanks to pushedx for the explanation about the file structure.

Code:
        public static void WriteSVTFile(byte[] buffer, int newVersion)
        {
            pk2Reader.Blowfish bf = new pk2Reader.Blowfish(Encoding.ASCII.GetBytes("SILKROADVERSION"), 0, 8);
            Array.Reverse(buffer, 4, 4);
            Array.Reverse(buffer, 8, 4);
            bf.Decrypt(buffer, 4, buffer, 4, 8);
            Array.Reverse(buffer, 4, 4);
            Array.Reverse(buffer, 8, 4);

            int version;
            int.TryParse(Encoding.ASCII.GetString(buffer, 4, 4), out version);

            byte[] tmp = Encoding.ASCII.GetBytes(newVersion.ToString());

            tmp.CopyTo(buffer, 4);

            Array.Reverse(buffer, 8, 4);
            Array.Reverse(buffer, 4, 4);
            bf.Encrypt(buffer, 4, buffer, 4, 8);
            Array.Reverse(buffer, 8, 4);
            Array.Reverse(buffer, 4, 4);

            File.WriteAllBytes("sv.t", buffer);
        }

        public static uint ReadVersion(byte[] buffer)
        {
            pk2Reader.Blowfish bf = new pk2Reader.Blowfish(Encoding.ASCII.GetBytes("SILKROADVERSION"), 0, 8);
            Array.Reverse(buffer, 4, 4);
            Array.Reverse(buffer, 8, 4);
            bf.Decrypt(buffer, 4, buffer, 4, 8);
            Array.Reverse(buffer, 4, 4);
            Array.Reverse(buffer, 8, 4);


            int version;
            int.TryParse(Encoding.ASCII.GetString(buffer, 4, 4), out version);

            if (PatchInfo.lastClientVersion != 0)
            {
                PatchInfo.lastClientVersion = (uint)version;
            }

            return (uint)version;
        }
cyberninjah is offline  
Thanks
8 Users
Old 04/26/2013, 17:04   #2
 
elite*gold: 1000
Join Date: Apr 2012
Posts: 1,003
Received Thanks: 208
Can be done more easily.
qkuh is offline  
Old 04/27/2013, 19:37   #3
 
elite*gold: 0
Join Date: Aug 2009
Posts: 152
Received Thanks: 11
I tried your come for ReadVersion , but doesn't read version correctly , when Array.Reverse removed it read well
tarek1500 is offline  
Old 04/30/2013, 22:49   #4
 
onekyh's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 264
Received Thanks: 54
Quote:
Originally Posted by qkuh View Post
Can be done more easily.
Yeah, but still. It works.


10/10.
onekyh is offline  
Old 11/27/2013, 20:06   #5
 
LemoniscooL's Avatar
 
elite*gold: 0
Join Date: Sep 2006
Posts: 1,100
Received Thanks: 397
i know this is sort of an old thread, but it deserves more thanks
LemoniscooL is offline  
Old 12/15/2013, 08:44   #6
 
elite*gold: 0
Join Date: Apr 2009
Posts: 10
Received Thanks: 0
nice source
Thabo is offline  
Old 01/09/2016, 18:49   #7
 
elite*gold: 0
Join Date: Jun 2007
Posts: 3
Received Thanks: 0
Hey,

i know its an old thread, but i searched for two days now and i can't find anything.
Could you guys please post the defenition of Blowfish function Decrypt/Encrypt.

Greets, spiele13.
spiele13 is offline  
Old 01/09/2016, 23:15   #8
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
Quote:
Originally Posted by spiele13 View Post
but i searched for two days
I'm sure you did.

Silkroad uses the Blowfish in ECB Mode.
You could either use the Blowfish class which is publicly available for use in various language from it's .
Or you use the one which pushedx included in his .
DaxterSoul is offline  
Thanks
1 User
Old 01/10/2016, 22:43   #9
 
elite*gold: 0
Join Date: Jun 2007
Posts: 3
Received Thanks: 0
Quote:
Originally Posted by DaxterSoul View Post
I'm sure you did.

Silkroad uses the Blowfish in ECB Mode.
You could either use the Blowfish class which is publicly available for use in various language from it's .
Or you use the one which pushedx included in his .
I did and i have the SilkroadSecurityApi, but there is no Decrypt/Encrypt function.
The bytes that are important are 4-12, i know that too. I tried to decode them but i failed. Thats why i ask here. :/

Thank you anyway for the answere.
spiele13 is offline  
Old 01/11/2016, 18:13   #10
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
Quote:
Originally Posted by spiele13 View Post
I did and i have the SilkroadSecurityApi, but there is no Decrypt/Encrypt function.
Sometimes you need to think outside the box, because encrypt and decrypt are just names for a function.
,




Quote:
Originally Posted by spiele13 View Post
The bytes that are important are 4-12, i know that too. I tried to decode them but i failed. Thats why i ask here. :/
There is a much simpler way to read them, you don't really need to fuzz with those indices that much.

Have a look at this , it might help you.
DaxterSoul is offline  
Thanks
1 User
Old 01/11/2016, 22:05   #11
 
elite*gold: 0
Join Date: Jun 2007
Posts: 3
Received Thanks: 0
Quote:
Originally Posted by DaxterSoul View Post
Sometimes you need to think outside the box, because encrypt and decrypt are just names for a function.
,





There is a much simpler way to read them, you don't really need to fuzz with those indices that much.

Have a look at this , it might help you.
Thank you very much. I did know that i could use Decode/Encode but they have less parameters, so i was not sure. My problem was that i read the file the wrong way and so every function of mine had a wrong buffer.

Thank you again for the helpful answers.
spiele13 is offline  
Old 01/11/2016, 22:33   #12
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
Quote:
Originally Posted by spiele13 View Post
Thank you very much. I did know that i could use Decode/Encode but they have less parameters, so i was not sure.
You might need to read something about then, because this technique is heavily used everywhere in .NET.

DaxterSoul is offline  
Thanks
3 Users
Reply


Similar Threads Similar Threads
Read before you create a new topic! [Tutorial]
02/23/2013 - Metin2 PServer Guides & Strategies - 6 Replies
Hallo Metin2 Sektion. Dieser Thread ist ein How to Thread und zwar unter dem Namen: Metin2 Guides Sektion lernen. Wieso mache ich diesen Thread? Wenn ihr euch selbst mal in der Community bzw. in dieser Sektion umschaut seht ihr mehr als nur eine Frage. (Ich denke ich brauche das nicht zu Screenen, denn das fällt euch selbst auf.
READ THIS PLEASE Project For create a bot
08/01/2012 - DarkOrbit - 8 Replies
Good morning or good night EVERYBODY Today I decided to created a free bot for NPC and BOX , GG etc..... And For create this bot I need Money to pays a thing very important for the bot And I need you to call at this number phone : 0 899 233 549 and once you have called, you must give me the code that was given
How to PROPER secure your servers! [Must read for developers]
11/17/2011 - Shaiya Private Server - 10 Replies
/No support on ePvPers
helps create trainer ^ ^ GCPH (read careful)
01/15/2010 - Grand Chase - 20 Replies
hi I am miguelGz creator trainer GCusa (perfect star, no limit iten, etc) Deavid that I am from south america, I can not enter this GCph I just need a person from philipines and create trainer for GCph if someone helps me, teach him to create cts, and create trainer Gcph no more to say soon horn eye have knowledge of engine cheats



All times are GMT +1. The time now is 16:16.


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