RenRem protocol [message #351553] |
Sun, 21 September 2008 04:15 |
jindrak2
Messages: 4 Registered: September 2007
Karma: 0
|
Recruit |
|
|
Hey guys,
Im scripting a bot in Java for my server.
For the moment, i use the FDSTalk.dll file to communicate to FDS (with JNI technology) and i used SSGM DDE as well. But i want to use pure java code to communicate to FDS and for that i need to know how RenRem does it.
If someone can help me it would be great
|
|
|
|
|
|
Re: RenRem protocol [message #395095 is a reply to message #351929] |
Wed, 15 July 2009 14:05 |
snazy2000
Messages: 67 Registered: December 2007
Karma: 0
|
Recruit |
|
|
i no im opening an old topic but ages ago i found this somewere
import java.io.*;
import java.net.*;
class JavaFDS {
byte[] message5 = new byte[20];
private String password;
private byte[] result;
private byte[] receiveData;
private String message;
private DatagramSocket clientSocket;
private InetAddress IPAdress;
private int port;
private DatagramPacket sendPacket,receivePacket;
public void connectFDS(String password, int port) throws Exception
{
this.password = password;
message = password;
this.port = port;
encrypt2();
clientSocket = new DatagramSocket();
IPAdress = InetAddress.getByName("loopback");
receiveData = new byte[1024];
sendPacket = new DatagramPacket(result,result.length,IPAdress,port);
clientSocket.send(sendPacket);
//receivePacket = new DatagramPacket(receiveData,receiveData.length);
//clientSocket.receive(receivePacket);
//decrypt2();
//Connection1.sendMsg("PRIVMSG " + Connection1.chan + " " + message);
//System.out.println(byteToInt(receiveData[1]));
return;
}
public void sendMsg(String message) throws Exception
{
this.message = message;
encrypt2();
receiveData = new byte[1024];
sendPacket = new DatagramPacket(result,result.length,IPAdress,port);
clientSocket.send(sendPacket);
//receivePacket = new DatagramPacket(receiveData,receiveData.length);
//clientSocket.receive(receivePacket);
//modifiedSentence = new String(receivePacket.getData());
//System.out.println(byteToInt(receiveData[1]));
//decrypt2();
//decrypt2();
//shutdown();
//return this.message;
return;
}
public void shutdown() throws Exception
{
clientSocket.close();
}
// ****************
// Internal functions
// ****************
// Encrypt the variable "message" and stock the encryption into the variable "result"
private void decrypt2() throws Exception {
int l=1023;
while(byteToInt(receiveData[l])==0)
l--;
//System.out.println(l);
while (l%4 != 0)
l++;
byte[] dmessage = new byte[l+1];
for(int i=0;i<l+1;i++)
dmessage[i] = receiveData[i];
//System.out.println(dmessage[0]);
byte ESI;
byte[] ECX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00};
byte[] EDX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00};
byte[] EBX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01};
byte[] EAX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00};
String shortpass;
if (password.length()>=8)
shortpass = password.substring(0,8);
else
return;
byte[] bpass = new byte[8];
bpass = shortpass.getBytes();
for(int i=4;i<l+1;i++)
{
EDX[3] = dmessage[i];
mov(ECX,EAX);
ECX[3] = (byte) (ECX[3] & (byte)0x07);
ECX[0]=(byte)0x00;
ECX[1]=(byte)0x00;
ECX[2]=(byte)0x00;
ESI = ECX[3];
ECX[3] = bpass[byteToInt(ECX[3])];
ECX[3] = (byte)(ECX[3] ^ EDX[3]);
EDX[3] = ECX[3];
bpass[(int)ESI] = ECX[3];
EDX[3] = (byte)(EDX[3] + ~EAX[3] + (byte)0x01);
EDX[3] = (byte)(EDX[3] + (byte)0x32);
dmessage[i] = EDX[3];
add(EAX,EBX);
}
for(int i=0;i<l+1;i++)
{
if(byteToInt(dmessage[i]) == 10)
dmessage[i]=(byte)0x20;
}
byte[] dmessage2 = new byte[l+1-8];
for(int i=0;i<l+1-8;i++)
dmessage2[i] = dmessage[i+8];
byte[] dmessage3 = new byte[l+1-11];
for(int i=0;i<l+1-11;i++)
dmessage3[i] = dmessage2[i];
String tze = new String( dmessage3 , "Cp1252" );
this.message=tze;
//System.out.println(message);
}
private void encrypt2() throws Exception
{
int l = this.message.length();
byte[] bmessage = new byte[l];
bmessage = this.message.getBytes();
String shortpass;
if (password.length()>=8)
shortpass = password.substring(0,8);
else
return;
byte[] bpass = new byte[8];
bpass = shortpass.getBytes();
l=l+9;
while (l%4 != 0)
l++;
result = new byte[l];
// Initialisation
for(int i=0;i<l;i++)
{
if(i<8)
{
result[i]=(byte)0x00;
}
else if(i>7 && i<8+this.message.length())
{
result[i]=bmessage[i-8];
}
else
{
result[i] = (byte)0x00;
}
}
// Encryption
byte ESI;
byte[] ECX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00};
byte[] EDX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00};
byte[] EBX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01};
byte[] EAX = {(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00};
for(int i=4;i<this.message.length()+9;i++)
{
EAX[3] = result[i];
mov(EDX,ECX);
EDX[3] = (byte) (EDX[3] & (byte)0x07);
EDX[0]=(byte)0x00;
EDX[1]=(byte)0x00;
EDX[2]=(byte)0x00;
add(EAX,ECX);
EAX[3] = (byte)(EAX[3] + ~(byte)0x32 + (byte)0x01);
ESI = EDX[3];
EDX[3] = bpass[(int)EDX[3]];
EAX[3] = (byte)(EAX[3] ^ EDX[3]);
result[i] = EAX[3];
EDX[3] = (byte)(EDX[3] ^ EAX[3]);
bpass[(int)ESI] = EDX[3];
add(ECX,EBX);
}
int rrr;
if((this.message.length()+4+1)%4 == 0)
rrr = (this.message.length()+4+1)/4;
else
rrr = (this.message.length()+4+1)/4+1;
//if((this.message.length())%4 != 0)
//rrr--;
for(int i=0;i<rrr;i++)
{
ECX[0] = result[3];
ECX[1] = result[2];
ECX[2] = result[1];
ECX[3] = result[0];
mov(EAX,ECX);
EAX[3] = (byte)((byte)(EAX[0] >> 7) & (byte)0x00 + 1);
EAX[0] = (byte)0x00;
EAX[1] = (byte)0x00;
EAX[2] = (byte)0x00;
shl(ECX);
add(EAX,ECX);
ECX[0] = result[4*i+7];
ECX[1] = result[4*i+6];
ECX[2] = result[4*i+5];
ECX[3] = result[4*i+4];
add(EAX,ECX);
result[3] = EAX[0];
result[2] = EAX[1];
result[1] = EAX[2];
result[0] = EAX[3];
}
}
// Convert a signed byte to an integer.
private int byteToInt(byte bIn){
if((bIn > 127) || (bIn < -128))
return 0;
else
{
if(bIn >= 0)
return (int)bIn;
else{
return (-(-(int)bIn) & 0xff);
}
}
}
// Replace the first registry by the second one.
private void mov(byte[] reg1, byte[] reg2)
{
reg1[0] = reg2[0];
reg1[1] = reg2[1];
reg1[2] = reg2[2];
reg1[3] = reg2[3];
}
// Add the second registry to the first one and stock the result into the first registry.
private void add(byte[] reg1, byte[] reg2)
{
byte temp = (byte)0x00;
byte temp2 = (byte)0x00;
if(byteToInt(reg1[3])+byteToInt(reg2[3]) > 255)
temp = (byte)0x01;
reg1[3] = (byte)(reg1[3] + reg2[3]);
if(byteToInt(reg1[2])+byteToInt(reg2[2])+temp > 255)
temp2 = (byte)0x01;
reg1[2] = (byte)(reg1[2] + reg2[2] + temp);
if(byteToInt(reg1[1])+byteToInt(reg2[1])+temp2 > 255)
temp = (byte)0x01;
else
temp = (byte)0x00;
reg1[1] = (byte)(reg1[1] + reg2[1] +temp2);
reg1[0] = (byte)(reg1[0] + reg2[0] +temp);
}
// Multiply the registry by 2.
private void shl(byte []reg)
{
byte temp = (byte)0x00;
byte temp2 = (byte)0x00;
if((int)reg[3] < 0)
temp = (byte)0x01;
reg[3] = (byte)(reg[3] << 1);
if((int)reg[2] < 0)
temp2 = (byte)0x01;
reg[2] = (byte)(reg[2] << 1);
reg[2] = (byte)(reg[2] + temp);
if((int)reg[1] < 0)
temp = (byte)0x01;
else
temp= (byte)0x00;
reg[1] = (byte)(reg[1] << 1);
reg[1] = (byte)(reg[1] + temp2);
reg[0] = (byte)(reg[0] << 1);
reg[0] = (byte)(reg[0] + temp);
}
}
Dont no if that can help any 1
|
|
|
|
|
Re: RenRem protocol [message #396154 is a reply to message #396086] |
Fri, 24 July 2009 22:31 |
Genesis2001
Messages: 1397 Registered: August 2006
Karma: 0
|
General (1 Star) |
|
|
CarrierII wrote on Fri, 24 July 2009 05:29 | RenRem's perfectly secure if you set the remote admin IP to 127.0.0.1, right?
|
RenRem's protocol, last I checked, wasn't supposed to be released as it's a security risk perhaps? or am I just thinking of FDSTalk.dll...?
|
|
|
Re: RenRem protocol [message #397189 is a reply to message #396154] |
Thu, 06 August 2009 10:22 |
|
Ethenal
Messages: 2532 Registered: January 2007 Location: US of A
Karma: 0
|
General (2 Stars) |
|
|
Zack wrote on Sat, 25 July 2009 00:31 |
CarrierII wrote on Fri, 24 July 2009 05:29 | RenRem's perfectly secure if you set the remote admin IP to 127.0.0.1, right?
|
RenRem's protocol, last I checked, wasn't supposed to be released as it's a security risk perhaps? or am I just thinking of FDSTalk.dll...?
|
Technically, FDSTalk.dll wasn't supposed to be released for security purposes, but this however, is obviously not FDSTalk so I don't think that applies. Somebody might remove it anyway, though.
-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29 | Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade
|
|
|
|
|
|