Register for your free account! | Forgot your password?

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

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

Advertisement



Problem loader C#, text data in Media.pk2

Discussion on Problem loader C#, text data in Media.pk2 within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2009
Posts: 7
Received Thanks: 0
Post Problem loader C#, text data in Media.pk2

Hello i'm form vietnamese.

Some day i begin coder bot for Silkroad(Vsro have Xtrap and packet anti clientless).

1. I'm want create loader use C#. I'm find on this forum then not found solution for problem of me. I have download code souce bot of "zeteris"(ZBot), i'm found method call is "CaveCode" injector dll to process sro, but i'm use for Vsro then not working. anyone to know why, if i'm use not correctly way then please help me. If anyone have code source dll(C# and C++) and code C# injector. Please upload this topic help for me.

2. When i'm use tool extract file textdata in Media.pk2 then very have file txtdata(not in one file). I'm want need data skill, item, mobs. what need read file content data i'm need?.
i'm seen many skill not have translate, i'm have need this skill?.
textdata skill have two type. enc and not enc, content two this file different?
Final struct files textdata i'm unknown. Somebody provider information about struct file example file mob, skill, item...
Thank everybody lost time read this topic.
Sory english of me very bad. Hopes everybody understand.
Plese help me.
tuandoi1 is offline  
Old 04/16/2013, 18:18   #2
 
elite*gold: 0
Join Date: Mar 2008
Posts: 31
Received Thanks: 6
pk2reader.cs

pk2.cs

Blowfish.cs


compile it

example
(select your encoding type)
Quote:
pk2Reader pr=new pk2Reader(@"C:\Silkroad_1.401\media.pk2");
string str=ASCIIEncoding.Unicode.GetString(pr.getFile("itemdata_5000.txt"));
mss29 is offline  
Thanks
1 User
Old 04/17/2013, 08:29   #3
 
elite*gold: 0
Join Date: Apr 2009
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by mss29 View Post
pk2reader.cs

pk2.cs

Blowfish.cs


compile it

example
(select your encoding type)
Thanks reply. You can help about dll C++ hook to sro. Thanks
tuandoi1 is offline  
Old 04/17/2013, 09:07   #4
 
elite*gold: 0
Join Date: Mar 2013
Posts: 55
Received Thanks: 4
You doesnt need to make injected dll like in zBot. That injected dlll doesnt have any special functions just redirect the sro_client to his own proxy, but you could redirect your client without injecting dll, so in that case thats totally useless right now. If you only want to make a loader, for vsro based servers you doesnt need proxy or redirect ip etc... just simply run the sro_client.exe with mutex. If you would like to add later functions and packet based things, than you need proxy and redirect ip.

