@@ -29,7 +29,32 @@ issue uncovered via the manual test. Each ecosystem may implement an analysis
29
29
that analyzes capture data, displays info to the user, probes the local
30
30
environment and generates additional artifacts.
31
31
32
- ## Getting started
32
+ ## Single host installation (no Raspberry Pi)
33
+
34
+ All features of ` idt ` are available on macOS and Linux (tested with Debian based
35
+ systems).
36
+ If you would prefer to execute capture and discovery from a Raspberry Pi, read
37
+ the next section instead.
38
+
39
+ The machine running ` idt ` should be connected to the same Wi-Fi network used for
40
+ testing.
41
+ Follow the steps below to execute capture and discovery without a Raspberry Pi:
42
+
43
+ - From the parent directory of ` idt ` , run ` source idt/scripts/alias.sh ` .
44
+ - Optionally, run ` source idt/scripts/setup_shell.sh ` to install aliases
45
+ permanently.
46
+ - After ` idt ` aliases are available in your environment, calling any ` idt `
47
+ command will automatically create a new virtual environment and install
48
+ python dependencies.
49
+ - If you're missing non-Python dependencies, you'll be prompted to install
50
+ them until they're available.
51
+ - Bluetooth discovery on macOS will require granting the program where ` idt `
52
+ is run, e.g. terminal emulator or IDE permission to access bluetooth in
53
+ macOS settings.
54
+ - Failure to do so may result in any of the following:
55
+ - A single ` abort ` message and no further output in the terminal.
56
+ - Failure with a relevant stack trace in the terminal.
57
+ - A prompt to allow the application access to bluetooth.
33
58
34
59
## Raspberry Pi installation
35
60
@@ -137,62 +162,21 @@ idt_clean
137
162
```
138
163
139
164
NOTE the idt artifacts directory is contained in idt, so running this will
140
- delete any artifacts ([TODO] change) .
165
+ delete any artifacts.
141
166
142
167
Then from the admin computer:
143
168
144
169
```
145
170
idt_push
146
171
```
147
172
148
- ## Single host installation (no Raspberry Pi)
149
-
150
- Follow the steps below to execute capture and discovery without a Raspberry Pi.
151
-
152
- ### Linux installation
153
-
154
- #### Requirements
155
-
156
- - This package should work on most Debian (/based) systems.
157
- - `idt` is currently tested on `Python 3.11`.
158
- - `adb` and `tcpdump` are required.
159
- - The machine running `idt` should be connected to the same Wi-Fi network used
160
- for testing.
161
-
162
- #### Setup
163
-
164
- - From the parent directory of `idt`, run `source idt/scripts/alias.sh`.
165
- - Optionally, run `source idt/scripts/setup_shell.sh` to install aliases
166
- permanently.
167
-
168
- > You may use `idt` in a Python virtual environment OR using a container from
169
- > the idt image.
170
-
171
- #### Python virtual environment
172
-
173
- - After `idt` aliases are available in your environment, calling any `idt`
174
- command will automatically create a new virtual environment and install
175
- dependencies.
176
-
177
- #### Docker
178
-
179
- - Run `idt_build` and `idt_activate` to enter the `idt` container.
180
-
181
- [TODO] Podman
182
-
183
- ### macOS installation
184
-
185
- Most features other than BLE should work on macOS.
186
-
187
- Follow the Linux installation steps above, but do not use Docker.
188
-
189
- [TODO] macOS BLE support
190
-
191
173
## User guide
192
174
193
175
> **_IMPORTANT_**
194
176
> `idt_` commands are shell aliases helpful for administrative commands.
195
- > `idt` invokes the `idt` python package.
177
+ > `idt` invokes the `idt` python package.
178
+ > Output from `idt` will generally be colorized while output from sub processes
179
+ > is generally not.
196
180
197
181
RPi users, as needed:
198
182
@@ -208,45 +192,38 @@ RPi users, as needed:
208
192
209
193
### Capture
210
194
195
+ > **_IMPORTANT_**
196
+ > Ensure you've made it to the log line "Starting real time analysis, press
197
+ > enter to stop!" before launching the app under test.
198
+
211
199
```
212
200
idt capture -h
213
201
214
- usage: idt capture [ -h] [ --platform {Android}]
215
- [ --ecosystem {PlayServices,PlayServicesUser,ALL}]
216
- [ --pcap {t,f}]
217
- [ --interface {wlp0s20f3,docker0,lo}]
218
- [ --additional {t,f}]
202
+ usage: idt capture [ -h] [ --platform {Android}] [ --ecosystem {PlayServicesUser,PlayServices,ALL}] [ --pcap {t,f}] [ --interface {wlp0s20f3,lo,docker0,any}]
219
203
220
204
options:
221
205
-h, --help show this help message and exit
222
206
--platform {Android}, -p {Android}
223
- Run capture for a particular platform
224
- (default Android)
225
- --ecosystem {PlayServices,PlayServicesUser,ALL}, -e {PlayServices,PlayServicesUser,ALL}
226
- Run capture for a particular ecosystem or ALL
227
- ecosystems (default ALL)
207
+ Run capture for a particular platform (default Android)
208
+ --ecosystem {PlayServicesUser,PlayServices,ALL}, -e {PlayServicesUser,PlayServices,ALL}
209
+ Run capture for a particular ecosystem or ALL ecosystems (default ALL)
228
210
--pcap {t,f}, -c {t,f}
229
211
Run packet capture (default t)
230
- --interface {wlp0s20f3,docker0,lo}, -i {wlp0s20f3,docker0,lo}
231
- Run packet capture against a specified
232
- interface (default wlp0s20f3)
233
- --additional {t,f}, -a {t,f}
234
- Run ble and mdns scanners in the background
235
- while capturing (default t)
212
+ --interface {wlp0s20f3,lo,docker0,any}, -i {wlp0s20f3,lo,docker0,any}
213
+ Specify packet capture interface (default any)
236
214
```
237
215
216
+ For packet capture interface (`-i`/`--interface`:
217
+
218
+ - On macOS, the only available interface is `any`.
219
+ - On Linux, `idt` checks available interfaces from `/sys/class/net/` as well
220
+ as allowing `any`.
221
+
238
222
#### Artifacts
239
223
240
224
Each ecosystem and platform involved in the capture will have their own
241
225
subdirectory in the root artifact dir.
242
226
243
- To download your artifacts, run these commands from your admin computer:
244
-
245
- `idt_fetch_artifacts`
246
-
247
- On windows admin computers, you may use `FileZilla` to pull the archive listed
248
- at the end of output.
249
-
250
227
### Discovery
251
228
252
229
```
@@ -260,7 +237,7 @@ options:
260
237
Specify the type of discovery to execute
261
238
```
262
239
263
- #### ble
240
+ #### BLE
264
241
265
242
```
266
243
idt discover -t b
@@ -274,13 +251,90 @@ idt discover -t d
274
251
275
252
#### Artifacts
276
253
277
- There is a per device log for ble scanning in `ble` subdirectory of the root
278
- artifact dir.
254
+ There is a per device log in `ble` and `dnssd` subdirectory of the root artifact
255
+ dir.
256
+
257
+ ### Probe
258
+
259
+ ```
260
+ usage: idt probe [ -h]
261
+
262
+ options:
263
+ -h, --help show this help message and exit
264
+ ```
279
265
280
- [TODO] dnssd per device log
266
+ Collect contextually relevant networking info from the local environment and
267
+ provide artifacts.
268
+
269
+ ## Troubleshooting
270
+
271
+ - Wireless `adb` may fail to connect indefinitely depending on network
272
+ configuration. Use a wired connection if wireless fails repeatedly.
273
+ - Change log level from `INFO` to `DEBUG` in root `config.py` for additional
274
+ logging.
275
+ - Compiling `tcpdump` for android may require additional dependencies.
276
+ - If the build script fails for you, try
277
+ `idt_go && source idt/scripts/compilers.sh`.
278
+ - You may disable colors and splash by setting `enable_color` in `config.py`
279
+ to `False`.
280
+ - `idt_clean_child` will kill any stray `tcpdump` and `adb` commands.
281
+ - `idt_check_child` will look for leftover processes.
282
+ - Not expected to be needed outside of development scenarios.
283
+
284
+ ## Project overview
285
+
286
+ - The entry point is in `idt.py` which contains simple CLI parsing with
287
+ `argparse`.
288
+
289
+ ### `capture`
290
+
291
+ - `base` contains the base classes for ecosystems and platforms.
292
+ - `controller` contains the ecosystem and platform producer and controller
293
+ - `loader` is a generic class loader that dynamically imports classes matching
294
+ a given super class from a given directory.
295
+ - `/platform` and `/ecosystem` contain one package for each platform and
296
+ ecosystem, which should each contain one implementation of the respective
297
+ base class.
298
+
299
+ ### `discovery`
300
+
301
+ - `matter_ble` provides a simple ble scanner that shows matter devices being
302
+ discovered and lost, as well as their VID/PID, RSSI, etc.
303
+ - `matter_dnssd` provides a simple DNS-SD browser that searches for matter
304
+ devices and thread border routers.
305
+
306
+ ### `probe`
307
+
308
+ - `probe` contains the base class for (`idt`'s) host platform specific
309
+ implementation.
310
+ - Reuses the dnssd discovery implementation to build probe targets.
311
+ - Calls platform + addr type specific probe methods for each target.
312
+ - `linux` and `mac` contain `probe` implementations for each host platform.
313
+
314
+ ### `utils`
315
+
316
+ - `log` contains logging utilities used by everything in the project.
317
+ - `artifact` contains helper functions for managing artifacts.
318
+ - `shell` contains a simple helper class for background and foreground Bash
319
+ commands.
320
+ - `host_platform` contains helper functions for the interacting with the host
321
+ running `idt`.
322
+
323
+ ### Conventions
324
+
325
+ - `config.py` should be used to hold development configs within the directory
326
+ where they are needed.
327
+ - It may also hold configs for flaky/cumbersome features that might need
328
+ to be disabled in an emergency.
329
+ - `config.py` **should not** be used for everyday operation.
330
+ - When needed, execute builds in a folder called `BUILD` within the source
331
+ tree.
332
+ - `idt_clean_all` deletes all `BUILD` dirs and `BUILD` is in `.gitignore`.
281
333
282
334
## Extending functionality
283
335
336
+ ### Capture
337
+
284
338
Ecosystem and Platform implementations are dynamically loaded.
285
339
286
340
For each package in `capture/ecosystem`, the ecosystem loader expects a module
@@ -299,14 +353,13 @@ $ idt capture -h
299
353
usage: idt capture [ -h] [ --platform {Android}] [ --ecosystem {DemoExtEcosystem...
300
354
```
301
355
356
+ > **IMPORTANT:** Note the following runtime expectations of ecosystems:
357
+ > `analyze_capture()` must not block the async event loop excessively and must
358
+ > not interact with standard in
359
+
302
360
The platform loader functions the same as `capture/ecosystem`.
303
361
304
362
For each package in `capture/platform`, the platform loader expects a module
305
363
name matching the package name.
306
364
This module must contain a single class which is a subclass of
307
365
`capture.base.PlatformLogStreamer`.
308
-
309
- Note the following runtime expectations of platforms:
310
-
311
- - Start should be able to be called repeatedly without restarting streaming.
312
- - Stop should not cause an error even if the stream is not running.
0 commit comments