mity@ropnet.ru 6 July 2001(lst modyfied 01/10/01
 
 
Audio Galaxy Satellite Communication Protocol
 
 
 

Introduction.

AGSatelite.exe - this is client, it is a file sharing program, based on p2p.

This document, shows the way AGSatelite.exe communicates with server, and it describes the structure of messages, between 2 clients. And it gives a set of messages used. This document is an instruction, for public use. It can be enriched by any one who has an information related to the topic of this document. If you found any faults or you wish to add any thing just mail me. The following information was received by analyzing the traffic from AGSatelite.exe( W606)

Rules, Procedures.

AGSatelite(further Client) uses TCP for data transmission. The connection to servers is made through port 21. For connecting client uses 2 servers.

Connecting to the information service of audiogalaxy.com

1) Client makes connection to the Master Server(squash.audiogalaxy.com).
2) Client receives a REDIRECTION message.
3) Client connects to the information server(further Server).
(the following 3 steps where decrypted by thenks to Justin Fletcher all thenxs goes to him)
4) Server sends Hash prefix (55)
5) Client generates 16 byte MD5 hash for the string PREFIX+PASSWORD. For example if you received a prefix 'fgh4564t' ajnd your password is 'teapot' you need to hash the string 'fgh4564tteapot'. MD5 hashing will give you 16 byte string. Then you put it in the end of LOGIN msg.
4) Client sends LOGIN(0) message.
5) Server tests the abilities of the client to Listen, and to Connect(further proxy test)

 

Proxy test.

The server sends FILE TRANSFER(10) message which makes client download 'proxy test' file. Connection is made with client-client protocol. After connecting to server or opening port, client sends message FILE TRANSFER STATUS(6) with status 3. After client sends FILE REQUEST message, server closes the connection without sending any data(It is a step of connection checking).After connection is closed client sends FILE TRANSFER STATUS(6) with status 5. There are 3 tests. 2 - test for an ability to Listen, 1 - test for ability to Connect.

6) Client informs server of the files to be shared.

 

Informing Server of the Shares.

The server sends message 8 a few times. On which you reply with message 7. Then server sends SEND SHARES(9) message. This message shows that you can send your shares. If you have any new files(which don't have server id) in the data base you send it's info with the message 33, then the server will reply with message 13 with the server IDs for the file. To inform the server about the files which alrady have server id, thet they are online, you send message 32. If you don't have any files to share you reply with message 7, but if so you will not be able to download more then 1 file at a time.

7) Every 30 seconds you send message 5.

Files sharing

After going through LOGIN process, client may receive FILE TRANSFER(10) message - it is an information from the server to start file sharing. It may inform you to upload or download file. It also gives you information weather to Listen or Connect.

If client must wait for connection:

1) Client opens a port defined in the message 10. The IP set in the message is just a mask, it shows only first 2 bytes.
2) Client sends message 6 status 3

If client must connect.

1) Client makes a connection to the IP and port defined in message 10
2) Client sends message 6 status 3

If client downloads.

1) After connection is done Client sends FILE REQUEST message which consists of FILE ID received from message 10. Size of the file to be downloaded, and the position to resume(the first byte of the file is at position 0)
2) The sender if the file was found sends RESPONSE FOR REQUEST in response. After finishing both sides send message 6 status 0. And the downloader sends message 33 with the information on new file.

Transfer shutdown

During file transfer server may send message 11 with the FILE ID of the transfer to be shutted down. After the p2p connection was closed client sends message 6 status 8.

Message specification.

The messages in this protocol have binary structure. It is base on the fields of 4 types:

String
 
string size
        2 bytes (size of char array)
char array
        
Byte
        1 byte (first byte is on the right)
Word
        2 byte (first byte is on the right)
Integer
        4 byte (first byte is on the right)

Messages may be of 2 types:

1) Messages used fore redirection and clien-client

START SIGNAL
1163907285 (4 bytes)  
MESSAGE SIZE
4 bytes . A Size of the whole message without START SIGNAL
ID
4 bytes message count
Then fields specific for every message

1) Messages server-client

START SIGNAL
17759(2 bytes)  
MESSAGE SIZE
2 bytes . A Size of the whole message without START SIGNAL
MESSAGE TYPE
1 bytes  
Then fields specific for every message

Message declaration.

REDIRECTOR (use the first type of header)

REDIRECTION
PORT - 4 bytes
SERVER IP- String

PEER TO SERVER (use the second type of header)

