Register for your free account! | Forgot your password?

You last visited: Today at 05:15

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

Advertisement



C# Simplest Proxy

Discussion on C# Simplest Proxy within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old 07/30/2011, 00:06   #16

 
elite*gold: 260
Join Date: Aug 2008
Posts: 560
Received Thanks: 3,780
Quote:
Originally Posted by sarkoplata View Post
About sending packets : How i send packets with this simplest proxy example ? I mean ;
remote_context.relaysecurity.send or
remote_context.socket.send or with whatever?
Even though i tried both , packet isn't being sent to server.
First, you never, ever send directly through the Socket object. Only through a Security object. Be sure you don't do this or you will have disastrous bugs!

It's kind of hard to explain clearly because it all depends on "perspective". Let's start out with the GatewayServer to make things simple.

local_context - The context for your sro_client and proxy connection.
remote_context - The context for your proxy and SRO server connection.

The "perspective" you are at is that of the proxy. So for example: sro_client <-> [proxy / you] <-> Silkroad server. When you send to the local_context, that means you are sending data from the proxy to sro_client. When you send to the remote_context, you are sending data from the proxy to the Silkroad server.

To inject data to the server, you would need to send data to the remote_context's security object directly. So, remote_context.Security.Send(...);

To inject data to the client, you would need to send data to the local_context's security object directly. So, local_context.Security.Send(...);

The "RelaySecurity" object is to make "forwarding" packets easier from one direction to the other, but it's not for the injecting data logic that you need.

It takes some thinking through, but try to imagine a proxy as just being an emulator (sro_client <-> proxy) + a clientless (proxy <-> SRO server). If you want to send data to the server, you have to use the remote_context object since that is your clientless object. If you want to send data to the client, you use the local_context since that is your emulator.

I hope that clears it up!
pushedx is offline  
Thanks
5 Users
Old 07/30/2011, 00:06   #17
 
elite*gold: 0
Join Date: May 2007
Posts: 99
Received Thanks: 39
Quote:
Originally Posted by sarkoplata View Post
Well ! I added context.relaysecurity.send(packet) for each packet-handle-sub.
Now working perfectly !
Thank you for all

Edit :

With some chars when i hit start , it doesnt do anything , some part of chardata is being parsed , and loading bar value is 0 . Why is that happens?

Edit 2 :

I dc randomly. I mean , i cant even find out why i am dcing :/ How i will know where i am doing something wrong ?
is your game crash during loading player data ? when you are entering in map ? if it that, maybe I know what is the problem.
benco is offline  
Old 07/30/2011, 00:15   #18

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Quote:
Originally Posted by pushedx View Post
First, you never, ever send directly through the Socket object. Only through a Security object. Be sure you don't do this or you will have disastrous bugs!

It's kind of hard to explain clearly because it all depends on "perspective". Let's start out with the GatewayServer to make things simple.

local_context - The context for your sro_client and proxy connection.
remote_context - The context for your proxy and SRO server connection.

The "perspective" you are at is that of the proxy. So for example: sro_client <-> [proxy / you] <-> Silkroad server. When you send to the local_context, that means you are sending data from the proxy to sro_client. When you send to the remote_context, you are sending data from the proxy to the Silkroad server.

To inject data to the server, you would need to send data to the remote_context's security object directly. So, remote_context.Security.Send(...);

To inject data to the client, you would need to send data to the local_context's security object directly. So, local_context.Security.Send(...);

The "RelaySecurity" object is to make "forwarding" packets easier from one direction to the other, but it's not for the injecting data logic that you need.

It takes some thinking through, but try to imagine a proxy as just being an emulator (sro_client <-> proxy) + a clientless (proxy <-> SRO server). If you want to send data to the server, you have to use the remote_context object since that is your clientless object. If you want to send data to the client, you use the local_context since that is your emulator.

I hope that clears it up!
Well , thank you for nice explanation ! I just got it clearly now

@benco

