Hello,
Je suis entrain d'essayer de coder un MITM. Aucun problème pour rediriger l'authentification avec un hook (https://github.com/ProtonOverflow/NoAnkama) seulement pour la connexion au serveur (ilyzaelle) que ce soit avec un deuxième hook ou avec le code ci-dessous qui modifie l'ip du serveur dofus par l'ip de mon serveur (j'imagine que c'est plus compliqué que ça mais même avec le 2nd hook ca ne fonctionne pas), rien ne marche. Pourriez-vous m'aider ? Merci.
const net = require('net'),
constants = require('./constants'),
log = require('./logs');
const authServer = new net.Server(), gameServer = new net.Server();
authServer.listen(5555);
gameServer.listen(443);
authServer.on('connection', function(socket) {
socket['myclient'] = null;
connectClient(socket, constants.dofusIp, constants.dofusPort);
socket.on('data', function(data) {
try{
const s = data.toString();
log("FROM DOFUS CLIENT: " + s);
socket['myclient'].write(data);
}catch(e){
console.log(e);
}
});
socket.on('end', function() {
log('close connection with dofus client');
});
socket.on('error', function(err) {
log('error connection with dofus client');
});
});
gameServer.on('connection', function(socket) {
socket['myclient'] = null;
connectClient(socket, constants.ipGameServer, constants.dofusPort);
socket.on('data', function(chunk) {
try{
const s = chunk.toString();
log("FROM DOFUS CLIENT: " + s);
socket['myclient'].write(s);
}catch(e){
console.log(e);
}
});
socket.on('end', function() {
// log('Closing connection with the dofus client');
});
socket.on('error', function(err) {
// log('Error connection with the client');
});
});
function connectClient(socket, ip, port){
socket['myclient'] = new net.Socket();
socket['myclient'].connect({
host: ip,
port: port
});
socket['myclient'].on('connect', function(){
log('connected with dofus authServer');
});
socket['myclient'].on('data', function(data) {
const s = data.toString();
log('FROM DOFUS SERVER: ' + s);
if(s.indexOf(constants.ipGameServer) > -1){
console.log('contient lip du serveur');
data = Buffer.from(s.replace(constants.ipGameServer, constants.myIp));
}
socket.write(data);
});
socket['myclient'].on('close', function() {
log("close connection with dofus server");
});
socket['myclient'].on('error', function(err) {
log("error connection with dofus server");
});
}