-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathSkypeUDP.py
86 lines (74 loc) · 1.75 KB
/
SkypeUDP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/python
#
# Skype's UDP Protocol
#
import dpkt
"""
name_to_code = {
'Char' : 'c',
'Byte' : 'b',
'UnsignedByte' : 'B',
'Int' : 'i',
'UnsignedInt' : 'I',
'Short' : 'h',
'UnsignedShort' : 'H',
'Long' : 'l',
'UnsignedLong' : 'L',
'String' : 's',
'PascalString' : 'p',
'Pointer' : 'P',
'Float' : 'f',
'Double' : 'd',
'LongLong' : 'q',
'UnsignedLongLong' : 'Q',
}
"""
class SkypeUDP(dpkt.Packet):
__hdr__ = (
('objectid', '2s', '\x00' * 2),
('type', 'B', 0),
)
SKYPEUDP_TYPE_PAYLOAD = 0x2
SKYPEUDP_TYPE_RESEND = 0x3
SKYPEUDP_TYPE_CONFIRM = 0x5
SKYPEUDP_TYPE_ERROR = 0x7
SKYPEUDP_TYPE_AUDIO = 0xd
SKYPEUDP_TYPE_FRAGMENT = 0xf
SKYPEUDP_TYPES_RECOGNIZED = [ SKYPEUDP_TYPE_PAYLOAD,
SKYPEUDP_TYPE_RESEND,
SKYPEUDP_TYPE_CONFIRM,
SKYPEUDP_TYPE_ERROR,
SKYPEUDP_TYPE_AUDIO,
SKYPEUDP_TYPE_FRAGMENT,
]
# Object List starts with : 0x41 1 byte number of elements
class Payload(dpkt.Packet):
__hdr__ = (
('iv', '4s', '\x00' * 4),
('crc', '4s', '\x00' * 4),
)
class Resend(dpkt.Packet):
__hdr__ = (
('number', 'B', '\x01'),
('ivseed', '4s', '\x00' * 4),
('unknown', '4s', '\x00' * 4),
('crc', '4s', '\x00' * 4),
)
class Confirm(dpkt.Packet):
__hdr__ = (
('yourip', '4s', '\x00' * 4),
('unknown', '4s', '\x00' * 4),
)
class Error(dpkt.Packet):
__hdr__ = (
('yourip', '4s', '\x00' * 4),
('ivseed', '4s', '\x00' * 4),
)
class Fragment(dpkt.Packet):
__hdr__ = (
('inreplyto', '2s', '\x00' * 2),
('flag', 'B', 0x01),
('magic', 'B', 0x02),
('iv', '4s', '\x00' * 4),
('crc', '4s', '\x00' * 4),
)