Register for your free account! | Forgot your password?

You last visited: Today at 20:26

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

Advertisement



Pk2 Tools (Source)

Discussion on Pk2 Tools (Source) within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
Th3K1nG's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 411
Received Thanks: 163
Pk2 Tools (Source)

Hello,
Is there any simple C# source, to extract a single file from the Media.pk2 and add this again?

For Example what i mean with "simple" i found this to Read: pk2Reader.dll

PHP Code:
//Usage Example

            
pk2.pk2Reader reader = new pk2Reader(@"Path to Media.pk2");
            
byte[] chardata reader.getFile("characterdata_5000.txt");
            
TextReader txtReader = new StreamReader(new MemoryStream(chardata));
            
Console.WriteLine(txtReader.ReadLine());
            
Console.Read(); 
Th3K1nG is offline  
Old 08/15/2012, 22:59   #2
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
If you have that DLL, pk2Reader.dll, you can use it by referencing it in your C# project.

If you're interested in the source code, you could decompile it with Reflector or dotPeek, unless the IL is obfuscated, which might make it a bit harder...
lesderid is offline  
Thanks
1 User
Old 08/15/2012, 23:44   #3
 
elite*gold: 0
Join Date: Mar 2009
Posts: 2,748
Received Thanks: 2,010
There is a lot of info about it in drew's releases, you might want to check them out. It is really not that hard
Nezekan is offline  
Old 08/16/2012, 01:17   #4
 
elite*gold: 0
Join Date: May 2009
Posts: 67
Received Thanks: 37
Quote:
Originally Posted by Th3K1nG View Post
For Example what i mean with "simple" i found this to Read: pk2Reader.dll

PHP Code:
//Usage Example

            
pk2.pk2Reader reader = new pk2Reader(@"Path to Media.pk2");
            
byte[] chardata reader.getFile("characterdata_5000.txt");
            
TextReader txtReader = new StreamReader(new MemoryStream(chardata));
            
Console.WriteLine(txtReader.ReadLine());
            
Console.Read(); 
You found

Heres the source:

It's horrible code, but it works.
theonly112 is offline  
Thanks
1 User
Old 08/16/2012, 01:40   #5
 
elite*gold: 163
Join Date: Mar 2008
Posts: 110
Received Thanks: 37
Quote:
Originally Posted by theonly112 View Post
You found

Heres the source:

It's horrible code, but it works.
How can i read SV.T ?
fatihy93 is offline  
Old 08/16/2012, 03:07   #6
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
Code:
        public static int Decrypt(byte[] buffer)
        {
            Pk2.Blowfish bf = new Pk2.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);

            return version;
        }
Another PK2Reader:
Blowfish for that:
DaxterSoul is offline  
Thanks
3 Users
Old 08/16/2012, 14:19   #7
 
elite*gold: 0
Join Date: Jan 2008
Posts: 21
Received Thanks: 12
@DaxterSoul the pk2reader you posted is broken

sPK2Entry
Position = 8byte (PosHigh << 32 | PosLow or just read int64 instead )
nextChain = 8byte not 4
illstar is offline  
Old 08/16/2012, 15:26   #8
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
Works fine for me :P
By the way it was your original vb.net code translated to C# ^^
DaxterSoul is offline  
Old 08/16/2012, 15:59   #9
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
Quote:
Originally Posted by DaxterSoul View Post
(...)
Another PK2Reader:
(...)
+1 for using IDisposable.
lesderid is offline  
Old 08/16/2012, 16:10   #10
 
elite*gold: 0
Join Date: Sep 2010
Posts: 783
Received Thanks: 921
Quote:
Originally Posted by lesderid View Post
+1 for using IDisposable.
welcome back,my friend
y u no skype?
ÑõÑ_Ŝŧóp is offline  
Thanks
1 User
Old 08/16/2012, 16:55   #11
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
Quote:
Originally Posted by ÑõÑ_Ŝŧóp View Post
welcome back,my friend
y u no skype?
I don't really use Skype, I do use MSN though.
lesderid is offline  
Old 08/16/2012, 19:40   #12
 
elite*gold: 0
Join Date: Mar 2009
Posts: 2,748
Received Thanks: 2,010
Quote:
Originally Posted by ÑõÑ_Ŝŧóp View Post
welcome back,my friend
y u no skype?
was he gone?
Nezekan is offline  
Old 08/17/2012, 19:24   #13
 
Th3K1nG's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 411
Received Thanks: 163
Quote:
Originally Posted by theonly112 View Post
You found

Heres the source:

It's horrible code, but it works.
thanks for share

Quote:
Originally Posted by DaxterSoul View Post
Code:
        public static int Decrypt(byte[] buffer)
        {
            Pk2.Blowfish bf = new Pk2.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);

            return version;
        }
Another PK2Reader:
Blowfish for that:
also thanks for share...


at least too much pastebin... but ill give a try

EDIT: But this is ONLY for reading isn't it? how about edit, and import into the pk2?
Th3K1nG is offline  
Old 08/17/2012, 23:02   #14
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
I worked on it but can't find it anymore. But if you break down the Code and read some threads you'll be able to write it on your own.
DaxterSoul is offline  
Old 03/26/2020, 01:45   #15
 
cardoso125874's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 206
Received Thanks: 69
how about edit, and import into the pk2?
cardoso125874 is offline  
Reply


Similar Threads Similar Threads
[Source]Wizatek´s Ep1 tools
05/05/2012 - Last Chaos Private Server - 12 Replies
Hallo ich erstelle diesen Thread um einiges zu Releasen was die SourceCodes von wizateks tools betrifft. Hier ist ein erstes Beispiel es sind nur wenige dateien aber es sind welche ich werde den rest im laufe der zeit releasen. Hello i want to release here the source of wizateks tools. here you can download 2 source files i will release more. ScreenShot: http://grabilla.com/02503-e61605d7-cb17-496c-9e6a -2601f8b4dd4e.png Download: Share-Online - dl/77DZSG3M3TN4 Share-Online -...
[Biete] Treasure Tools Source [AutoIt] [S]uche E*G/PSC
11/16/2011 - elite*gold Trading - 11 Replies
Hallo Community! Ich Möchte euch einen Treasure Tools Source Verkaufen (ohne/mit Keyssystem zu Verkaufen) Link: http://www.elitepvpers.com/forum/elite-gold-tradin g/1531263-treasure-tools-ezel.html Wieviel E*G/PSC würdest ihr mir geben? Ohne Spaßpreise/Angebote! €: Außerdem ist das mit Checker!
[SOURCE]Add Music to Your Tools..
05/29/2011 - Grand Chase Hacks, Bots, Cheats & Exploits - 1 Replies
hellow i have a suggestion...Can you add Music to your Tools ^_^... Add Music To Your Tool Source.. First Add your music to Resources Note: The File Type Of The Music must be .wav Double Click Button1 (start): My.Computer.Audio.Play(My.Resources.song namenowav, AudioPlayMode.BackgroundLoop)



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


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.