-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsniffs.py
175 lines (150 loc) · 4.37 KB
/
sniffs.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 17:08:05 2018
@author: mattis
"""
# ******** M-SEARCH******************
"""
First M-Search, seems to scan for another service
M-SEARCH * HTTP/1.1
Host:239.255.255.250:1900
ST:urn:schemas-canon-com:service:ICPO-SmartPhoneEOSSystemService:1
Man:"ssdp:discover"
MX:3
"""
"""
2nd M-Search, now that's our service
M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 3
ST: urn:schemas-canon-com:service:MobileConnectedCameraService:1
"""
#************ NOTIFY***********************
"""
0th notification
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
NT: upnp:rootdevice
NTS: ssdp:byebye
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5::upnp:rootdevice
"""
"""
1st notification
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
NT: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5
NTS: ssdp:byebye
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5
"""
"""
2nd notification
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
NT: urn:schemas-upnp-org:device:Basic:1
NTS: ssdp:byebye
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5::urn:schemas-upnp-org:device:Basic:1
"""
"""
3rd notification
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
NT: urn:schemas-canon-com:service:CameraConnectedMobileService:1
NTS: ssdp:byebye
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5::urn:schemas-canon-com:service:CameraConnectedMobileService:1
"""
#got some data, looks good
"""
('192.168.0.1', 63476)
HTTP/1.1 200 OK\r\n
Cache-Control: max-age=1800\r\n
EXT: \r\n
Location: http://192.168.0.1:49152/CameraDevDesc.xml\r\n
Server: Camera OS/1.0 UPnP/1.0 Camera 1.0/Canon PowerShot G7 X/1.0\r\n
ST: urn:schemas-canon-com:service:MobileConnectedCameraService:1\r\n
USN: uuid:8C5A1ABA-4BE3-4A9F-9630-C11BF48437EE::urn:schemas-canon-com:service:MobileConnectedCameraService:1\r\n\r\n'
"""
#send next step of messages
# ------------------SECOND SET which makes us show up in the mobile devices list----------------------------------
"""
0th
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=1800
Location: http://192.168.0.2:49152/MobileDevDesc.xml
NT: upnp:rootdevice
NTS: ssdp:alive
Server: Camera OS/1.0 UPnP/1.0 Android 7.1.2/Redmi 5/1.0
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5::upnp:rootdevice
"""
"""
1st
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=1800
Location: http://192.168.0.2:49152/MobileDevDesc.xml
NT: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5
NTS: ssdp:alive
Server: Camera OS/1.0 UPnP/1.0 Android 7.1.2/Redmi 5/1.0
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5
"""
"""
2nd
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=1800
Location: http://192.168.0.2:49152/MobileDevDesc.xml
NT: urn:schemas-upnp-org:device:Basic:1
NTS: ssdp:alive
Server: Camera OS/1.0 UPnP/1.0 Android 7.1.2/Redmi 5/1.0
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5::urn:schemas-upnp-org:device:Basic:1
"""
"""
3rd
NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=1800
Location: http://192.168.0.2:49152/MobileDevDesc.xml
NT: urn:schemas-canon-com:service:CameraConnectedMobileService:1
NTS: ssdp:alive
Server: Camera OS/1.0 UPnP/1.0 Android 7.1.2/Redmi 5/1.0
USN: uuid:7B788B31-EC1E-445A-B5EF-243274B188E5::urn:schemas-canon-com:service:CameraConnectedMobileService:1
"""
# ---------------------------- POST-requests from camera----------------------------
#Detecting Run status request and answering with statusReplyRun.xml:
"""
<ParamSet xmlns="urn:schemas-canon-com:service:CameraConnectedMobileService:1">
<Status>Run</Status>
</ParamSet>
"""
#Acknowledge CapabilityInfo
"""
<ParamSet xmlns="urn:schemas-canon-com:service:CameraConnectedMobileService:1">
<Pull_Operating>TRUE</Pull_Operating>
<GPS_Operating>TRUE</GPS_Operating>
<RemoteCapture_Operating>TRUE</RemoteCapture_Operating>
<ConnectionMode>1</ConnectionMode>
<GroupType>Basic</GroupType>
<CustomMode>ModeA&ModeC</CustomMode>
</ParamSet>
"""
#Acknowledge CameraInfo
"""
<ParamSet xmlns="urn:schemas-canon-com:service:CameraConnectedMobileService:1">
<CardProtect>FALSE</CardProtect>
</ParamSet>
"""
#Acknowledge NCFData
"""
<ParamSet xmlns="urn:schemas-canon-com:service:CameraConnectedMobileService:1">
<AARData>jp.co.canon.ic.cameraconnect</AARData>
<URIData>canon-a01</URIData>
</ParamSet>
"""
#Detect Status Stop
"""
<ParamSet xmlns="urn:schemas-canon-com:service:CameraConnectedMobileService:1">
<Status>Stop</Status>
</ParamSet>
"""