Yes, it - was crashing - when trying to load char data and was being stuck at loading part. I still ignore errors so it doesnt stuck but a real solution would be nice.

edit : I dont know why i still cannot send packets , strangely
Is it related to my code ?
Code:
  Dim packetx As New Packet(&H704F, False, False)
        packetx.WriteUInt8(4)
        Proxy.remote_context.Security.Send(packetx)
sarkoplata is offline  
Old 07/30/2011, 00:39   #19
 
elite*gold: 0
Join Date: May 2007
Posts: 99
Received Thanks: 39
silkroad packets are chunked when there's huge data. You should parse server packet correctly before to send it to sro_client.exe

simple exemple :

050030130000ABCDEF|packet 1
0102|packet 2
concat packet 1 with packet to get all data. this exemple can be reapted.
Is that help you ?
benco is offline  
Old 07/30/2011, 00:53   #20

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Quote:
Originally Posted by benco View Post
silkroad packets are chunked when there's huge data. You should parse server packet correctly before to send it to sro_client.exe

simple exemple :

050030130000ABCDEF|packet 1
0102|packet 2
concat packet 1 with packet to get all data. this exemple can be reapted.
Is that help you ?
Not really. I just didnt understand what you said.

^ Addition to my upper post :

I tried to send packet at agentServer thread and it work. Some equivalent processes are being i think thats why i can't send from somewhere else.Like :
Code:
remote_context.RelaySecurity = local_context.Security
            local_context.RelaySecurity = remote_context.Security
So my local_context and remote_contexts are public shared at Proxy.vb.
I acess them from somewhere else and writing :
remote_context.security.send(packet)
So i think I should do something before i try to send from another class.
sarkoplata is offline  
Old 07/30/2011, 01:12   #21
 
elite*gold: 0
Join Date: May 2007
Posts: 99
Received Thanks: 39
I thought the problem come from sro server to sro game.
I did't see proxy code and security handshake. Give local_context and remote_contexte throw constructor of classes that need security.send.
benco is offline  
Old 07/30/2011, 01:29   #22

 
sarkoplata's Avatar
 
elite*gold: 166
Join Date: Apr 2009
Posts: 2,339
Received Thanks: 2,661
Quote:
Originally Posted by benco View Post
I thought the problem come from sro server to sro game.
I did't see proxy code and security handshake. Give local_context and remote_contexte throw constructor of classes that need security.send.
Thanks i created 2different contexts for agentserver and gatewayserver so i can send now from anywhere
sarkoplata is offline  
Old 10/10/2011, 02:23   #23
 
elite*gold: 0
Join Date: Sep 2006
Posts: 13
Received Thanks: 3
Thanks man really help
Kyra is offline  
Old 11/30/2011, 14:15   #24
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1
Received Thanks: 0
hello, i'm trying to make a new connection to a hackshield server running on my pc using this example. i was able to connect but i can't seem to forward 0x2114 packet to localhost:15777. i'm planning on analyzing packets without being disconnected.

here's what i added:

Context hs_context = new Context();// new context for hs server connection

List<Context> contexts = new List<Context>();
contexts.Add(local_context);
contexts.Add(remote_context);
contexts.Add(hs_context);// add hs context to list of contexts

//create a client socket
Socket hs = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
{
hs_context.Socket = hs;
hs_context.Socket.Connect("localhost", 15777);
}

//added hs packet processing block
else if (packet.Opcode == 0x2114)
{
//forward packet to hs server here
Console.WriteLine("Hackshield Packet is received");
}

Thanks in advance
slamangkero is offline  
Old 02/07/2012, 10:55   #25
dotCom
 
Devsome's Avatar
 
elite*gold: 9842
The Black Market: 107/0/0
Join Date: Mar 2009
Posts: 16,856
Received Thanks: 4,683
First of all , thanks !
Got it , thanks
Devsome is offline  
Old 10/15/2012, 20:43   #26
 
bdeniz's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 92
Received Thanks: 16
Quote:
Originally Posted by bdeniz View Post
i think its easier

