Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Nemo247820

#1
Dudas y pedidos generales / [SOLUCIONADO] Preguntas
Diciembre 07, 2015, 09:51:47 AM
hola solo queria saber si podia poner temas que no tengan que ver con informatica Como series, peliculas.etc?
Puedo?

Saludos
#2
Hola,
Aca les dejo el documento de protocolo de ares:
Mi pregunta es: que solicitudes envio en un chat de ares cuando me conecto?

Código: c
Code: [Select]
2 bytes -> data length
1 byte -> proto id
x bytes -> data


Ares Chatroom Protocol - Ares 2.1.7.3041 implementation:

Code: [Select]
Proto ID: MSG_CHAT_SERVER_ERROR (0)
Direction: server to client
Function: make client display error message and then disconnect

x bytes -> error message

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_RELOGIN (1)
Direction: client to server
Function: login and automatically set keepalive flag

Same packet layout as MSG_CHAT_CLIENT_LOGIN

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_LOGIN (2)
Direction: client to server
Function: login handshake packet when first joining a room

16 bytes -> guid
2 bytes -> file count
1 byte -> null
2 bytes -> data port
4 bytes -> node ip address
2 bytes -> node port
4 bytes -> null * 4
x bytes -> user name
1 byte -> null
x bytes -> client version
1 byte -> null
4 bytes -> local ip address
4 bytes -> external ip address
1 byte -> client features
1 byte -> current uploads
1 byte -> maximum uploads allowed
1 byte -> current queued users
1 byte -> user age
1 byte -> user gender
1 byte -> user country code
x bytes -> user location
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_SERVER_LOGIN_ACK (3)
Direction: server to client
Function: server tells client that they have logged in successfully

x bytes -> the user name allocated to you
1 byte -> null
x bytes -> the current name of the chatroom
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_UPDATE_STATUS (4)
Direction: client to server
Function: client sends this every few minutes to keep connection alive

2 bytes -> file count
1 byte -> client features
4 bytes -> node ip address
2 bytes -> node port
4 bytes -> external ip address
1 byte -> client features
1 byte -> current uploads
1 byte -> maximum uploads allowed
1 byte -> current queued users
1 byte -> user age
1 byte -> user gender
1 byte -> user country code
x bytes -> user location
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_SERVER_UPDATE_USER_STATUS (5)
Direction: server to client
Function: server tells users that user details have changed

x bytes -> user name
1 byte -> null
2 bytes -> file count
1 byte -> browsable status
4 bytes -> node ip address
2 bytes -> node port
4 bytes -> external ip address
1 byte -> admin level
1 byte -> user age
1 byte -> user gender
1 byte -> user country code
x bytes -> user location
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_SERVER_REDIRECT (6)
Direction: server to client
Function: send a client to a different chatroom

4 bytes -> new room external ip address
2 bytes -> new room port
4 bytes -> new room local ip address
x bytes -> new room name
1 byte -> null
x bytes -> reason for redirecting
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_AUTOLOGIN (7)
Direction: client to server
Function: secure admin login

20 bytes -> SHA1 hash
(
    20 bytes -> SHA1 hash
    (
        x bytes -> password
    )
    4 bytes -> server external ip address
    4 bytes -> the admin cookie allocated to you
)

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_AVATAR (9)
Direction: client to server
Function: upload your avatar

x bytes -> 48x48 sized image as JPEG

Code: [Select]
Proto ID: MSG_CHAT_SERVER_AVATAR (9)
Direction: server to client
Function: update a user's avatar for everyone

x bytes -> user name
1 byte -> null
x bytes -> 48x48 sized image as JPEG

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_PUBLIC (10)
Direction: client to server
Function: upload a message to the server

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_PUBLIC (10)
Direction: server to client
Function: send a received message to clients

x bytes -> user name
1 byte -> null
x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_EMOTE (11)
Direction: client to server
Function: upload a purple message to the server

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_EMOTE (11)
Direction: server to client
Function: send a received purple message to clients

x bytes -> user name
1 byte -> null
x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_PERSONALMESSAGE (13)
Direction: client to server
Function: upload your personal message to the server

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_PERSONALMESSAGE (13)
Direction: server to client
Function: update a user's personal message for everyone

x bytes -> user name
1 byte -> null
x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_FASTPING (14)
Direction: client to server
Function: fast ping users send this every few seconds if supported

empty

Code: [Select]
Proto ID: MSG_CHAT_SERVER_FASTPING (14)
Direction: server to client
Function: reply to client fastping packet

empty

Code: [Select]
Proto ID: MSG_CHAT_SERVER_JOIN (20)
Direction: server to client
Function: server sends green join message

2 bytes -> file count
4 bytes -> null * 4
4 bytes -> external ip
2 bytes -> data port
4 bytes -> node ip
2 bytes -> node port
1 byte -> null
x bytes -> user name
1 byte -> null
4 bytes -> local ip
1 byte -> browsable status
1 byte -> admin level
1 byte -> age
1 byte -> gender
1 byte -> country code
x byte -> user location
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_SERVER_PART (22)
Direction: server to client
Function: server sends orange part message

x bytes -> user name

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_PVT (25)
Direction: client to server
Function: client uploads a private message

x bytes -> target user name
1 byte -> null
x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_PVT (25)
Direction: server to client
Function: server sends an uploaded private message

