net.sf.jqql.packets.out
Class SendIMPacket
java.lang.Object
net.sf.jqql.packets.Packet
net.sf.jqql.packets.OutPacket
net.sf.jqql.packets.BasicOutPacket
net.sf.jqql.packets.out.SendIMPacket
public class SendIMPacket
- extends BasicOutPacket
message sent packet, format:
1. head
2. sender's QQ number, 4 byte
3. receiver's QQ number, 4 byte
4. sender's QQ version, 2 byte
5. sender's QQ number, 4 byte
6. receiver's QQ number, 4 byte(amazing, duplicated QQ number for sender and receiver)
7. md5 1 time processed result of sender's QQ number and session key.
8. message type, 2 byte
9. session ID, 2 byte. If the operation need to send several packets to finish. The id of the packets should be the same.
10. send time, 4 byte
11. sender's head, 2 byte
12. font infor, 4 byte, set to 0x00000001, unkown meaning
13. message fragment count, 1 byte. If it' s quite a long message, here need to set a fragment value. QQ is 700 byte for a fragment
by default. This 700 byte is pure message, exclude any other part.
14. fragment sequence, 1 byte, begin with 0
å‘逿¶ˆæ¯çš„åŒ…ï¼Œæ ¼å¼ä¸º
1. 头部
2. å‘é€è€…QQå·ï¼Œ4个å—节
3. 接收者的QQå·ï¼Œ4个å—节
4. å‘é€è€…QQ版本,2å—节
5. å‘é€è€…QQå·ï¼Œ4å—节
6. 接收者QQå·ï¼Œ4个å—èŠ‚ï¼ˆå¥‡æ€ªï¼Œä¸ºä»€ä¹ˆè¦æžä¸¤ä¸ªåœ¨é‡Œé¢ï¼‰
7. å‘é€è€…QQå·å’Œsession keyåˆåœ¨ä¸€èµ·ç”¨md5处ç†ä¸€æ¬¡çš„结果,16å—节
8. 消æ¯ç±»åž‹ï¼Œ2å—节
9. 会è¯ID,2å—节,如果是一个æ“作需è¦å‘é€å¤šä¸ªåŒ…æ‰èƒ½å®Œæˆï¼Œåˆ™è¿™ä¸ªid必须一致
10. å‘逿—¶é—´ï¼Œ4å—节
11. å‘é€è€…头åƒï¼Œ2å—节
12. å—体信æ¯ï¼Œ4å—节,设æˆ0x00000001å§ï¼Œä¸æ‡‚å…·ä½“æ„æ€
13. 消æ¯åˆ†ç‰‡æ•°ï¼Œ1å—èŠ‚ï¼Œå¦‚æžœæ¶ˆæ¯æ¯”较长,这里è¦ç½®ä¸€ä¸ªåˆ†ç‰‡å€¼ï¼ŒQQç¼ºçœæ˜¯700å—节一个分片,这个700å—节是纯消æ¯ï¼Œ
ä¸åŒ…å«å…¶ä»–部分
14. 分片åºå·ï¼Œ1å—节,从0开始
15. message id, 2 byte. different fragment of the same message has the same id
16. message manner, is sent by human or auto reply, 1 byte
17. message content, the last fragment should be appended to with a space.
Note: the ending space is a must, without it, cause some default face to be shown as mess code
18. message tail, include some message parameter, like font color and so on, order in:
1. font decoration attribute, bold, italic and etc, 2 byte, digits known are:
i. bit0-bit4 used to indicate font size, so the max size is 32
ii. bit5 to indicate bold or not
iii, bit6 to indicate italic or not
iv. bit7 to indicate underline or not
2. color Red, 1 byte
3. color Green, 1 byte
4. color Blue, 1 byte
5. 1 unknown byte, set 0 first
6. message encoding, 2 byte, 0x8602 is GB, 0x0000 is EN, other unknown, seem to customable, for server doesn't
interfere.
7. font name, like 0xcb, 0xce, 0xcc, 0xe5
19. 1 byte, stands for byte length of part 18, 19
20. tail
15. 消æ¯çš„id,2å—节,åŒä¸€æ¡æ¶ˆæ¯çš„ä¸åŒåˆ†ç‰‡id相åŒ
16. æ¶ˆæ¯æ–¹å¼ï¼Œæ˜¯å‘é€çš„,还是自动回å¤çš„,1å—节
17. 消æ¯å†…容,最åŽä¸€ä¸ªåˆ†ç‰‡çš„结尾需è¦è¿½åŠ ä¸€ä¸ªç©ºæ ¼ã€‚
Note: ç»“å°¾å¤„çš„ç©ºæ ¼æ˜¯å¿…é¡»çš„ï¼Œå¦‚æžœä¸è¿½åŠ ç©ºæ ¼ï¼Œä¼šå¯¼è‡´æœ‰äº›ç¼ºçœè¡¨æƒ…显示为乱ç
18. 消æ¯çš„尾部,包å«ä¸€äº›æ¶ˆæ¯çš„傿•°ï¼Œæ¯”如å—体颜色啦,ç‰ç‰ç‰ç‰ï¼Œé¡ºåºæ˜¯
1. å—体修饰属性,bold,italic之类的,2å—èŠ‚ï¼Œå·²çŸ¥çš„ä½æ˜¯
i. bit0-bit4用æ¥è¡¨ç¤ºå—体大å°ï¼Œæ‰€ä»¥æœ€å¤§æ˜¯32
ii. bit5表示是å¦bold
iii. bit6表示是å¦italic
iv. bit7表示是å¦underline
2. 颜色Red,1å—节
3. 颜色Green,1å—节
4. 颜色Blue,1å—节
5. 1个未知å—节,置0å…ˆ
6. 消æ¯ç¼–ç ,2å—节,0x8602为GB,0x0000为EN,其他未知,好åƒå¯ä»¥è‡ªå®šä¹‰ï¼Œå› 为æœåС噍好åƒä¸å¹²æ¶‰
7. å—体å,比如0xcb, 0xce, 0xcc, 0xe5表示宋体
19. 1å—节,表示18å’Œ19部分的å—节长度
20. 包尾部
requst send file packet, another usage of this packet, format is:
1- 14. part 1-14 are the same, only part 8 is some part different. For UDP request, part 8 is 0x0035. For TCP
it's 0x0001
15-17. I doubt it's the same as the one of send message packet. However, in this situation, this part is not used, filled with 0
11 byte 0 total
18. transfer type, 1 byte, indicate send file or send face
19. connection mode byte, UDP is 0, TCP is 3
20. 4 byte sender's external IP(may be proxy's IP)
21. 2 byte sender's port
22. 2 byte port, first listening port, TCP has no this part
23. 4 byte address, read IP
24. 2 byte port, second listerning port
25. space is appended to the end. 1 byte, 0x20
26. delimiter 0x1F
27. name of file to send
28. delimiter 0x1F
29. append "byte" in Chinese form to the back of byte count which is in string form. Fox example, if the file size
is 3 byte, this is "3 byte" in string form and in Chinese form.
30. tail
è¯·æ±‚ä¼ é€æ–‡ä»¶çš„包,这是这个包的å¦ä¸€ç§ç”¨æ³•ï¼Œå…¶æ ¼å¼ä¸º
1 - 14. 1到14部分å‡ä¸Žå‘逿¶ˆæ¯åŒ…相åŒï¼Œåªæœ‰ç¬¬8部分ä¸åŒï¼Œå¯¹äºŽUDP的请求,8部分是0x0035,对于TCP,是0x0001
15 - 17. 怀疑也和å‘逿¶ˆæ¯åŒ…相åŒï¼Œä½†æ˜¯åœ¨è¿™ç§æƒ…况ä¸ï¼Œè¿™éƒ¨åˆ†æ²¡æœ‰ä½¿ç”¨ï¼Œä¸ºå…¨0,一共11个0å—节
18. ä¼ è¾“ç±»åž‹ï¼Œ1å—èŠ‚ï¼Œè¡¨ç¤ºæ˜¯ä¼ æ–‡ä»¶è¿˜æ˜¯ä¼ è¡¨æƒ…
19. 连接方å¼å—节,UDP是0, TCP是3
20. 4个å—节的å‘é€è€…外部ip地å€ï¼ˆä¹Ÿå°±æ˜¯å¯èƒ½ä¸ºä»£ç†åœ°å€ï¼‰
21. 2个å—节的å‘é€è€…端å£
22. 2个å—节的端å£ï¼Œç¬¬ä¸€ä¸ªç›‘å¬ç«¯å£ï¼ŒTCP没有这个部分
23. 4个å—节的地å€ï¼ŒçœŸå®žIP
24. 2个å—节的端å£ï¼Œç¬¬äºŒä¸ªè€Œç›‘å¬ç«¯å£
25. ç©ºæ ¼ç¬¦å·åšä¸ºä¸Šè¿°ä¿¡æ¯çš„结æŸï¼Œä¸€ä¸ªå—节,0x20
26. 分隔符0x1F
27. è¦ä¼ é€çš„æ–‡ä»¶å
28. 分隔符0x1F
29. å—节数的å—符串形å¼åŽè·Ÿ" å—节",比如文件大å°3å—节的è¯ï¼Œå°±æ˜¯"3 å—节"这个å—符串的编ç å½¢å¼
30. 尾部
aggree to send file packet, format:
1- 24. except part 8, other parts are the same. as send message packet For UDP, part 8 is 0x0037, For TCP, it's 0x0003
For UDP, the last local ip and port are 0; ForTCP it has no part 22
25. tail
åŒæ„ä¼ é€æ–‡ä»¶çš„åŒ…ï¼Œæ ¼å¼ä¸º
1 - 24. 除了8部分,其他å‡ä¸Žå‘逿¶ˆæ¯åŒ…相åŒã€‚对于UDP的情况,8部分是0x0037,TCP是0x0003。
UDP时,最åŽçš„æœ¬åœ°ip和端å£éƒ½æ˜¯0ï¼›TCP时没有22部分
25. 尾部
deny to receive file packet, format:
1-19, except for part 8, others are the same as agree send file packet. For UDP, part 8 is 0x0039
For TCP, it's 0x0005
20. tail
æ‹’ç»æŽ¥æ”¶æ–‡ä»¶çš„åŒ…ï¼Œæ ¼å¼ä¸º
1 - 19. 除了8部分,å‡ä¸ŽåŒæ„ä¼ é€æ–‡ä»¶åŒ…相åŒã€‚对于UDP的情况,8部分是0x0039,对于TCP,是0x0005
20. 尾部
notice my IP info, format:
1-24. except for part 8, all are the same as request file sending packet. Part 8 is 0x003B
25. tail
通知我的IPä¿¡æ¯ï¼Œæ ¼å¼ä¸º
1 - 24. 除了8部分,å‡ä¸Žè¯·æ±‚ä¼ é€æ–‡ä»¶åŒ…相åŒã€‚8部分是0x003B
25. 尾部
cancel sending file, format:
1- 18. except for part 8, all are the same as request send file packet. part 8 is 0x0049
19. tail
å–æ¶ˆä¼ 逿–‡ä»¶ï¼Œæ ¼å¼ä¸º
1 - 18. 除了8部分,å‡ä¸Žè¯·æ±‚ä¼ é€æ–‡ä»¶åŒ…相åŒã€‚8部分是0x0049
19. 尾部
request other connect me proactive packet, format:
1-18. Except for part 8, all are the same as request send file packet. Part 8 is 0x003F
19. tail
è¦æ±‚åˆ«äººä¸»åŠ¨è¿žæŽ¥æˆ‘çš„åŒ…ï¼Œæ ¼å¼ä¸º
1 - 18. 除了8部分,å‡ä¸Žè¯·æ±‚ä¼ é€æ–‡ä»¶åŒ…相åŒã€‚8部分是0x003F
19. 尾部
- Author:
- luma
Fields inherited from class net.sf.jqql.packets.Packet |
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user |
Methods inherited from class net.sf.jqql.packets.BasicOutPacket |
decryptBody, encryptBody, getBodyBytes, getCryptographStart, getFamily, getHeadLength, getLength, getTailLength, parseHeader, parseTail, postFill, putHead, putTail, toString, validateHeader |
Methods inherited from class net.sf.jqql.packets.OutPacket |
dump, fill, getKey, getNextSeq, getSendCount, getTimeout, needAck, needResend, parseBody, setKey, setSendCount, setTimeout |
Methods inherited from class net.sf.jqql.packets.Packet |
equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, setDuplicated, setHeader, setSequence |
SendIMPacket
public SendIMPacket(QQUser user)
- constructor
æž„é€ å‡½æ•°
SendIMPacket
public SendIMPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
- Parameters:
buf
- length
-
- Throws:
PacketParseException
getPacketName
public String getPacketName()
- Overrides:
getPacketName
in class BasicOutPacket
- Returns:
- descriptive name of packet
包的æè¿°æ€§åç§°
putBody
protected void putBody(ByteBuffer buf)
- Description copied from class:
Packet
- initialize packet body
åˆå§‹åŒ–包体
- Specified by:
putBody
in class Packet
- Parameters:
buf
- ByteBuffer
getBlue
public int getBlue()
- Returns:
- Returns the blue.
setBlue
public void setBlue(int blue)
- Parameters:
blue
- The blue to set.
isBold
public boolean isBold()
- Returns:
- Returns the bold.
setBold
public void setBold(boolean bold)
- Parameters:
bold
- The bold to set.
getEncoding
public char getEncoding()
- Returns:
- Returns the encoding.
setEncoding
public void setEncoding(char encoding)
- Parameters:
encoding
- The encoding to set.
getFontName
public String getFontName()
- Returns:
- Returns the fontName.
setFontName
public void setFontName(String fontName)
- Parameters:
fontName
- The fontName to set.
getGreen
public int getGreen()
- Returns:
- Returns the green.
setGreen
public void setGreen(int green)
- Parameters:
green
- The green to set.
isItalic
public boolean isItalic()
- Returns:
- Returns the italic.
setItalic
public void setItalic(boolean italic)
- Parameters:
italic
- The italic to set.
getRed
public int getRed()
- Returns:
- Returns the red.
setRed
public void setRed(int red)
- Parameters:
red
- The red to set.
isUnderline
public boolean isUnderline()
- Returns:
- Returns the underline.
setUnderline
public void setUnderline(boolean underline)
- Parameters:
underline
- The underline to set.
getFontSize
public int getFontSize()
- Returns:
- Returns the fontSize.
setFontSize
public void setFontSize(int fontSize)
- Parameters:
fontSize
- The fontSize to set.
getReceiver
public int getReceiver()
- Returns:
- Returns the receiver.
setReceiver
public void setReceiver(int receiver)
- Parameters:
receiver
- The receiver to set.
getMessageType
public char getMessageType()
- Returns:
- Returns the messageType.
setMessageType
public void setMessageType(char messageType)
- Parameters:
messageType
- The messageType to set.
getReplyType
public byte getReplyType()
- Returns:
- Returns the replyType.
setReplyType
public void setReplyType(byte replyType)
- Parameters:
replyType
- The replyType to set.
setFileName
public void setFileName(String filePath)
- Parameters:
filePath
- The filePath to set.
setFileSize
public void setFileSize(int size)
- Parameters:
fileSize
- The fileSize to set.
setDirectPort
public void setDirectPort(int port)
- Parameters:
port
- The port to set.
getSessionId
public char getSessionId()
- Returns:
- Returns the requestSequence.
setSessionId
public void setSessionId(char requestSequence)
- Parameters:
requestSequence
- The requestSequence to set.
getLocalIp
public byte[] getLocalIp()
- Returns:
- Returns the localIp.
setLocalIp
public void setLocalIp(byte[] localIp)
- Parameters:
localIp
- The localIp to set.
getLocalPort
public char getLocalPort()
- Returns:
- Returns the localPort.
setLocalPort
public void setLocalPort(int localPort)
- Parameters:
localPort
- The localPort to set.
getTransferType
public byte getTransferType()
setTransferType
public void setTransferType(byte transferType)
isFakeIp
public boolean isFakeIp()
setFakeIp
public void setFakeIp(boolean fakeIp)
getFragmentSequence
public int getFragmentSequence()
- Returns:
- Returns the fragmentSequence.
setFragmentSequence
public void setFragmentSequence(int fragmentSequence)
- Parameters:
fragmentSequence
- The fragmentSequence to set.
getTotalFragments
public int getTotalFragments()
- Returns:
- Returns the totalFragments.
setTotalFragments
public void setTotalFragments(int totalFragments)
- Parameters:
totalFragments
- The totalFragments to set.
getMessageId
public char getMessageId()
- Returns:
- Returns the messageId.
setMessageId
public void setMessageId(char messageId)
- Parameters:
messageId
- The messageId to set.
getMessage
public byte[] getMessage()
- Returns:
- the message
setMessage
public void setMessage(byte[] message)
- Parameters:
message
- the message to set