using System.Net.Sockets;


private void Form1_Load(object sender, EventArgs e)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//usage : socket.Connect(" IP" , port); ( u can write this into a button or write on forms load event
}
example, open phconector.ini,

write it to IP : 127.0.0.1
and write it to Listenport : 10001

open ph connector,

open a new C# form and write .

using System.Net.Sockets;

//create a button ( name = Button1)
private void Button1_Click(object sender, EventArgs e)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect("127.0.0.1", 10001);
}

Run application and click button1. and look phconnector.exe

u will see

Connection to silkroad established
conecting to the login server

then you can login with edx loader.

note : if u want to try, enter a real server ip instead 127.0.0.1
and run edx loader with redirect login ip: server ip you writed, and port = 10001
bdeniz is offline  
Old 10/31/2012, 20:43   #27
 
elite*gold: 0
Join Date: Aug 2009
Posts: 152
Received Thanks: 11
i wanna understand how the proxy works , i wanna make it my self
i need simple way plz
tarek1500 is offline  
Old 01/25/2013, 07:12   #28
 
elite*gold: 0
Join Date: Jan 2013
Posts: 1
Received Thanks: 0
what is it ' s usage code?
Alireza.imani is offline  
Old 03/08/2013, 12:41   #29
 
elite*gold: 0
Join Date: Jun 2009
Posts: 48
Received Thanks: 9
Hi guys, i read all the tutorials, examples etc. I decided to write a "tool" for vsro based servers. Im just a hobby coder but now i think ive understand the main things about silkroad security, how bots etc works, and i already know a lot about silkroad packets.
My problem is, i want to use pushedx's simplest proxy on my project, but i cant make it work. I always got c9 error. I read all off the posts from its thread, but i didnt find any solution. I use the second posted code from pushedx.
There are my connection configs from the code:

Code:
  
            String gateway_host = "127.0.0.1";
            Int32 gateway_port = 16000;

            String agent_host = "192.168.1.101";
            Int32 agent_port = 16001;

            String remote_host = "5.153.13.184";
            Int32 remote_port = 9779;

            String type = "gateway";
Also i use the code which was posted second by pushedx. Im trying to redirect my client with edxLoader, and the proxy works fine until i hit the chapta code. Than i got C9 error.

I set edxLoader like this:



Uploaded with

Thank you for your answers, and also thanks for your great tutorials pushedx.
spartai333 is offline  
Old 04/04/2015, 12:08   #30
 
elite*gold: 0
Join Date: Mar 2009
Posts: 537
Received Thanks: 156
I'm getting error on this line :/ int count = context.Socket.Receive(context.Buffer.Buffer);
"an existing connection was forcibly closed by the remote host "
alexhun is offline  
Reply


Similar Threads Similar Threads
[TUT] REAL, SIMPLEST, EASIEST HP HACK
09/01/2009 - Grand Chase Hacks, Bots, Cheats & Exploits - 47 Replies
this is how to do the "REAL" HP HACKand this TUTORIAL is indeed a lot different from all previously posted HP HACK.as well as this is a lot better than SAVER HACK since with this you can be able to manipulate your HP without being noticed unlike SAVER HACK which makes you obviously a CHEATER when used in pvp... but don't get me wrong... i NEVER state to use this in PVP... but i guess i don't have to WARN nor RESTRICT you as well... you are mere RESPONSIBLE enough for all your ACTIONS...and...
cracking sv in simplest way
06/23/2007 - CO2 Guides & Templates - 30 Replies
iam do this because i find alot of people saying they still dont under stand how to crack sv so iam giveing the simplest instruction i can for those who still cant crack it TY to anantasia this is all her work iam just simplifying it this is for 1.15 very simple open cheat engine then open script vessel go back to cheat engine click on the little computer in the top right hand corner select script vessel from the options go to memory view press ctrl + a copy and paste all the codeing...



All times are GMT +1. The time now is 05: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.