x bytes -> sender user name
1 byte -> null
x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_ISIGNORINGYOU (26)
Direction: server to client
Function: message when you PM a user who ignored you

x bytes -> sender user name

Code: [Select]
Proto ID: MSG_CHAT_SERVER_OFFLINEUSER (27)
Direction: server to client
Function: message when you PM a user who is no longer connected

x bytes -> sender user name

Code: [Select]
Proto ID: MSG_CHAT_SERVER_CHANNEL_USER_LIST (30)
Direction: server to client
Function: userlist item when you first join a room

same as MSG_CHAT_SERVER_JOIN

Code: [Select]
Proto ID: MSG_CHAT_SERVER_TOPIC (31)
Direction: server to client
Function: new topic message

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_TOPIC_FIRST (32)
Direction: server to client
Function: topic message received when you join a room

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_CHANNEL_USER_LIST_END (35)
Direction: server to client
Function: userlist items finished sending

1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_SERVER_NOSUCH (44)
Direction: server to client
Function: red announce message

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_IGNORELIST (45)
Direction: client to server
Function: add/remove a user to/from your ignore list

1 byte -> add/remove
x bytes -> target user name

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_ADDSHARE (50)
Direction: client to server
Function: upload a browse item

1 byte -> mime type
4 bytes -> file length
2 bytes -> length of search words
x bytes -> search words

// file data --->
15 bytes -> SHA1 hash (range 1 to 16)
x bytes -> params
2 bytes -> length of details
x bytes -> details
// <--- file data

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_REMSHARE (51)
Direction: client to server
Function: remove a browse item

4 bytes -> size of file(s) to be removed

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_BROWSE (52)
Direction: client to server
Function: request browse of someone's shared files

2 bytes -> browse id
1 byte -> mime
x bytes -> target user name

Code: [Select]
Proto ID: MSG_CHAT_SERVER_ENDOFBROWSE (53)
Direction: server to client
Function: all browse items have been sent

2 bytes -> browse id

Code: [Select]
Proto ID: MSG_CHAT_SERVER_BROWSEERROR (54)
Direction: server to client
Function: cancelled browse session

2 bytes -> browse id

Code: [Select]
Proto ID: MSG_CHAT_SERVER_BROWSEITEM (55)
Direction: server to client
Function: browse item sent to client

2 bytes -> browse id
1 byte -> mime
4 bytes -> file size
x bytes -> file data

Code: [Select]
Proto ID: MSG_CHAT_SERVER_STARTOFBROWSE (56)
Direction: server to client
Function: browse session begins

2 bytes -> browse id
2 bytes -> browse items to be sent

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_SEARCH (60)
Direction: client to server
Function: request a search of everyone's shared files

2 bytes -> search id
1 byte -> null
1 byte -> mime
2 bytes -> length of search words
x bytes -> search words

Code: [Select]
Proto ID: MSG_CHAT_SERVER_SEARCHHIT (61)
Direction: server to client
Function: search result item

2 bytes -> search id
1 byte -> mime
4 bytes -> file data
4 bytes -> external ip
2 bytes -> port
4 bytes -> node ip
2 bytes -> node port
4 bytes -> local ip
1 byte -> current upload count
1 byte -> maximum uploads allowed
1 byte -> current queued users
1 byte -> 0x01

Code: [Select]
Proto ID: MSG_CHAT_SERVER_ENDOFSEARCH (62)
Direction: server to client
Function: search items finished being sent

2 bytes -> search id

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_DUMMY (64)
Direction: client to server
Function: proxy server keep alive

empty

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_SEND_SUPERNODES (70)
Direction: client to server
Function: request a list of reliable nodes

empty

Code: [Select]
Proto ID: MSG_CHAT_SERVER_HERE_SUPERNODES (70)
Direction: server to client
Function: receive a list of reliable nodes

while (remaining_data >= 6)
{
    4 bytes -> node ip
    2 bytes -> node port
}

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_DIRCHATPUSH (72)
Direction: client to server
Function: request help initialising a direct chat session

x bytes -> target user name
1 byte -> null
16 bytes -> direct chat session guid

Code: [Select]
Proto ID: MSG_CHAT_SERVER_DIRCHATPUSH (72)
Direction: server to client
Function: direct chat push response

either:

1 byte -> direct chat error code

or:

x bytes -> target name
1 byte -> null
4 bytes -> target external ip
2 bytes -> target port
4 bytes -> target local ip
16 bytes -> direct chat session guid

Code: [Select]
Proto ID: MSG_CHAT_SERVER_URL (73)
Direction: server to client
Function: update the url tag

x bytes -> URL
1 byte -> null
x bytes -> message
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_COMMAND (74)
Direction: client to server
Function: send an admin command to the server

x bytes -> message

Code: [Select]
Proto ID: MSG_CHAT_SERVER_OPCHANGE (75)
Direction: server to client
Function: set right click userlist menu for a user

1 byte -> include admin options
1 byte -> null

Code: [Select]
Proto ID: MSG_CHAT_CLIENTCOMPRESSED (80)
Direction: client to server
Function: client sends compressed data to the server

x bytes -> compressed data

Code: [Select]
Proto ID: MSG_CHAT_CLIENTCOMPRESSED (80)
Direction: server to client
Function: server sends compressed data to the client

