├── .gitignore ├── BinaryMotionSensorSamples.md ├── CommandClasses.md ├── MyNexia ├── Board1.jpg ├── Board2.jpg ├── Board3.jpg ├── Board4.jpg ├── Board5.jpg ├── Board6.jpg ├── Board7.jpg ├── Board_Back1.jpg ├── Board_Back2.jpg ├── README.md └── ZWave_SOC.jpg ├── OtherSample.md ├── README.md ├── SecurityDevice.md ├── bin ├── ACK.bin ├── CLEAR_PROMISCUOUS_MODE.bin ├── SET_PROMISCUOUS_MODE.bin ├── clearPromiscuous.sh ├── sendAck.sh └── setPromiscuous.sh ├── binarySwitchSamples.md ├── docs ├── 24352403 BE469 Z-Wave Parameters WO-a_ENGLISH.pdf ├── DSH10717-3_ZW0301.pdf ├── INS11095-2 - Z-Wave ZW0201-ZW0301 Programmers Guide v4_50 (Beta1).pdf ├── SDS10242-17 Z-Wave Device Class Specification.pdf ├── SDS11060-7 Z-Wave Command Class Specification.pdf ├── Security Evaluation of Z-Wave_WP.pdf ├── T-REC-G.9959-201202-I!!PDF-E.pdf ├── Z-Wave_Node_Type_Overview_and_Network_Installation_Guide.pdf └── ZW0301.pdf ├── exampleSnifferOutput.md ├── images └── zwaveFrameFormat.png ├── openZSniffer ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── TODO ├── aclocal.m4 ├── bsd-openpty.c ├── bsd-openpty.h ├── common.c ├── common.h ├── config.h.in ├── configure ├── configure.in ├── depcomp ├── install-sh ├── interceptty-nicedump ├── interceptty.1 ├── interceptty.c ├── interceptty.pod ├── missing ├── mkinstalldirs ├── test ├── testport └── zwavecore.h └── zwaystartupSample.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .deps/ 3 | Makefile 4 | bsd-openpty.o 5 | common.o 6 | config.h 7 | config.log 8 | config.status 9 | interceptty 10 | interceptty.o 11 | stamp-h1 12 | 13 | -------------------------------------------------------------------------------- /BinaryMotionSensorSamples.md: -------------------------------------------------------------------------------- 1 | Name: Motion Extra 2 | 3 | Node 40 - Sensor (Binary) - Sensor 4 | Node Type: 042001 5 | Command Classes: ["30", "70", "84", "72", "86", "85", "80", "ef", "20"] 6 | 7 | Motion Detected 8 | ===================== 9 | 10 | |Direction|Hex|Dec|NAME| 11 | |---|---|---|---| 12 | |>|0x01| |__Header=SOC__| 13 | |>|0x09| |Length=9| 14 | |>|0x00| |Type=REQUEST| 15 | |>|0x04| |Function=ApplicationCommandHandler| 16 | |>|0x00| |Status| 17 | |>|0x28| |NodeId 40| 18 | |>|0x03| |?? SensorBinaryCmd_Report ??| 19 | |>|0x20| |32 Binary Sensor| 20 | |>|0x01| |PayloadType=1 byte| 21 | |>|0xff| |Command=Basic ON| 22 | |>|0x07| |Checksum| 23 | |<|0x06| |__ACK__| 24 | |>|0x01| |__Header=SOC__| 25 | |>|0x09| |Length=9| 26 | |>|0x00| |Type=REQUEST| 27 | |>|0x04| |Function=ApplicationCommandHandler| 28 | |>|0x00| |Status| 29 | |>|0x28| |NodeId 40| 30 | |>|0x03| |?? SensorBinaryCmd_Report ??| 31 | |>|0x20| |32 Binary Sensor| 32 | |>|0x01| |PayloadType=1 byte| 33 | |>|0x00| |Command=OFF| 34 | |>|0xf8| |Checksum| 35 | |<|0x06| |__ACK__| 36 | 37 | 38 | 39 | 40 | Motion Detected 41 | ============== 42 | 43 | |Direction|Hex|Dec|NAME| 44 | |---|---|---|---| 45 | |>|0x01| |__Header=SOC__| 46 | |>|0x09| |Length=9| 47 | |>|0x00| |Type=REQUEST| 48 | |>|0x04| |Function=ApplicationCommandHandler| 49 | |>|0x00| |Status| 50 | |>|0x28| |NodeId 40| 51 | |>|0x03| |?? SensorBinaryCmd_Report ??| 52 | |>|0x20| |32 Binary Sensor| 53 | |>|0x01| |PayloadType=1 byte| 54 | |>|0xff| |Command=Basic ON| 55 | |>|0x07| |Checksum| 56 | |>|0x01| |__Header=SOC__ | 57 | |>|0x09| |Length=9| 58 | |>|0x00| |Type=REQUEST| 59 | |>|0x04| |Function=ApplicationCommandHandler| 60 | |>|0x00| |Status| 61 | |>|0x28| |NodeId 40| 62 | |>|0x03| |?? SensorBinaryCmd_Report ??| 63 | |>|0x20| |32 Binary Sensor| 64 | |>|0x01| |PayloadType=1 byte| 65 | |>|0xff| |Command=Basic ON| 66 | |>|0x07| |Checksum| 67 | |>|0x01| |__Header=SOC__ | 68 | |>|0x09| |Length=9| 69 | |>|0x00| |Type=REQUEST| 70 | |>|0x04| |Function=ApplicationCommandHandler| 71 | |>|0x00| |Status| 72 | |>|0x28| |NodeId 40| 73 | |>|0x03| |?? SensorBinaryCmd_Report ??| 74 | |>|0x20| |32 Binary Sensor| 75 | |>|0x01| |PayloadType=1 byte| 76 | |>|0xff| |Command=Basic ON| 77 | |>|0x07| |Checksum| 78 | |>|0x01| |__Header=SOC__ | 79 | |>|0x09| |Length=9| 80 | |>|0x00| |Type=REQUEST| 81 | |>|0x04| |Function=ApplicationCommandHandler| 82 | |>|0x00| |Status| 83 | |>|0x28| |NodeId 40| 84 | |>|0x03| |?? SensorBinaryCmd_Report ??| 85 | |>|0x20| |32 Binary Sensor| 86 | |>|0x01| |PayloadType=1 byte| 87 | |>|0xff| |Command=Basic ON| 88 | |>|0x07| |Checksum| 89 | |<|0x06| |__ACK__| 90 | |<|0x06| |__ACK__| 91 | |<|0x06| |__ACK__| 92 | |<|0x06| |__ACK__| 93 | |>|0x01| |__Header=SOC__| 94 | |>|0x09| |Length=9| 95 | |>|0x00| |Type=REQUEST | 96 | |>|0x04| |Function=ApplicationCommandHandler | 97 | |>|0x00| | | 98 | |>|0x28| |NodeId 40 | 99 | |>|0x03| |?? SensorBinaryCmd_Report ??| 100 | |>|0x20| |32 Binary Sensor| 101 | |>|0x01| |PayloadType=1 byte| 102 | |>|0x00| |Command=Basic OFF | 103 | |>|0xf8| |Checksum | 104 | |>|0x01| |__Header=SOC__ | 105 | |>|0x09| |Length=9| 106 | |>|0x00| |Type=REQUEST| 107 | |>|0x04| |Function=ApplicationCommandHandler| 108 | |>|0x00| |Status| 109 | |>|0x28| |NodeId 40| 110 | |>|0x03| |?? SensorBinaryCmd_Report ??| 111 | |>|0x20| |32 Binary Sensor| 112 | |>|0x01| |PayloadType=1 byte| 113 | |>|0x00| |Command=Basic OFF | 114 | |>|0xf8| |Checksum | 115 | |>|0x01| |__Header=SOC__ | 116 | |>|0x09| |Length=9| 117 | |>|0x00| |Type=REQUEST| 118 | |>|0x04| |Function=ApplicationCommandHandler| 119 | |>|0x00| |Status| 120 | |>|0x28| |NodeId 40| 121 | |>|0x03| |?? SensorBinaryCmd_Report ??| 122 | |>|0x20| |32 Binary Sensor| 123 | |>|0x01| |PayloadType=1 byte| 124 | |>|0x00| |Command=Basic OFF | 125 | |>|0xf8| |Checksum | 126 | |>|0x01| |__Header=SOC__ | 127 | |>|0x09| |Length=9| 128 | |>|0x00| |Type=REQUEST| 129 | |>|0x04| |Function=ApplicationCommandHandler| 130 | |>|0x00| |Status| 131 | |>|0x28| |NodeId 40| 132 | |>|0x03| |?? SensorBinaryCmd_Report ??| 133 | |>|0x20| |32 Binary Sensor| 134 | |>|0x01| |PayloadType=1 byte| 135 | |>|0x00| |Command=Basic OFF | 136 | |>|0xf8| |Checksum | 137 | |<|0x06| |__ACK__| 138 | |<|0x06| |__ACK__| 139 | |<|0x06| |__ACK__| 140 | |<|0x06| |__ACK__| 141 | |>|0x01| |__Header=SOC__| 142 | |>|0x09| |Length=9| 143 | |>|0x00| |Type=REQUEST| 144 | |>|0x04| |Function=ApplicationCommandHandler| 145 | |>|0x00| |Status| 146 | |>|0x28| |NodeId 40| 147 | |>|0x03| |?? SensorBinaryCmd_Report ??| 148 | |>|0x20| |32 Binary Sensor| 149 | |>|0x01| |PayloadType=1 byte| 150 | |>|0xff| |Command=Basic ON| 151 | |>|0x07| |Checksum| 152 | |<|0x06| |__ACK__| 153 | |>|0x01| |__Header=SOC__| 154 | |>|0x09| |Length=9| 155 | |>|0x00| |Type=REQUEST| 156 | |>|0x04| |Function=ApplicationCommandHandler| 157 | |>|0x00| |Status| 158 | |>|0x28|40|NodeId 40| 159 | |>|0x03| |?? SensorBinaryCmd_Report ??| 160 | |>|0x20|32|Binary Sensor| 161 | |>|0x01| |PayloadType=1 byte| 162 | |>|0x00|0|Command=Basic OFF| 163 | |>|0xf8| |Checksum | 164 | |<|0x06| |__ACK__| 165 | 166 | 167 | Tamper Switch 168 | =============== 169 | 170 | |Direction|Hex|Dec|NAME| 171 | |---|---|---|---| 172 | |>|0x01| |__Header=SOC__| 173 | |>|0x0a| |Length=10| 174 | |>|0x00| |Type=REQUEST | 175 | |>|0x04| |Function=ApplicationCommandHandler | 176 | |>|0x00| |Status| 177 | |>|0x28|40|NodeId 40 | 178 | |>|0x04| |__TBD__ ??(ALARM SENSOR)?? | 179 | |>|0x71| 113 | ??? COMMAND_CLASS_ALARM??? | 180 | |>|0x05| 5 | ALARM_REPORT | 181 | |>|0x01| | | 182 | |>|0x11| | | 183 | |>|0xb9| |Checksum | 184 | |<|0x06| |__ACK__| 185 | 186 | 187 | switch release 188 | ============== 189 | 190 | 191 | |Direction|Hex|Dec|NAME| 192 | |---|---|---|---| 193 | |>|0x01| |__Header=SOC__| 194 | |>|0x0a| |Length=10| 195 | |>|0x00| |Type=REQUEST | 196 | |>|0x04| |Function=ApplicationCommandHandler | 197 | |>|0x00| | | 198 | |>|0x28| |NodeId 40 | 199 | |>|0x04| |__TBD__ ??(ALARM SENSOR)?? | 200 | |>|0x71| 113 | ??? COMMAND_CLASS_ALARM??? | 201 | |>|0x05| | ALARM_REPORT | 202 | |>|0x01| | | 203 | |>|0x11| | | 204 | |>|0xb9| |Checksum | 205 | |<|0x06| |__ACK__| 206 | 207 | switch release with long wait 208 | ============================= 209 | 210 | |Direction|Hex|Dec|NAME| 211 | |---|---|---|---| 212 | |>|0x01| |__Header=SOC__| 213 | |>|0x0a| |Length=10 | 214 | |>|0x00| |Type=REQUEST | 215 | |>|0x04| |Function=ApplicationCommandHandler | 216 | |>|0x00| | | 217 | |>|0x28| |NodeId 40 | 218 | |>|0x04| |__TBD__ ??(ALARM SENSOR)?? | 219 | |>|0x71| 113 | ??? COMMAND_CLASS_ALARM??? | 220 | |>|0x05| | ALARM_REPORT | 221 | |>|0x01| | | 222 | |>|0x11| | | 223 | |>|0xb9| |Checksum | 224 | |<|0x06| |__ACK__| 225 | |>|0x01| |__Header=SOC__| 226 | |>|0x08| |Length=8| 227 | |>|0x00| |Type=REQUEST | 228 | |>|0x04| |Function=ApplicationCommandHandler | 229 | |>|0x00| | | 230 | |>|0x28| |NodeId 40 | 231 | |>|0x02| |__TBD__ | 232 | |>|0x84|132 | COMMAND_CLASS_WAKE_UP| 233 | |>|0x07| |WAKE_UP_NOTIFICATION | 234 | |>|0x5a| |Checksum | 235 | |<|0x06| |__ACK__| 236 | |>|0x01| |__Header=SOC__| 237 | |<|0x09| |Length=9 | 238 | |<|0x00| |Type=REQUEST | 239 | |<|0x13|19|Function=SendData| 240 | |<|0x28|40| | 241 | |<|0x02| | | 242 | |<|0x84|132 | | 243 | |<|0x08| | | 244 | |<|0x05| | | 245 | |<|0x01| | | 246 | |<|0x47| | | 247 | |>|0x06| |__ACK__ | 248 | |>|0x01| |__Header=SOC__ | 249 | |>|0x04| |Length=4 | 250 | |>|0x01| |Type=RESPONSE | 251 | |>|0x13| | | 252 | |>|0x01| | | 253 | |>|0xe8| |Checksum | 254 | |<|0x06| |__ACK__| 255 | |>|0x01| |__Header=SOC__| 256 | |>|0x05| |Length=5 | 257 | |>|0x00| |Type=REQUEST | 258 | |>|0x13|19|Function=SendData| 259 | |>|0x01| | | 260 | |>|0x00| | | 261 | |>|0xe8| |Checksum | 262 | |<|0x06| |__ACK__| 263 | 264 | 265 | 266 | 267 | 268 | Battery Inserted 269 | ================= 270 | 271 | |Direction|Hex|Dec|NAME| 272 | |---|---|---|---| 273 | |>|0x01| |__Header=SOC__| 274 | |>|0x09| |Length=9| 275 | |>|0x00| |REQUEST| 276 | |>|0x04| |ApplicationCommandHandler| 277 | |>|0x00| |Status| 278 | |>|0x28| |Node ID 40| 279 | |>|0x03| |?? SensorBinaryCmd_Report ??| 280 | |>|0x20| |32 Binary Sensor| 281 | |>|0x01| |PayloadType=1 byte| 282 | |>|0xff| |Command=Basic ON | 283 | |>|0x07| |Checksum | 284 | |<|0x06| |__ACK__| 285 | 286 | 287 | new battery 288 | ============== 289 | 290 | |Direction|Hex|Dec|NAME| 291 | |---|---|---|---| 292 | |>|0x01| |__Header=SOC__| 293 | |>|0x09| |Length=9| 294 | |>|0x00| |Type=REQUEST | 295 | |>|0x04| |Function=ApplicationCommandHandler | 296 | |>|0x00| | | 297 | |>|0x28| |NodeId 40 | 298 | |>|0x03| |?? SensorBinaryCmd_Report ??| 299 | |>|0x20| |32 Binary Sensor| 300 | |>|0x01| |PayloadType=1 byte| 301 | |>|0xff| |Command=Basic ON | 302 | |>|0x07| |Checksum | 303 | |<|0x06| |__ACK__| 304 | 305 | 306 | 307 | Battery Insert 308 | =============== 309 | 310 | |Direction|Hex|Dec|NAME| 311 | |---|---|---|---| 312 | |>|0x01| |__Header=SOC__| 313 | |>|0x09| |Length=9| 314 | |>|0x00| |Type=REQUEST | 315 | |>|0x04| |Function=ApplicationCommandHandler | 316 | |>|0x00| | | 317 | |>|0x28| |NodeId 40 | 318 | |>|0x03| |?? SensorBinaryCmd_Report ??| 319 | |>|0x20| |32 Binary Sensor| 320 | |>|0x01| |PayloadType=1 byte| 321 | |>|0xff| |Command=Basic ON | 322 | |>|0x07| |Checksum | 323 | |<|0x06| |__ACK__| 324 | |>|0x01| |__Header=SOC__| 325 | |>|0x09| |Length=9| 326 | |>|0x00| |Type=REQUEST | 327 | |>|0x04| |Function=ApplicationCommandHandler | 328 | |>|0x00| | | 329 | |>|0x28| |NodeId 40 | 330 | |>|0x03| |?? SensorBinaryCmd_Report ??| 331 | |>|0x20| |32 Binary Sensor| 332 | |>|0x01| |PayloadType=1 byte| 333 | |>|0x00| |Command=Basic OFF | 334 | |>|0xf8| |Checksum | 335 | |<|0x06| |__ACK__| 336 | 337 | 338 | switch pressed 339 | =============== 340 | 341 | |Direction|Hex|Dec|NAME| 342 | |---|---|---|---| 343 | |>|0x01| |__Header=SOC__| 344 | |>|0x09| |Length=9| 345 | |>|0x00| |Type=REQUEST | 346 | |>|0x04| |Function=ApplicationCommandHandler | 347 | |>|0x00| | | 348 | |>|0x28| |NodeId 40 | 349 | |>|0x03| |?? SensorBinaryCmd_Report ??| 350 | |>|0x20| |32 Binary Sensor| 351 | |>|0x01| |PayloadType=1 byte| 352 | |>|0x00| |Command=Basic OFF | 353 | |>|0xf8| |Checksum | 354 | |>|0x01| |__Header=SOC__ | 355 | |>|0x09| |Length=9 | 356 | |>|0x00| |Type=REQUEST | 357 | |>|0x04| |Function=ApplicationCommandHandler | 358 | |>|0x00| | | 359 | |>|0x28| |NodeId 40 | 360 | |>|0x03| |?? SensorBinaryCmd_Report ??| 361 | |>|0x20| |32 Binary Sensor| 362 | |>|0x01| |PayloadType=1 byte| 363 | |>|0x00| |Command=Basic OFF | 364 | |>|0xf8| |Checksum | 365 | |>|0x01| |__Header=SOC__ | 366 | |>|0x09| |Length=9 | 367 | |>|0x00| |Type=REQUEST | 368 | |>|0x04| |Function=ApplicationCommandHandler | 369 | |>|0x00| | | 370 | |>|0x28| |NodeId 40 | 371 | |>|0x03| |?? SensorBinaryCmd_Report ??| 372 | |>|0x20| |32 Binary Sensor| 373 | |>|0x01| |PayloadType=1 byte| 374 | |>|0x00| |Command=Basic OFF | 375 | |>|0xf8| |Checksum | 376 | |>|0x01| |__Header=SOC__ | 377 | |>|0x09| |Length=9 | 378 | |>|0x00| |Type=REQUEST | 379 | |>|0x04| |Function=ApplicationCommandHandler | 380 | |>|0x00| | | 381 | |>|0x28| |NodeId 40 | 382 | |>|0x03| |?? SensorBinaryCmd_Report ??| 383 | |>|0x20| |32 Binary Sensor| 384 | |>|0x01| |PayloadType=1 byte| 385 | |>|0x00| |Command=Basic OFF | 386 | |>|0xf8| |Checksum | 387 | |<|0x06| |__ACK__| 388 | |<|0x06| |__ACK__| 389 | |<|0x06| |__ACK__| 390 | |<|0x06| |__ACK__| 391 | 392 | 393 | motion with switch down 394 | ================== 395 | 396 | |Direction|Hex|Dec|NAME| 397 | |---|---|---|---| 398 | |>|0x01| |__Header=SOC__| 399 | |>|0x09| |Length=9| 400 | |>|0x00| |Type=REQUEST | 401 | |>|0x04| |Function=ApplicationCommandHandler | 402 | |>|0x00| | | 403 | |>|0x28| |NodeId 40 | 404 | |>|0x03| |?? SensorBinaryCmd_Report ??| 405 | |>|0x20| |32 Binary Sensor| 406 | |>|0x01| |PayloadType=1 byte| 407 | |>|0xff| |Command=Basic ON | 408 | |>|0x07| |Checksum | 409 | |<|0x06| |__ACK__| 410 | |>|0x01| |__Header=SOC__| 411 | |>|0x09| |Length=9| 412 | |>|0x00| |Type=REQUEST | 413 | |>|0x04| |Function=ApplicationCommandHandler | 414 | |>|0x00| | | 415 | |>|0x28| |NodeId 40 | 416 | |>|0x03| |?? SensorBinaryCmd_Report ??| 417 | |>|0x20| |32 Binary Sensor| 418 | |>|0x01| |PayloadType=1 byte| 419 | |>|0x00| |Command=Basic OFF | 420 | |>|0xf8| |Checksum | 421 | |<|0x06| |__ACK__| 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | -------------------------------------------------------------------------------- /MyNexia/Board1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board1.jpg -------------------------------------------------------------------------------- /MyNexia/Board2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board2.jpg -------------------------------------------------------------------------------- /MyNexia/Board3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board3.jpg -------------------------------------------------------------------------------- /MyNexia/Board4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board4.jpg -------------------------------------------------------------------------------- /MyNexia/Board5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board5.jpg -------------------------------------------------------------------------------- /MyNexia/Board6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board6.jpg -------------------------------------------------------------------------------- /MyNexia/Board7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board7.jpg -------------------------------------------------------------------------------- /MyNexia/Board_Back1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board_Back1.jpg -------------------------------------------------------------------------------- /MyNexia/Board_Back2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/Board_Back2.jpg -------------------------------------------------------------------------------- /MyNexia/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## MyNexia ZWave Gateway 3 | 4 | 5 | |#|Part|Name |Description | 6 | |---|---|---|---| 7 | |U6|ZW0301|ZWave SOC|Zwave Controller http://www.digikey.com/product-detail/en/RBK-Z3120V450U/703-1043-ND/1632524| 8 | |U5|AT25128|Serial EEProm|128K (16,384 x 8) Storage http://www.atmel.com/Images/doc0872.pdf| 9 | |U2|ATMEL AT91SAM7X256 |ARM Proc|32-bit microcontrollers http://www.atmel.com/devices/sam7x256.aspx| 10 | |U1|DM9161AEP|Ethernet Controller |100BASE-TX Ethernet http://www.davicom.com.tw/userfile/24247/DM9161AEPProductBrief_v1.0.pdf| 11 | 12 | -------------------------------------------------------------------------------- /MyNexia/ZWave_SOC.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/MyNexia/ZWave_SOC.jpg -------------------------------------------------------------------------------- /OtherSample.md: -------------------------------------------------------------------------------- 1 | The following data is sent/receive on the RaZberry board. 2 | 3 | This is some scratch data to try and manually decode what the binary packets actually mean. 4 | 5 | 6 | Promiscuous Data? 7 | ================ 8 | 9 | Set Promiscuous 10 | 11 | |Direction|Hex|Dec|Description| 12 | |---|---|---|---| 13 | |<| 0x01|1| | 14 | |<| 0x04|4| | 15 | |<| 0x00|0| | 16 | |<| 0xd0|208| | 17 | |<| 0xff|255| | 18 | |<| 0xd4|212| | 19 | |>| 0x06|6| | 20 | 21 | 22 | |Direction|Hex|Dec|Description| 23 | |---|---|---|---| 24 | |>| 0x01|1|__Header=SOC__| 25 | |>| 0x08|8|Length=8 | 26 | |>| 0x00|0|Type=REQUEST| 27 | |>| 0x04|4|Func=ApplicationCommandHandler | 28 | |>| 0x00|0| | 29 | |>| 0x28|40| | 30 | |>| 0x02|2| | 31 | |>| 0x84|132| | 32 | |>| 0x07|7| | 33 | |>| 0x5a|90|Checksum | 34 | 35 | |Direction|Hex|Dec|Description| 36 | |---|---|---|---| 37 | |>| 0x01|1|__Header=SOC__| 38 | |>| 0x08|8|Length=8 | 39 | |>| 0x00|0|Type=REQUEST| 40 | |>| 0x04|4|Func=ApplicationCommandHandler | 41 | |>| 0x00|0| | 42 | |>| 0x28|40| | 43 | |>| 0x02|2| | 44 | |>| 0x84|132| | 45 | |>| 0x07|7| | 46 | |>| 0x5a|90| | 47 | 48 | |Direction|Hex|Dec|Description| 49 | |---|---|---|---| 50 | |>| 0x01|1|__Header=SOC__| 51 | |>| 0x08|8|Length=8 | 52 | |>| 0x00|0|Type=REQUEST| 53 | |>| 0x04|4|Func=ApplicationCommandHandler | 54 | |>| 0x00|0| | 55 | |>| 0x28|40| | 56 | |>| 0x02|2| | 57 | |>| 0x84|132| | 58 | |>| 0x07|7| | 59 | |>| 0x5a|90| | 60 | 61 | |Direction|Hex|Dec|Description| 62 | |---|---|---|---| 63 | |>| 0x01|1|__Header=SOC__| 64 | |>| 0x08|8|Length=8 | 65 | |>| 0x00|0|Type=REQUEST| 66 | |>| 0x04|4|Func=ApplicationCommandHandler | 67 | |>| 0x00|0| | 68 | |>| 0x28|40| | 69 | |>| 0x02|2| | 70 | |>| 0x84|132| | 71 | |>| 0x07|7| | 72 | |>| 0x5a|90| | 73 | 74 | 75 | 76 | 77 | Set Temp 78 | ========= 79 | 80 | Node 4 - Thermostat - TraneThermostat 81 | Node Type: 040806 82 | Command Classes: ["40", "42", "43", "44", "45", "70", "31", "86", "81", "72", "76", "85"] 83 | 84 | 85 | |Direction|Hex|Dec|Description| 86 | |---|---|---|---| 87 | |>| 0x01|1|__Header=SOC__ | 88 | |>| 0x09|9| | 89 | |>| 0x00|0| | 90 | |>| 0x04|4| | 91 | |>| 0x00|0| | 92 | |>| 0x04|4|Node=4 | 93 | |>| 0x03|3| | 94 | |>| 0x42|66| | 95 | |>| 0x03|3| | 96 | |>| 0x01|1| | 97 | |>| 0xb5|181| | 98 | 99 | |Direction|Hex|Dec|Description| 100 | |---|---|---|---| 101 | |>| 0x01|1|__Header=SOC__ | 102 | |>| 0x09|9| | 103 | |>| 0x00|0| | 104 | |>| 0x04|4| | 105 | |>| 0x00|0| | 106 | |>| 0x04|4|Node=4 | 107 | |>| 0x03|3| | 108 | |>| 0x42|66| | 109 | |>| 0x03|3| | 110 | |>| 0x01|1| | 111 | |>| 0xb5|181| | 112 | 113 | |Direction|Hex|Dec|Description| 114 | |---|---|---|---| 115 | |>| 0x01|1|__Header=SOC__ | 116 | |>| 0x09|9| | 117 | |>| 0x00|0| | 118 | |>| 0x04|4|Node=4 | 119 | |>| 0x00|0| | 120 | |>| 0x04|4| | 121 | |>| 0x03|3| | 122 | |>| 0x42|66| | 123 | |>| 0x03|3| | 124 | |>| 0x01|1| | 125 | |>| 0xb5|181| | 126 | 127 | |Direction|Hex|Dec|Description| 128 | |---|---|---|---| 129 | |>| 0x01|1|__Header=SOC__ | 130 | |>| 0x09|9| | 131 | |>| 0x00|0| | 132 | |>| 0x04|4| | 133 | |>| 0x00|0| | 134 | |>| 0x04|4|Node=4 | 135 | |>| 0x03|3| | 136 | |>| 0x42|66| | 137 | |>| 0x03|3| | 138 | |>| 0x01|1| | 139 | |>| 0xb5|181| | 140 | 141 | 142 | 143 | 144 | 145 | 146 | _Table: Switch Multi Level Switch Off_ 147 | 148 | |Value |Meaning | 149 | |---|---| 150 | |01| SOC| 151 | |0a| LEN| 152 | |00| REQUEST| 153 | |13| SendData| 154 | |07| NodeID| 155 | |03| ???| 156 | |26| SWITCH MULTILEVEL| 157 | |01| SET| 158 | |00| off| 159 | |25| ???| 160 | |03| ???| 161 | |e3| CHECKSUM| 162 | 163 | 164 | 165 | 166 | _Table: First frame sent from controller_ 167 | 168 | |index|Direction|Value|Decode Information| 169 | |---|---|---|---| 170 | |1 |TX|0x01| SOF (see Preambles below)| 171 | |2 |TX|0x03| Length | 172 | |3 |TX|0x00| 0x00-Request| 173 | |4 |TX|0x07| SerialGetCapabilities | 174 | |5 |TX|0xfb| Checksum - see _Generating a checksum_ below| 175 | 176 | _Table: Response_ 177 | 178 | |index|Direction|Value|Decode Information| 179 | |---|---|---|---|---| 180 | | |RX|0x06| ACK (see Preambles below)| | 181 | | |RX|0x01| SOF (see Preambles below)| | 182 | | |RX|0x2b| Length 43 Bytes | | 183 | | |RX|0x01| 0x01-Response | | 184 | | |RX|0x07| SerialGetCapabilities| | 185 | | |RX|0x04| Version | | 186 | | |RX|0x02| Revision | | 187 | | |RX|0x01| Manufacture ID1 | | 188 | | |RX|0x47| Manufacture ID1 | | 189 | | |RX|0x00| Product Type 1| | 190 | | |RX|0x02| Product Type 2| | 191 | | |RX|0x00| Product ID 1| | 192 | | |RX|0x03| Product ID 2| | 193 | | |RX|0xfe| | | 194 | | |RX|0x00| | | 195 | | |RX|0x16| | | 196 | | |RX|0x80| | | 197 | | |RX|0x0c| | | 198 | | |RX|0x00| | | 199 | | |RX|0x00| | | 200 | | |RX|0x00| | | 201 | | |RX|0xe3| | | 202 | | |RX|0x97| | | 203 | | |RX|0x7d| | | 204 | | |RX|0x80| | | 205 | | |RX|0x07| | | 206 | | |RX|0x00| | | 207 | | |RX|0x00| | | 208 | | |RX|0x80| | | 209 | | |RX|0x00| | | 210 | | |RX|0x00| | | 211 | | |RX|0x00| | | 212 | | |RX|0x00| | | 213 | | |RX|0x00| | | 214 | | |RX|0x00| | | 215 | | |RX|0x00| | | 216 | | |RX|0x00| | | 217 | | |RX|0x00| | | 218 | | |RX|0x00| | | 219 | | |RX|0x02| | | 220 | | |RX|0x00| | | 221 | | |RX|0x00| | | 222 | | |RX|0x80| | | 223 | | |RX|0x07| | | 224 | | |RX|0x00| | | 225 | | |RX|0x7c| Checksum| | 226 | 227 | 228 | _Table: (Switch Binary Set)_ 229 | 230 | |index|Direction|Value|Decode Information| 231 | |---|---|---|---| 232 | |1 |TX|0x01| SOF (see Preambles below)| 233 | |2 |TX|0x0a| Length | 234 | |3 |TX|0x00| 0x00-Request| 235 | |4 |TX|0x13| SendData | 236 | |5 |TX|0x09| Node ID| 237 | |6 |TX|0x03| 3-BinarySet (2-BinaryGet) | 238 | |7 |TX|0x25| BINARY_SWITCH| 239 | |8 |TX|0x01| Set value? (is this [SET, GET, REPORT]?)| 240 | |9 |TX|0x00| 0x00-Switch off (0xff=ON) | 241 | |10 |TX|0x25| | 242 | |11 |TX|0x03| | 243 | |12 |TX|0xee| Checksum - see _Generating a checksum_ below| 244 | 245 | _Table: Random decodes_ 246 | 247 | |nodeId| | | | |Description| 248 | |---|---|---|---|---|---| 249 | |18|2|30|2|5| Sensor Binary Get| 250 | |9|3|25|1|ff 25| BINARY_SWITCH Set| 251 | |9|2|25|2|25| BINARY_SWITCH Get| 252 | |9|3|25|1|0 25| BINARY_SWITCH Set| 253 | |9|2|25|2|25| BINARY_SWITCH Get| 254 | |9|3|25|1|0 25| BINARY_SWITCH Set| 255 | |9|2|25|2|25| BINARY_SWITCH Get| 256 | 257 | 258 | 259 | Random Capture 260 | =============== 261 | 262 | |Direction|Hex|Dec|Description| 263 | |---|---|---|---| 264 | |>| 0x01|1| 265 | |>| 0x08|8| 266 | |>| 0x00|0| 267 | |>| 0x04|4| 268 | |>| 0x00|0| 269 | |>| 0x28|40| 270 | |>| 0x02|2| 271 | |>| 0x84|132| 272 | |>| 0x07|7| 273 | |>| 0x5a|90| 274 | |<| 0x06|6| 275 | |<| 0x01|1| 276 | |<| 0x09|9| 277 | |<| 0x00|0| 278 | |<| 0x13|19| 279 | |<| 0x28|40| 280 | |<| 0x02|2| 281 | |<| 0x84|132| 282 | |<| 0x08|8| 283 | |<| 0x05|5| 284 | |<| 0x20|32| 285 | |<| 0x66|102| 286 | |>| 0x06|6| 287 | |>| 0x01|1| 288 | |>| 0x04|4| 289 | |>| 0x01|1| 290 | |>| 0x13|19| 291 | |>| 0x01|1| 292 | |>| 0xe8|232| 293 | |<| 0x06|6| 294 | |>| 0x01|1| 295 | |>| 0x05|5| 296 | |>| 0x00|0| 297 | |>| 0x13|19| 298 | |>| 0x20|32| 299 | |>| 0x00|0| 300 | |>| 0xc9|201| 301 | |<| 0x06|6| 302 | |>| 0x01|1| 303 | |>| 0x0b|11| 304 | |>| 0x00|0| 305 | |>| 0x04|4| 306 | |>| 0x00|0| 307 | |>| 0x04|4| 308 | |>| 0x05|5| 309 | |>| 0x31|49| 310 | |>| 0x05|5| 311 | |>| 0x01|1| 312 | |>| 0x09|9| 313 | |>| 0x47|71| 314 | |>| 0x8a|138| 315 | |<| 0x06|6| 316 | |>| 0x01|1| 317 | |>| 0x09|9| 318 | |>| 0x00|0| 319 | |>| 0x04|4| 320 | |>| 0x00|0| 321 | |>| 0x04|4| 322 | |>| 0x03|3| 323 | |>| 0x42|66| 324 | |>| 0x03|3| 325 | |>| 0x00|0| 326 | |>| 0xb4|180| 327 | |<| 0x06|6| 328 | 329 | 330 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | __Disclaimer:__ If you are under NDA with ZenSYS, although I wish I could, I cannot use your input. I want this to be an open definition of ZWave clear of NDA. 2 | 3 | If you are not under NDA and you see any errors or have anything to add I welcome your input. I will be glad to incorporate any pull requests you may offer or review any issues you choose to create. 4 | 5 | ZWave Serial API Sniffing Journal 6 | ======================== 7 | 8 | These are my notes About ZWave mostly compiled with RaZberry, Open ZWave, and a lot of Google-ing. See the bottom of this file for a list of the most helpful resources that are not inline linked. 9 | 10 | Updates 11 | 12 | 2014 Aug 18 - HackRF has arrived and now I have raw RF 908.42 MHz samples of ZWave devices. Next step is to work on GFSK decoder. 13 | 14 | 2013 Aug 13 - I am now backing the HackRF on KickStarter. The goal is to apply my learnings to decoding the RF part of ZWave. 15 | 16 | 17 | I have been asked why am I doing this. My answer is two fold: 18 | 19 | 1. I want to make sure that my new favorite technology is secure. I don't want someone able to unlock my door because I am using ZWave. I feel I can accomplish this more throughly if I am open about my knowledge and others are open about theirs. 20 | 2. I Want to be able to do things that currently are not available in any of the ZWave services. First I want to fully understand ZWave then I want to create cool apps and hardware that leverage that knowledge. 21 | 22 | 23 | Questions To Be Answered: 24 | =================== 25 | 26 | Now I feel I have a good grasp on the Application Layer Serial protocol and just need to finish documenting it. Here are some of my next big questions: 27 | 28 | * How can I get the ZWave [ZM3102][1] into "promiscuous" mode so I can see all OTA traffic? 29 | * How hard would it be to make my own OTA sniffer? 30 | * Can I take apart a zwave device and repurpose it as a sniffer? 31 | * I have found some views from ZNiffer on Youtube. How can I get more examples of decoded ZWave to verify my decodes are accurate? 32 | * There are a lot of really cruddy databases of ZWave devices. Should I create one that is maintainable by the community? 33 | 34 | 35 | RaZberry 36 | ======== 37 | 38 | A RaZberry hardware solution is a combination of the [Raspberry Pi] [2] motherboard and the [RaZberry] [2] Z-Wave transceiver daughter board. The daughter board is connected to the mother-board using the General IO Pin header connector of Raspberry PI. This GPIO interface offers Serial TX and RX signals, ground and 3.3 V VCC to power the Z-Wave transceiver board. 39 | 40 | The RaZberry uses the [ZM3102][1] Z-Wave transceiver from [SIGMA DESIGNS] [4]. This module combines a "System on Chip" (SOC) with a 8051 micro controller, the Z-Wave transceiver and some IO interfaces the systems crystal and the SAW antenna filter. 41 | 42 | 43 | The micro controller of the SOC contains control code that operates the wireless transceiver and handles certain network level operations of Z-Wave. The communication with this code runs over the serial interface. There is a protocol specification for this interface that is issued by the 44 | Manufacturer of the Z-Wave chip Sigma Designs that most of the [Z-Wave transceivers] [5] on the market (e.g., USB Sticks) use. This interface specification — called Sigma Designs Serial API - is not a public document but available under Non Disclosure Agreement only as part of the Sigma Designs Systems Development Kit (SDK). The firmware of RaZberry is based on the SDK Version 4.54 but has enhanced the Sigma Designs Serial API in several ways. 45 | 46 | 47 | Almond+ 48 | ======== 49 | 50 | I am a backer at the life-time service level of the KickStarter project [Almond+] [6]. I can't wait to get my hands on this product. I have very high hopes for this project. 51 | 52 | 53 | ZWave 54 | ======= 55 | 56 | Thanks to the folks over at the OpenZwave project I found out that the basis of ZWave is an ITU standard. A little Googling and it appears the standard of interest is ITU-T G.9959 (http://www.itu.int/rec/T-REC-G.9959/en). 57 | 58 | Have I mentioned that I love the project Open-ZWave? 59 | 60 | 61 | Thoughts on Application Design 62 | ============================== 63 | 64 | I have written my fair share of Wireshark dissectors but I have always had Wireshark to do the display of those captures. 65 | 66 | Creating a ZWave sniffer will require the dissector but it will also require some user interface. This may be best split into to project. Similar to TShark (or tcpdump) that does the capture and the user interface application. Initially the UI will just dump to the console or to a file. 67 | 68 | or 69 | 70 | Maybe I can sort out someway to save the capture in PCAP format and still use Wireshark to decode it? 71 | 72 | 73 | Future Goals 74 | =============== 75 | 76 | I would like to make a ZWave decoder that will monitor the serial line and output human readable information about what is being sent. 77 | 78 | 79 | ZWave Frames 80 | ======== 81 | 82 | ![ZWave Frame](https://raw.github.com/yepher/RaZBerry/master/images/zwaveFrameFormat.png) 83 | 84 | 85 | _Basic ZWave Frame_ 86 | 87 | 88 | |Byte Position: |0|1|2|3|…| N| 89 | |---|---|---|---|---|---|---| 90 | | **Field:** |Header|Length|Type (Request 0x00 or Response 0x01)|Command - ZWave Function (see ZWave Functions below)| Data … | Checksum| 91 | 92 | 93 | ZWave Sample Decodes 94 | ===================== 95 | 96 | See Also: 97 | * binarySwitchSamples.md 98 | * BinaryMotionSensorSamples.md 99 | * OtherSample.md 100 | 101 | 102 | 103 | *Generating a checksum* 104 | 105 | ```JAVA 106 | private static byte generateChecksum(byte[] dataFrame) { 107 | int offset = 0; // Initialize this to 0xFF and no need to NOT result below 108 | byte ret = data[offset]; 109 | for (int i = offset; i < data.length; i++) { 110 | // Xor bytes 111 | ret ^= data[i]; 112 | } 113 | ret = (byte) (~ret); 114 | return ret; 115 | } 116 | 117 | 118 | Usage: 119 | byte[] zwaveFrame = new byte[] {0x01, 0x03, 0x20, /* (byte) 0xdc, */}; 120 | System.out.println("==============> Checksum: 0x" + Integer.toHexString(EIMApplication.generateChecksum(zwaveFrame))); 121 | 122 | 123 | ``` 124 | 125 | Device Classes 126 | =========== 127 | 128 | To allow inter-operability between different Z-Wave devices from different manufacturers, each device must include certain well-defined functions above and beyond the ‘Basic’ command class. 129 | 130 | These requirements are called ‘Device Classes’. A device class refers to a typical device and defines which command classes that are mandatory for it to support. 131 | 132 | Device classes are organized into a three-layer hierarchy: 133 | 134 | Every device must belong to a basic device class 135 | Devices can be further specified by assigning them to a generic device class 136 | Further functionality can be defined by assigning the device to a specific device class 137 | Basic Device Class 138 | The ‘Basic’ device class simply defines a device as a Controller, Slave or Routing Slave. Therefore every device belongs to one basic device class. 139 | 140 | Generic Device Class 141 | The ‘Generic’ device class defines the basic functionality that the devices will support as a controller or slave. Current ‘Generic’ device classes are: 142 | 143 | |Hex Value|Value|Description |Key| 144 | |---|---|---|---| 145 | |0x01|1|General controller|BASIC TYPE CONTROLLER| 146 | |0x02|2|Static cont roller|STATIC CONTROLLER| 147 | |0x03|3| |BASIC TYPE SLAVE| 148 | |0x04|4| |BASIC TYPE ROUTING SLAVE| 149 | |0x08|8|Thermostat|GENERIC TYPE THERMOSTAT| 150 | |0x10|16|Binary switch|BINARY SWITCH| 151 | |0x11|17|Multi level switch|MULTI LEVEL SWITCH| 152 | |0x12|18| |GENERIC TYPE SWITCH REMOTE| 153 | |0x13|19| |GENERIC TYPE SWITCH TOGGLE| 154 | |0x17|23| |GENERIC TYPE SECURITY PANEL| 155 | |0x20|32|Binary sensor|BINARY SENSOR| 156 | |0x21|33 |Multilevel-Sensor|MULTILEVEL SENSOR| 157 | |0x31|49 |Meter|METER| 158 | | |64| |GENERIC TYPE ENTRY CONTROL| 159 | 160 | 161 | _Specific Device Class_ 162 | 163 | Assigning a ‘Specific’ device class to a Z-Wave device allows it to further specify its functionality. Each ‘Generic’ device class refers to a number of specific device classes. You can decide to assign a specific device class, however, it only makes sense if the device really supports all functions of a ‘Specific’ device class. 164 | 165 | 166 | _Table: **0x01 – 0x1F ZWave Protocol Commands**_ 167 | 168 | |Name|Hex|Dec| 169 | |---|---|---| 170 | |NO OPERATION|0x00|0| 171 | |NODE INFO|0x01|1| 172 | |REQUEST NODE INFO|0x02|2| 173 | |ASSIGN IDS|0x03|3| 174 | |FIND NODES IN RANGE|0x04|4| 175 | |GET NODES IN RANGE|0x05|5| 176 | |RANGE INFO|0x06|6| 177 | |CMD COMPLETE|0x07|7| 178 | |TRANSFER PRESENTATION|0x08|8| 179 | |TRANSFER NODE INFO|0x09|9| 180 | |TRANSFER RANGE INFO|0x0A|10| 181 | |TRANSFER END|0x0B|11| 182 | |ASSIGN RETURN ROUTE|0x0C|12| 183 | |NEW NODE REGISTERED|0x0D|13| 184 | |NEW RANGE REGISTERED|0x0E|14| 185 | |TRANSFER NEW PRIMARY COMPLETE|0x0F|15| 186 | |AUTOMATIC CONTROLLER UPDATE START|0x10|16| 187 | |SUC NODE ID|0x11|17| 188 | |SET SUC|0x12|18| 189 | |SET SUC ACK|0x13|19| 190 | |ASSIGN SUC RETURN ROUTE|0x14|20| 191 | |STATIC ROUTE REQUEST|0x15|21| 192 | |LOST|0x16|22| 193 | |ACCEPT LOST|0x17|23| 194 | |NOP POWER|0x18|24| 195 | |RESERVE NODE IDS|0x19|25| 196 | |RESERVED IDS|0x1A|26| 197 | |UNKNOWN|0x1B-0x1F|27-31| 198 | 199 | 200 | 201 | _Table: **ZWave Command Classes**_ 202 | 203 | A Command Class can contain up to 255 different Commands. 204 | 205 | __NOTE:__ _If the Command Class field is set to 0xF1 - 0xFF then there is another Command Class byte added_. This allows for future extensions of the Command Classes. The strategy of having an Extended Command Class followed by the actual command identifier provides the possibility of having more than 4000 Command Classes. 206 | 207 | |Name|Hex|Dec| 208 | |---|---|---| 209 | |BASIC|0x20|32| 210 | |CONTROLLER REPLICATION|0x21|33| 211 | |APPLICATION STATUS|0x22|34| 212 | |ZIP SERVICES|0x23|35| 213 | |ZIP SERVER|0x24|36| 214 | |SWITCH BINARY|0x25|37| 215 | |SWITCH MULTILEVEL|0x26|38| 216 | |SWITCH MULTILEVEL V2|0x26|38| 217 | |SWITCH ALL|0x27|39| 218 | |SWITCH TOGGLE BINARY|0x28|40| 219 | |SWITCH TOGGLE MULTILEVEL|0x29|41| 220 | |CHIMNEY FAN|0x2A|42| 221 | |SCENE ACTIVATION|0x2B|43| 222 | |SCENE ACTUATOR CONF|0x2C|44| 223 | |SCENE CONTROLLER CONF|0x2D|45| 224 | |ZIP CLIENT|0x2E|46| 225 | |ZIP ADV SERVICES|0x2F|47| 226 | |SENSOR BINARY|0x30|48| 227 | |SENSOR MULTILEVEL|0x31|49| 228 | |SENSOR MULTILEVEL V2|0x31|49| 229 | |METER|0x32|50| 230 | |ZIP ADV SERVER|0x33|51| 231 | |ZIP ADV CLIENT|0x34|52| 232 | |METER PULSE|0x35|53| 233 | |METER TBL CONFIG|0x3C|60| 234 | |METER TBL MONITOR|0x3D|61| 235 | |METER TBL PUSH|0x3E|62| 236 | |THERMOSTAT HEATING|0x38|56| 237 | |THERMOSTAT MODE|0x40|64| 238 | |THERMOSTAT OPERATING STATE|0x42|66| 239 | |THERMOSTAT SETPOINT|0x43|67| 240 | |THERMOSTAT FAN MODE|0x44|68| 241 | |THERMOSTAT FAN STATE|0x45|69| 242 | |CLIMATE CONTROL SCHEDULE|0x46|70| 243 | |THERMOSTAT SETBACK|0x47|71| 244 | |TARIF CONFIG|0x4A|74| 245 | |TARIF TABLE MONITOR|0x4B|75| 246 | |COMMAND CLASS DOOR LOCK LOGGING|0x4C|76| 247 | |SCHEDULE ENTRY LOCK|0x4E|78| 248 | |ZIP 6LOWPAN|0x4F|79| 249 | |BASIC WINDOW COVERING|0x50|80| 250 | |MTP WINDOW COVERING|0x51|81| 251 | |MULTI CHANNEL V2|0x60|96| 252 | |MULTI INSTANCE|0x60|96| 253 | |DOOR LOCK|0x62|98| 254 | |USER CODE|0x63|99| 255 | |CONFIGURATION|0x70|112| 256 | |CONFIGURATION V2|0x70|112| 257 | |ALARM|0x71|113| 258 | |MANUFACTURER SPECIFIC|0x72|114| 259 | |POWER LEVEL|0x73|115| 260 | |PROTECTION|0x75|117| 261 | |PROTECTION V2|0x75|117| 262 | |LOCK|0x76|118| 263 | |NODE NAMING|0x77|119| 264 | |FIRMWARE UPDATE MD|0x7A|122| 265 | |GROUPING NAME|0x7B|123| 266 | |REMOTE ASSOCIATION ACTIVATE|0x7C|124| 267 | |REMOTE ASSOCIATION|0x7D|125| 268 | |BATTERY|0x80|128| 269 | |CLOCK|0x81|129| 270 | |HAIL|0x82|130| 271 | |WAKE UP|0x84|132| 272 | |WAKE UP V2|0x84|132| 273 | |ASSOCIATION|0x85|133| 274 | |ASSOCIATION V2|0x85|133| 275 | |VERSION|0x86|134| 276 | |INDICATOR|0x87|135| 277 | |PROPRIETARY|0x88|136| 278 | |LANGUAGE|0x89|137| 279 | |TIME|0x8A|138| 280 | |TIME PARAMETERS|0x8B|139| 281 | |GEOGRAPHIC LOCATION|0x8C|140| 282 | |COMPOSITE|0x8D|141| 283 | |MULTI CHANNEL ASSOCIATION V2|0x8E|142| 284 | |MULTI INSTANCE ASSOCIATION|0x8E|142| 285 | |MULTI CMD|0x8F|143| 286 | |ENERGY PRODUCTION|0x90|144| 287 | |MANUFACTURER PROPRIETARY|0x91|145| 288 | |SCREEN MD|0x92|146| 289 | |SCREEN MD V2|0x92|146| 290 | |SCREEN ATTRIBUTES|0x93|147| 291 | |SCREEN ATTRIBUTES V2|0x93|147| 292 | |SIMPLE AV CONTROL|0x94|148| 293 | |AV CONTENT DIRECTORY MD|0x95|149| 294 | |AV RENDERER STATUS|0x96|150| 295 | |AV CONTENT SEARCH MD|0x97|151| 296 | |SECURITY|0x98|152| 297 | |AV TAGGING MD|0x99|153| 298 | |IP CONFIGURATION|0x9A|154| 299 | |ASSOCIATION COMMAND CONFIGURATION|0x9B|155| 300 | |SENSOR ALARM|0x9C|156| 301 | |SILENCE ALARM|0x9D|157| 302 | |SENSOR CONFIGURATION|0x9E|158| 303 | |MARK|0xEF|239| 304 | |NON INTEROPERABLE|0xF0|240 305 | |EXTENDED APPLICATION COMMANDS|0xF1 – 0xFF|241 - 255| 306 | 307 | _Table: **ZWave Basic**_ 308 | 309 | |Name|Hex|Dec| 310 | |---|---|---| 311 | |VERSION|0x01|1| 312 | |SET|0x01|1| 313 | |GET|0x02|2| 314 | |REPORT|0x03|3| 315 | 316 | _Table: **ZWave Thermostat Setpoint**_ 317 | 318 | |Name|Hex|Dec| 319 | |---|---|---| 320 | |VERSION|0x01|1| 321 | |SET|0x01|1| 322 | |GET|0x02|2| 323 | |REPORT|0x03|3| 324 | |SUPPORTED GET|0x04|4| 325 | |SUPPORTED REPORT|0x05|5| 326 | 327 | 328 | _Table: **ZWave Wake Up**_ 329 | 330 | |Name|Hex|Dec| 331 | |---|---|---| 332 | |VERSION|0x01|1| 333 | |INTERVAL SET|0x04|4| 334 | |INTERVAL GET|0x05|5| 335 | |INTERVAL REPORT|0x06|6| 336 | |NOTIFICATION|0x07|7| 337 | 338 | 339 | _Table: **ZWave Multi**_ 340 | 341 | |Name|Hex|Dec| 342 | |---|---|---| 343 | |VERSION|0x01|1| 344 | |ENCAP|0x01|1| 345 | 346 | 347 | 348 | _Table: **ZWave Battery**_ 349 | 350 | |Name|Hex|Dec| 351 | |---|---|---| 352 | |VERSION|0x01|1| 353 | |GET|0x02|2| 354 | |REPORT|0x03|3| 355 | 356 | _Table: **ZWave Transmit Options**_ 357 | 358 | |Name|Hex|Dec| 359 | |---|---|---| 360 | |ACK|0x01|1| 361 | |LOW POWER|0x02|2| 362 | |AUTO ROUTE|0x04|4| 363 | |EXPLORE|0x20|32| 364 | 365 | 366 | _Table: **ZWave Parameter Types**_ 367 | 368 | |Name|Hex|Dec| 369 | |---|---|---| 370 | |BYTE|0x01|1| 371 | |WORD|0x02|2| 372 | |DWORD|0x03|3| 373 | |BIT_24|0x04|4| 374 | |ARRAY|0x05|5| 375 | |BITMASK|0x06|6| 376 | |STRUCT_BYTE|0x07|7| 377 | |ENUM|0x08|8| 378 | |ENUM_ARRAY|0x09|9| 379 | |MULTI_ARRAY|0x0A|10| 380 | |CONST| 0x0B|11| 381 | |VARIANT|0x0C|12| 382 | |VARIANT_GROUP|0x0D|13| 383 | 384 | 385 | 386 | Node Definitions 387 | ================= 388 | 389 | ```XML 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | ``` 494 | 495 | Device Class 496 | 497 | 498 | ZWave Functions 499 | =============== 500 | 501 | |Name|Value| 502 | |---|---| 503 | |None|0x00| 504 | |DiscoveryNodes|0x02| 505 | |SerialApiApplNodeInformation|0x03| 506 | |ApplicationCommandHandler|0x04| 507 | |GetControllerCapabilities|0x05| 508 | |SerialApiSetTimeouts|0x06| 509 | |SerialGetCapabilities|0x07| 510 | |SerialApiSoftReset|0x08| 511 | |SetRFReceiveMode|0x10| 512 | |SetSleepMode|0x11| 513 | |SendNodeInformation|0x12| 514 | |SendData|0x13| 515 | |SendDataMulti|0x14| 516 | |GetVersion|0x15| 517 | |SendDataAbort|0x16| 518 | |RFPowerLevelSet|0x17| 519 | |SendDataMeta|0x18| 520 | |MemoryGetId|0x20| 521 | |MemoryGetByte|0x21| 522 | |MemoryPutByte|0x22| 523 | |MemoryGetBuffer|0x23| 524 | |MemoryPutBuffer|0x24| 525 | |ReadMemory|0x23| 526 | |ClockSet|0x30| 527 | |ClockGet|0x31| 528 | |ClockCompare|0x32| 529 | |RtcTimerCreate|0x33| 530 | |RtcTimerRead|0x34| 531 | |RtcTimerDelete|0x35| 532 | |RtcTimerCall|0x36| 533 | |GetNodeProtocolInfo|0x41| 534 | |SetDefault|0x42| 535 | |ReplicationCommandComplete|0x44| 536 | |ReplicationSendData|0x45| 537 | |AssignReturnRoute|0x46| 538 | |DeleteReturnRoute|0x47| 539 | |RequestNodeNeighborUpdate|0x48| 540 | |ApplicationUpdate|0x49| 541 | |AddNodeToNetwork|0x4a| 542 | |RemoveNodeFromNetwork|0x4b| 543 | |CreateNewPrimary|0x4c| 544 | |ControllerChange|0x4d| 545 | |SetLearnMode|0x50| 546 | |AssignSucReturnRoute|0x51| 547 | |EnableSuc|0x52| 548 | |RequestNetworkUpdate|0x53| 549 | |SetSucNodeId|0x54| 550 | |DeleteSucReturnRoute|0x55| 551 | |GetSucNodeId|0x56| 552 | |SendSucId|0x57| 553 | |RediscoveryNeeded|0x59| 554 | |RequestNodeInfo|0x60| 555 | |RemoveFailedNodeId|0x61| 556 | |IsFailedNode|0x62| 557 | |ReplaceFailedNode|0x63| 558 | |TimerStart|0x70| 559 | |TimerRestart|0x71| 560 | |TimerCancel|0x72| 561 | |TimerCall|0x73| 562 | |GetRoutingTableLine|0x80| 563 | |GetTXCounter|0x81| 564 | |ResetTXCounter|0x82| 565 | |StoreNodeInfo|0x83| 566 | |StoreHomeId|0x84| 567 | |LockRouteResponse|0x90| 568 | |SendDataRouteDemo|0x91| 569 | |SerialApiTest|0x95| 570 | |SerialApiSlaveNodeInfo|0xa0| 571 | |ApplicationSlaveCommandHandler|0xa1| 572 | |SendSlaveNodeInfo|0xa2| 573 | |SendSlaveData|0xa3| 574 | |SetSlaveLearnMode|0xa4| 575 | |GetVirtualNodes|0xa5| 576 | |IsVirtualNode|0xa6| 577 | |SetPromiscuousMode|0xd0 578 | 579 | 580 | _Table: Preambles used see "man ascii"_ 581 | 582 | |Name|Hex|Dec|Description| 583 | |---|---|---|---| 584 | |SOF|0x01|1|Start Of Frame| 585 | |ACK|0x06|6|Message Ack| 586 | |NAK|0x15|21|Message NAK| 587 | |CAN|0x18|24|Cancel - Resend request| 588 | 589 | 590 | Capturing serial port data 591 | ========= 592 | 593 | Install "interceptty". 594 | 595 | * http://www.suspectclass.com/sgifford/interceptty/ 596 | * unpack 597 | * build it and install the tool 598 | 599 | ```BASH 600 | 601 | # Usage: 602 | # Stop Z-Way process "sudo /etc/init.d/Z-Way stop" 603 | # > sudo vi /opt/z-way-server/config.xml 604 | # change "/dev/ttyAMA0" to "/tmp/ttyAMA0" 605 | # Run this script 606 | # Start Z-Way "sudo /etc/init.d/Z-Way start" 607 | 608 | interceptty -s 'ispeed 115200 ospeed 115200' /dev/ttyAMA0 /tmp/ttyAMA0 609 | 610 | ``` 611 | 612 | Once you are done sniffing the serial port you will need to stop the Z-Way server and change "config.xml" back to it's original form. 613 | 614 | 615 | 616 | JSON Server 617 | ======== 618 | 619 | Z-Way makes a server for Raspberry PI and RaZberry. 620 | 621 | 622 | Terms 623 | ======== 624 | 625 | Term | Description 626 | -----|-------------------- 627 | FLIRS | Frequently Listening Devices 628 | NIF | Node Information Frame 629 | SIS | Static ID-Server 630 | SOF | Start Of Frame 631 | SUC | Static Update Controller 632 | 633 | 634 | 635 | More ZWave References 636 | ========== 637 | * ZWave Overview - http://dkc1.digikey.com/us/en/tod/SigmaDesigns/Z-Wave/Z-Wave.html 638 | * linuxmce ZWave API - http://wiki.linuxmce.org/index.php/ZWave_API 639 | * Catching the Z-Wave - http://www.drdobbs.com/embedded-systems/catching-the-z-wave/193104353 640 | * Open ZWave - https://code.google.com/p/open-zwave/ 641 | * An introduction to Z-Wave programming in C# - http://www.digiwave.dk/en/programming/an-introduction-to-z-wave-programming-in-c/ 642 | * http://www.vesternet.com/resources/technology-indepth/how-z-wave-controllers-work 643 | * http://www.codecoretechnologies.com/community/index.php?topic=946.20 644 | * ViziaRF - https://code.google.com/p/zwave-driver-for-premise/source/browse/trunk/ViziaRF/ViziaRF.xdo 645 | * "razberry.pdf" - http://razberry.z-wave.me/docs/razberry.pdf 646 | * http://wiki.micasaverde.com/index.php/ZWave_Command_Classes 647 | * ZWave protocol version - http://wiki.micasaverde.com/index.php/ZWave_Protocol_Version 648 | * Aeonz Stick Driver - https://bitbucket.org/bradsjm/aeonzstickdriver/src/befa5117e290?at=default 649 | * ZWave device DB (far from complete) - http://www.pepper1.net/zwavedb/ 650 | * In German does does seem like a nice introduction - http://www.digiwave.dk/ 651 | * Python ZWave - http://z-wave.alsenet.com/index.php/Main_Page 652 | * ZWave insiders wiki - http://wiki.zwaveeurope.com/ 653 | * ZWave Dimmer Test - https://code.google.com/p/i7afp/source/browse/#svn%2Ftrunk%2FSourcecode%2FZWave 654 | * ZWave Prezi Introduction - http://prezi.com/839cbmtlz-3n/z-wave/ 655 | * Getting Firmware from chips http://blog.cassidiancybersecurity.com/post/2014/02/Dumping-firmware-from-ASIC 656 | * BlackHat talk on ZWave - https://www.youtube.com/watch?v=KYaEQhvodc8 657 | * Z-Force ZWave attack tool - https://code.google.com/p/z-force/ 658 | 659 | 660 | [1]: http://www.digikey.com/us/en/ph/SigmaDesigns/z-wave_zm3102.html "ZM3102" 661 | [2]: http://www.raspberrypi.org/ "Raspberry Pi" 662 | [3]: http://razberry.zwave.me/ "RaZberry" 663 | [4]: http://www.sigmadesigns.com/ "SIGMA DESIGNS" 664 | [5]: http://www.itu.int/rec/T-REC-G.9959/en "Z-Wave transceivers" 665 | [6]: http://www.kickstarter.com/projects/2037429657/almond-80211ac-touchscreen-wifi-router-smart-home/posts/442531?ref=activity "Almond+" 666 | -------------------------------------------------------------------------------- /SecurityDevice.md: -------------------------------------------------------------------------------- 1 | See: https://www.youtube.com/watch?v=KYaEQhvodc8 @ 26:32 2 | 3 | 4 | ![Security Device Signalling](http://yepher.com/sequencePNG.jsp?data=%5Bsettings%5D%0AshowRungNumber%3Dyes%0A%0A%5Btitle%5D%0AZWave%20Security%20Signaling%0A%0A%5Bactors%5D%0AController%0ASecurity%20Device%0A%0A%5Bsequences%5D%0AGet%20ready%20for%20key%20establishment%2C%20Controller%2C%20Security%20Device%0AReady%2C%20Security%20Device%2C%20Controller%0ANonce%20request%2C%20Controller%2C%20security%20device%0ANonce%20Value%2C%20Security%20device%2C%20controller%0AEncrypted%20network%20key-Kn%2C%20Controller%2C%20Security%20Device%0ANonce%20request%2C%20Security%20Device%2C%20Controller%0ANonce%20value%2C%20Controller%2C%20Security%20Device%0AEncrypted%20message%20%28new%20key%20is%20set%29%2C%20Security%20Device%2C%20controller%0A%0A&name=image.png). 5 | -------------------------------------------------------------------------------- /bin/ACK.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /bin/CLEAR_PROMISCUOUS_MODE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/bin/CLEAR_PROMISCUOUS_MODE.bin -------------------------------------------------------------------------------- /bin/SET_PROMISCUOUS_MODE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/bin/SET_PROMISCUOUS_MODE.bin -------------------------------------------------------------------------------- /bin/clearPromiscuous.sh: -------------------------------------------------------------------------------- 1 | cat CLEAR_PROMISCUOUS_MODE.bin >/tmp/ttyAMA0 2 | -------------------------------------------------------------------------------- /bin/sendAck.sh: -------------------------------------------------------------------------------- 1 | cat ACK.bin >/tmp/ttyAMA0 2 | -------------------------------------------------------------------------------- /bin/setPromiscuous.sh: -------------------------------------------------------------------------------- 1 | cat SET_PROMISCUOUS_MODE.bin >/tmp/ttyAMA0 2 | -------------------------------------------------------------------------------- /docs/24352403 BE469 Z-Wave Parameters WO-a_ENGLISH.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/24352403 BE469 Z-Wave Parameters WO-a_ENGLISH.pdf -------------------------------------------------------------------------------- /docs/DSH10717-3_ZW0301.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/DSH10717-3_ZW0301.pdf -------------------------------------------------------------------------------- /docs/INS11095-2 - Z-Wave ZW0201-ZW0301 Programmers Guide v4_50 (Beta1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/INS11095-2 - Z-Wave ZW0201-ZW0301 Programmers Guide v4_50 (Beta1).pdf -------------------------------------------------------------------------------- /docs/SDS10242-17 Z-Wave Device Class Specification.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/SDS10242-17 Z-Wave Device Class Specification.pdf -------------------------------------------------------------------------------- /docs/SDS11060-7 Z-Wave Command Class Specification.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/SDS11060-7 Z-Wave Command Class Specification.pdf -------------------------------------------------------------------------------- /docs/Security Evaluation of Z-Wave_WP.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/Security Evaluation of Z-Wave_WP.pdf -------------------------------------------------------------------------------- /docs/T-REC-G.9959-201202-I!!PDF-E.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/T-REC-G.9959-201202-I!!PDF-E.pdf -------------------------------------------------------------------------------- /docs/Z-Wave_Node_Type_Overview_and_Network_Installation_Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/Z-Wave_Node_Type_Overview_and_Network_Installation_Guide.pdf -------------------------------------------------------------------------------- /docs/ZW0301.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/docs/ZW0301.pdf -------------------------------------------------------------------------------- /images/zwaveFrameFormat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yepher/RaZBerry/84edb0132ac0857d9a3c12d86ba6ddd67b65a1c2/images/zwaveFrameFormat.png -------------------------------------------------------------------------------- /openZSniffer/AUTHORS: -------------------------------------------------------------------------------- 1 | Scott Gifford 2 | 3 | $Id: AUTHORS,v 7.2 2003/10/01 20:16:14 sgifford Exp $ 4 | -------------------------------------------------------------------------------- /openZSniffer/COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /openZSniffer/ChangeLog: -------------------------------------------------------------------------------- 1 | See NEWS for recent changes. 2 | -------------------------------------------------------------------------------- /openZSniffer/INSTALL: -------------------------------------------------------------------------------- 1 | Basic Installation 2 | ================== 3 | 4 | These are generic installation instructions. 5 | 6 | The `configure' shell script attempts to guess correct values for 7 | various system-dependent variables used during compilation. It uses 8 | those values to create a `Makefile' in each directory of the package. 9 | It may also create one or more `.h' files containing system-dependent 10 | definitions. Finally, it creates a shell script `config.status' that 11 | you can run in the future to recreate the current configuration, a file 12 | `config.cache' that saves the results of its tests to speed up 13 | reconfiguring, and a file `config.log' containing compiler output 14 | (useful mainly for debugging `configure'). 15 | 16 | If you need to do unusual things to compile the package, please try 17 | to figure out how `configure' could check whether to do them, and mail 18 | diffs or instructions to the address given in the `README' so they can 19 | be considered for the next release. If at some point `config.cache' 20 | contains results you don't want to keep, you may remove or edit it. 21 | 22 | The file `configure.in' is used to create `configure' by a program 23 | called `autoconf'. You only need `configure.in' if you want to change 24 | it or regenerate `configure' using a newer version of `autoconf'. 25 | 26 | The simplest way to compile this package is: 27 | 28 | 1. `cd' to the directory containing the package's source code and type 29 | `./configure' to configure the package for your system. If you're 30 | using `csh' on an old version of System V, you might need to type 31 | `sh ./configure' instead to prevent `csh' from trying to execute 32 | `configure' itself. 33 | 34 | Running `configure' takes awhile. While running, it prints some 35 | messages telling which features it is checking for. 36 | 37 | 2. Type `make' to compile the package. 38 | 39 | 3. Optionally, type `make check' to run any self-tests that come with 40 | the package. 41 | 42 | 4. Type `make install' to install the programs and any data files and 43 | documentation. 44 | 45 | 5. You can remove the program binaries and object files from the 46 | source code directory by typing `make clean'. To also remove the 47 | files that `configure' created (so you can compile the package for 48 | a different kind of computer), type `make distclean'. There is 49 | also a `make maintainer-clean' target, but that is intended mainly 50 | for the package's developers. If you use it, you may have to get 51 | all sorts of other programs in order to regenerate files that came 52 | with the distribution. 53 | 54 | Compilers and Options 55 | ===================== 56 | 57 | Some systems require unusual options for compilation or linking that 58 | the `configure' script does not know about. You can give `configure' 59 | initial values for variables by setting them in the environment. Using 60 | a Bourne-compatible shell, you can do that on the command line like 61 | this: 62 | CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure 63 | 64 | Or on systems that have the `env' program, you can do it like this: 65 | env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure 66 | 67 | Compiling For Multiple Architectures 68 | ==================================== 69 | 70 | You can compile the package for more than one kind of computer at the 71 | same time, by placing the object files for each architecture in their 72 | own directory. To do this, you must use a version of `make' that 73 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 74 | directory where you want the object files and executables to go and run 75 | the `configure' script. `configure' automatically checks for the 76 | source code in the directory that `configure' is in and in `..'. 77 | 78 | If you have to use a `make' that does not supports the `VPATH' 79 | variable, you have to compile the package for one architecture at a time 80 | in the source code directory. After you have installed the package for 81 | one architecture, use `make distclean' before reconfiguring for another 82 | architecture. 83 | 84 | Installation Names 85 | ================== 86 | 87 | By default, `make install' will install the package's files in 88 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 89 | installation prefix other than `/usr/local' by giving `configure' the 90 | option `--prefix=PATH'. 91 | 92 | You can specify separate installation prefixes for 93 | architecture-specific files and architecture-independent files. If you 94 | give `configure' the option `--exec-prefix=PATH', the package will use 95 | PATH as the prefix for installing programs and libraries. 96 | Documentation and other data files will still use the regular prefix. 97 | 98 | In addition, if you use an unusual directory layout you can give 99 | options like `--bindir=PATH' to specify different values for particular 100 | kinds of files. Run `configure --help' for a list of the directories 101 | you can set and what kinds of files go in them. 102 | 103 | If the package supports it, you can cause programs to be installed 104 | with an extra prefix or suffix on their names by giving `configure' the 105 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 106 | 107 | Optional Features 108 | ================= 109 | 110 | Some packages pay attention to `--enable-FEATURE' options to 111 | `configure', where FEATURE indicates an optional part of the package. 112 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 113 | is something like `gnu-as' or `x' (for the X Window System). The 114 | `README' should mention any `--enable-' and `--with-' options that the 115 | package recognizes. 116 | 117 | For packages that use the X Window System, `configure' can usually 118 | find the X include and library files automatically, but if it doesn't, 119 | you can use the `configure' options `--x-includes=DIR' and 120 | `--x-libraries=DIR' to specify their locations. 121 | 122 | Specifying the System Type 123 | ========================== 124 | 125 | There may be some features `configure' can not figure out 126 | automatically, but needs to determine by the type of host the package 127 | will run on. Usually `configure' can figure that out, but if it prints 128 | a message saying it can not guess the host type, give it the 129 | `--host=TYPE' option. TYPE can either be a short name for the system 130 | type, such as `sun4', or a canonical name with three fields: 131 | CPU-COMPANY-SYSTEM 132 | 133 | See the file `config.sub' for the possible values of each field. If 134 | `config.sub' isn't included in this package, then this package doesn't 135 | need to know the host type. 136 | 137 | If you are building compiler tools for cross-compiling, you can also 138 | use the `--target=TYPE' option to select the type of system they will 139 | produce code for and the `--build=TYPE' option to select the type of 140 | system on which you are compiling the package. 141 | 142 | Sharing Defaults 143 | ================ 144 | 145 | If you want to set default values for `configure' scripts to share, 146 | you can create a site shell script called `config.site' that gives 147 | default values for variables like `CC', `cache_file', and `prefix'. 148 | `configure' looks for `PREFIX/share/config.site' if it exists, then 149 | `PREFIX/etc/config.site' if it exists. Or, you can set the 150 | `CONFIG_SITE' environment variable to the location of the site script. 151 | A warning: not all `configure' scripts look for a site script. 152 | 153 | Operation Controls 154 | ================== 155 | 156 | `configure' recognizes the following options to control how it 157 | operates. 158 | 159 | `--cache-file=FILE' 160 | Use and save the results of the tests in FILE instead of 161 | `./config.cache'. Set FILE to `/dev/null' to disable caching, for 162 | debugging `configure'. 163 | 164 | `--help' 165 | Print a summary of the options to `configure', and exit. 166 | 167 | `--quiet' 168 | `--silent' 169 | `-q' 170 | Do not print messages saying which checks are being made. To 171 | suppress all normal output, redirect it to `/dev/null' (any error 172 | messages will still be shown). 173 | 174 | `--srcdir=DIR' 175 | Look for the package's source code in directory DIR. Usually 176 | `configure' can determine that directory automatically. 177 | 178 | `--version' 179 | Print the version of Autoconf used to generate the `configure' 180 | script, and exit. 181 | 182 | `configure' also accepts some other, not widely useful, options. 183 | -------------------------------------------------------------------------------- /openZSniffer/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = @CFLAGS@ -Wall 2 | bin_PROGRAMS = interceptty 3 | bin_SCRIPTS = interceptty-nicedump 4 | man_MANS = interceptty.1 5 | interceptty_SOURCES = common.c common.h interceptty.c bsd-openpty.h bsd-openpty.c 6 | EXTRA_DIST = test testport interceptty.pod $(man_MANS) $(bin_SCRIPTS) 7 | check-local: interceptty test 8 | $(SHELL) ./test 9 | -------------------------------------------------------------------------------- /openZSniffer/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.8.3 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | 18 | SOURCES = $(interceptty_SOURCES) 19 | 20 | srcdir = @srcdir@ 21 | top_srcdir = @top_srcdir@ 22 | VPATH = @srcdir@ 23 | pkgdatadir = $(datadir)/@PACKAGE@ 24 | pkglibdir = $(libdir)/@PACKAGE@ 25 | pkgincludedir = $(includedir)/@PACKAGE@ 26 | top_builddir = . 27 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 28 | INSTALL = @INSTALL@ 29 | install_sh_DATA = $(install_sh) -c -m 644 30 | install_sh_PROGRAM = $(install_sh) -c 31 | install_sh_SCRIPT = $(install_sh) -c 32 | INSTALL_HEADER = $(INSTALL_DATA) 33 | transform = $(program_transform_name) 34 | NORMAL_INSTALL = : 35 | PRE_INSTALL = : 36 | POST_INSTALL = : 37 | NORMAL_UNINSTALL = : 38 | PRE_UNINSTALL = : 39 | POST_UNINSTALL = : 40 | bin_PROGRAMS = interceptty$(EXEEXT) 41 | subdir = . 42 | DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ 43 | $(srcdir)/Makefile.in $(srcdir)/config.h.in \ 44 | $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ 45 | TODO depcomp install-sh missing mkinstalldirs 46 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 47 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 49 | $(ACLOCAL_M4) 50 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 51 | configure.lineno configure.status.lineno 52 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 53 | CONFIG_HEADER = config.h 54 | CONFIG_CLEAN_FILES = 55 | am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" 56 | binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 57 | PROGRAMS = $(bin_PROGRAMS) 58 | am_interceptty_OBJECTS = common.$(OBJEXT) interceptty.$(OBJEXT) \ 59 | bsd-openpty.$(OBJEXT) 60 | interceptty_OBJECTS = $(am_interceptty_OBJECTS) 61 | interceptty_LDADD = $(LDADD) 62 | binSCRIPT_INSTALL = $(INSTALL_SCRIPT) 63 | SCRIPTS = $(bin_SCRIPTS) 64 | DEFAULT_INCLUDES = -I. -I$(srcdir) -I. 65 | depcomp = $(SHELL) $(top_srcdir)/depcomp 66 | am__depfiles_maybe = depfiles 67 | @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bsd-openpty.Po \ 68 | @AMDEP_TRUE@ ./$(DEPDIR)/common.Po ./$(DEPDIR)/interceptty.Po 69 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 70 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 71 | CCLD = $(CC) 72 | LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 73 | SOURCES = $(interceptty_SOURCES) 74 | DIST_SOURCES = $(interceptty_SOURCES) 75 | man1dir = $(mandir)/man1 76 | NROFF = nroff 77 | MANS = $(man_MANS) 78 | ETAGS = etags 79 | CTAGS = ctags 80 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 81 | distdir = $(PACKAGE)-$(VERSION) 82 | top_distdir = $(distdir) 83 | am__remove_distdir = \ 84 | { test ! -d $(distdir) \ 85 | || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ 86 | && rm -fr $(distdir); }; } 87 | DIST_ARCHIVES = $(distdir).tar.gz 88 | GZIP_ENV = --best 89 | distuninstallcheck_listfiles = find . -type f -print 90 | distcleancheck_listfiles = find . -type f -print 91 | ACLOCAL = @ACLOCAL@ 92 | AMDEP_FALSE = @AMDEP_FALSE@ 93 | AMDEP_TRUE = @AMDEP_TRUE@ 94 | AMTAR = @AMTAR@ 95 | AUTOCONF = @AUTOCONF@ 96 | AUTOHEADER = @AUTOHEADER@ 97 | AUTOMAKE = @AUTOMAKE@ 98 | AWK = @AWK@ 99 | CC = @CC@ 100 | CCDEPMODE = @CCDEPMODE@ 101 | CFLAGS = @CFLAGS@ 102 | CPP = @CPP@ 103 | CPPFLAGS = @CPPFLAGS@ 104 | CYGPATH_W = @CYGPATH_W@ 105 | DEFS = @DEFS@ 106 | DEPDIR = @DEPDIR@ 107 | ECHO_C = @ECHO_C@ 108 | ECHO_N = @ECHO_N@ 109 | ECHO_T = @ECHO_T@ 110 | EGREP = @EGREP@ 111 | EXEEXT = @EXEEXT@ 112 | INSTALL_DATA = @INSTALL_DATA@ 113 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 114 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 115 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 116 | LDFLAGS = @LDFLAGS@ 117 | LIBOBJS = @LIBOBJS@ 118 | LIBS = @LIBS@ 119 | LTLIBOBJS = @LTLIBOBJS@ 120 | MAKEINFO = @MAKEINFO@ 121 | OBJEXT = @OBJEXT@ 122 | PACKAGE = @PACKAGE@ 123 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 124 | PACKAGE_NAME = @PACKAGE_NAME@ 125 | PACKAGE_STRING = @PACKAGE_STRING@ 126 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 127 | PACKAGE_VERSION = @PACKAGE_VERSION@ 128 | PATH_SEPARATOR = @PATH_SEPARATOR@ 129 | SET_MAKE = @SET_MAKE@ 130 | SHELL = @SHELL@ 131 | STRIP = @STRIP@ 132 | VERSION = @VERSION@ 133 | ac_ct_CC = @ac_ct_CC@ 134 | ac_ct_STRIP = @ac_ct_STRIP@ 135 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 136 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 137 | am__include = @am__include@ 138 | am__leading_dot = @am__leading_dot@ 139 | am__quote = @am__quote@ 140 | bindir = @bindir@ 141 | build_alias = @build_alias@ 142 | datadir = @datadir@ 143 | exec_prefix = @exec_prefix@ 144 | host_alias = @host_alias@ 145 | includedir = @includedir@ 146 | infodir = @infodir@ 147 | install_sh = @install_sh@ 148 | libdir = @libdir@ 149 | libexecdir = @libexecdir@ 150 | localstatedir = @localstatedir@ 151 | mandir = @mandir@ 152 | mkdir_p = @mkdir_p@ 153 | oldincludedir = @oldincludedir@ 154 | prefix = @prefix@ 155 | program_transform_name = @program_transform_name@ 156 | sbindir = @sbindir@ 157 | sharedstatedir = @sharedstatedir@ 158 | sysconfdir = @sysconfdir@ 159 | target_alias = @target_alias@ 160 | AM_CFLAGS = @CFLAGS@ -Wall 161 | bin_SCRIPTS = interceptty-nicedump 162 | man_MANS = interceptty.1 163 | interceptty_SOURCES = common.c common.h interceptty.c bsd-openpty.h bsd-openpty.c 164 | EXTRA_DIST = test testport interceptty.pod $(man_MANS) $(bin_SCRIPTS) 165 | all: config.h 166 | $(MAKE) $(AM_MAKEFLAGS) all-am 167 | 168 | .SUFFIXES: 169 | .SUFFIXES: .c .o .obj 170 | am--refresh: 171 | @: 172 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 173 | @for dep in $?; do \ 174 | case '$(am__configure_deps)' in \ 175 | *$$dep*) \ 176 | echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ 177 | cd $(srcdir) && $(AUTOMAKE) --gnu \ 178 | && exit 0; \ 179 | exit 1;; \ 180 | esac; \ 181 | done; \ 182 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ 183 | cd $(top_srcdir) && \ 184 | $(AUTOMAKE) --gnu Makefile 185 | .PRECIOUS: Makefile 186 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 187 | @case '$?' in \ 188 | *config.status*) \ 189 | echo ' $(SHELL) ./config.status'; \ 190 | $(SHELL) ./config.status;; \ 191 | *) \ 192 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ 193 | cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ 194 | esac; 195 | 196 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 197 | $(SHELL) ./config.status --recheck 198 | 199 | $(top_srcdir)/configure: $(am__configure_deps) 200 | cd $(srcdir) && $(AUTOCONF) 201 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 202 | cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) 203 | 204 | config.h: stamp-h1 205 | @if test ! -f $@; then \ 206 | rm -f stamp-h1; \ 207 | $(MAKE) stamp-h1; \ 208 | else :; fi 209 | 210 | stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status 211 | @rm -f stamp-h1 212 | cd $(top_builddir) && $(SHELL) ./config.status config.h 213 | $(srcdir)/config.h.in: $(am__configure_deps) 214 | cd $(top_srcdir) && $(AUTOHEADER) 215 | rm -f stamp-h1 216 | touch $@ 217 | 218 | distclean-hdr: 219 | -rm -f config.h stamp-h1 220 | install-binPROGRAMS: $(bin_PROGRAMS) 221 | @$(NORMAL_INSTALL) 222 | test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" 223 | @list='$(bin_PROGRAMS)'; for p in $$list; do \ 224 | p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ 225 | if test -f $$p \ 226 | ; then \ 227 | f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 228 | echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ 229 | $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ 230 | else :; fi; \ 231 | done 232 | 233 | uninstall-binPROGRAMS: 234 | @$(NORMAL_UNINSTALL) 235 | @list='$(bin_PROGRAMS)'; for p in $$list; do \ 236 | f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 237 | echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ 238 | rm -f "$(DESTDIR)$(bindir)/$$f"; \ 239 | done 240 | 241 | clean-binPROGRAMS: 242 | -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) 243 | interceptty$(EXEEXT): $(interceptty_OBJECTS) $(interceptty_DEPENDENCIES) 244 | @rm -f interceptty$(EXEEXT) 245 | $(LINK) $(interceptty_LDFLAGS) $(interceptty_OBJECTS) $(interceptty_LDADD) $(LIBS) 246 | install-binSCRIPTS: $(bin_SCRIPTS) 247 | @$(NORMAL_INSTALL) 248 | test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" 249 | @list='$(bin_SCRIPTS)'; for p in $$list; do \ 250 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 251 | if test -f $$d$$p; then \ 252 | f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ 253 | echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ 254 | $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ 255 | else :; fi; \ 256 | done 257 | 258 | uninstall-binSCRIPTS: 259 | @$(NORMAL_UNINSTALL) 260 | @list='$(bin_SCRIPTS)'; for p in $$list; do \ 261 | f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ 262 | echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ 263 | rm -f "$(DESTDIR)$(bindir)/$$f"; \ 264 | done 265 | 266 | mostlyclean-compile: 267 | -rm -f *.$(OBJEXT) 268 | 269 | distclean-compile: 270 | -rm -f *.tab.c 271 | 272 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd-openpty.Po@am__quote@ 273 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ 274 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interceptty.Po@am__quote@ 275 | 276 | .c.o: 277 | @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ 278 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 279 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 280 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 281 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 282 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< 283 | 284 | .c.obj: 285 | @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ 286 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi 287 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 288 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 289 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 290 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` 291 | uninstall-info-am: 292 | install-man1: $(man1_MANS) $(man_MANS) 293 | @$(NORMAL_INSTALL) 294 | test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" 295 | @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ 296 | l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ 297 | for i in $$l2; do \ 298 | case "$$i" in \ 299 | *.1*) list="$$list $$i" ;; \ 300 | esac; \ 301 | done; \ 302 | for i in $$list; do \ 303 | if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ 304 | else file=$$i; fi; \ 305 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ 306 | case "$$ext" in \ 307 | 1*) ;; \ 308 | *) ext='1' ;; \ 309 | esac; \ 310 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ 311 | inst=`echo $$inst | sed -e 's/^.*\///'`; \ 312 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ 313 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ 314 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ 315 | done 316 | uninstall-man1: 317 | @$(NORMAL_UNINSTALL) 318 | @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ 319 | l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ 320 | for i in $$l2; do \ 321 | case "$$i" in \ 322 | *.1*) list="$$list $$i" ;; \ 323 | esac; \ 324 | done; \ 325 | for i in $$list; do \ 326 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ 327 | case "$$ext" in \ 328 | 1*) ;; \ 329 | *) ext='1' ;; \ 330 | esac; \ 331 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ 332 | inst=`echo $$inst | sed -e 's/^.*\///'`; \ 333 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ 334 | echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ 335 | rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ 336 | done 337 | 338 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 339 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 340 | unique=`for i in $$list; do \ 341 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 342 | done | \ 343 | $(AWK) ' { files[$$0] = 1; } \ 344 | END { for (i in files) print i; }'`; \ 345 | mkid -fID $$unique 346 | tags: TAGS 347 | 348 | TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ 349 | $(TAGS_FILES) $(LISP) 350 | tags=; \ 351 | here=`pwd`; \ 352 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ 353 | unique=`for i in $$list; do \ 354 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 355 | done | \ 356 | $(AWK) ' { files[$$0] = 1; } \ 357 | END { for (i in files) print i; }'`; \ 358 | test -z "$(ETAGS_ARGS)$$tags$$unique" \ 359 | || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 360 | $$tags $$unique 361 | ctags: CTAGS 362 | CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ 363 | $(TAGS_FILES) $(LISP) 364 | tags=; \ 365 | here=`pwd`; \ 366 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ 367 | unique=`for i in $$list; do \ 368 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 369 | done | \ 370 | $(AWK) ' { files[$$0] = 1; } \ 371 | END { for (i in files) print i; }'`; \ 372 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ 373 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 374 | $$tags $$unique 375 | 376 | GTAGS: 377 | here=`$(am__cd) $(top_builddir) && pwd` \ 378 | && cd $(top_srcdir) \ 379 | && gtags -i $(GTAGS_ARGS) $$here 380 | 381 | distclean-tags: 382 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 383 | 384 | distdir: $(DISTFILES) 385 | $(am__remove_distdir) 386 | mkdir $(distdir) 387 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 388 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 389 | list='$(DISTFILES)'; for file in $$list; do \ 390 | case $$file in \ 391 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 392 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 393 | esac; \ 394 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 395 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 396 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 397 | dir="/$$dir"; \ 398 | $(mkdir_p) "$(distdir)$$dir"; \ 399 | else \ 400 | dir=''; \ 401 | fi; \ 402 | if test -d $$d/$$file; then \ 403 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 404 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 405 | fi; \ 406 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 407 | else \ 408 | test -f $(distdir)/$$file \ 409 | || cp -p $$d/$$file $(distdir)/$$file \ 410 | || exit 1; \ 411 | fi; \ 412 | done 413 | -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ 414 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ 415 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ 416 | ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ 417 | || chmod -R a+r $(distdir) 418 | dist-gzip: distdir 419 | $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 420 | $(am__remove_distdir) 421 | 422 | dist-bzip2: distdir 423 | $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 424 | $(am__remove_distdir) 425 | 426 | dist-tarZ: distdir 427 | $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z 428 | $(am__remove_distdir) 429 | 430 | dist-shar: distdir 431 | shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz 432 | $(am__remove_distdir) 433 | 434 | dist-zip: distdir 435 | -rm -f $(distdir).zip 436 | zip -rq $(distdir).zip $(distdir) 437 | $(am__remove_distdir) 438 | 439 | dist dist-all: distdir 440 | $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 441 | $(am__remove_distdir) 442 | 443 | # This target untars the dist file and tries a VPATH configuration. Then 444 | # it guarantees that the distribution is self-contained by making another 445 | # tarfile. 446 | distcheck: dist 447 | case '$(DIST_ARCHIVES)' in \ 448 | *.tar.gz*) \ 449 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ 450 | *.tar.bz2*) \ 451 | bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ 452 | *.tar.Z*) \ 453 | uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ 454 | *.shar.gz*) \ 455 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\ 456 | *.zip*) \ 457 | unzip $(distdir).zip ;;\ 458 | esac 459 | chmod -R a-w $(distdir); chmod a+w $(distdir) 460 | mkdir $(distdir)/_build 461 | mkdir $(distdir)/_inst 462 | chmod a-w $(distdir) 463 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ 464 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ 465 | && cd $(distdir)/_build \ 466 | && ../configure --srcdir=.. --prefix="$$dc_install_base" \ 467 | $(DISTCHECK_CONFIGURE_FLAGS) \ 468 | && $(MAKE) $(AM_MAKEFLAGS) \ 469 | && $(MAKE) $(AM_MAKEFLAGS) dvi \ 470 | && $(MAKE) $(AM_MAKEFLAGS) check \ 471 | && $(MAKE) $(AM_MAKEFLAGS) install \ 472 | && $(MAKE) $(AM_MAKEFLAGS) installcheck \ 473 | && $(MAKE) $(AM_MAKEFLAGS) uninstall \ 474 | && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ 475 | distuninstallcheck \ 476 | && chmod -R a-w "$$dc_install_base" \ 477 | && ({ \ 478 | (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ 479 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ 480 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ 481 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ 482 | distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ 483 | } || { rm -rf "$$dc_destdir"; exit 1; }) \ 484 | && rm -rf "$$dc_destdir" \ 485 | && $(MAKE) $(AM_MAKEFLAGS) dist \ 486 | && rm -rf $(DIST_ARCHIVES) \ 487 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck 488 | $(am__remove_distdir) 489 | @(echo "$(distdir) archives ready for distribution: "; \ 490 | list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ 491 | sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' 492 | distuninstallcheck: 493 | @cd $(distuninstallcheck_dir) \ 494 | && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ 495 | || { echo "ERROR: files left after uninstall:" ; \ 496 | if test -n "$(DESTDIR)"; then \ 497 | echo " (check DESTDIR support)"; \ 498 | fi ; \ 499 | $(distuninstallcheck_listfiles) ; \ 500 | exit 1; } >&2 501 | distcleancheck: distclean 502 | @if test '$(srcdir)' = . ; then \ 503 | echo "ERROR: distcleancheck can only run from a VPATH build" ; \ 504 | exit 1 ; \ 505 | fi 506 | @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ 507 | || { echo "ERROR: files left in build directory after distclean:" ; \ 508 | $(distcleancheck_listfiles) ; \ 509 | exit 1; } >&2 510 | check-am: all-am 511 | $(MAKE) $(AM_MAKEFLAGS) check-local 512 | check: check-am 513 | all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h 514 | installdirs: 515 | for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ 516 | test -z "$$dir" || $(mkdir_p) "$$dir"; \ 517 | done 518 | install: install-am 519 | install-exec: install-exec-am 520 | install-data: install-data-am 521 | uninstall: uninstall-am 522 | 523 | install-am: all-am 524 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 525 | 526 | installcheck: installcheck-am 527 | install-strip: 528 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 529 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 530 | `test -z '$(STRIP)' || \ 531 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 532 | mostlyclean-generic: 533 | 534 | clean-generic: 535 | 536 | distclean-generic: 537 | -rm -f $(CONFIG_CLEAN_FILES) 538 | 539 | maintainer-clean-generic: 540 | @echo "This command is intended for maintainers to use" 541 | @echo "it deletes files that may require special tools to rebuild." 542 | clean: clean-am 543 | 544 | clean-am: clean-binPROGRAMS clean-generic mostlyclean-am 545 | 546 | distclean: distclean-am 547 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 548 | -rm -rf ./$(DEPDIR) 549 | -rm -f Makefile 550 | distclean-am: clean-am distclean-compile distclean-generic \ 551 | distclean-hdr distclean-tags 552 | 553 | dvi: dvi-am 554 | 555 | dvi-am: 556 | 557 | html: html-am 558 | 559 | info: info-am 560 | 561 | info-am: 562 | 563 | install-data-am: install-man 564 | 565 | install-exec-am: install-binPROGRAMS install-binSCRIPTS 566 | 567 | install-info: install-info-am 568 | 569 | install-man: install-man1 570 | 571 | installcheck-am: 572 | 573 | maintainer-clean: maintainer-clean-am 574 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 575 | -rm -rf $(top_srcdir)/autom4te.cache 576 | -rm -rf ./$(DEPDIR) 577 | -rm -f Makefile 578 | maintainer-clean-am: distclean-am maintainer-clean-generic 579 | 580 | mostlyclean: mostlyclean-am 581 | 582 | mostlyclean-am: mostlyclean-compile mostlyclean-generic 583 | 584 | pdf: pdf-am 585 | 586 | pdf-am: 587 | 588 | ps: ps-am 589 | 590 | ps-am: 591 | 592 | uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ 593 | uninstall-info-am uninstall-man 594 | 595 | uninstall-man: uninstall-man1 596 | 597 | .PHONY: CTAGS GTAGS all all-am am--refresh check check-am check-local \ 598 | clean clean-binPROGRAMS clean-generic ctags dist dist-all \ 599 | dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip distcheck \ 600 | distclean distclean-compile distclean-generic distclean-hdr \ 601 | distclean-tags distcleancheck distdir distuninstallcheck dvi \ 602 | dvi-am html html-am info info-am install install-am \ 603 | install-binPROGRAMS install-binSCRIPTS install-data \ 604 | install-data-am install-exec install-exec-am install-info \ 605 | install-info-am install-man install-man1 install-strip \ 606 | installcheck installcheck-am installdirs maintainer-clean \ 607 | maintainer-clean-generic mostlyclean mostlyclean-compile \ 608 | mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ 609 | uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \ 610 | uninstall-info-am uninstall-man uninstall-man1 611 | 612 | check-local: interceptty test 613 | $(SHELL) ./test 614 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 615 | # Otherwise a system limit (for SysV at least) may be exceeded. 616 | .NOEXPORT: 617 | -------------------------------------------------------------------------------- /openZSniffer/NEWS: -------------------------------------------------------------------------------- 1 | Version 0.6 (9/5/2004) 2 | ====================== 3 | 4 | Important fixes for running as root systems with /dev/ptmx! Earlier 5 | versions screwed up permissions on /dev/ptmx on some systems, making a 6 | real mess. 7 | 8 | Other features useful for running as root: Can now set permissions on 9 | pty, and also chroot and switch UID/GID after opening devices. 10 | 11 | If permissions are set on the pty, create a process to monitor 12 | interceptty for exit, and when it finishes fix up permissions. This 13 | makes sure permissions get reset even if interceptty dies 14 | unexpectedly, and also allows us to reset a pty owner even if we've 15 | dropped privileges. This isn't necessary on modern systems, but 16 | doesn't hurt. 17 | 18 | Version 0.5 (7/3/2004) 19 | ====================== 20 | 21 | Many portability fixes. Lifted PTY code from OpenSSH. Tested on RedHat 22 | 7.2, Fedora Core 2, Solaris 2.8, OpenBSD 2.9. Should be portable to 23 | all platforms OpenSSH is, although it may need some fixes. 24 | 25 | Version 0.4 (6/27/2004) 26 | ======================= 27 | 28 | Added all sorts of new backends, and some new frontends too, including 29 | new VMWare compatability. See the manpage for more information. 30 | 31 | Added a manpage. 32 | 33 | We don't poll when our first client goes away now. 34 | 35 | Signal handling using sigaction, and should be more reliable. 36 | 37 | Add some switches, to reduce the amount of output and print the 38 | version. 39 | 40 | Use -Wall compiler flags. 41 | 42 | 43 | Version 0.3 44 | =========== 45 | Fixed a problem with option parsing that prevented the 'front-device' 46 | option from working. 47 | 48 | Version 0.2b 49 | ============ 50 | Replaced accidental inclusion of an incorrect COPYING file. 51 | 52 | Version 0.2 53 | =========== 54 | 55 | Modified to use GNU autoconf. 56 | 57 | Fixed a problem with option parsing that prevented '-t' from working. 58 | 59 | Re-formatted the whole thing, converting from the ttysnoop-style to my 60 | own preferred style. 61 | 62 | Version 0.1b 63 | =========== 64 | Fixed a compilation problem. 65 | 66 | Version 0.1 67 | =========== 68 | This is the first release. 69 | 70 | 71 | $Id: NEWS,v 7.7 2004/09/05 22:42:29 gifford Exp $ 72 | -------------------------------------------------------------------------------- /openZSniffer/README: -------------------------------------------------------------------------------- 1 | interceptty V0.6 2 | ---------------- 3 | Copyright 2000-2004 by Scott Gifford 4 | This software is licensed under the GNU Public License. See the file 5 | COPYING included with this distribution for details 6 | 7 | interceptty is designed to sit between a serial port (or other 8 | terminal device, or program, or socket, or something connected to a 9 | file descriptor) and a program which is communicating with that 10 | device, recording everything that goes back and forth between the two. 11 | It does this by opening the real device, creating a pseudo-tty, then 12 | forwarding everything between the two, recording whatever it sees. It 13 | has a number of options that let you fine-tune the devices it uses and 14 | the terminal options for the real device. 15 | 16 | See the included manpage for more information. 17 | 18 | Compiling 19 | --------- 20 | 21 | The configuration of interceptty is now managed by autoconf. That 22 | means that you run 23 | 24 | ./configure 25 | make 26 | make install 27 | 28 | to go from just-unwrapped-the-tarfile to installed-on-your-computer. 29 | 30 | For more details on using the configure script, run: 31 | 32 | ./configure --help 33 | 34 | or see the INSTALL file included with this distribution. 35 | 36 | There is a test script that is useful for making sure everything's 37 | basically worked. After compiling and before installing, it's a good 38 | idea to run: 39 | 40 | ./test 41 | 42 | The script takes about 30 seconds to run, and will run interceptty in 43 | several configurations, making sure they all work as expected. 44 | 45 | $Id: README,v 7.4 2004/09/05 23:01:34 gifford Exp $ 46 | -------------------------------------------------------------------------------- /openZSniffer/TODO: -------------------------------------------------------------------------------- 1 | Review code for correctness, security, and efficiency. 2 | 3 | Handle permissions on pseudo-tty's we create. 4 | 5 | This should really be a simple, tty-specific program, with other 6 | programs (like tcpserver, netcat, or the shell) used to provide the 7 | more complex functionality. 8 | 9 | Proper device locking, using whatever's appropriate according to local 10 | custom. 11 | -------------------------------------------------------------------------------- /openZSniffer/bsd-openpty.c: -------------------------------------------------------------------------------- 1 | /* This file was taken from portable openssh 3.8p1, as permitted by 2 | * its license. 3 | * 4 | * It has been somewhat modified by Scott Gifford 5 | * Any bugs here are my responsibility, not Damien Miller's or the 6 | * OpenSSH team. 7 | */ 8 | 9 | /* 10 | * Please note: this implementation of openpty() is far from complete. 11 | * it is just enough for our needs. 12 | */ 13 | 14 | /* 15 | * Copyright (c) 2004 Damien Miller 16 | * 17 | * Permission to use, copy, modify, and distribute this software for any 18 | * purpose with or without fee is hereby granted, provided that the above 19 | * copyright notice and this permission notice appear in all copies. 20 | * 21 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 22 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 24 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 25 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 26 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 27 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 28 | */ 29 | 30 | /* 31 | * Author: Tatu Ylonen 32 | * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland 33 | * All rights reserved 34 | * Allocating a pseudo-terminal, and making it the controlling tty. 35 | * 36 | * As far as I am concerned, the code I have written for this software 37 | * can be used freely for any purpose. Any derived versions of this 38 | * software must be clearly marked as such, and if the derived work is 39 | * incompatible with the protocol description in the RFC file, it must be 40 | * called by a name other than "ssh" or "Secure Shell". 41 | */ 42 | 43 | #include "config.h" 44 | #include "bsd-openpty.h" 45 | 46 | #include 47 | /* This XOPEN hack seems to be required for Linux. --sg */ 48 | #define __USE_XOPEN 1 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | #ifdef HAVE_UTIL_H 58 | # include 59 | #endif /* HAVE_UTIL_H */ 60 | 61 | #ifdef HAVE_PTY_H 62 | # include 63 | #endif 64 | #if defined(HAVE_DEV_PTMX) && defined(HAVE_SYS_STROPTS_H) 65 | # include 66 | #endif 67 | 68 | #ifndef O_NOCTTY 69 | #define O_NOCTTY 0 70 | #endif 71 | 72 | typedef void (*mysig_t)(int); 73 | 74 | int 75 | my_openpty(int *amaster, int *aslave, char *name) 76 | { 77 | #if defined(HAVE_OPENPTY) 78 | /* Re-implement with clearer rules about the size of name: 79 | * must be TTYLEN+1 bytes. 80 | */ 81 | char *tmpname; 82 | 83 | if (openpty(amaster, aslave, NULL, NULL, NULL) < 0) 84 | return -1; 85 | if (!name) 86 | return 0; 87 | if ((tmpname = ttyname(*aslave)) == NULL) 88 | return -1; 89 | if (strlen(tmpname) > TTYLEN) 90 | return -1; 91 | strcpy(name,tmpname); 92 | return (0); 93 | #elif defined(HAVE__GETPTY) 94 | /* 95 | * _getpty(3) exists in SGI Irix 4.x, 5.x & 6.x -- it generates more 96 | * pty's automagically when needed 97 | */ 98 | char *slave; 99 | 100 | if ((slave = _getpty(amaster, O_RDWR, 0622, 0)) == NULL) 101 | return (-1); 102 | if (strlen(slave) > TTYLEN) 103 | return (-1); 104 | strcpy(name,slave); 105 | /* Open the slave side. */ 106 | if ((*aslave = open(slave, O_RDWR | O_NOCTTY)) == -1) { 107 | close(*amaster); 108 | return (-1); 109 | } 110 | return (0); 111 | 112 | #elif defined(HAVE_DEV_PTMX) 113 | /* 114 | * This code is used e.g. on Solaris 2.x. (Note that Solaris 2.3 115 | * also has bsd-style ptys, but they simply do not work.) 116 | */ 117 | int ptm; 118 | char *pts; 119 | mysig_t old_signal; 120 | 121 | if ((ptm = open("/dev/ptmx", O_RDWR | O_NOCTTY)) == -1) 122 | return (-1); 123 | 124 | /* XXX: need to close ptm on error? */ 125 | old_signal = signal(SIGCHLD, SIG_DFL); 126 | if (grantpt(ptm) < 0) 127 | return (-1); 128 | signal(SIGCHLD, old_signal); 129 | 130 | if (unlockpt(ptm) < 0) 131 | return (-1); 132 | 133 | *amaster = ptm; 134 | 135 | /* Get the name of the slave side */ 136 | if ((pts = ptsname(ptm)) == NULL) 137 | return (-1); 138 | if (strlen(pts) > TTYLEN) 139 | return -1; 140 | strcpy(name,pts); 141 | 142 | /* Open the slave side. */ 143 | if ((*aslave = open(pts, O_RDWR | O_NOCTTY)) == -1) { 144 | close(*amaster); 145 | return (-1); 146 | } 147 | 148 | #ifndef HAVE_CYGWIN 149 | /* 150 | * Try to push the appropriate streams modules, as described 151 | * in Solaris pts(7). 152 | */ 153 | ioctl(*aslave, I_PUSH, "ptem"); 154 | ioctl(*aslave, I_PUSH, "ldterm"); 155 | # ifndef __hpux 156 | ioctl(*aslave, I_PUSH, "ttcompat"); 157 | # endif /* __hpux */ 158 | #endif /* HAVE_CYGWIN */ 159 | 160 | return (0); 161 | 162 | #elif defined(HAVE_DEV_PTS_AND_PTC) 163 | /* AIX-style pty code. */ 164 | const char *ttname; 165 | 166 | if ((*amaster = open("/dev/ptc", O_RDWR | O_NOCTTY)) == -1) 167 | return (-1); 168 | if ((ttname = ttyname(*amaster)) == NULL) 169 | return (-1); 170 | if (strlen(ttname) > TTYLEN) 171 | return (-1); 172 | if ((*aslave = open(ttname, O_RDWR | O_NOCTTY)) == -1) { 173 | close(*amaster); 174 | return (-1); 175 | } 176 | return (0); 177 | 178 | #elif defined(_UNICOS) 179 | char ptbuf[64], ttbuf[64]; 180 | int i; 181 | int highpty; 182 | 183 | highpty = 128; 184 | #ifdef _SC_CRAY_NPTY 185 | if ((highpty = sysconf(_SC_CRAY_NPTY)) == -1) 186 | highpty = 128; 187 | #endif /* _SC_CRAY_NPTY */ 188 | 189 | for (i = 0; i < highpty; i++) { 190 | snprintf(ptbuf, sizeof(ptbuf), "/dev/pty/%03d", i); 191 | snprintf(ttbuf, sizeof(ttbuf), "/dev/ttyp%03d", i); 192 | if ((*amaster = open(ptbuf, O_RDWR|O_NOCTTY)) == -1) 193 | continue; 194 | /* Open the slave side. */ 195 | if (strlen(ttbuf) > TTYLEN) 196 | return (-1); 197 | strcpy(name,ttbuf); 198 | if ((*aslave = open(ttbuf, O_RDWR|O_NOCTTY)) == -1) { 199 | close(*amaster); 200 | return (-1); 201 | } 202 | return (0); 203 | } 204 | return (-1); 205 | 206 | #else 207 | /* BSD-style pty code. */ 208 | char ptbuf[64], ttbuf[64]; 209 | int i; 210 | const char *ptymajors = "pqrstuvwxyzabcdefghijklmno" 211 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 212 | const char *ptyminors = "0123456789abcdef"; 213 | int num_minors = strlen(ptyminors); 214 | int num_ptys = strlen(ptymajors) * num_minors; 215 | struct termios tio; 216 | 217 | for (i = 0; i < num_ptys; i++) { 218 | snprintf(ptbuf, sizeof(ptbuf), "/dev/pty%c%c", 219 | ptymajors[i / num_minors], ptyminors[i % num_minors]); 220 | snprintf(ttbuf, sizeof(ttbuf), "/dev/tty%c%c", 221 | ptymajors[i / num_minors], ptyminors[i % num_minors]); 222 | 223 | if ((*amaster = open(ptbuf, O_RDWR | O_NOCTTY)) == -1) { 224 | /* Try SCO style naming */ 225 | snprintf(ptbuf, sizeof(ptbuf), "/dev/ptyp%d", i); 226 | snprintf(ttbuf, sizeof(ttbuf), "/dev/ttyp%d", i); 227 | if ((*amaster = open(ptbuf, O_RDWR | O_NOCTTY)) == -1) 228 | continue; 229 | } 230 | if (strlen(ttbuf) > TTYLEN) 231 | return (-1); 232 | strcpy(name,ttbuf); 233 | /* Open the slave side. */ 234 | if ((*aslave = open(ttbuf, O_RDWR | O_NOCTTY)) == -1) { 235 | close(*amaster); 236 | return (-1); 237 | } 238 | /* set tty modes to a sane state for broken clients */ 239 | if (tcgetattr(*amaster, &tio) != -1) { 240 | tio.c_lflag |= (ECHO | ISIG | ICANON); 241 | tio.c_oflag |= (OPOST | ONLCR); 242 | tio.c_iflag |= ICRNL; 243 | tcsetattr(*amaster, TCSANOW, &tio); 244 | } 245 | 246 | return (0); 247 | } 248 | return (-1); 249 | #endif 250 | } 251 | 252 | 253 | -------------------------------------------------------------------------------- /openZSniffer/bsd-openpty.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef HAVE_PTY_H 3 | # include 4 | #endif 5 | 6 | int my_openpty(int *, int *, char *); 7 | #define TTYLEN 32 8 | -------------------------------------------------------------------------------- /openZSniffer/common.c: -------------------------------------------------------------------------------- 1 | /* 2 | common.c 3 | */ 4 | 5 | /* $Id: common.c,v 7.2 2003/10/01 20:21:09 sgifford Exp $ */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "common.h" 14 | 15 | #define TTY_STORE 16 16 | 17 | static struct termios orig_tty_state[TTY_STORE]; 18 | static int sttyfds[TTY_STORE]; 19 | 20 | void errorf (char *fmt, ...) 21 | { 22 | va_list args; 23 | 24 | va_start (args, fmt); 25 | vfprintf (stderr, fmt, args); 26 | exit (1); 27 | } 28 | 29 | int fdprintf (int fd, char *fmt, ...) 30 | { 31 | va_list args; 32 | int r; 33 | char str[256]; 34 | 35 | va_start (args, fmt); 36 | r = vsprintf(str, fmt, args); 37 | write (fd, str, r); 38 | 39 | return (r); 40 | } 41 | 42 | char *leafname (char *path) 43 | { 44 | int i = 0, j; 45 | 46 | for (j = 0; path[j]; j++) 47 | if (path[j] == '/') 48 | i = j + 1; 49 | 50 | return (path + i); 51 | } 52 | 53 | /* init the stty store array */ 54 | 55 | void stty_initstore (void) 56 | { 57 | int i; 58 | 59 | for (i = 0; i < TTY_STORE; i++) 60 | sttyfds[i] = -1; 61 | } 62 | 63 | /* set tty on fd into raw mode */ 64 | 65 | int stty_raw (int fd) 66 | { 67 | struct termios tty_state; 68 | int i; 69 | 70 | if (tcgetattr(fd, &tty_state) < 0) 71 | return (-1); 72 | 73 | for (i = 0; i < TTY_STORE; i++) 74 | if (sttyfds[i] == -1) 75 | { 76 | orig_tty_state[i] = tty_state; 77 | sttyfds[i] = fd; 78 | break; 79 | } 80 | 81 | tty_state.c_lflag &= ~(ICANON | IEXTEN | ISIG | ECHO); 82 | tty_state.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON | BRKINT); 83 | tty_state.c_oflag &= ~OPOST; 84 | tty_state.c_cflag |= CS8; 85 | 86 | tty_state.c_cc[VMIN] = 1; 87 | tty_state.c_cc[VTIME] = 0; 88 | 89 | if (tcsetattr(fd, TCSAFLUSH, &tty_state) < 0) 90 | return (-1); 91 | 92 | return (0); 93 | } 94 | 95 | /* restore all altered ttys to their original state */ 96 | 97 | void stty_orig (void) 98 | { 99 | int i; 100 | 101 | for (i = 0; i < TTY_STORE; i++) 102 | if (sttyfds[i] != -1) 103 | { 104 | tcsetattr (sttyfds[i], TCSAFLUSH, &orig_tty_state[i]); 105 | sttyfds[i] = -1; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /openZSniffer/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | common.h 3 | */ 4 | 5 | /* $Id: common.h,v 7.1 2000/05/03 04:41:24 sgifford Exp $ */ 6 | 7 | #define max(x,y) ((x) > (y) ? (x) : (y)) 8 | #define strncopy(x,y) strncpy (x, y, sizeof(x)) 9 | 10 | void errorf (char *fmt, ...); 11 | int fdprintf (int fd, char *fmt, ...); 12 | char *leafname (char *path); 13 | void stty_initstore (void); 14 | int stty_raw (int fd); 15 | void stty_orig (void); 16 | -------------------------------------------------------------------------------- /openZSniffer/config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if compiling under cygwin */ 4 | #undef HAVE_CYGWIN 5 | 6 | /* Define to 1 if you have a /dev/ptmx device */ 7 | #undef HAVE_DEV_PTMX 8 | 9 | /* Define to 1 if you have a /dev/ptc device */ 10 | #undef HAVE_DEV_PTS_AND_PTC 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_FCNTL_H 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_INTTYPES_H 17 | 18 | /* Define to 1 if you have the `nsl' library (-lnsl). */ 19 | #undef HAVE_LIBNSL 20 | 21 | /* Define to 1 if you have the `socket' library (-lsocket). */ 22 | #undef HAVE_LIBSOCKET 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_LIBUTIL_H 26 | 27 | /* Define to 1 if you have the `logout' function. */ 28 | #undef HAVE_LOGOUT 29 | 30 | /* Define to 1 if you have the `logwtmp' function. */ 31 | #undef HAVE_LOGWTMP 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_MEMORY_H 35 | 36 | /* Define to 1 if you have the BSD openpty function */ 37 | #undef HAVE_OPENPTY 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_PTY_H 41 | 42 | /* Define to 1 if you have the `select' function. */ 43 | #undef HAVE_SELECT 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_STDINT_H 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #undef HAVE_STDLIB_H 50 | 51 | /* Define to 1 if you have the `strerror' function. */ 52 | #undef HAVE_STRERROR 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #undef HAVE_STRINGS_H 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #undef HAVE_STRING_H 59 | 60 | /* Define to 1 if you have the header file. */ 61 | #undef HAVE_SYS_IOCTL_H 62 | 63 | /* Define to 1 if you have the header file. */ 64 | #undef HAVE_SYS_STAT_H 65 | 66 | /* Define to 1 if you have the header file. */ 67 | #undef HAVE_SYS_STROPTS_H 68 | 69 | /* Define to 1 if you have the header file. */ 70 | #undef HAVE_SYS_TYPES_H 71 | 72 | /* Define to 1 if you have that is POSIX.1 compatible. */ 73 | #undef HAVE_SYS_WAIT_H 74 | 75 | /* Define to 1 if you have the header file. */ 76 | #undef HAVE_UNISTD_H 77 | 78 | /* Define to 1 if you have the `updwtmp' function. */ 79 | #undef HAVE_UPDWTMP 80 | 81 | /* Define to 1 if you have the header file. */ 82 | #undef HAVE_UTIL_H 83 | 84 | /* Define to 1 if you have the `_getpty' function. */ 85 | #undef HAVE__GETPTY 86 | 87 | /* Name of package */ 88 | #undef PACKAGE 89 | 90 | /* Define to the address where bug reports for this package should be sent. */ 91 | #undef PACKAGE_BUGREPORT 92 | 93 | /* Define to the full name of this package. */ 94 | #undef PACKAGE_NAME 95 | 96 | /* Define to the full name and version of this package. */ 97 | #undef PACKAGE_STRING 98 | 99 | /* Define to the one symbol short name of this package. */ 100 | #undef PACKAGE_TARNAME 101 | 102 | /* Define to the version of this package. */ 103 | #undef PACKAGE_VERSION 104 | 105 | /* Define as the return type of signal handlers (`int' or `void'). */ 106 | #undef RETSIGTYPE 107 | 108 | /* Define to 1 if you have the ANSI C header files. */ 109 | #undef STDC_HEADERS 110 | 111 | /* Version number of package */ 112 | #undef VERSION 113 | -------------------------------------------------------------------------------- /openZSniffer/configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | AC_INIT(interceptty.c) 3 | AM_INIT_AUTOMAKE(interceptty, 0.6) 4 | AM_CONFIG_HEADER(config.h) 5 | 6 | dnl Checks for programs. 7 | AC_PROG_CC 8 | AC_PROG_INSTALL 9 | 10 | dnl Checks for header files. 11 | AC_HEADER_STDC 12 | AC_HEADER_SYS_WAIT 13 | AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h util.h sys/stropts.h pty.h) 14 | 15 | dnl Checks for libutil functions 16 | AC_CHECK_FUNCS(logout updwtmp logwtmp) 17 | AC_ARG_ENABLE(libutil, 18 | [ --disable-libutil disable use of libutil (openpty() etc.) (no)]) 19 | AC_ARG_ENABLE(openpty, 20 | [ --disable-openpty disable use of openpty (no)]) 21 | 22 | if test "x$enable_libutil" != "xno" ; then 23 | AC_CHECK_HEADERS(util.h) 24 | AC_CHECK_HEADERS(libutil.h) 25 | if test "x$enable_openpty" != "xno"; then 26 | AC_CHECK_FUNCS(openpty) 27 | AC_SEARCH_LIBS(openpty, util bsd, [AC_DEFINE(HAVE_OPENPTY,1,Define to 1 if you have the BSD openpty function)]) 28 | fi 29 | fi 30 | 31 | dnl Checks for library functions. 32 | AC_TYPE_SIGNAL 33 | AC_CHECK_LIB(nsl,gethostbyname) 34 | AC_CHECK_LIB(socket, setsockopt, , , setsockopt) 35 | AC_CHECK_FUNCS(_getpty select strerror) 36 | 37 | # Check for some target-specific stuff 38 | case "$host" in 39 | *-cygwin*) 40 | check_for_libcrypt_later=1 41 | LIBS="$LIBS /usr/lib/textmode.o" 42 | AC_DEFINE(HAVE_CYGWIN,1,Define to 1 if compiling under cygwin) 43 | ;; 44 | esac 45 | 46 | 47 | AC_ARG_ENABLE(dev-ptmx, 48 | [ --disable-dev-ptmx disable use of /dev/ptmx (no)]) 49 | 50 | if test "x$enable_dev_ptmx" != "xno" ; then 51 | AC_CHECK_FILE("/dev/ptmx", 52 | [ 53 | AC_DEFINE(HAVE_DEV_PTMX,1,Define to 1 if you have a /dev/ptmx device) 54 | have_dev_ptmx=1 55 | ] 56 | ) 57 | fi 58 | 59 | 60 | AC_ARG_ENABLE(dev-ptc, 61 | [ --disable-dev-ptc disable use of /dev/ptc (no)]) 62 | 63 | if test "x$enable_dev_ptc" != "xno" ; then 64 | AC_CHECK_FILE("/dev/ptc", 65 | [ 66 | AC_DEFINE(HAVE_DEV_PTS_AND_PTC,1,Define to 1 if you have a /dev/ptc device) 67 | have_dev_ptc=1 68 | ] 69 | ) 70 | fi 71 | 72 | 73 | 74 | 75 | AC_OUTPUT(Makefile) 76 | 77 | dnl $Id: configure.in,v 7.9 2004/09/05 22:46:57 gifford Exp $ 78 | -------------------------------------------------------------------------------- /openZSniffer/depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # depcomp - compile a program generating dependencies as side-effects 3 | 4 | scriptversion=2003-11-08.23 5 | 6 | # Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. 7 | 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | # 02111-1307, USA. 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | # Originally written by Alexandre Oliva . 29 | 30 | case $1 in 31 | '') 32 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 33 | exit 1; 34 | ;; 35 | -h | --h*) 36 | cat <<\EOF 37 | Usage: depcomp [--help] [--version] PROGRAM [ARGS] 38 | 39 | Run PROGRAMS ARGS to compile a file, generating dependencies 40 | as side-effects. 41 | 42 | Environment variables: 43 | depmode Dependency tracking mode. 44 | source Source file read by `PROGRAMS ARGS'. 45 | object Object file output by `PROGRAMS ARGS'. 46 | depfile Dependency file to output. 47 | tmpdepfile Temporary file to use when outputing dependencies. 48 | libtool Whether libtool is used (yes/no). 49 | 50 | Report bugs to . 51 | EOF 52 | exit 0 53 | ;; 54 | -v | --v*) 55 | echo "depcomp $scriptversion" 56 | exit 0 57 | ;; 58 | esac 59 | 60 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 61 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 62 | exit 1 63 | fi 64 | # `libtool' can also be set to `yes' or `no'. 65 | 66 | if test -z "$depfile"; then 67 | base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` 68 | dir=`echo "$object" | sed 's,/.*$,/,'` 69 | if test "$dir" = "$object"; then 70 | dir= 71 | fi 72 | # FIXME: should be _deps on DOS. 73 | depfile="$dir.deps/$base" 74 | fi 75 | 76 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 77 | 78 | rm -f "$tmpdepfile" 79 | 80 | # Some modes work just like other modes, but use different flags. We 81 | # parameterize here, but still list the modes in the big case below, 82 | # to make depend.m4 easier to write. Note that we *cannot* use a case 83 | # here, because this file can only contain one case statement. 84 | if test "$depmode" = hp; then 85 | # HP compiler uses -M and no extra arg. 86 | gccflag=-M 87 | depmode=gcc 88 | fi 89 | 90 | if test "$depmode" = dashXmstdout; then 91 | # This is just like dashmstdout with a different argument. 92 | dashmflag=-xM 93 | depmode=dashmstdout 94 | fi 95 | 96 | case "$depmode" in 97 | gcc3) 98 | ## gcc 3 implements dependency tracking that does exactly what 99 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 100 | ## it if -MD -MP comes after the -MF stuff. Hmm. 101 | "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 102 | stat=$? 103 | if test $stat -eq 0; then : 104 | else 105 | rm -f "$tmpdepfile" 106 | exit $stat 107 | fi 108 | mv "$tmpdepfile" "$depfile" 109 | ;; 110 | 111 | gcc) 112 | ## There are various ways to get dependency output from gcc. Here's 113 | ## why we pick this rather obscure method: 114 | ## - Don't want to use -MD because we'd like the dependencies to end 115 | ## up in a subdir. Having to rename by hand is ugly. 116 | ## (We might end up doing this anyway to support other compilers.) 117 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 118 | ## -MM, not -M (despite what the docs say). 119 | ## - Using -M directly means running the compiler twice (even worse 120 | ## than renaming). 121 | if test -z "$gccflag"; then 122 | gccflag=-MD, 123 | fi 124 | "$@" -Wp,"$gccflag$tmpdepfile" 125 | stat=$? 126 | if test $stat -eq 0; then : 127 | else 128 | rm -f "$tmpdepfile" 129 | exit $stat 130 | fi 131 | rm -f "$depfile" 132 | echo "$object : \\" > "$depfile" 133 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 134 | ## The second -e expression handles DOS-style file names with drive letters. 135 | sed -e 's/^[^:]*: / /' \ 136 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 137 | ## This next piece of magic avoids the `deleted header file' problem. 138 | ## The problem is that when a header file which appears in a .P file 139 | ## is deleted, the dependency causes make to die (because there is 140 | ## typically no way to rebuild the header). We avoid this by adding 141 | ## dummy dependencies for each header file. Too bad gcc doesn't do 142 | ## this for us directly. 143 | tr ' ' ' 144 | ' < "$tmpdepfile" | 145 | ## Some versions of gcc put a space before the `:'. On the theory 146 | ## that the space means something, we add a space to the output as 147 | ## well. 148 | ## Some versions of the HPUX 10.20 sed can't process this invocation 149 | ## correctly. Breaking it into two sed invocations is a workaround. 150 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 151 | rm -f "$tmpdepfile" 152 | ;; 153 | 154 | hp) 155 | # This case exists only to let depend.m4 do its work. It works by 156 | # looking at the text of this script. This case will never be run, 157 | # since it is checked for above. 158 | exit 1 159 | ;; 160 | 161 | sgi) 162 | if test "$libtool" = yes; then 163 | "$@" "-Wp,-MDupdate,$tmpdepfile" 164 | else 165 | "$@" -MDupdate "$tmpdepfile" 166 | fi 167 | stat=$? 168 | if test $stat -eq 0; then : 169 | else 170 | rm -f "$tmpdepfile" 171 | exit $stat 172 | fi 173 | rm -f "$depfile" 174 | 175 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 176 | echo "$object : \\" > "$depfile" 177 | 178 | # Clip off the initial element (the dependent). Don't try to be 179 | # clever and replace this with sed code, as IRIX sed won't handle 180 | # lines with more than a fixed number of characters (4096 in 181 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 182 | # the IRIX cc adds comments like `#:fec' to the end of the 183 | # dependency line. 184 | tr ' ' ' 185 | ' < "$tmpdepfile" \ 186 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 187 | tr ' 188 | ' ' ' >> $depfile 189 | echo >> $depfile 190 | 191 | # The second pass generates a dummy entry for each header file. 192 | tr ' ' ' 193 | ' < "$tmpdepfile" \ 194 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 195 | >> $depfile 196 | else 197 | # The sourcefile does not contain any dependencies, so just 198 | # store a dummy comment line, to avoid errors with the Makefile 199 | # "include basename.Plo" scheme. 200 | echo "#dummy" > "$depfile" 201 | fi 202 | rm -f "$tmpdepfile" 203 | ;; 204 | 205 | aix) 206 | # The C for AIX Compiler uses -M and outputs the dependencies 207 | # in a .u file. In older versions, this file always lives in the 208 | # current directory. Also, the AIX compiler puts `$object:' at the 209 | # start of each line; $object doesn't have directory information. 210 | # Version 6 uses the directory in both cases. 211 | stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 212 | tmpdepfile="$stripped.u" 213 | if test "$libtool" = yes; then 214 | "$@" -Wc,-M 215 | else 216 | "$@" -M 217 | fi 218 | stat=$? 219 | 220 | if test -f "$tmpdepfile"; then : 221 | else 222 | stripped=`echo "$stripped" | sed 's,^.*/,,'` 223 | tmpdepfile="$stripped.u" 224 | fi 225 | 226 | if test $stat -eq 0; then : 227 | else 228 | rm -f "$tmpdepfile" 229 | exit $stat 230 | fi 231 | 232 | if test -f "$tmpdepfile"; then 233 | outname="$stripped.o" 234 | # Each line is of the form `foo.o: dependent.h'. 235 | # Do two passes, one to just change these to 236 | # `$object: dependent.h' and one to simply `dependent.h:'. 237 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 238 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 239 | else 240 | # The sourcefile does not contain any dependencies, so just 241 | # store a dummy comment line, to avoid errors with the Makefile 242 | # "include basename.Plo" scheme. 243 | echo "#dummy" > "$depfile" 244 | fi 245 | rm -f "$tmpdepfile" 246 | ;; 247 | 248 | icc) 249 | # Intel's C compiler understands `-MD -MF file'. However on 250 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 251 | # ICC 7.0 will fill foo.d with something like 252 | # foo.o: sub/foo.c 253 | # foo.o: sub/foo.h 254 | # which is wrong. We want: 255 | # sub/foo.o: sub/foo.c 256 | # sub/foo.o: sub/foo.h 257 | # sub/foo.c: 258 | # sub/foo.h: 259 | # ICC 7.1 will output 260 | # foo.o: sub/foo.c sub/foo.h 261 | # and will wrap long lines using \ : 262 | # foo.o: sub/foo.c ... \ 263 | # sub/foo.h ... \ 264 | # ... 265 | 266 | "$@" -MD -MF "$tmpdepfile" 267 | stat=$? 268 | if test $stat -eq 0; then : 269 | else 270 | rm -f "$tmpdepfile" 271 | exit $stat 272 | fi 273 | rm -f "$depfile" 274 | # Each line is of the form `foo.o: dependent.h', 275 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 276 | # Do two passes, one to just change these to 277 | # `$object: dependent.h' and one to simply `dependent.h:'. 278 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 279 | # Some versions of the HPUX 10.20 sed can't process this invocation 280 | # correctly. Breaking it into two sed invocations is a workaround. 281 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 282 | sed -e 's/$/ :/' >> "$depfile" 283 | rm -f "$tmpdepfile" 284 | ;; 285 | 286 | tru64) 287 | # The Tru64 compiler uses -MD to generate dependencies as a side 288 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 289 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 290 | # dependencies in `foo.d' instead, so we check for that too. 291 | # Subdirectories are respected. 292 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 293 | test "x$dir" = "x$object" && dir= 294 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 295 | 296 | if test "$libtool" = yes; then 297 | tmpdepfile1="$dir.libs/$base.lo.d" 298 | tmpdepfile2="$dir.libs/$base.d" 299 | "$@" -Wc,-MD 300 | else 301 | tmpdepfile1="$dir$base.o.d" 302 | tmpdepfile2="$dir$base.d" 303 | "$@" -MD 304 | fi 305 | 306 | stat=$? 307 | if test $stat -eq 0; then : 308 | else 309 | rm -f "$tmpdepfile1" "$tmpdepfile2" 310 | exit $stat 311 | fi 312 | 313 | if test -f "$tmpdepfile1"; then 314 | tmpdepfile="$tmpdepfile1" 315 | else 316 | tmpdepfile="$tmpdepfile2" 317 | fi 318 | if test -f "$tmpdepfile"; then 319 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 320 | # That's a tab and a space in the []. 321 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 322 | else 323 | echo "#dummy" > "$depfile" 324 | fi 325 | rm -f "$tmpdepfile" 326 | ;; 327 | 328 | #nosideeffect) 329 | # This comment above is used by automake to tell side-effect 330 | # dependency tracking mechanisms from slower ones. 331 | 332 | dashmstdout) 333 | # Important note: in order to support this mode, a compiler *must* 334 | # always write the preprocessed file to stdout, regardless of -o. 335 | "$@" || exit $? 336 | 337 | # Remove the call to Libtool. 338 | if test "$libtool" = yes; then 339 | while test $1 != '--mode=compile'; do 340 | shift 341 | done 342 | shift 343 | fi 344 | 345 | # Remove `-o $object'. 346 | IFS=" " 347 | for arg 348 | do 349 | case $arg in 350 | -o) 351 | shift 352 | ;; 353 | $object) 354 | shift 355 | ;; 356 | *) 357 | set fnord "$@" "$arg" 358 | shift # fnord 359 | shift # $arg 360 | ;; 361 | esac 362 | done 363 | 364 | test -z "$dashmflag" && dashmflag=-M 365 | # Require at least two characters before searching for `:' 366 | # in the target name. This is to cope with DOS-style filenames: 367 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 368 | "$@" $dashmflag | 369 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 370 | rm -f "$depfile" 371 | cat < "$tmpdepfile" > "$depfile" 372 | tr ' ' ' 373 | ' < "$tmpdepfile" | \ 374 | ## Some versions of the HPUX 10.20 sed can't process this invocation 375 | ## correctly. Breaking it into two sed invocations is a workaround. 376 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 377 | rm -f "$tmpdepfile" 378 | ;; 379 | 380 | dashXmstdout) 381 | # This case only exists to satisfy depend.m4. It is never actually 382 | # run, as this mode is specially recognized in the preamble. 383 | exit 1 384 | ;; 385 | 386 | makedepend) 387 | "$@" || exit $? 388 | # Remove any Libtool call 389 | if test "$libtool" = yes; then 390 | while test $1 != '--mode=compile'; do 391 | shift 392 | done 393 | shift 394 | fi 395 | # X makedepend 396 | shift 397 | cleared=no 398 | for arg in "$@"; do 399 | case $cleared in 400 | no) 401 | set ""; shift 402 | cleared=yes ;; 403 | esac 404 | case "$arg" in 405 | -D*|-I*) 406 | set fnord "$@" "$arg"; shift ;; 407 | # Strip any option that makedepend may not understand. Remove 408 | # the object too, otherwise makedepend will parse it as a source file. 409 | -*|$object) 410 | ;; 411 | *) 412 | set fnord "$@" "$arg"; shift ;; 413 | esac 414 | done 415 | obj_suffix="`echo $object | sed 's/^.*\././'`" 416 | touch "$tmpdepfile" 417 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 418 | rm -f "$depfile" 419 | cat < "$tmpdepfile" > "$depfile" 420 | sed '1,2d' "$tmpdepfile" | tr ' ' ' 421 | ' | \ 422 | ## Some versions of the HPUX 10.20 sed can't process this invocation 423 | ## correctly. Breaking it into two sed invocations is a workaround. 424 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 425 | rm -f "$tmpdepfile" "$tmpdepfile".bak 426 | ;; 427 | 428 | cpp) 429 | # Important note: in order to support this mode, a compiler *must* 430 | # always write the preprocessed file to stdout. 431 | "$@" || exit $? 432 | 433 | # Remove the call to Libtool. 434 | if test "$libtool" = yes; then 435 | while test $1 != '--mode=compile'; do 436 | shift 437 | done 438 | shift 439 | fi 440 | 441 | # Remove `-o $object'. 442 | IFS=" " 443 | for arg 444 | do 445 | case $arg in 446 | -o) 447 | shift 448 | ;; 449 | $object) 450 | shift 451 | ;; 452 | *) 453 | set fnord "$@" "$arg" 454 | shift # fnord 455 | shift # $arg 456 | ;; 457 | esac 458 | done 459 | 460 | "$@" -E | 461 | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 462 | sed '$ s: \\$::' > "$tmpdepfile" 463 | rm -f "$depfile" 464 | echo "$object : \\" > "$depfile" 465 | cat < "$tmpdepfile" >> "$depfile" 466 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 467 | rm -f "$tmpdepfile" 468 | ;; 469 | 470 | msvisualcpp) 471 | # Important note: in order to support this mode, a compiler *must* 472 | # always write the preprocessed file to stdout, regardless of -o, 473 | # because we must use -o when running libtool. 474 | "$@" || exit $? 475 | IFS=" " 476 | for arg 477 | do 478 | case "$arg" in 479 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 480 | set fnord "$@" 481 | shift 482 | shift 483 | ;; 484 | *) 485 | set fnord "$@" "$arg" 486 | shift 487 | shift 488 | ;; 489 | esac 490 | done 491 | "$@" -E | 492 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 493 | rm -f "$depfile" 494 | echo "$object : \\" > "$depfile" 495 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 496 | echo " " >> "$depfile" 497 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 498 | rm -f "$tmpdepfile" 499 | ;; 500 | 501 | none) 502 | exec "$@" 503 | ;; 504 | 505 | *) 506 | echo "Unknown depmode $depmode" 1>&2 507 | exit 1 508 | ;; 509 | esac 510 | 511 | exit 0 512 | 513 | # Local Variables: 514 | # mode: shell-script 515 | # sh-indentation: 2 516 | # eval: (add-hook 'write-file-hooks 'time-stamp) 517 | # time-stamp-start: "scriptversion=" 518 | # time-stamp-format: "%:y-%02m-%02d.%02H" 519 | # time-stamp-end: "$" 520 | # End: 521 | -------------------------------------------------------------------------------- /openZSniffer/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # This comes from X11R5 (mit/util/scripts/install.sh). 5 | # 6 | # Copyright 1991 by the Massachusetts Institute of Technology 7 | # 8 | # Permission to use, copy, modify, distribute, and sell this software and its 9 | # documentation for any purpose is hereby granted without fee, provided that 10 | # the above copyright notice appear in all copies and that both that 11 | # copyright notice and this permission notice appear in supporting 12 | # documentation, and that the name of M.I.T. not be used in advertising or 13 | # publicity pertaining to distribution of the software without specific, 14 | # written prior permission. M.I.T. makes no representations about the 15 | # suitability of this software for any purpose. It is provided "as is" 16 | # without express or implied warranty. 17 | # 18 | # Calling this script install-sh is preferred over install.sh, to prevent 19 | # `make' implicit rules from creating a file called install from it 20 | # when there is no Makefile. 21 | # 22 | # This script is compatible with the BSD install script, but was written 23 | # from scratch. It can only install one file at a time, a restriction 24 | # shared with many OS's install programs. 25 | 26 | 27 | # set DOITPROG to echo to test this script 28 | 29 | # Don't use :- since 4.3BSD and earlier shells don't like it. 30 | doit="${DOITPROG-}" 31 | 32 | 33 | # put in absolute paths if you don't have them in your path; or use env. vars. 34 | 35 | mvprog="${MVPROG-mv}" 36 | cpprog="${CPPROG-cp}" 37 | chmodprog="${CHMODPROG-chmod}" 38 | chownprog="${CHOWNPROG-chown}" 39 | chgrpprog="${CHGRPPROG-chgrp}" 40 | stripprog="${STRIPPROG-strip}" 41 | rmprog="${RMPROG-rm}" 42 | mkdirprog="${MKDIRPROG-mkdir}" 43 | 44 | transformbasename="" 45 | transform_arg="" 46 | instcmd="$mvprog" 47 | chmodcmd="$chmodprog 0755" 48 | chowncmd="" 49 | chgrpcmd="" 50 | stripcmd="" 51 | rmcmd="$rmprog -f" 52 | mvcmd="$mvprog" 53 | src="" 54 | dst="" 55 | dir_arg="" 56 | 57 | while [ x"$1" != x ]; do 58 | case $1 in 59 | -c) instcmd="$cpprog" 60 | shift 61 | continue;; 62 | 63 | -d) dir_arg=true 64 | shift 65 | continue;; 66 | 67 | -m) chmodcmd="$chmodprog $2" 68 | shift 69 | shift 70 | continue;; 71 | 72 | -o) chowncmd="$chownprog $2" 73 | shift 74 | shift 75 | continue;; 76 | 77 | -g) chgrpcmd="$chgrpprog $2" 78 | shift 79 | shift 80 | continue;; 81 | 82 | -s) stripcmd="$stripprog" 83 | shift 84 | continue;; 85 | 86 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 87 | shift 88 | continue;; 89 | 90 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 91 | shift 92 | continue;; 93 | 94 | *) if [ x"$src" = x ] 95 | then 96 | src=$1 97 | else 98 | # this colon is to work around a 386BSD /bin/sh bug 99 | : 100 | dst=$1 101 | fi 102 | shift 103 | continue;; 104 | esac 105 | done 106 | 107 | if [ x"$src" = x ] 108 | then 109 | echo "install: no input file specified" 110 | exit 1 111 | else 112 | true 113 | fi 114 | 115 | if [ x"$dir_arg" != x ]; then 116 | dst=$src 117 | src="" 118 | 119 | if [ -d $dst ]; then 120 | instcmd=: 121 | chmodcmd="" 122 | else 123 | instcmd=mkdir 124 | fi 125 | else 126 | 127 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 128 | # might cause directories to be created, which would be especially bad 129 | # if $src (and thus $dsttmp) contains '*'. 130 | 131 | if [ -f $src -o -d $src ] 132 | then 133 | true 134 | else 135 | echo "install: $src does not exist" 136 | exit 1 137 | fi 138 | 139 | if [ x"$dst" = x ] 140 | then 141 | echo "install: no destination specified" 142 | exit 1 143 | else 144 | true 145 | fi 146 | 147 | # If destination is a directory, append the input filename; if your system 148 | # does not like double slashes in filenames, you may need to add some logic 149 | 150 | if [ -d $dst ] 151 | then 152 | dst="$dst"/`basename $src` 153 | else 154 | true 155 | fi 156 | fi 157 | 158 | ## this sed command emulates the dirname command 159 | dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 160 | 161 | # Make sure that the destination directory exists. 162 | # this part is taken from Noah Friedman's mkinstalldirs script 163 | 164 | # Skip lots of stat calls in the usual case. 165 | if [ ! -d "$dstdir" ]; then 166 | defaultIFS=' 167 | ' 168 | IFS="${IFS-${defaultIFS}}" 169 | 170 | oIFS="${IFS}" 171 | # Some sh's can't handle IFS=/ for some reason. 172 | IFS='%' 173 | set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` 174 | IFS="${oIFS}" 175 | 176 | pathcomp='' 177 | 178 | while [ $# -ne 0 ] ; do 179 | pathcomp="${pathcomp}${1}" 180 | shift 181 | 182 | if [ ! -d "${pathcomp}" ] ; 183 | then 184 | $mkdirprog "${pathcomp}" 185 | else 186 | true 187 | fi 188 | 189 | pathcomp="${pathcomp}/" 190 | done 191 | fi 192 | 193 | if [ x"$dir_arg" != x ] 194 | then 195 | $doit $instcmd $dst && 196 | 197 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && 198 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && 199 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && 200 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi 201 | else 202 | 203 | # If we're going to rename the final executable, determine the name now. 204 | 205 | if [ x"$transformarg" = x ] 206 | then 207 | dstfile=`basename $dst` 208 | else 209 | dstfile=`basename $dst $transformbasename | 210 | sed $transformarg`$transformbasename 211 | fi 212 | 213 | # don't allow the sed command to completely eliminate the filename 214 | 215 | if [ x"$dstfile" = x ] 216 | then 217 | dstfile=`basename $dst` 218 | else 219 | true 220 | fi 221 | 222 | # Make a temp file name in the proper directory. 223 | 224 | dsttmp=$dstdir/#inst.$$# 225 | 226 | # Move or copy the file name to the temp name 227 | 228 | $doit $instcmd $src $dsttmp && 229 | 230 | trap "rm -f ${dsttmp}" 0 && 231 | 232 | # and set any options; do chmod last to preserve setuid bits 233 | 234 | # If any of these fail, we abort the whole thing. If we want to 235 | # ignore errors from any of these, just make sure not to ignore 236 | # errors from the above "$doit $instcmd $src $dsttmp" command. 237 | 238 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && 239 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && 240 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && 241 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && 242 | 243 | # Now rename the file to the real destination. 244 | 245 | $doit $rmcmd -f $dstdir/$dstfile && 246 | $doit $mvcmd $dsttmp $dstdir/$dstfile 247 | 248 | fi && 249 | 250 | 251 | exit 0 252 | -------------------------------------------------------------------------------- /openZSniffer/interceptty-nicedump: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # $Id: interceptty-nicedump,v 7.1 2000/05/03 04:41:24 sgifford Exp $ 4 | 5 | #| = 1; 6 | 7 | while (<>) 8 | { 9 | chomp; 10 | s/^(.)\s+//; 11 | if ($1 eq "<") 12 | { 13 | if ($dumpdir eq ">") 14 | { 15 | &dumpnow; 16 | } 17 | $dumpdir = $1; 18 | } 19 | elsif ($1 eq ">") 20 | { 21 | if ($dumpdir eq "<") 22 | { 23 | &dumpnow; 24 | } 25 | $dumpdir = $1; 26 | } 27 | /^..(..)/; 28 | $hexchar = $1; 29 | $bufhex .= " ".$hexchar; 30 | if (/\((.*)\)/) 31 | { 32 | $bufasc .= "$1"; 33 | } 34 | else 35 | { 36 | $bufasc .= " "; 37 | } 38 | $bufchars++; 39 | if ($hexchar eq "0a") { &dumpnow } 40 | # print "Char $bufchars: hex is '$bufhex', asc is '$bufasc', dumpdir is '$dumpdir'\n"; 41 | if ($bufchars >= 10) 42 | { 43 | &dumpnow; 44 | } 45 | } 46 | 47 | &dumpnow; 48 | 49 | sub dumpnow 50 | { 51 | return if ($bufchars == 0); 52 | printf "%-s %-30s | %-10s\n",$dumpdir,$bufhex,$bufasc; 53 | $bufchars=0; 54 | $bufhex=""; 55 | $bufasc=""; 56 | } 57 | -------------------------------------------------------------------------------- /openZSniffer/interceptty.1: -------------------------------------------------------------------------------- 1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 2 | .\" 3 | .\" Standard preamble: 4 | .\" ======================================================================== 5 | .de Sh \" Subsection heading 6 | .br 7 | .if t .Sp 8 | .ne 5 9 | .PP 10 | \fB\\$1\fR 11 | .PP 12 | .. 13 | .de Sp \" Vertical space (when we can't use .PP) 14 | .if t .sp .5v 15 | .if n .sp 16 | .. 17 | .de Vb \" Begin verbatim text 18 | .ft CW 19 | .nf 20 | .ne \\$1 21 | .. 22 | .de Ve \" End verbatim text 23 | .ft R 24 | .fi 25 | .. 26 | .\" Set up some character translations and predefined strings. \*(-- will 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left 28 | .\" double quote, and \*(R" will give a right double quote. | will give a 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. 32 | .tr \(*W-|\(bv\*(Tr 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' 34 | .ie n \{\ 35 | . ds -- \(*W- 36 | . ds PI pi 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch 39 | . ds L" "" 40 | . ds R" "" 41 | . ds C` "" 42 | . ds C' "" 43 | 'br\} 44 | .el\{\ 45 | . ds -- \|\(em\| 46 | . ds PI \(*p 47 | . ds L" `` 48 | . ds R" '' 49 | 'br\} 50 | .\" 51 | .\" If the F register is turned on, we'll generate index entries on stderr for 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the 54 | .\" output yourself in some meaningful fashion. 55 | .if \nF \{\ 56 | . de IX 57 | . tm Index:\\$1\t\\n%\t"\\$2" 58 | .. 59 | . nr % 0 60 | . rr F 61 | .\} 62 | .\" 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes 64 | .\" way too many mistakes in technical documents. 65 | .hy 0 66 | .if n .na 67 | .\" 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. 70 | . \" fudge factors for nroff and troff 71 | .if n \{\ 72 | . ds #H 0 73 | . ds #V .8m 74 | . ds #F .3m 75 | . ds #[ \f1 76 | . ds #] \fP 77 | .\} 78 | .if t \{\ 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) 80 | . ds #V .6m 81 | . ds #F 0 82 | . ds #[ \& 83 | . ds #] \& 84 | .\} 85 | . \" simple accents for nroff and troff 86 | .if n \{\ 87 | . ds ' \& 88 | . ds ` \& 89 | . ds ^ \& 90 | . ds , \& 91 | . ds ~ ~ 92 | . ds / 93 | .\} 94 | .if t \{\ 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' 101 | .\} 102 | . \" troff and (daisy-wheel) nroff accents 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] 110 | .ds ae a\h'-(\w'a'u*4/10)'e 111 | .ds Ae A\h'-(\w'A'u*4/10)'E 112 | . \" corrections for vroff 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' 115 | . \" for low resolution devices (crt and lpr) 116 | .if \n(.H>23 .if \n(.V>19 \ 117 | \{\ 118 | . ds : e 119 | . ds 8 ss 120 | . ds o a 121 | . ds d- d\h'-1'\(ga 122 | . ds D- D\h'-1'\(hy 123 | . ds th \o'bp' 124 | . ds Th \o'LP' 125 | . ds ae ae 126 | . ds Ae AE 127 | .\} 128 | .rm #[ #] #H #V #F C 129 | .\" ======================================================================== 130 | .\" 131 | .IX Title "INTERCEPTTY 1" 132 | .TH INTERCEPTTY 1 "2004-09-05" "perl v5.8.3" "User Contributed Perl Documentation" 133 | .SH "NAME" 134 | interceptty \- Intercept traffic to and from a serial port. 135 | .SH "SYNOPSIS" 136 | .IX Header "SYNOPSIS" 137 | .Vb 32 138 | \& Usage: ./interceptty [-V] [-qvl] [-s back-set] [-o output-file] 139 | \& [-p pty-dev] [-t tty-dev] 140 | \& [-m [pty-owner,[pty-group,]]pty-mode] 141 | \& [-u uid] [-g gid] [-/ chroot-dir] 142 | \& back-device front-device 143 | \& back-device Use back-device as the device to intercept 144 | \& path TTY dev is at /path 145 | \& @/path Socket is at /path 146 | \& @host:port Inet socket is at host:port 147 | \& !prog Run prog for backend 148 | \& =rfd[,wfd] Use file descriptors 149 | \& front-device Use front-device as the device applications connect to 150 | \& path Create symlink at /path 151 | \& @/path Socket at /path 152 | \& @host:port Inet socket at host:port 153 | \& =rfd[,wfd] Use file descriptors 154 | \& '-' to prevent creating a front-device. 155 | \& Doesn't currently do anything. 156 | \& -l Line-buffer output 157 | \& -o output-file Write intercepted data to output-file 158 | \& -s back-stty Use given settings to set up back-device 159 | \& These settings are passed directly to stty(1). 160 | \& -m pty-mode Specify permissions for the new pty. 161 | \& Format is [pty-owner,[pty-group,]]pty-mode] 162 | \& -u uid Switch to given uid after setting up (must be root) 163 | \& -g gid Switch to given gid after setting up (must be root) 164 | \& -/ chroot-dir chroot(2) to given dir after setting up (must be root) 165 | \& -q Activate quiet mode 166 | \& -v Activate verbose mode 167 | \& -V Print version number then exit 168 | \& -p pty-dev Full path to pty device for front-end (used internally) 169 | \& -t tty-dev Full path to tty device for front-end (used externally) 170 | .Ve 171 | .SH "DESCRIPTION" 172 | .IX Header "DESCRIPTION" 173 | interceptty is designed to sit between a serial port (or other 174 | terminal device, or program, or socket, or something connected to a 175 | file descriptor) and a program which is communicating with that 176 | device, recording everything that goes back and forth between the two. 177 | It does this by opening the real device, creating a pseudo\-tty, then 178 | forwarding everything between the two, recording whatever it sees. It 179 | has a number of options that let you fine-tune the devices it uses and 180 | the terminal options for the real device. 181 | .PP 182 | With the support for various backend types, interceptty is also useful 183 | to create a fake serial port that will talk to the network or to a 184 | program you've written. The \-q switch will turn off its logging 185 | output, and you can read about the different backends further down. 186 | .PP 187 | The output of interceptty is a somewhat ugly, rudimentary format that 188 | I usually postprocess through interceptty\-nicedump, an included Perl 189 | script. More information about the output format is included later, 190 | in the Output section. 191 | .PP 192 | To stop interceptty, press \s-1CTRL\-C\s0. It doesn't exit under any other 193 | circumstances except error conditions. 194 | .Sh "Command-Line" 195 | .IX Subsection "Command-Line" 196 | .IP "\fIback-device\fR" 4 197 | .IX Item "back-device" 198 | Use \fIback-device\fR as the backend device\-\-\-the device to which 199 | \&\fIinterceptty\fR connects. Normally it will be a character-special 200 | device file, like a serial port or other tty-compatible device. You 201 | can instruct interceptty to use other things for your backend by using 202 | a \fIback-device\fR that starts with one of several special characters. 203 | .Sp 204 | If \fIback-device\fR starts with an \f(CW\*(C`@\*(C'\fR and contains a slash (\f(CW\*(C`/\*(C'\fR), it 205 | will be treated as a Unix socket. 206 | .Sp 207 | If \fIback-device\fR starts with an \f(CW\*(C`@\*(C'\fR and \fIdoesn't\fR contain a slash 208 | (\f(CW\*(C`/\*(C'\fR), it will be treated as an Internet hostname, followed by a 209 | colon, followed by a port. interceptty will connect to that address 210 | and port. 211 | .Sp 212 | If \fIback-device\fR starts with an exclamation point (\f(CW\*(C`!\*(C'\fR), it will be 213 | treated as a program to run. That program will be started up, and its 214 | standard input and output will be connected to the frontend. 215 | .Sp 216 | If \fIback-device\fR starts with an equal sign (\f(CW\*(C`=\*(C'\fR), it will be treated 217 | as a file descriptor to use, or a comma-seperated pair of file 218 | descriptors. The first file descriptor will be used for reading, and 219 | the second for writing; if only one is specified, it will be used for 220 | both. These descriptors must already be opened by the program that 221 | started interceptty. 222 | .IP "\fIfront-device\fR" 4 223 | .IX Item "front-device" 224 | Use \fIfront-device\fR as the frontend device\-\-\-the device to which other 225 | applications should connect to talk to the backend device through 226 | interceptty. Normally interceptty will create a pseudo\-terminal, then 227 | create a symlink to the master device at \fIfront-device\fR. You can 228 | control whether and how it creates a pseudo-terminal with the \fI\-t\fR 229 | and \fI\-p\fR options. You can have it create no symlink by giving a 230 | \&\fIfront-device\fR of a single dash (\f(CW\*(C`\-\*(C'\fR), and you can use things other 231 | than pseudo-terminals as a frontend by using a \fIfront-device\fR that 232 | starts with one of several special characters. 233 | .Sp 234 | If \fIfront-device\fR starts with an \f(CW\*(C`@\*(C'\fR and contains a slash (\f(CW\*(C`/\*(C'\fR), it 235 | will be treated as a Unix socket. interceptty will create this 236 | socket, and listen for connections. This is the mode to use for newer 237 | versions of \fIVMWare\fR. 238 | .Sp 239 | If \fIfront-device\fR starts with an \f(CW\*(C`@\*(C'\fR and \fIdoesn't\fR contain a slash 240 | (\f(CW\*(C`/\*(C'\fR), it will be treated as a local interface name to listen on, 241 | followed by a colon, followed by a port. interceptty will listen on 242 | that interface and port. Use an interface name of 0 to listen on all 243 | local interfaces. 244 | .Sp 245 | If \fIfront-device\fR starts with an equal sign (\f(CW\*(C`=\*(C'\fR), it will be 246 | treated as a file descriptor to use, or a comma-seperated pair of file 247 | descriptors. The first file descriptor will be used for reading, and 248 | the second for writing; if only one is specified, it will be used for 249 | both. These descriptors must already be opened by the program that 250 | started interceptty. This is useful for running interceptty under 251 | another program, such as \fItcpserver\fR, \fIinetd\fR, or \fIstunnel\fR. 252 | .IP "\-l" 4 253 | .IX Item "-l" 254 | Line-buffer output, displaying the intercepted data immediately as it 255 | comes in. 256 | .IP "\-o \fIoutput-file\fR" 4 257 | .IX Item "-o output-file" 258 | Write output to \fIoutput-file\fR instead of standard output. 259 | .IP "\-s \fIback-stty\fR" 4 260 | .IX Item "-s back-stty" 261 | Run \fIstty\fR with the given options on the backend, to configure it. 262 | You can use this to set the baud rate, character size, etc. You 263 | should only use this if you have a \s-1TTY\s0 as your back\-end. 264 | .IP "\-q" 4 265 | .IX Item "-q" 266 | Be quiet. Don't display intercepted data, and only display errors. 267 | .IP "\-v" 4 268 | .IX Item "-v" 269 | Be verbose. Asks interceptty to just say whatever's on its mind. 270 | Useful for debugging. 271 | .IP "\-V" 4 272 | .IX Item "-V" 273 | Print the version number and exit. 274 | .IP "\-p \fIpty-dev\fR" 4 275 | .IX Item "-p pty-dev" 276 | Use \fIpty-dev\fR as the physical frontend device that interceptty should 277 | connect to, instead of creating a pseudo\-tty. This should be a 278 | TTY-compatible device, such as a serial port. 279 | .IP "\-t \fItty-dev\fR" 4 280 | .IX Item "-t tty-dev" 281 | Use \fItty-dev\fR as the device that an application should connect to, 282 | such as the other end of a pseudo\-tty. This device is opened and a 283 | symlink is created to it, and that's all. If you're using a device 284 | that doesn't have two sides to connect to, like a serial port, don't 285 | use this option, and specify \f(CW\*(C`\-\*(C'\fR for the frontend. 286 | .Sh "Output" 287 | .IX Subsection "Output" 288 | interceptty prints its output in a fairly unattractive, painful to 289 | look at format. However, it is very easy for other programs to parse. 290 | For an example of how to post-process this output into something 291 | appropriate to whatever you are intercepting, see the included Perl 292 | script \fIinterceptty-nicedump\fR. 293 | .PP 294 | Output lines are in this general format: 295 | .PP 296 | .Vb 7 297 | \& < 0x54 (T) 298 | \& > 0x4b (K) 299 | \& ^ Direction 300 | \& ^^^^ Hex code (to real device) 301 | \& ^^^ ASCII character (to real device) 302 | \& ^^^^ Hex code (from real device) 303 | \& ^^^ ASCII character (from real device) 304 | .Ve 305 | .PP 306 | The direction marker is a '<' if this character was sent \fIto\fR the 307 | backend device, and '>' if it was received \fIfrom\fR the backend device. 308 | It is always followed by a single space. If the character was 309 | received from the real device, a tab will appear next (this makes the 310 | output easier to follow). After that is the hex code for the 311 | character, and the \s-1ASCII\s0 representation of the character if it is an 312 | \&\s-1ASCII\s0 character. 313 | .SH "EXAMPLES" 314 | .IX Header "EXAMPLES" 315 | Here's some examples of some common, useful, or interesting tasks you 316 | can use interceptty for. 317 | .IP "VMWare" 4 318 | .IX Item "VMWare" 319 | I wrote this program to watch what a program running under \fIVMWare\fR 320 | version 2 () was sending to the serial port. 321 | To do that, I ran: 322 | .Sp 323 | .Vb 2 324 | \& interceptty -s 'ispeed 19200 ospeed 19200' -l /dev/ttyS0 | 325 | \& interceptty-nicedump 326 | .Ve 327 | .Sp 328 | then configured \fIVMWare\fR to use /tmp/interceptty for \s-1COM1\s0. 329 | .Sp 330 | Newer versions of \fIVMware\fR use a socket. You can use them like this: 331 | .Sp 332 | .Vb 3 333 | \& interceptty -s 'ispeed 19200 ospeed 19200' -l \e 334 | \& /dev/ttyS0 @/tmp/sersock | 335 | \& interceptty-nicedump 336 | .Ve 337 | .Sp 338 | then configure VMWare to use a \*(L"named pipe\*(R" at /tmp/sersock. 339 | .Sp 340 | You must start interceptty before you connect the serial device under 341 | VMWare. If you stop interceptty with \s-1CTRL\-C\s0, or if it otherwise shuts 342 | down, once you have connected it, you will need to disconnect and 343 | reconnect \s-1COM1\s0 before it will work again. 344 | .IP "External Serial Monitor" 4 345 | .IX Item "External Serial Monitor" 346 | If you want to use interceptty as an external serial monitor\-\-\-connected to 347 | two serial ports on your machine and relaying between them, while 348 | recording the output\-\-\-you can use one device as the backend, and use 349 | the \fI\-p\fR option to tell the frontend not to create it's own tty, but 350 | just use the one you tell it: 351 | .Sp 352 | .Vb 2 353 | \& interceptty -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 \e 354 | \& -p /dev/ttyS1 - 355 | .Ve 356 | .Sp 357 | That lets you monitor serial communication between two non-PC 358 | devices. It's likely you'll need to use a null-modem cable to connect 359 | one of the devices. 360 | .IP "Network serial port server" 4 361 | .IX Item "Network serial port server" 362 | If you have a device connected to your serial port that you want to 363 | make available over the network, you can create a socket frontend. 364 | If you just want to create a serial server without monitoring the 365 | traffic, you can use the \-q option: 366 | .Sp 367 | .Vb 2 368 | \& interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 \e 369 | \& '@0:4001' 370 | .Ve 371 | .Sp 372 | Note that this doesn't allow any kind of access control, but you can 373 | run it under a program that does provide access control, like 374 | tcpserver. See the example below. 375 | .IP "Network serial port client" 4 376 | .IX Item "Network serial port client" 377 | If you have a device available over a network serial port using a 378 | simple \s-1TCP\s0 connection or a telnet connection, you can create a virtual 379 | serial port on your system connected to it by using the network device 380 | as a backend. I've tested this with several different 381 | serial-to-Ethernet adapters available on the market. 382 | .Sp 383 | .Vb 2 384 | \& interceptty -q '@serial-server.example.com:4001' \e 385 | \& /dev/serial-server 386 | .Ve 387 | .Sp 388 | Some Digi brand serial-to-Ethernet adapters can use \fIssh\fR. To 389 | connect to this, you can use a program backend: 390 | .Sp 391 | .Vb 2 392 | \& interceptty -q '!ssh -p 4001 serial-server.example.com' \e 393 | \& /dev/serial-server 394 | .Ve 395 | .IP "Running under tcpserver/inetd/stunnel" 4 396 | .IX Item "Running under tcpserver/inetd/stunnel" 397 | To run under tcpserver or inetd, make sure that logging is turned off 398 | or directed to a file, then configure a backend of file descriptors 0 399 | and 1: 400 | .Sp 401 | .Vb 2 402 | \& tcpserver 0 9999 \e 403 | \& interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 =0,1 404 | .Ve 405 | .SH "SECURITY" 406 | .IX Header "SECURITY" 407 | While an effort has been made to make sure that this code is free of 408 | security issues, it has not been thoroughly audited, and should not 409 | under any circumstances be set-UID or set-GID to anything. If nothing 410 | else, the '\-s' option will probably allow shell escapes, and using a 411 | program back-end is also dangerous. 412 | .PP 413 | If this program is run as root, it will set up the pty portion of its 414 | pseudo-terminal to be only readable by itself, and will copy the 415 | ownership and permissions from the real device to the tty portion. It 416 | tries to change this back before exiting, but if it crashes such that 417 | it doesn't get to run its cleanup code, the ownership and permission 418 | will stay the same. 419 | .PP 420 | If it is not run as root, it will make no effort to change the 421 | permissions on the pseudo\-terminal. If you need to do this, select a 422 | pseudo-terminal in advance, set the permissions appropriately, and use 423 | the '\-p' and '\-t' options to instruct interceptty to use that device 424 | instead of picking its own. 425 | .SH "SEE ALSO" 426 | .IX Header "SEE ALSO" 427 | \&\fIstty\fR\|(1), \fIminicom\fR\|(1), \fItip\fR\|(1). 428 | .SH "LICENSE" 429 | .IX Header "LICENSE" 430 | Copyright 2000\-2004 by Scott Gifford 431 | This software is licensed under the \s-1GNU\s0 Public License. See the file 432 | \&\s-1COPYING\s0 included with this distribution for details 433 | .SH "BUGS" 434 | .IX Header "BUGS" 435 | You must set all serial options, such as baud rate, flow control, 436 | etc., up front with the '\-s' option. Any settings that the 437 | application sets using interceptty's pseudo-terminal will be ignored. 438 | I can't find a way around this; if you have ideas, please let me know. 439 | .PP 440 | We make no attempt to lock backend device. We probably should, but I 441 | don't know how to do it portably. If somebody has a nice \s-1API\s0 function 442 | I can call, I will happily add locking support in. 443 | .PP 444 | This program has only been tested under Linux, although the code is 445 | fairly portable. I don't have access to another machine with serial 446 | ports I can play with, so I haven't tried to port it. I probably 447 | won't port this to any other machines, but if you manage to, please 448 | send me the patches and I will include them in future distributions. 449 | I have recently added autoconf support, which may be useful in making 450 | this program more portable. But to be honest, I just used it so I 451 | could get \*(L"make dist\*(R". 452 | .SH "HISTORY" 453 | .IX Header "HISTORY" 454 | interceptty is based in larte part on ttysnoop\-0.12d, by Carl 455 | Declerck. Any bugs with interceptty should be reported to me, and not 456 | to Carl. I basically adapted ttysnoop for my foul purposes, removed 457 | the parts that weren't necessary anymore, and added appropriate option 458 | processing. ttysnoop was licensed under the \s-1GPL\s0, and I have of course 459 | kept that license for interceptty. 460 | .SH "AUTHOR" 461 | .IX Header "AUTHOR" 462 | Scott Gifford 463 | -------------------------------------------------------------------------------- /openZSniffer/interceptty.pod: -------------------------------------------------------------------------------- 1 | =head1 NAME 2 | 3 | interceptty - Intercept traffic to and from a serial port. 4 | 5 | =head1 SYNOPSIS 6 | 7 | Usage: ./interceptty [-V] [-qvl] [-s back-set] [-o output-file] 8 | [-p pty-dev] [-t tty-dev] 9 | [-m [pty-owner,[pty-group,]]pty-mode] 10 | [-u uid] [-g gid] [-/ chroot-dir] 11 | back-device front-device 12 | back-device Use back-device as the device to intercept 13 | path TTY dev is at /path 14 | @/path Socket is at /path 15 | @host:port Inet socket is at host:port 16 | !prog Run prog for backend 17 | =rfd[,wfd] Use file descriptors 18 | front-device Use front-device as the device applications connect to 19 | path Create symlink at /path 20 | @/path Socket at /path 21 | @host:port Inet socket at host:port 22 | =rfd[,wfd] Use file descriptors 23 | '-' to prevent creating a front-device. 24 | Doesn't currently do anything. 25 | -l Line-buffer output 26 | -o output-file Write intercepted data to output-file 27 | -s back-stty Use given settings to set up back-device 28 | These settings are passed directly to stty(1). 29 | -m pty-mode Specify permissions for the new pty. 30 | Format is [pty-owner,[pty-group,]]pty-mode] 31 | -u uid Switch to given uid after setting up (must be root) 32 | -g gid Switch to given gid after setting up (must be root) 33 | -/ chroot-dir chroot(2) to given dir after setting up (must be root) 34 | -q Activate quiet mode 35 | -v Activate verbose mode 36 | -V Print version number then exit 37 | -p pty-dev Full path to pty device for front-end (used internally) 38 | -t tty-dev Full path to tty device for front-end (used externally) 39 | 40 | =head1 DESCRIPTION 41 | 42 | interceptty is designed to sit between a serial port (or other 43 | terminal device, or program, or socket, or something connected to a 44 | file descriptor) and a program which is communicating with that 45 | device, recording everything that goes back and forth between the two. 46 | It does this by opening the real device, creating a pseudo-tty, then 47 | forwarding everything between the two, recording whatever it sees. It 48 | has a number of options that let you fine-tune the devices it uses and 49 | the terminal options for the real device. 50 | 51 | With the support for various backend types, interceptty is also useful 52 | to create a fake serial port that will talk to the network or to a 53 | program you've written. The -q switch will turn off its logging 54 | output, and you can read about the different backends further down. 55 | 56 | The output of interceptty is a somewhat ugly, rudimentary format that 57 | I usually postprocess through interceptty-nicedump, an included Perl 58 | script. More information about the output format is included later, 59 | in the Output section. 60 | 61 | To stop interceptty, press CTRL-C. It doesn't exit under any other 62 | circumstances except error conditions. 63 | 64 | =head2 Command-Line 65 | 66 | =over 4 67 | 68 | =item I 69 | 70 | Use I as the backend device---the device to which 71 | I connects. Normally it will be a character-special 72 | device file, like a serial port or other tty-compatible device. You 73 | can instruct interceptty to use other things for your backend by using 74 | a I that starts with one of several special characters. 75 | 76 | If I starts with an C<@> and contains a slash (C), it 77 | will be treated as a Unix socket. 78 | 79 | If I starts with an C<@> and I contain a slash 80 | (C), it will be treated as an Internet hostname, followed by a 81 | colon, followed by a port. interceptty will connect to that address 82 | and port. 83 | 84 | If I starts with an exclamation point (C), it will be 85 | treated as a program to run. That program will be started up, and its 86 | standard input and output will be connected to the frontend. 87 | 88 | If I starts with an equal sign (C<=>), it will be treated 89 | as a file descriptor to use, or a comma-seperated pair of file 90 | descriptors. The first file descriptor will be used for reading, and 91 | the second for writing; if only one is specified, it will be used for 92 | both. These descriptors must already be opened by the program that 93 | started interceptty. 94 | 95 | =item I 96 | 97 | Use I as the frontend device---the device to which other 98 | applications should connect to talk to the backend device through 99 | interceptty. Normally interceptty will create a pseudo-terminal, then 100 | create a symlink to the master device at I. You can 101 | control whether and how it creates a pseudo-terminal with the I<-t> 102 | and I<-p> options. You can have it create no symlink by giving a 103 | I of a single dash (C<->), and you can use things other 104 | than pseudo-terminals as a frontend by using a I that 105 | starts with one of several special characters. 106 | 107 | If I starts with an C<@> and contains a slash (C), it 108 | will be treated as a Unix socket. interceptty will create this 109 | socket, and listen for connections. This is the mode to use for newer 110 | versions of I. 111 | 112 | If I starts with an C<@> and I contain a slash 113 | (C), it will be treated as a local interface name to listen on, 114 | followed by a colon, followed by a port. interceptty will listen on 115 | that interface and port. Use an interface name of 0 to listen on all 116 | local interfaces. 117 | 118 | If I starts with an equal sign (C<=>), it will be 119 | treated as a file descriptor to use, or a comma-seperated pair of file 120 | descriptors. The first file descriptor will be used for reading, and 121 | the second for writing; if only one is specified, it will be used for 122 | both. These descriptors must already be opened by the program that 123 | started interceptty. This is useful for running interceptty under 124 | another program, such as I, I, or I. 125 | 126 | 127 | =item -l 128 | 129 | Line-buffer output, displaying the intercepted data immediately as it 130 | comes in. 131 | 132 | =item -o I 133 | 134 | Write output to I instead of standard output. 135 | 136 | =item -s I 137 | 138 | Run I with the given options on the backend, to configure it. 139 | You can use this to set the baud rate, character size, etc. You 140 | should only use this if you have a TTY as your back-end. 141 | 142 | =item -q 143 | 144 | Be quiet. Don't display intercepted data, and only display errors. 145 | 146 | =item -v 147 | 148 | Be verbose. Asks interceptty to just say whatever's on its mind. 149 | Useful for debugging. 150 | 151 | =item -V 152 | 153 | Print the version number and exit. 154 | 155 | =item -p I 156 | 157 | Use I as the physical frontend device that interceptty should 158 | connect to, instead of creating a pseudo-tty. This should be a 159 | TTY-compatible device, such as a serial port. 160 | 161 | =item -t I 162 | 163 | Use I as the device that an application should connect to, 164 | such as the other end of a pseudo-tty. This device is opened and a 165 | symlink is created to it, and that's all. If you're using a device 166 | that doesn't have two sides to connect to, like a serial port, don't 167 | use this option, and specify C<-> for the frontend. 168 | 169 | =back 170 | 171 | 172 | 173 | =head2 Output 174 | 175 | interceptty prints its output in a fairly unattractive, painful to 176 | look at format. However, it is very easy for other programs to parse. 177 | For an example of how to post-process this output into something 178 | appropriate to whatever you are intercepting, see the included Perl 179 | script I. 180 | 181 | Output lines are in this general format: 182 | 183 | < 0x54 (T) 184 | > 0x4b (K) 185 | ^ Direction 186 | ^^^^ Hex code (to real device) 187 | ^^^ ASCII character (to real device) 188 | ^^^^ Hex code (from real device) 189 | ^^^ ASCII character (from real device) 190 | 191 | The direction marker is a '<' if this character was sent I the 192 | backend device, and '>' if it was received I the backend device. 193 | It is always followed by a single space. If the character was 194 | received from the real device, a tab will appear next (this makes the 195 | output easier to follow). After that is the hex code for the 196 | character, and the ASCII representation of the character if it is an 197 | ASCII character. 198 | 199 | 200 | =head1 EXAMPLES 201 | 202 | Here's some examples of some common, useful, or interesting tasks you 203 | can use interceptty for. 204 | 205 | =over 4 206 | 207 | =item VMWare 208 | 209 | I wrote this program to watch what a program running under I 210 | version 2 (L) was sending to the serial port. 211 | To do that, I ran: 212 | 213 | interceptty -s 'ispeed 19200 ospeed 19200' -l /dev/ttyS0 | 214 | interceptty-nicedump 215 | 216 | then configured I to use /tmp/interceptty for COM1. 217 | 218 | Newer versions of I use a socket. You can use them like this: 219 | 220 | interceptty -s 'ispeed 19200 ospeed 19200' -l \ 221 | /dev/ttyS0 @/tmp/sersock | 222 | interceptty-nicedump 223 | 224 | then configure VMWare to use a "named pipe" at /tmp/sersock. 225 | 226 | You must start interceptty before you connect the serial device under 227 | VMWare. If you stop interceptty with CTRL-C, or if it otherwise shuts 228 | down, once you have connected it, you will need to disconnect and 229 | reconnect COM1 before it will work again. 230 | 231 | 232 | =item External Serial Monitor 233 | 234 | If you want to use interceptty as an external serial monitor---connected to 235 | two serial ports on your machine and relaying between them, while 236 | recording the output---you can use one device as the backend, and use 237 | the I<-p> option to tell the frontend not to create it's own tty, but 238 | just use the one you tell it: 239 | 240 | interceptty -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 \ 241 | -p /dev/ttyS1 - 242 | 243 | That lets you monitor serial communication between two non-PC 244 | devices. It's likely you'll need to use a null-modem cable to connect 245 | one of the devices. 246 | 247 | 248 | =item Network serial port server 249 | 250 | If you have a device connected to your serial port that you want to 251 | make available over the network, you can create a socket frontend. 252 | If you just want to create a serial server without monitoring the 253 | traffic, you can use the -q option: 254 | 255 | interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 \ 256 | '@0:4001' 257 | 258 | Note that this doesn't allow any kind of access control, but you can 259 | run it under a program that does provide access control, like 260 | tcpserver. See the example below. 261 | 262 | =item Network serial port client 263 | 264 | If you have a device available over a network serial port using a 265 | simple TCP connection or a telnet connection, you can create a virtual 266 | serial port on your system connected to it by using the network device 267 | as a backend. I've tested this with several different 268 | serial-to-Ethernet adapters available on the market. 269 | 270 | interceptty -q '@serial-server.example.com:4001' \ 271 | /dev/serial-server 272 | 273 | Some Digi brand serial-to-Ethernet adapters can use I. To 274 | connect to this, you can use a program backend: 275 | 276 | interceptty -q '!ssh -p 4001 serial-server.example.com' \ 277 | /dev/serial-server 278 | 279 | =item Running under tcpserver/inetd/stunnel 280 | 281 | To run under tcpserver or inetd, make sure that logging is turned off 282 | or directed to a file, then configure a backend of file descriptors 0 283 | and 1: 284 | 285 | tcpserver 0 9999 \ 286 | interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 =0,1 287 | 288 | =back 289 | 290 | =head1 SECURITY 291 | 292 | While an effort has been made to make sure that this code is free of 293 | security issues, it has not been thoroughly audited, and should not 294 | under any circumstances be set-UID or set-GID to anything. If nothing 295 | else, the '-s' option will probably allow shell escapes, and using a 296 | program back-end is also dangerous. 297 | 298 | If this program is run as root, it will set up the pty portion of its 299 | pseudo-terminal to be only readable by itself, and will copy the 300 | ownership and permissions from the real device to the tty portion. It 301 | tries to change this back before exiting, but if it crashes such that 302 | it doesn't get to run its cleanup code, the ownership and permission 303 | will stay the same. 304 | 305 | If it is not run as root, it will make no effort to change the 306 | permissions on the pseudo-terminal. If you need to do this, select a 307 | pseudo-terminal in advance, set the permissions appropriately, and use 308 | the '-p' and '-t' options to instruct interceptty to use that device 309 | instead of picking its own. 310 | 311 | 312 | =head1 SEE ALSO 313 | 314 | L, L, L. 315 | 316 | =head1 LICENSE 317 | 318 | Copyright 2000-2004 by Scott Gifford Esgifford@suspectclass.comE 319 | This software is licensed under the GNU Public License. See the file 320 | COPYING included with this distribution for details 321 | 322 | 323 | =head1 BUGS 324 | 325 | You must set all serial options, such as baud rate, flow control, 326 | etc., up front with the '-s' option. Any settings that the 327 | application sets using interceptty's pseudo-terminal will be ignored. 328 | I can't find a way around this; if you have ideas, please let me know. 329 | 330 | We make no attempt to lock backend device. We probably should, but I 331 | don't know how to do it portably. If somebody has a nice API function 332 | I can call, I will happily add locking support in. 333 | 334 | This program has only been tested under Linux, although the code is 335 | fairly portable. I don't have access to another machine with serial 336 | ports I can play with, so I haven't tried to port it. I probably 337 | won't port this to any other machines, but if you manage to, please 338 | send me the patches and I will include them in future distributions. 339 | I have recently added autoconf support, which may be useful in making 340 | this program more portable. But to be honest, I just used it so I 341 | could get "make dist". 342 | 343 | 344 | =head1 HISTORY 345 | 346 | interceptty is based in larte part on ttysnoop-0.12d, by Carl 347 | Declerck. Any bugs with interceptty should be reported to me, and not 348 | to Carl. I basically adapted ttysnoop for my foul purposes, removed 349 | the parts that weren't necessary anymore, and added appropriate option 350 | processing. ttysnoop was licensed under the GPL, and I have of course 351 | kept that license for interceptty. 352 | 353 | =head1 AUTHOR 354 | 355 | Scott Gifford Esgifford@suspectclass.comE 356 | 357 | -------------------------------------------------------------------------------- /openZSniffer/missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2003-09-02.23 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 23 | # 02111-1307, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case "$1" in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | esac 64 | 65 | # If it does not exist, or fails to run (possibly an outdated version), 66 | # try to emulate it. 67 | case "$1" in 68 | 69 | -h|--h|--he|--hel|--help) 70 | echo "\ 71 | $0 [OPTION]... PROGRAM [ARGUMENT]... 72 | 73 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 74 | error status if there is no known handling for PROGRAM. 75 | 76 | Options: 77 | -h, --help display this help and exit 78 | -v, --version output version information and exit 79 | --run try to run the given command, and emulate it if it fails 80 | 81 | Supported PROGRAM values: 82 | aclocal touch file \`aclocal.m4' 83 | autoconf touch file \`configure' 84 | autoheader touch file \`config.h.in' 85 | automake touch all \`Makefile.in' files 86 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 87 | flex create \`lex.yy.c', if possible, from existing .c 88 | help2man touch the output file 89 | lex create \`lex.yy.c', if possible, from existing .c 90 | makeinfo touch the output file 91 | tar try tar, gnutar, gtar, then tar without non-portable flags 92 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 93 | 94 | Send bug reports to ." 95 | ;; 96 | 97 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98 | echo "missing $scriptversion (GNU Automake)" 99 | ;; 100 | 101 | -*) 102 | echo 1>&2 "$0: Unknown \`$1' option" 103 | echo 1>&2 "Try \`$0 --help' for more information" 104 | exit 1 105 | ;; 106 | 107 | aclocal*) 108 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 109 | # We have it, but it failed. 110 | exit 1 111 | fi 112 | 113 | echo 1>&2 "\ 114 | WARNING: \`$1' is $msg. You should only need it if 115 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 116 | to install the \`Automake' and \`Perl' packages. Grab them from 117 | any GNU archive site." 118 | touch aclocal.m4 119 | ;; 120 | 121 | autoconf) 122 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 123 | # We have it, but it failed. 124 | exit 1 125 | fi 126 | 127 | echo 1>&2 "\ 128 | WARNING: \`$1' is $msg. You should only need it if 129 | you modified \`${configure_ac}'. You might want to install the 130 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 131 | archive site." 132 | touch configure 133 | ;; 134 | 135 | autoheader) 136 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 137 | # We have it, but it failed. 138 | exit 1 139 | fi 140 | 141 | echo 1>&2 "\ 142 | WARNING: \`$1' is $msg. You should only need it if 143 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 144 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 145 | from any GNU archive site." 146 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 147 | test -z "$files" && files="config.h" 148 | touch_files= 149 | for f in $files; do 150 | case "$f" in 151 | *:*) touch_files="$touch_files "`echo "$f" | 152 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 153 | *) touch_files="$touch_files $f.in";; 154 | esac 155 | done 156 | touch $touch_files 157 | ;; 158 | 159 | automake*) 160 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 161 | # We have it, but it failed. 162 | exit 1 163 | fi 164 | 165 | echo 1>&2 "\ 166 | WARNING: \`$1' is $msg. You should only need it if 167 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 168 | You might want to install the \`Automake' and \`Perl' packages. 169 | Grab them from any GNU archive site." 170 | find . -type f -name Makefile.am -print | 171 | sed 's/\.am$/.in/' | 172 | while read f; do touch "$f"; done 173 | ;; 174 | 175 | autom4te) 176 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 177 | # We have it, but it failed. 178 | exit 1 179 | fi 180 | 181 | echo 1>&2 "\ 182 | WARNING: \`$1' is needed, but is $msg. 183 | You might have modified some files without having the 184 | proper tools for further handling them. 185 | You can get \`$1' as part of \`Autoconf' from any GNU 186 | archive site." 187 | 188 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 189 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 190 | if test -f "$file"; then 191 | touch $file 192 | else 193 | test -z "$file" || exec >$file 194 | echo "#! /bin/sh" 195 | echo "# Created by GNU Automake missing as a replacement of" 196 | echo "# $ $@" 197 | echo "exit 0" 198 | chmod +x $file 199 | exit 1 200 | fi 201 | ;; 202 | 203 | bison|yacc) 204 | echo 1>&2 "\ 205 | WARNING: \`$1' $msg. You should only need it if 206 | you modified a \`.y' file. You may need the \`Bison' package 207 | in order for those modifications to take effect. You can get 208 | \`Bison' from any GNU archive site." 209 | rm -f y.tab.c y.tab.h 210 | if [ $# -ne 1 ]; then 211 | eval LASTARG="\${$#}" 212 | case "$LASTARG" in 213 | *.y) 214 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 215 | if [ -f "$SRCFILE" ]; then 216 | cp "$SRCFILE" y.tab.c 217 | fi 218 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 219 | if [ -f "$SRCFILE" ]; then 220 | cp "$SRCFILE" y.tab.h 221 | fi 222 | ;; 223 | esac 224 | fi 225 | if [ ! -f y.tab.h ]; then 226 | echo >y.tab.h 227 | fi 228 | if [ ! -f y.tab.c ]; then 229 | echo 'main() { return 0; }' >y.tab.c 230 | fi 231 | ;; 232 | 233 | lex|flex) 234 | echo 1>&2 "\ 235 | WARNING: \`$1' is $msg. You should only need it if 236 | you modified a \`.l' file. You may need the \`Flex' package 237 | in order for those modifications to take effect. You can get 238 | \`Flex' from any GNU archive site." 239 | rm -f lex.yy.c 240 | if [ $# -ne 1 ]; then 241 | eval LASTARG="\${$#}" 242 | case "$LASTARG" in 243 | *.l) 244 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 245 | if [ -f "$SRCFILE" ]; then 246 | cp "$SRCFILE" lex.yy.c 247 | fi 248 | ;; 249 | esac 250 | fi 251 | if [ ! -f lex.yy.c ]; then 252 | echo 'main() { return 0; }' >lex.yy.c 253 | fi 254 | ;; 255 | 256 | help2man) 257 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 258 | # We have it, but it failed. 259 | exit 1 260 | fi 261 | 262 | echo 1>&2 "\ 263 | WARNING: \`$1' is $msg. You should only need it if 264 | you modified a dependency of a manual page. You may need the 265 | \`Help2man' package in order for those modifications to take 266 | effect. You can get \`Help2man' from any GNU archive site." 267 | 268 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 269 | if test -z "$file"; then 270 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 271 | fi 272 | if [ -f "$file" ]; then 273 | touch $file 274 | else 275 | test -z "$file" || exec >$file 276 | echo ".ab help2man is required to generate this page" 277 | exit 1 278 | fi 279 | ;; 280 | 281 | makeinfo) 282 | if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 283 | # We have makeinfo, but it failed. 284 | exit 1 285 | fi 286 | 287 | echo 1>&2 "\ 288 | WARNING: \`$1' is $msg. You should only need it if 289 | you modified a \`.texi' or \`.texinfo' file, or any other file 290 | indirectly affecting the aspect of the manual. The spurious 291 | call might also be the consequence of using a buggy \`make' (AIX, 292 | DU, IRIX). You might want to install the \`Texinfo' package or 293 | the \`GNU make' package. Grab either from any GNU archive site." 294 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 295 | if test -z "$file"; then 296 | file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 297 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 298 | fi 299 | touch $file 300 | ;; 301 | 302 | tar) 303 | shift 304 | if test -n "$run"; then 305 | echo 1>&2 "ERROR: \`tar' requires --run" 306 | exit 1 307 | fi 308 | 309 | # We have already tried tar in the generic part. 310 | # Look for gnutar/gtar before invocation to avoid ugly error 311 | # messages. 312 | if (gnutar --version > /dev/null 2>&1); then 313 | gnutar "$@" && exit 0 314 | fi 315 | if (gtar --version > /dev/null 2>&1); then 316 | gtar "$@" && exit 0 317 | fi 318 | firstarg="$1" 319 | if shift; then 320 | case "$firstarg" in 321 | *o*) 322 | firstarg=`echo "$firstarg" | sed s/o//` 323 | tar "$firstarg" "$@" && exit 0 324 | ;; 325 | esac 326 | case "$firstarg" in 327 | *h*) 328 | firstarg=`echo "$firstarg" | sed s/h//` 329 | tar "$firstarg" "$@" && exit 0 330 | ;; 331 | esac 332 | fi 333 | 334 | echo 1>&2 "\ 335 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 336 | You may want to install GNU tar or Free paxutils, or check the 337 | command line arguments." 338 | exit 1 339 | ;; 340 | 341 | *) 342 | echo 1>&2 "\ 343 | WARNING: \`$1' is needed, and is $msg. 344 | You might have modified some files without having the 345 | proper tools for further handling them. Check the \`README' file, 346 | it often tells you about the needed prerequisites for installing 347 | this package. You may also peek at any GNU archive site, in case 348 | some other package would contain this missing \`$1' program." 349 | exit 1 350 | ;; 351 | esac 352 | 353 | exit 0 354 | 355 | # Local variables: 356 | # eval: (add-hook 'write-file-hooks 'time-stamp) 357 | # time-stamp-start: "scriptversion=" 358 | # time-stamp-format: "%:y-%02m-%02d.%02H" 359 | # time-stamp-end: "$" 360 | # End: 361 | -------------------------------------------------------------------------------- /openZSniffer/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id: mkinstalldirs,v 7.1 2000/05/03 04:41:24 sgifford Exp $ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /openZSniffer/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You can run this script after building to test out interceptty in a 4 | # safe way. 5 | 6 | # These two settings are adjustable, although the defaults will 7 | # probably work fine. 8 | 9 | INET_PORT=9999 10 | DELAY=2 11 | 12 | trap 'exec 2>/dev/null; [ -n "$kids" ] && kill $kids' EXIT 13 | 14 | printf "%40s" "Starting up echo server..." 15 | ./interceptty -q '!cat' ./test1.tty & 16 | kids="$kids $!" 17 | sleep $DELAY 18 | if [ -c ./test1.tty ] 19 | then 20 | echo "OK" 21 | else 22 | echo "NO" 23 | exit 1 24 | fi 25 | 26 | printf "%40s" "Testing echo server..." 27 | if ./testport ./test1.tty "Test 1 OK" 28 | then 29 | echo "OK" 30 | else 31 | echo "NO" 32 | exit 1 33 | fi 34 | 35 | 36 | printf "%40s" "Starting up tty server..." 37 | ./interceptty -q ./test1.tty ./test2.tty & 38 | kids="$kids $!" 39 | sleep $DELAY 40 | if [ -c ./test2.tty ] 41 | then 42 | echo "OK" 43 | else 44 | echo "NO" 45 | exit 1 46 | fi 47 | 48 | printf "%40s" "Testing tty server..." 49 | if ./testport ./test2.tty "Test 2 OK" 50 | then 51 | echo "OK" 52 | else 53 | echo "NO" 54 | exit 1 55 | fi 56 | 57 | 58 | printf "%40s" "Starting Unix socket server..." 59 | ./interceptty -q ./test2.tty @./test3.sock & 60 | kids="$kids $!" 61 | sleep $DELAY 62 | if [ -r ./test3.sock ] 63 | then 64 | echo "OK" 65 | else 66 | echo "NO" 67 | exit 1 68 | fi 69 | 70 | printf "%40s" "Starting Unix socket client..." 71 | ./interceptty -q @./test3.sock ./test4.tty & 72 | kids="$kids $!" 73 | sleep $DELAY 74 | if [ -c ./test4.tty ] 75 | then 76 | echo "OK" 77 | else 78 | echo "NO" 79 | exit 1 80 | fi 81 | 82 | printf "%40s" "Testing Unix sockets..." 83 | if ./testport ./test4.tty "Test 4 OK" 84 | then 85 | echo "OK" 86 | else 87 | echo "NO" 88 | exit 1 89 | fi 90 | 91 | 92 | printf "%40s" "Starting file descriptor server..." 93 | ./interceptty -q =0,1 ./test5.tty >test4.tty & 94 | kids="$kids $!" 95 | sleep $DELAY 96 | if [ -c ./test5.tty ] 97 | then 98 | echo "OK" 99 | else 100 | echo "NO" 101 | exit 1 102 | fi 103 | 104 | printf "%40s" "Testing file descriptors..." 105 | if ./testport ./test5.tty "Test 5 OK" 106 | then 107 | echo "OK" 108 | else 109 | echo "NO" 110 | exit 1 111 | fi 112 | 113 | 114 | printf "%40s" "Starting Inet server on port $INET_PORT..." 115 | ./interceptty -q ./test5.tty @localhost:$INET_PORT & 116 | kids="$kids $!" 117 | sleep $DELAY 118 | # The netstat test we used to do doesn't work in some configurations. 119 | echo "OK" 120 | 121 | printf "%40s" "Starting Inet client on port $INET_PORT..." 122 | ./interceptty -q @localhost:$INET_PORT ./test6.tty & 123 | kids="$kids $!" 124 | sleep $DELAY 125 | if [ -c ./test6.tty ] 126 | then 127 | echo "OK" 128 | else 129 | echo "NO" 130 | echo "You may want to try changing the port used for testing, at the top of $0." 131 | exit 1 132 | fi 133 | 134 | printf "%40s" "Testing Internet socket server..." 135 | if ./testport ./test6.tty "Test 6 OK" 136 | then 137 | echo "OK" 138 | else 139 | echo "You may want to try changing the port used for testing, at the top of $0." 140 | echo "NO" 141 | exit 1 142 | fi 143 | 144 | 145 | 146 | 147 | 148 | exit 0 149 | -------------------------------------------------------------------------------- /openZSniffer/testport: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exec < $1 >> $1 4 | echo "$2" 5 | read i 6 | if [ "$i" != "$2" ] 7 | then 8 | exit 1 9 | else 10 | exit 0 11 | fi 12 | -------------------------------------------------------------------------------- /openZSniffer/zwavecore.h: -------------------------------------------------------------------------------- 1 | 2 | #define SOC 0x01 3 | 4 | 5 | --------------------------------------------------------------------------------