private static int send_Hooked(IntPtr socketHandle, IntPtr buf, int count, int socketFlags) { lock (typeof(Main)) { NativeSocketMethode.sockaddr address = new NativeSocketMethode.sockaddr(); int namelen = 0x10; int num2 = NativeSocketMethode.getpeername(socketHandle, ref address, ref namelen); string str = Marshal.PtrToStringAnsi(NativeSocketMethode.inet_ntoa(address.sin_addr)) + ":" + NativeSocketMethode.ntohs(address.sin_port); byte[] destination = new byte[count]; Marshal.Copy(buf, destination, 0, count); return NativeSocketMethode.send(socketHandle, buf, count, socketFlags); } }
private static int recv_Hooked(IntPtr socketHandle, IntPtr buf, int count, int socketFlags) { lock (typeof(Main)) { NativeSocketMethode.sockaddr address = new NativeSocketMethode.sockaddr(); int namelen = 0x10; int num2 = NativeSocketMethode.getpeername(socketHandle, ref address, ref namelen); int length = NativeSocketMethode.recv(socketHandle, buf, count, socketFlags); string str = address.sin_addr.sin_addr[0].ToString() + "." + address.sin_addr.sin_addr[1].ToString() + "." + address.sin_addr.sin_addr[2].ToString() + "." + address.sin_addr.sin_addr[3].ToString() + ":" + address.sin_port.ToString(); if (length > 0) { byte[] destination = new byte[length]; Marshal.Copy(buf, destination, 0, length); string str2 = Encoding.ASCII.GetString(destination); } return length; } }