x bytes -> compressed data

Code: [Select]
Proto ID: MSG_CHAT_CLIENT_AUTHLOGIN (82)
Direction: client to server
Function: unsecure admin login

x bytes -> password

Code: [Select]
Proto ID: MSG_CHAT_SERVER_MYFEATURES (92)
Direction: server to client
Function: server sends joining user chatroom credentials

x bytes -> server version
1 byte -> null
1 byte -> client features supported
1 byte -> mime types supported
1 byte -> default language
4 bytes -> admin cookie
1 byte -> avatar support


Gracias y saludos
#3
Hola Snifer,
bueno... primero me queria disculpar porque me fui a la bosta. Luego queria decirte que era un malentendido. Mira:
En realidad mi problema no era packet tracer. Lo que pasa es que hice un error. Primero pregunte y despues busque. Pero no busque en espanol. Busque en ingles y en aleman y salieron mas resultados. Primero pregunte por el temporizador, luego busque en ingles y me quede hasta la parte de paquet tracer y no sabia que hacer, ahora busque de nuevo y fui avanzando....
Pero ahora pirmero busque y despues preguntare lo que leeras a continuacion.

Saludos


Hola Cl0udswX,
perdon, todo fue mi culpa por no ser humilde...
Con respecto a CLI... no tengo esa pestana en la pagina de mi router. Por eso, en vez de comandos en la pagina del router, lo hice de otra forma tus instrucciones.
La cosa es que me quede atorado en la generacion de la llave de RSA. Con Git Bash se puede generar esas claves. Pero al instalar Git, no me sale el programa en mi computadora. Ni siquiera al abrir la consola funcionan los comandos. Me puedes dar una mano hermano?

Muchisimas gracias y saludos
#4
Hola Snifer,
me gustaria ser humilde y decirte: "Oh perdona, la proxima vez hare la pregunta bien lo prometo" pero me resulta imposible hacerlo. Por tu actitud podrida. (He pasado por algunos de tus posts y lei que eres un genio en la informatica y que tienes una pagina.... etc. Por eso es probable que los administradores me cierren este post.)
Snifer.... hacete el hacker en la casa de tu abuela y decile a Ella Como se hackea pero no me vengas a decir nino, no sabes buscar. Ponme un link para saber si sabes buscar TU acerca de mi pregunta.

Saludos
#5
Hola Cl0udswX,
muchisimas gracias por tu ayuda. Pero....
cómo puedo cambiar el nombre de HOST de router. Yo se que hay que Hacer doble click en packet tracer sobre el router. Pero donde?

Gracias y saludos

Hola Snifer,
yo busque en google y no encontre nada. Y ya que estoy con bronca... porque no me mascas el mouse para que te pueda borrar?

Saludos
#6
Hola hermano Cl0udswX,
he capturado el trafico.
El primer paquete es:
Paquete numero 1, Tiempo: 0.000000, Source: 83.60.49.157, Destination: 192.168.0.10, Protocolo: UDP, Length: 76,
Info: 6686 (una flecha) 15021 Len: 34

Paquete numero 2, Tiempo: 0.000548, Source 192.168.0.10, Destination: 83.60.49.157, Protocolo: UDP, Length: 161,
Info: 15021 (una flecha) 6686 Len: 119

Hay que aclarar que 84.123.54.109 es la ip de la sala.

