# Reverse Engineering - Icecast protocol # General Info: # - This investigation is done on the older protocol (< 2.4.0) # - This information is from a quick eye and from my understanding # - NOTE: Newer Icecast versions still support this protocol # Protocol Info: # - Icecast is using a modified HTTP protocol (Version 1.0) # - The connection is persistent and it never closes (Unless the streamer stops streaming, or fails to login) # Headers: # - ice-name: - The displayed name of the stream # - ice-description: - The displayed description of the stream # - ice-genre: - The displayed genre of the stream # - ice-url: - The displayed URL of the stream # - ice-public: <1/0> - If the stream should be displayed on the YP listing # - ice-private: <1/0> - If the stream should not be displayed on the YP listing # It is unknown if something breaks if both "ice-public" and "ice-private" are set to "1" # Authorization # - The authorization is the same as HTTP (Basic authorization) # - You need to encode a string in the format : in base64 # - Example source:averysecurepassword123 -> c291cmNlOmF2ZXJ5c2VjdXJlcGFzc3dvcmQxMjM= # - Read more here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication # Login response codes: # - 200 OK: Successfully logged in # - 401 Authentication Required: No credentials sent or they are invalid (You need to authenticate) # - 403 Forbidden: There are too many streams connected (too many sources connected) # - 403 Forbidden: The specified mountpoint is in use (Mountpoint in use) # - 500 Internal Server Error: An internal server error has occured # Connect C: SOURCE / HTTP/1.0 C: Authorization: Basic C: Host: : C: User-Agent: C: Content-Type: C: ice-public: <1/0> C: ice-private: <1/0> C: ice-name: C: ice-description: C: ice-genre: C: ice-url: C: \n\r S: HTTP/1.0 200 OK S: \n\r *C is ready to send audio data* # Sending audio data # Supported media types: audio/ogg, audio/opus, audio/webm, audio/mpeg (Other COMPRESSED formats might work, uncompressed formats do not work) # In order to send out data, you must send splitted segments (THAT INCLUDE THE AUDIO HEADER) of the original audio # NOTE: I was able to see in other examples (bellow) that you are also supposed to send NULL bytes before your next # NOTE: audio data segment, but in my tests it worked without it # NOTE: The server will not reply with anything # NOTE: If you have finished sending the stream data, you are expected to disconnect # NOTE: The timeout is unknown, but if you exceed it, you will be disconnected # Example code (C#) NetworkStream networkStream = tcpClient.GetStream(); byte[] empty = Encoding.ASCII.GetBytes(string.Empty); networkStream.Write(empty, 0, empty.Length); networkStream.Write(audioData, 0, audioData.Length);