To redirect your sro_client to a specific ip (for example to your proxy) check this:
PHP Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace 
Loader
{
    public 
partial class Form1 Form
    
{
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr LoadLibrary(string dllToLoad);
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr OpenProcess(uint dwDesiredAccessint bInheritHandleint dwProcessId);
        [
DllImport("kernel32.dll")]
        static 
extern uint ReadProcessMemory(IntPtr hProcessuint lpBaseAddressuint lpbufferuint nSizeuint lpNumberOfBytesRead);
        [
DllImport("kernel32.dll")]
        static 
extern uint WriteProcessMemory(IntPtr hProcessuint lpBaseAddressbyte[] lpBufferint nSizeuint lpNumberOfBytesWritten);
        [
DllImport("kernel32.dll")]
        static 
extern uint VirtualAllocEx(IntPtr hProcessIntPtr lpAddressint dwSizeuint flAllocationTypeuint flProtect);
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr CreateMutex(IntPtr lpMutexAttributesbool bInitialOwnerstring lpName);
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr GetModuleHandle(string lpModuleName);
        [
DllImport("kernel32")]
        static 
extern uint GetProcAddress(IntPtr hModulestring procName);
        [
DllImport("kernel32.dll")]
        static 
extern uint WritePrivateProfileString(string sectionstring keystring valstring filePath);
        [
DllImport("kernel32.dll")]
        static 
extern uint GetPrivateProfileString(string lpAppNamestring lpKeyNamestring lpDefaultStringBuilder lpReturnedStringint nSizestring lpFileName);

        public static 
IntPtr Handle;

        public 
Form1()
        {
            
InitializeComponent();
        }

        private 
void Form1_Load(object senderEventArgs e)
        {
            
CreateMutex(IntPtr.Zerofalse"Silkroad Online Launcher");
            
CreateMutex(IntPtr.Zerofalse"Ready");
            
uint count 0;
            
Process SilkProcess;
            
SilkProcess = new Process();
            
SilkProcess.StartInfo.FileName = @"D:\Program Files\Creddy Avengers Loki\sro_client.exe";
            
SilkProcess.StartInfo.Arguments "0/22 0 0";
            
SilkProcess.Start();
            
Handle OpenProcess((uint)(0x000F0000L 0x00100000L 0xFFF), 0SilkProcess.Id);
            
uint ConnectionStack VirtualAllocEx(HandleIntPtr.Zero80x10000x4);
            
byte[] ConnectionStackArray BitConverter.GetBytes(ConnectionStack);
            
byte[] Connection = {
                                    
0x02,0x00,
                                    
0x3D0xA2// PORT (15778)
                                    
0x7F,0x00,0x00,0x01 // IP (127.0.0.1)
                                
};
            
uint Codecave VirtualAllocEx(HandleIntPtr.Zero160x10000x4);
            
byte[] CodecaveArray BitConverter.GetBytes(Codecave 0x004B08A1 5);
            
byte[] CodeCaveFunc = {
                                      
0xBF,ConnectionStackArray[0],ConnectionStackArray[1],ConnectionStackArray[2],ConnectionStackArray[3],
                                      
0x8B,0x4E,0x04,
                                      
0x6A,0x10,
                                      
0x68,0xA6,0x08,0x4B,0x00,
                                      
0xC3
                                  
};
            
byte[] JMPCodeCave = { 0xE9CodecaveArray[0], CodecaveArray[1], CodecaveArray[2], CodecaveArray[3] };
            
WriteProcessMemory(HandleConnectionStackConnectionConnection.Lengthcount);
            
WriteProcessMemory(HandleCodecaveCodeCaveFuncCodeCaveFunc.Lengthcount);
            
WriteProcessMemory(Handle0x004B08A1JMPCodeCaveJMPCodeCave.Lengthcount);
        }
    } 
Also you could write a dll like zeteris in c++ with this c# code need just a bit conversion to cpp, but making a dll and injecting just makes the things more complicated so doesnt worth it, since you wont got any other functions and you doesnt needed other functions from a dll.
miamidolphin is offline  
Old 04/17/2013, 12:04   #5
 
elite*gold: 0
Join Date: Apr 2009
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by miamidolphin View Post
You doesnt need to make injected dll like in zBot. That injected dlll doesnt have any special functions just redirect the sro_client to his own proxy, but you could redirect your client without injecting dll, so in that case thats totally useless right now. If you only want to make a loader, for vsro based servers you doesnt need proxy or redirect ip etc... just simply run the sro_client.exe with mutex. If you would like to add later functions and packet based things, than you need proxy and redirect ip.

To redirect your sro_client to a specific ip (for example to your proxy) check this:
PHP Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace 
Loader
{
    public 
partial class Form1 Form
    
{
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr LoadLibrary(string dllToLoad);
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr OpenProcess(uint dwDesiredAccessint bInheritHandleint dwProcessId);
        [
DllImport("kernel32.dll")]
        static 
extern uint ReadProcessMemory(IntPtr hProcessuint lpBaseAddressuint lpbufferuint nSizeuint lpNumberOfBytesRead);
        [
DllImport("kernel32.dll")]
        static 
extern uint WriteProcessMemory(IntPtr hProcessuint lpBaseAddressbyte[] lpBufferint nSizeuint lpNumberOfBytesWritten);
        [
DllImport("kernel32.dll")]
        static 
extern uint VirtualAllocEx(IntPtr hProcessIntPtr lpAddressint dwSizeuint flAllocationTypeuint flProtect);
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr CreateMutex(IntPtr lpMutexAttributesbool bInitialOwnerstring lpName);
        [
DllImport("kernel32.dll")]
        static 
extern IntPtr GetModuleHandle(string lpModuleName);
        [
DllImport("kernel32")]
        static 
extern uint GetProcAddress(IntPtr hModulestring procName);
        [
DllImport("kernel32.dll")]
        static 
extern uint WritePrivateProfileString(string sectionstring keystring valstring filePath);
        [
DllImport("kernel32.dll")]
        static 
extern uint GetPrivateProfileString(string lpAppNamestring lpKeyNamestring lpDefaultStringBuilder lpReturnedStringint nSizestring lpFileName);

        public static 
IntPtr Handle;

        public 
Form1()
        {
            
InitializeComponent();
        }

        private 
void Form1_Load(object senderEventArgs e)
        {
            
CreateMutex(IntPtr.Zerofalse"Silkroad Online Launcher");
            
CreateMutex(IntPtr.Zerofalse"Ready");
            
uint count 0;
            
Process SilkProcess;
            
SilkProcess = new Process();
            
SilkProcess.StartInfo.FileName = @"D:\Program Files\Creddy Avengers Loki\sro_client.exe";
            
SilkProcess.StartInfo.Arguments "0/22 0 0";
            
SilkProcess.Start();
            
Handle OpenProcess((uint)(0x000F0000L 0x00100000L 0xFFF), 0SilkProcess.Id);
            
uint ConnectionStack VirtualAllocEx(HandleIntPtr.Zero80x10000x4);
            
byte[] ConnectionStackArray BitConverter.GetBytes(ConnectionStack);
            
byte[] Connection = {
                                    
0x02,0x00,
                                    
0x3D0xA2// PORT (15778)
                                    
0x7F,0x00,0x00,0x01 // IP (127.0.0.1)
                                
};
            
uint Codecave VirtualAllocEx(HandleIntPtr.Zero160x10000x4);
            
byte[] CodecaveArray BitConverter.GetBytes(Codecave 0x004B08A1 5);
            
byte[] CodeCaveFunc = {
                                      
0xBF,ConnectionStackArray[0],ConnectionStackArray[1],ConnectionStackArray[2],ConnectionStackArray[3],
                                      
0x8B,0x4E,0x04,
                                      
0x6A,0x10,
                                      
0x68,0xA6,0x08,0x4B,0x00,
                                      
0xC3
                                  
};
            
byte[] JMPCodeCave = { 0xE9CodecaveArray[0], CodecaveArray[1], CodecaveArray[2], CodecaveArray[3] };
            
WriteProcessMemory(HandleConnectionStackConnectionConnection.Lengthcount);
            
WriteProcessMemory(HandleCodecaveCodeCaveFuncCodeCaveFunc.Lengthcount);
            
WriteProcessMemory(Handle0x004B08A1JMPCodeCaveJMPCodeCave.Lengthcount);
        }
    } 
Also you could write a dll like zeteris in c++ with this c# code need just a bit conversion to cpp, but making a dll and injecting just makes the things more complicated so doesnt worth it, since you wont got any other functions and you doesnt needed other functions from a dll.
Thank you, i'm very happy when you share code redirect. But when i try it isn't working. You can recheck. ip vsro 123.30.200.5 and 123.30.200.6. Note when i'm try wiht private sro then it working. (vsro have xtrap). do you know this problem?
tuandoi1 is offline  
Old 04/17/2013, 12:19   #6
 
elite*gold: 0
Join Date: Mar 2013
Posts: 55
Received Thanks: 4
So it doesnt work with isro and it is working with vsro based servers? Because to isro you need other things too but this should work at vsro based servers coz i used that on my project. Explain me more the problem.
miamidolphin is offline  
Old 04/17/2013, 12:47   #7
 
elite*gold: 0
Join Date: Apr 2009
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by miamidolphin View Post
So it doesnt work with isro and it is working with vsro based servers? Because to isro you need other things too but this should work at vsro based servers coz i used that on my project. Explain me more the problem.
Oh no. i use on vsro private(source private from server test of vsro). But when use server vsro(not private) then not working. i understand this problem. You can explain for me about code you write. Thanks
tuandoi1 is offline  
Old 04/17/2013, 12:59   #8
 
elite*gold: 0
Join Date: Mar 2013
Posts: 55
Received Thanks: 4
I understand what u say, yes the code i posted working only on pservers. To make something work on original servers, you may have to change something. I doesnt really have solution for that coz i stopped coding for silkroad and now im out of date. But the main purpose is to find out the problem, and check if there are some other solutions working. You could also check out bots working loaders or dlls or just simply try out some public solutions, may they are working . Does zbot work there? Also could you load the client with that? If yes just make a loader.dll in cpp. You could write that easy. You should check this out to make a dll in cpp to redirect your client:
As i said, im out of date of silkroad right now, but there are maybe some working proxies like nuconnector or idk. If they are working and you have some loader to redirect to them check their source code. I think your problem comes from xtrap or hackshield.
miamidolphin is offline  
Old 04/17/2013, 13:44   #9
 
elite*gold: 0
Join Date: Apr 2009
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by miamidolphin View Post
I understand what u say, yes the code i posted working only on pservers. To make something work on original servers, you may have to change something. I doesnt really have solution for that coz i stopped coding for silkroad and now im out of date. But the main purpose is to find out the problem, and check if there are some other solutions working. You could also check out bots working loaders or dlls or just simply try out some public solutions, may they are working . Does zbot work there? Also could you load the client with that? If yes just make a loader.dll in cpp. You could write that easy. You should check this out to make a dll in cpp to redirect your client:
As i said, im out of date of silkroad right now, but there are maybe some working proxies like nuconnector or idk. If they are working and you have some loader to redirect to them check their source code. I think your problem comes from xtrap or hackshield.
you can help me a project dll VC++. i'm very bad C++.
tuandoi1 is offline  
Old 04/17/2013, 13:46   #10
 
elite*gold: 1000
Join Date: Apr 2012
Posts: 1,003
Received Thanks: 208
Use MS Detours to redirect the WS2_32 Connect func.
qkuh is offline  
Old 04/17/2013, 14:03   #11
 
elite*gold: 0
Join Date: Apr 2009
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by qkuh View Post
Use MS Detours to redirect the WS2_32 Connect func.
i try but error
my code
Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <winsock2.h>
#include <stdio.h>
#include <windows.h>
#include <Detours.h>

#pragma comment(lib, "Detours.lib")
#pragma comment(lib, "ws2_32.lib")

typedef int (WINAPI * trampoline_connect)(SOCKET s, const sockaddr *name, int namelen);
trampoline_connect orginal_connect;


int WINAPI my_connect(SOCKET s, const sockaddr *name, int namelen)
{
	sockaddr_in si;
	memcpy(&si, name, sizeof(sockaddr_in));

	si.sin_addr.S_un.S_addr = inet_addr("127.0.0.1");
	si.sin_port = 15778;
	return orginal_connect(s, (sockaddr*)&si, sizeof(sockaddr_in));
}


BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		{
			orginal_connect = (trampoline_connect)DetourFunction((PBYTE)GetProcAddress(GetModuleHandle((LPCWSTR)"ws2_32.dll"),"connect"), (PBYTE)my_connect);
		}
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
tuandoi1 is offline  
Reply


Similar Threads Similar Threads
Text Data (shn) datei.
03/13/2013 - Fiesta Online - 4 Replies
hi wollte mal fragen ob mir jemand helfen kann bin am versuchen die Text Data um zu schreiben auf deutsch doch jedes mal wenn ich die datei dann wieder in den client haue und starte bekomme ich immer an die geänderten sachen (+ac) warum zeigt er es nicht in deutsch wie ich es eingetragen habe genau so wie ich nicht die umlaute schreiben kann muss ich immer ae ue oe -.- hat jemand ne lösung für das problem? oder nen besseren shn editor weil habe nur den gefunden im netz vielleicht hat jemand...
[Poll] Reading data from text file or database?
04/01/2011 - SRO Coding Corner - 11 Replies
Hi, I'm currently facing a little choice about how I should read the data of silkroad. So I hope that I can get a clear answer with this thread/poll. Well as you might know I'm using C++ and currently I'm reading the data into the memory which is just a big list of for example npc position objects. So yesterday I created a little test and I inserted all the npc positions into an MySQL database (version 5.1) and I used 10 different id's of npcs to get the positions. I runned this test...
Media/Data.pk2
02/19/2011 - SRO Private Server - 2 Replies
I keep crashing in Swsro wen i try log in with ddbot an if i dont crash i get Access denied an the Dbbot Crashes. i asked my friend he said have old .pk2 so where can i get the lastest for swsro 1
Media/Data.pk2
02/18/2011 - SRO Private Server - 0 Replies
Media/Data.pk2 I keep crashing in Swsro wen i try log in with ddbot an if i dont crash i get Access denied an the Dbbot Crashes. i asked my friend he said have old .pk2 so where can i get the lastest for swsro 1
Import data from-to Media.pk2
05/12/2010 - SRO Private Server - 3 Replies
I export data i need from swsro media.pk2 using pk2editor for swsro: http://img140.imageshack.us/img140/6013/10275034. jpg http://img171.imageshack.us/img171/2750/49258915. jpg http://img62.imageshack.us/img62/1593/27933717.jp g Now i try to import all these to sro client v1.150 media.pk2, but i got this:



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


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.