Al seguir el stream del primer paquete me sale esto:
.`..g._/)..<`..\;
3.f.....:YH..Fx..a..g._/)..<`..\;
...e.:/..S..?p4.n.k^..Yp2.Z.e..}g..E..9!.n.}.B.f.f.M.d.S....hc....,.........U*d...v.r.b.0#R....<g.g......g._/)..<`..\;
5......-........._?X.N....g._/)..<`..\;
5....

Y al seguir el segundo paquete me sale esto:
.`..g._/)..<`..\;
3.f.....:YH..Fx..a..g._/)..<`..\;
...e.:/..S..?p4.n.k^..Yp2.Z.e..}g..E..9!.n.}.B.f.f.M.d.S....hc....,.........U*d...v.r.b.0#R....<g.g......g._/)..<`..\;
5......-........._?X.N....g._/)..<`..\;
5....

Que significa todo esto lo que les escribi. Que solicitudes envio cuando me conecto en una sala de ares?

Si quieres te puedo mostrar los datos en otro tipo. Solo decime en cual.

Gracias y saludos
#7
Dudas y pedidos generales / Re:Wireshark
Diciembre 01, 2015, 04:57:20 PM
Hola Stiuvert,
listo ya lo filtre por ip. Antes que me conecte a la sala me salen 4 paquetes, pero....
una vez que me conecte me salen de repente 200 paquetes y va creciendo hasta llegar a 2000 y mas. Cómo puedo ver yo que solicitudes envio yo cuando me conecto en una sala de chat de ares?

Gracias y saludos
#8
Hola Snifer,
no tenes uno en espanol? O me podes decir la respuesta directa?

Gracias y saludos
#9
Dudas y pedidos generales / Re:Wireshark
Noviembre 30, 2015, 06:21:35 PM
Hola ANTRAX,
Muchas gracias por el link, lo he leido.
Pero aun asi...
Cuando abro Ares se me muestran en la tabla de Wireshark conexiones. Y cuando me conecto a una sala me muestra mas conexiones todavia. Cómo puedo filtrar las conexiones que hago con la sala de todos las demas?

Gracias y saludos
#10
Dudas y pedidos generales / Re:Wireshark
Noviembre 30, 2015, 10:13:34 AM
Hola ANTRAX,
ahh vale,
ahora otra pregunta: cómo puedo filtrar las conexiones con ares de las otras conexiones?

Gracias y saludos
#11
Hola,
Como puedo protocolar una conexion con un sala de chat de ares por ocho minutos, es decir, archivar todo el analisis de 8 minutos para despues verlo nuevamente con Wireshark?

Gracias y saludos
#12
Hola,
para entender mi pregunta lean esto:
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Pregunta: Cómo puedo limitar el numero de intentos de login, asi como el temporizador?

Gracias y saludos
#13
Hola,
debido a que el codigo completo no pudo escribirse completo, aca sigue lo que falta:

Código: php
 {
                byte[] buffer = ServerOutboundPackets.VoiceChatChunk(userobj.name, packet.ReadBytes());
                UserPool.BroadcastVoiceClip(userobj, buffer);
            }
        }

        private void ProcessVCChunkTo(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
            {
                String target_name = packet.ReadString();
                byte[] buffer = ServerOutboundPackets.VoiceChatChunkTo(userobj.name, packet.ReadBytes());
                UserObject target_obj = UserPool.GetUserByName(target_name);

                if (target_obj != null)
                    if (target_obj.voice_private_chat)
                        if (!target_obj.voice_chat_ignores.Contains(userobj.name))
                            target_obj.SendOutboundPacket(buffer);
            }
        }

        private void ProcessVCIgnore(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
            {
                String target_name = packet.ReadString();

                if (userobj.voice_chat_ignores.Contains(target_name))
                {
                    userobj.SendOutboundPacket(ServerOutboundPackets.AnnoucePacket(target_name + " is voice chat unignored"));
                    userobj.voice_chat_ignores.RemoveAll(x => x == target_name);
                }
                else
                {
                    userobj.SendOutboundPacket(ServerOutboundPackets.AnnoucePacket(target_name + " is voice chat ignored"));
                    userobj.voice_chat_ignores.Add(target_name);
                }
            }
        }
    }
}
#14
Hola,
mis preguntas: que solicitudes envio en una sala de chat de ares cuando me conecto?
que hace el servidor con los datos que me pidio?

Aqui la parte ServerCore.PacketProcessor.cs  que compone la parte "server" que a su vez compone el codigo fuente de sb0t:

Código: php
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using Ares.PacketHandlers;
using System.Drawing;
using System.IO;

namespace cb0tServer
{
    partial class ServerCore
    {
        private void ProcessReceivedPacket(UserObject user, byte id, AresDataPacket packet)
        {
            byte temp_byte;
            ushort temp_int16;
            String name, text;
            CommandObject cmd;
            SharedFileObject fileobj;

            if (!user.logged_in && ((id > 2 && id < 112) || id > 112)) // only packet id 2 or 112 is acceptable to those not logged in
            {
                user.Disconnect();
                return;
            }

            if (id != 250)
            {
                if (packet.GetByteCount() > 4040)
                {
                    bool should_part = user.logged_in;

                    user.Disconnect();

                    if (should_part)
                        this.OnPart(user);

                    return;
                }
            }

            if (user.IsFlooding(id, packet.ToByteArray(), (uint)this.time_now))
            {
                user.Disconnect();
                this.OnPart(user);
                return;
            }

            switch (id) // process packet
            {
                case 2: // login
                    if (!user.logged_in)
                    {
                        user.guid = packet.ReadGuid();
                        user.files = packet.ReadInt16();
                        packet.SkipByte();
                        user.dc_port = packet.ReadInt16();
                        user.node_ip = packet.ReadIP();
                        user.node_port = packet.ReadInt16();
                        user.line = packet.ReadInt32();
                        user.name = packet.ReadString();
                        user.version = packet.ReadString();
                        user.local_ip = packet.ReadIP();
                        user.external_ip = packet.ReadIP();
                        temp_byte = packet.ReadByte();
                        user.browse = (temp_byte >= 3); // 3 = browse 4 = browse+compression old 7 = browse_compression new
                        user.supports_compression = (temp_byte > 3);
                        if (user.files == 0) user.browse = false;
                        user.custom_client = !(user.version.StartsWith("Ares 1.") || user.version.StartsWith("Ares 2."));
                        user.current_uploads = packet.ReadByte();
                        user.max_uploads = packet.ReadByte();
                        user.current_queued = packet.ReadByte();
                        user.orgName = user.name;
                        user.vroom = 0;
                        user.admin = false;
                        user.host = false;
                        user.kiddied = false;

                        if (packet.Remaining() > 3) // got personal information
                        {
                            user.user_age = packet.ReadByte();
                            user.user_sex = packet.ReadByte();
                            user.user_country = packet.ReadByte();
                            user.user_region = packet.ReadString();
                        }

                        if (this.OnJoinCheck(user)) // login authorised
                        {
                            Stats.UsersJoined++;
                            this.OnJoin(user);

                            if (CoreSettings.captcha)
                            {
                                if (user.level == 0 && !Captcha.IsTrusted(user.guid))
                                {
                                    user.SendOutboundPacket(ServerOutboundPackets.AnnoucePacket(StringTemplate.GetString(153)));
                                    CaptchaObj cap = Captcha.Create();

                                    foreach (byte[] b in cap.packets)
                                        user.SendOutboundPacket(b);

                                    user.captcha_answer = cap.answer;
                                }
                                else user.has_captched = true;
                            }
                            else user.has_captched = true;
                        }
                        else // reject
                        {
                            user.Disconnect();

                            if (!user.auto_redirect)
                            {
                                Stats.UsersRejected++;
                                this.OnUserRejected(user);
                            }
                        }
                    }
                    else // login flood
                    {
                        this.OnFlood(user, "login flood");
                        this.OnPart(user);
                        Stats.UsersParted++;
                        Stats.FloodedUsers++;
                    }
                    break;

                case 4: // update
                    user.last_update_time = this.time_now;
                    temp_int16 = packet.ReadInt16();

                    if (user.files != temp_int16) UserPool.Broadcast(user.vroom, ServerOutboundPackets.UpdatePacket(user));

                    break;

                case 7: // auto password login
                    if (Passwords.IsAutoPasswordLogin(user, packet.ReadBytes()))
                        this.OnAdminStatusChanged(user);

                    break;

                case 8: // ping reply
                    if (packet.ReadString() == "0123456789")
                        UserPool.BroadcastPingReply(user, cb0tServer.Helpers.UnixTimeMS());

                    break;

                case 9: // avatar
                    user.avatar_count++;

                    if (user.avatar_count > 2)
                    {
                        user.avatar_count = 10;
                        return;
                    }

                    user.user_image = packet.ReadBytes();

                    try
                    {
                        Bitmap test_av = new Bitmap(new MemoryStream(user.user_image));
                    }
                    catch { user.user_image = null; }

                    UserPool.Broadcast(user.vroom, ServerOutboundPackets.AvatarPacket(user));

                    if (this.link_client.IsLinking())
                        this.link_client.SendOutboundPacket(ServerOutboundPackets.AvatarPacket(user));

                    break;

                case 10: // public text
                    text = packet.ReadString();
                    text = text.Replace(" ", "");

                    if (!user.has_captched)
                    {
                        String cap_str = text;
                        cap_str = Helpers.StripColors(cap_str);
                        cap_str = cap_str.Trim();

                        if (cap_str.Length > 0)
                        {
                            user.SendOutboundPacket(ServerOutboundPackets.PublicTextPacket(user.name, cap_str));
                            int cap;

                            if (int.TryParse(cap_str, out cap))
                            {
                                if (user.captcha_answer == cap)
                                {
                                    user.has_captched = true;
                                    user.SendOutboundPacket(ServerOutboundPackets.AnnoucePacket(StringTemplate.GetString(154)));
                                    Captcha.MakeTrusted(user.guid);
                                    return;
                                }
                            }
                        }

                        user.captcha_attempts++;

                        if (user.captcha_attempts > 2)
                        {
                            user.SendOutboundPacket(ServerOutboundPackets.AnnoucePacket(StringTemplate.GetString(151)));
                            user.Disconnect();
                            this.OnPart(user);
                            Stats.UsersParted++;
                            Stats.KickedUsers++;
                            return;
                        }
                        else
                        {
                            user.SendOutboundPacket(ServerOutboundPackets.AnnoucePacket(StringTemplate.GetString(152)));
                            CaptchaObj cap = Captcha.Create();

                            foreach (byte[] b in cap.packets)
                                user.SendOutboundPacket(b);

                            user.captcha_answer = cap.answer;
                            return;
                        }
                    }

                    Stats.PublicMessagesReceived++;

                    if (text.StartsWith("#")) // command text
                    {
                        cmd = CommandEval.EvaluateClientCommandString(text.Substring(1));
                        this.OnCommand(user, cmd.cmdText, cmd.tUser, cmd.args);
                    }

                    if (user.IsSet()) text = this.OnTextBefore(user, text); // still connected? (invalid login attempt??)

                    if (user.IsSet()) // still connected? (word filter??)
                        if (!String.IsNullOrEmpty(text))
                            this.OnTextAfter(user, text);

                    break;

                case 11: // emote text
                    if (!user.has_captched)
                        return;

                    text = packet.ReadString();
                    text = text.Replace(" ", "");
                    Stats.EmoteMessagesReceived++;

                    text = this.OnEmoteBefore(user, text);

                    if (user.IsSet()) // still connected? (word filter??)
                        if (!String.IsNullOrEmpty(text))
                            this.OnEmoteAfter(user, text);

                    break;

                case 13: // personal message
                    text = packet.ReadString();
                    text = text.Replace(" ", "");

                    while (Encoding.UTF8.GetByteCount(text) > 50)
                        text = text.Substring(0, text.Length - 1);

                    if (PMessages.IsAdminMsg(user) != null)
                        return;

                    if (user.idle && !text.StartsWith("[idle] "))
                        text = "[idle] " + text;

                    user.user_message = text;
                    UserPool.Broadcast(user.vroom, ServerOutboundPackets.PersonalMessagePacket(user, text));

                    if (this.link_client.IsLinking())
                        this.link_client.SendOutboundPacket(ServerOutboundPackets.PersonalMessagePacket(user, text));

                    break;

                case 25: // pm text
                    if (!user.has_captched)
                        return;

                    name = packet.ReadString();
                    text = packet.ReadString();
                    text = text.Replace(" ", "");
                    Stats.PrivateMessagesReceived++;

                    if (name == CoreSettings.room_bot)
                    {
                        if (text.StartsWith("/") || text.StartsWith("#")) // command via host pm
                        {
                            text = text.Substring(1);
                            cmd = CommandEval.EvaluateClientCommandString(text);
                            this.OnCommand(user, cmd.cmdText, cmd.tUser, cmd.args);
                        }
                        else
                        {
                            this.OnHostPM(user, text);
                        }

                        return;
                    }

                    /*     if (name == this.last_pm_spam) // pm spammer
                         {
                             if (user.level < 5)
                             {
                                 this.banstats.Add(user.name + " [" + user.physical_ip + "] was banned for being a pm spammer");
                                 AdminLog.WriteLine(user.name + " was banned for being a pm spammer");
                                 Bans.AddBan(user);
                                 user.Disconnect();
                                 this.OnPart(user);
                                 Stats.UsersParted++;
                                 Stats.BannedUsers++;
                                 return;
                             }
                         }*/

                    this.OnPM(user, name, text);
                    break;

                case 45: // ignore request
                    temp_byte = packet.ReadByte();
                    name = packet.ReadString();
                    this.OnIgnoreRequested(user, name, temp_byte);
                    break;

                case 50: // add share
                    user.file_count++;

                    if (user.file_count > 12000) // too many files
                    {
                        this.OnFlood(user, "file share limit exceeded");
                        this.OnPart(user);
                        Stats.UsersParted++;
                        return;
                    }

                    fileobj = FileBrowseHelpers.CreateFileObject(packet);

                    if (fileobj != null)
                    {
                        user.AddFile(fileobj);
                        this.OnFileReceived(user, fileobj);
                    }

                    break;

                case 80:
                    byte[] _unzipped = null;

                    try
                    {
                        _unzipped = ZLib.Zlib.Decompress(packet.ReadBytes(), false);
                    }
                    catch { user.file_count++; }

                    if (_unzipped != null)
                    {
                        AresDataPacket _unzipped_files = new AresDataPacket(_unzipped);

                        while (_unzipped_files.Remaining() > 3)
                        {
                            temp_int16 = _unzipped_files.ReadInt16();

                            if (_unzipped_files.ReadByte() != 50)
                            {
                                user.file_count++;
                                break; // i'm only interested in add shares
                            }

                            byte[] _file_data = _unzipped_files.ReadBytes(temp_int16);

                            user.file_count++;

                            if (user.file_count > 12000) // too many files
                            {
                                this.OnFlood(user, "file share limit exceeded");
                                this.OnPart(user);
                                Stats.UsersParted++;
                                return;
                            }

                            fileobj = FileBrowseHelpers.CreateFileObject(new AresDataPacket(_file_data));

                            if (fileobj != null)
                            {
                                user.AddFile(fileobj);
                                this.OnFileReceived(user, fileobj);
                            }
                        }
                    }

                    break;

                case 51: // rem share
                    break;

                case 52: // browse request
                    FileBrowseHelpers.ProcessBrowseRequest(this.link_client, user, packet);
                    break;

                case 60: // room search request
                    FileBrowseHelpers.ProcessSearchRequest(user, packet);
                    break;

                case 64: // client uses proxy server
                    if (!user.admin)
                    {
                        this.tor.Update(user.physical_ip);
                        AdminLog.ReportProxy(user);
                        Bans.AddBan(user);
                        user.Disconnect();
                        this.OnPart(user);
                        Stats.UsersParted++;
                        Stats.KickedUsers++;
                    }

                    break;

                case 70: // request supernodes
                    byte[] s_nodes = UserPool.GetSuperNodes();
                    if (s_nodes == null) break;
                    user.SendOutboundPacket(ServerOutboundPackets.SuperNodesPacket(s_nodes));
                    break;

                case 74: // command text
                    if (!user.has_captched)
                        return;

                    text = packet.ReadString();
                    text = text.Replace(" ", "");
                    cmd = CommandEval.EvaluateClientCommandString(text);
                    this.OnCommand(user, cmd.cmdText, cmd.tUser, cmd.args);
                    break;

                case 82: // command login
                    text = packet.ReadString();
                    this.OnCommand(user, "login " + text, null, String.Empty);
                    break;

                case 112: // we are server - client requests link login
                    if (this.link_client.IsSet() || !CoreSettings.allow_linking) // already linked
                    {
                        user.SendOutboundPacket(ServerOutboundPackets.LinkErrorPacket((byte)LinkClient.LinkError.LinkingDisabled));
                        user.Disconnect();
                        return;
                    }

                    this.link_client = new LinkClient(user.socket, this.time_now);
                    user.UserWasLinkLeaf();
                    packet.SkipBytes(2);
                    temp_int16 = packet.ReadInt16();
                    ushort _tempint162 = packet.ReadInt16();
                    this.link_client.target_port = _tempint162;
                    this.link_client.room_name = packet.ReadString();
                    user = new UserObject();
                    user.physical_ip = this.link_client.target_ip;

                    if (!CoreSettings.link_any)
                    {
                        Ares.CommonObjects.ChannelListItem _c = new Ares.CommonObjects.ChannelListItem();
                        _c.port = this.link_client.target_port;
                        _c.externalIp = this.link_client.target_ip;
                        _c.name = this.link_client.room_name;

                        if (!LinkAllowList.CanAcceptLink(_c)) // not on allow list
                        {
                            this.link_client.SendOutboundPacket(ServerOutboundPackets.LinkErrorPacket((byte)LinkClient.LinkError.NotOnAllowList));
                            this.link_client.SendAndDisconnect();
                            return;
                        }
                    }

                    if (Bans.IsLinkBanned(user) || RangeBans.IsBanned(user)) // banned user
                    {
                        this.link_client.SendOutboundPacket(ServerOutboundPackets.LinkErrorPacket((byte)LinkClient.LinkError.BannedUser));
                        this.link_client.SendAndDisconnect();
                        return;
                    }

                    UserPool.Broadcast(ServerOutboundPackets.AnnoucePacket("\x000314room link: " + this.link_client.room_name + " requesting room link..."));

                    if (temp_int16 < 3041) // proto out of date
                    {
                        UserPool.Broadcast(ServerOutboundPackets.AnnoucePacket("\x000314room link: rejected [invalid link protocol]"));
                        this.link_client.SendOutboundPacket(ServerOutboundPackets.LinkErrorPacket((byte)LinkClient.LinkError.OldProtocol));
                        this.link_client.SendAndDisconnect();
                        return;
                    }

                    if (AutoLogin.IsHost(this.link_client.target_ip) && _tempint162 == CoreSettings.room_port) // linking yourself
                    {
                        UserPool.Broadcast(ServerOutboundPackets.AnnoucePacket("\x000314room link: rejected [self linking]"));
                        this.link_client.SendOutboundPacket(ServerOutboundPackets.LinkErrorPacket((byte)LinkClient.LinkError.LinkToSelf));
                        this.link_client.SendAndDisconnect();
                        return;
                    }

                    UserPool.Broadcast(ServerOutboundPackets.AnnoucePacket("\x000314room link: accepted link request from " + this.link_client.room_name + " (Y)"));
                    this.link_client.SendOutboundPacket(ServerOutboundPackets.RequestLinkAckPacket());

                    foreach (UserObject usr in UserPool.Users)
                        if (usr.IsSet())
                            if (usr.logged_in)
                                if (usr.vroom == 0)
                                    this.link_client.SendOutboundPacket(ServerOutboundPackets.UserListItemPacket(usr, true));

                    this.link_client.SendOutboundPacket(ServerOutboundPackets.UserListEndPacket());
                    this.link_client.logged_in = true;
                    this.link_client.SetRoomInfo();

                    foreach (UserObject usr in UserPool.Users)
                    {
                        if (usr.IsSet())
                        {
                            if (usr.logged_in)
                            {
                                if (usr.vroom == 0)
                                {
                                    this.link_client.SendOutboundPacket(ServerOutboundPackets.AvatarPacket(usr));
                                    this.link_client.SendOutboundPacket(ServerOutboundPackets.PersonalMessagePacket(usr, usr.user_message));
                                }
                            }
                        }
                    }

                    AdminLog.WriteLine(this.link_client.room_name + " has requested and been accepted to link");
                    break;

                case 200: // custom data
                    text = packet.ReadString();
                    name = packet.ReadString();
                    UserObject tUser = UserPool.GetUserByName(name);

                    if (tUser != null)
                    {
                        tUser.SendOutboundPacket(ServerOutboundPackets.CustomDataPacket(user, text, packet.ReadBytes()));
                    }

                    break;

                case 201: // custom data to all
                    text = packet.ReadString();
                    UserPool.BroadcastCustomData(user, ServerOutboundPackets.CustomDataPacket(user, text, packet.ReadBytes()));
                    break;

                case 250:
                    ushort adf_len = packet.ReadInt16();
                    byte adf_id = packet.ReadByte();
                    byte[] adf_data = packet.ReadBytes();

                    if (adf_data.Length == adf_len)
                        this.ProcessAdvancedFeaturesPacket(user, adf_id, new AresDataPacket(adf_data));

                    break;
            }
        }

        private void ProcessAdvancedFeaturesPacket(UserObject user, byte id, AresDataPacket packet)
        {
            switch (id)
            {
                case 202: // add tag
                    this.ProcessCustomDataAddTags(user, packet);
                    break;

                case 203: // remove tag
                    this.ProcessCustomDataRemTags(user, packet);
                    break;

                case 204: // font
                    if (packet.Remaining() == 2)
                    {
                        user.font = new UserFont("Verdana", 10);
                        UserPool.Broadcast(user.vroom, ServerOutboundPackets.Font(user));
                        user.font = null;
                    }
                    else
                    {
                        int _f_size = (int)packet.ReadByte();
                        String _f_name = packet.ReadString();
                        user.font = new UserFont(_f_name, _f_size);

                        if (packet.Remaining() >= 2)
                        {
                            user.font.ncol = packet.ReadByte();
                            user.font.tcol = packet.ReadByte();
                        }

                        UserPool.Broadcast(user.vroom, ServerOutboundPackets.Font(user));
                    }
                    break;

                case 205:
                    user.voice_chat = packet.ReadByte() == 1;
                    user.voice_private_chat = packet.ReadByte() == 1;
                    UserPool.Broadcast(user.vroom, ServerOutboundPackets.VoiceChatUserSupport(user));
                    break;

                case 206:
                    this.ProcessVCFirst(user, packet);
                    break;

                case 207:
                    this.ProcessVCFirstTo(user, packet);
                    break;

                case 208:
                    this.ProcessVCChunk(user, packet);
                    break;

                case 209:
                    this.ProcessVCChunkTo(user, packet);
                    break;

                case 210:
                    this.ProcessVCIgnore(user, packet);
                    break;

                case 220: // supports custom emotes
                    this.ProcessSupportsCustomEmotes(user);
                    break;

                case 221: // custom emote item
                    this.ProcessCustomEmoteUpload(user, packet);
                    break;

                case 222: // delete custom emote
                    this.ProcessCustomEmoteDelete(user, packet);
                    break;
            }
        }

        private void ProcessSupportsCustomEmotes(UserObject userobj)
        {
            if (!CoreSettings.supports_custom_emoticons)
                return;

            if (!userobj.supports_custom_emotes)
            {
                userobj.supports_custom_emotes = true;
                userobj.custom_emotes.Clear();
                UserPool.SendCustomEmotes(userobj);
            }
        }

        private void ProcessCustomEmoteUpload(UserObject userobj, AresDataPacket packet)
        {
            if (!CoreSettings.supports_custom_emoticons)
                return;

            ProcessSupportsCustomEmotes(userobj);

            CustomEmoteItem c = new CustomEmoteItem();
            c.Shortcut = packet.ReadString();
            c.Size = packet.ReadByte();
            c.Image = packet.ReadBytes();
            UserPool.BroadcastToVroomCustomEmotes(userobj.vroom, ServerOutboundPackets.CustomEmoteItem(userobj, c));
            userobj.custom_emotes.Add(c);

            if (userobj.custom_emotes.Count > 16)
            {
                userobj.Disconnect();
                this.OnPart(userobj);
            }
        }

        private void ProcessCustomEmoteDelete(UserObject userobj, AresDataPacket packet)
        {
            if (!CoreSettings.supports_custom_emoticons)
                return;

            String text = packet.ReadString();
            userobj.custom_emotes.RemoveAll(delegate(CustomEmoteItem x) { return x.Shortcut == text; });
            UserPool.BroadcastToVroomCustomEmotes(userobj.vroom, ServerOutboundPackets.CustomEmoteDelete(userobj, text));
        }

        private void ProcessCustomDataAddTags(UserObject userobj, AresDataPacket packet)
        {
            while (packet.Remaining() > 0)
                userobj.custom_tags.Add(packet.ReadString());
        }

        private void ProcessCustomDataRemTags(UserObject userobj, AresDataPacket packet)
        {
            while (packet.Remaining() > 0)
                userobj.custom_tags.RemoveAll(x => x == packet.ReadString());
        }

        private void ProcessVCFirst(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
            {
                byte[] buffer = ServerOutboundPackets.VoiceChatFirst(userobj.name, packet.ReadBytes());
                UserPool.BroadcastVoiceClip(userobj, buffer);
            }
        }

        private void ProcessVCFirstTo(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
            {
                String target_name = packet.ReadString();
                byte[] buffer = ServerOutboundPackets.VoiceChatFirstTo(userobj.name, packet.ReadBytes());
                UserObject target_obj = UserPool.GetUserByName(target_name);

                if (target_obj != null)
                    if (!target_obj.voice_chat_ignores.Contains(userobj.name))
                        if (target_obj.voice_private_chat)
                            target_obj.SendOutboundPacket(buffer);
                        else userobj.SendOutboundPacket(ServerOutboundPackets.VoiceChatNoPrivate(target_name));
                    else userobj.SendOutboundPacket(ServerOutboundPackets.VoiceChatIgnored(target_name));
                else userobj.SendOutboundPacket(ServerOutboundPackets.PMOfflinePacket(target_name));
            }
        }

        private void ProcessVCChunk(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
            {
                byte[] buffer = ServerOutboundPackets.VoiceChatChunk(userobj.name, packet.ReadBytes());
                UserPool.BroadcastVoiceClip(userobj, buffer);
            }
        }

        private void ProcessVCChunkTo(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
            {
                String target_name = packet.ReadString();
                byte[] buffer = ServerOutboundPackets.VoiceChatChunkTo(userobj.name, packet.ReadBytes());
                UserObject target_obj = UserPool.GetUserByName(target_name);

                if (target_obj != null)
                    if (target_obj.voice_private_chat)
                        if (!target_obj.voice_chat_ignores.Contains(userobj.name))
                            target_obj.SendOutboundPacket(buffer);
            }
        }

        private void ProcessVCIgnore(UserObject userobj, AresDataPacket packet)
        {
            if (CoreSettings.can_vc)
 
#15
Dudas y pedidos generales / Inyectar códigos en Sb0t
Noviembre 27, 2015, 09:52:53 AM
Hola,
Cómo puedo inyectar códigos en Sb0t?

Gracias y saludos