msg ID
parametrs
comments
LOGIN
0
? - 4 bytes just use 0
LOGIN - string  
ZERO - String(2 byte) just use 0
SATELITE VERSION - string  
CLIENT IP - string  
CLIENT HOST_NAME - string  
?(0) - 4 bytes just use 0
16 BYTE HASH see Rules, Procedures.
LOGOFF
1
  Sent when you quit the satelite
READY FOR TRANSFER
5
  is sent every 20-40 sec, to keep you connected
FILE TRANSFER STATE
6
FILE_ID - string  
STATE - 4 bytes
  0 - download is complete
  3 - Setting up transfer
  5 - connection was closed
  8 - stopped
 
READY TO SEND SHAES
7
  it is sent in reply for message '8' and message '9'
SEND SHARES STEND BY
8
  it is sent after proxy test is done, i guess it is a command for client to start gathering shares to send to the server
SEND SHARES
9
  you send shares, and reply with '7',
FILE TRANSFER
10
FILE_ID - string  
CONNECT - 1 byte
  listen - 0
  connect -1
 
DIRRECTION - 1 byte
  send - 0
  read - 1
 
IP - string  
PORT - 4 bytes  
? - 4 bytes  
FILE NAME - string  
FILE SIZE - 4 byes  
STOP FILE TRANSFER
11
FILE_ID - string  
NEW SHARE RESPONSE
13
Local ID - 4 bytes position in the db file
fileSet - string server position
fileID - 4 bytes server position
songID - 4 bytes server position
size - 4 bytes  
WRONG LOGIN MESSAGE
14
ERROR TYPE - 4 byte
  login or password len = 0 - 1
  wrong client type - 2 (don't give yor names)
  somebody just logged in elsewhere - 3
( msg was reseive from email of Marc Warne, addjusted from the msg of Justin Fletcher)
EX ACCOUNT INFORMATION
31
SATELITE_VERSION - string  
LOGIN - string  
PASSWORD - string  
OLD SHARES
32
Local ID - 4 bytes  
fileSet - string  
fileID - 4 bytes  
songID - 4 bytes  
size - 4 bytes  
bitRate - 4 bytes  
LAST MOD DATE- 4 byte  
DATA TO UPDATE SHARES
33
? - 4 byte always was 0
DB FILE COUNT- 2 byte  
FILE NAME- string  
FOLDER - string  
FILE SIZE - 4 byte  
KB/S - 2 byte  
SEC LENGTH- 4 byte  
LAST MOD DATE- 4 byte  
FLAG ID3v1 exists - 1 byte
  0 - Missing
  1 - Exists
If you set 0 then you don't need to add all the following( untill flag ID3v2) fields
TITLE - string lower register
ARTIST - string lower register
ALBUM - string lower register
FLAG ID3v2 exists - 1 byte
  0 - Missing
  1 - Exists
If you set 0 then you don't need to add all the following fields
TITLE - string  
ARTIST - string  
ALBUM - string  
TRACK - 2 byte  
? - 2 bytes it is not any field of the tag. May be just some reserved field, it is always 0
NEW ACCOUNT INFORMATION
35
SATELITE_VERSION - string  
LOGIN - string  
PASSWORD - string  
E-MAIL - string  
AGE - string  
SEX - string  
CITY - string  
STATE - string  
ZIP - string  
COUNTRY - string  
HOW_HEARD - string  
?(0) - 4 bytes  
NEW ACCOUNT INFORMATION RESPONSE
50
RESPONSE - 4 bytes  
  1 - success
  2 - Email Already in use.
  4 - Username already in use.
  6 - Username and email already in use.
Thenks to efoster
EX ACCOUNT INFORMATION RESPONSE
51
RESPONSE - 4 bytes  
  1 - success
  2 - no such login or password
 
DB UPDATE WITH FILE ID
52
File ID - string  
File Name - string  
PLAY A FILE IN LOCAL DB
53
Unknown - 4 byte (allways 1) thenks to Justin Fletcher
Unknown - 4 byte (allways 1)
Local ID - 4 bytes file id in db ( set by msg32)
Unknown - 4 byte
LOGIN HASH PREFIX
55
prefix - String thenks to Justin Fletcher

PEER TO PEER (use the first type of header)

FILE REQUEST
FILE ID - string
FILE SIZE- 4 bytes
RESUME POSITION- 4 bytes

 

RESPONSE FOR REQUEST
FILE ID - string
FILE SIZE- 4 bytes
"OK" - string

7. Acknowledgements

A big THANKS goes to NAI for a very good Sniffer.
And to More Beer for some tips with AG emulator.