tsdecrypt reads and decrypts CSA encrypted incoming mpeg transport stream over UDP/RTP using code words obtained from OSCAM or similar CAM server. tsdecrypt communicates with CAM server using cs378x (camd35 over tcp) protocol or newcamd protocol. https://georgi.unixsol.org/programs/tsdecrypt/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tsdecrypt.1 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. .TH TSDECRYPT "1" "April 2012" "tsdecrypt 8.1" "User Commands"
  2. .SH NAME
  3. tsdecrypt \- Decrypt mpeg transport stream.
  4. .SH SYNOPSIS
  5. .B tsdecrypt
  6. [\fIoptions\fR]
  7. .SH DESCRIPTION
  8. tsdecrypt reads incoming mpeg transport stream over UDP/RTP or file and
  9. then decrypts it by after retriving code words from OSCAM or similar
  10. CAMD server. tsdecrypt communicates with CAM server using cs378x (camd35
  11. over tcp) protocol or newcamd protocol.
  12. .SH OPTIONS
  13. .TP
  14. .SH MAIN OPTIONS
  15. .PP
  16. .TP
  17. \fB\-i\fR, \fB\-\-ident\fR <ident>
  18. Set ident that will be used when logging to syslog. The preferred format
  19. for the ident is PROVIDER/CHANNEL.
  20. .TP
  21. \fB\-d\fR, \fB\-\-daemon\fR <pidfile>
  22. When started become a daemon and write pid file to <pidfile>.
  23. .TP
  24. \fB\-N\fR, \fB\-\-notify\-program\fR <program>
  25. Execute \fB<program>\fR when predefined events happen. In order for
  26. this option to work \fB\-\-ident\fR should also be used.
  27. You can use \fBnotify\-script.example\fR file as notification program
  28. and an example on how to create your own notification script.
  29. See \fBEVENTS\fR section for detailed description of the events.
  30. .TP
  31. \fB\-S\fR, \fB\-\-syslog\fR
  32. Write log messages to local syslog.
  33. .TP
  34. \fB\-l\fR, \fB\-\-syslog\-host\fR <addr>
  35. Set syslog host. tsdecrypt sends messages to this host over tcp in
  36. syslog compatible format. syslog\-ng was tested as receiving syslog server.
  37. .TP
  38. \fB\-L\fR, \fB\-\-syslog\-port\fR <port>
  39. Syslog server port. The default value is \fB514\fR.
  40. .TP
  41. \fB\-F\fR, \fB\-\-log\-file\fR <filename>
  42. Write logging data to <filename>. This option can be used along with syslog.
  43. .TP
  44. \fB\-D\fR, \fB\-\-debug\fR <level>
  45. Set message debug level. Currently there are five message levels.
  46. 0 = default messages, 1 = show PSI tables, 2 = show EMMs 3 = show
  47. duplicate ECMs, 4 = packet debug. 5 = packet debug + mpeg ts packet
  48. dump.
  49. Setting higher level enables the levels bellow.
  50. .TP
  51. \fB\-j\fR, \fB\-\-pid\-report\fR
  52. When this option is used, tsdecrypt on exit reports how much packets
  53. were received on each PID.
  54. .TP
  55. \fB\-b\fR, \fB\-\-bench\fR
  56. Bechmark the CSA decryption. The benchmark is single threaded.
  57. If you want to fully test your CPU, run couple of tsdecrypts in parallel.
  58. .TP
  59. \fB\-V\fR, \fB\-\-version\fR
  60. Show program version.
  61. .TP
  62. \fB\-h\fR, \fB\-\-help\fR
  63. Show program help.
  64. .TP
  65. .SH INPUT OPTIONS
  66. .PP
  67. .TP
  68. \fB\-I\fR, \fB\-\-input\fR <source>
  69. Where to read from. tsdecrypt supports input from files (\-I file.ts or \-I \-)
  70. or multicast (\-I 224.0.0.1:5000). By default tsdecrypt reads from \fBstdin\fR.
  71. .TP
  72. \fB\-R\fR, \fB\-\-input\-rtp\fR
  73. When reading from multicast assume the input is RTP stream. NOTE: No RTP
  74. processing/reordering of packets is done. The 12 byte RTP header is just
  75. stripped out and the stream is then processed as normal mpeg transport
  76. stream over UDP multicast.
  77. .TP
  78. \fB\-z\fR, \fB\-\-input\-ignore\-disc\fR
  79. Do not report input discontinuity or RTP discontinuity errors.
  80. .TP
  81. \fB\-M\fR, \fB\-\-input\-service\fR <service_id>
  82. Choose the service id. This option must be used when the input is MPTS
  83. in order to select the correct service (program). If the input is MPTS
  84. and \fB\-\-input\-service\fR is not used, tsdecrypt chooses the last service
  85. listed in PAT.
  86. .TP
  87. \fB\-T\fR, \fB\-\-input\-buffer\fR <miliseconds>
  88. Use this option to delay the decoding for certain amount of milliseconds. This
  89. allows tsdecrypt to decode services even if OSCAM returns code word too late.
  90. For example SkyUK sends code words ~700 ms before it starts using them. This
  91. means that if OSCAM is unable to return code word in less than 700 ms the
  92. decryption will fail for a small amount of time. Setting \-\-input\-buffer 1000
  93. will solve the problem in this case.
  94. .TP
  95. \fB\-W\fR, \fB\-\-input\-dump\fR <filename>
  96. Save input stream in <filename>. If the input is RTP, the file will contain
  97. the data without RTP headers (pure mpeg transport stream). Easiest way to
  98. save the input is using command line like the following:
  99. tsdecrypt \-I 239.78.78.78:5000 \-O /dev/null \-s 0.0.0.0 \-W file.ts
  100. .TP
  101. .SH OUTPUT OPTIONS
  102. .PP
  103. .TP
  104. \fB\-O\fR, \fB\-\-output\fR <dest>
  105. Output decrypted stream to <dest>. Destination can be multicast address
  106. (\-O 239.0.0.1:5000) or a file (\-O file.ts). The default output is \fBstdout\fR.
  107. .TP
  108. \fB\-o\fR, \fB\-\-output\-intf\fR <addr>
  109. Set multicast output interface.
  110. .TP
  111. \fB\-t\fR, \fB\-\-output\-ttl\fR
  112. Set multicast ttl. The default value is \fB1\fR.
  113. .TP
  114. \fB\-g\fR, \fB\-\-output\-tos\fR
  115. Set TOS value of output packets. The default is not to set any specific TOS.
  116. .TP
  117. \fB\-r\fR, \fB\-\-output\-rtp\fR
  118. Enable RTP output. The default output is standard MPEG TS over UDP, this
  119. option enables tsdecrypt to output RTP packets.
  120. .TP
  121. \fB\-k\fR, \fB\-\-output\-rtp\-ssrc\fR <ssrc>
  122. .TP
  123. \fB\-u\fR, \fB\-\-no\-output\-on\-error\fR
  124. Filter all output when there is no valid code word.
  125. .TP
  126. \fB\-p\fR, \fB\-\-no\-output\-filter\fR
  127. Disable output filtering. By default the output filter is enabled and only
  128. PAT/PMT/SDT and data packets are left in the output. Everything else not
  129. mentioned in PMT like NIT, EIT, TDT tables and unknown pids is removed.
  130. .TP
  131. \fB\-y\fR, \fB\-\-output\-nit\-pass\fR
  132. Pass through NIT packets when output filtering is enabled.
  133. .TP
  134. \fB\-w\fR, \fB\-\-output\-eit\-pass\fR
  135. Pass through EIT (EPG) packets when output filtering is enabled.
  136. .TP
  137. \fB\-x\fR, \fB\-\-output\-tdt\-pass\fR
  138. Pass through TDT/TOT packets when output filtering is enabled.
  139. .TP
  140. .SH CA OPTIONS
  141. .PP
  142. .TP
  143. \fB\-c\fR, \fB\-\-ca\-system\fR <ca_sys>
  144. Process input EMM/ECM from <ca_sys>. Currently tested and working CA systems
  145. are \fBCONAX\fR, \fBCRYPTOWORKS\fR, \fBIRDETO\fR, \fBVIACCESS\fR, \fBMEDIAGUARD\fR
  146. (\fBSECA\fR) and \fBVIDEOGUARD\fR (\fBNDS\fR), \fBNAGRA\fR and \fBBULCRYPT\fR.
  147. Other supported CA system that you can choose but is not tested is \fBDRECRYPT\fR.
  148. The default \fB<ca_sys>\fR is \fBCONAX\fR. You can override the default CAS CAIDs
  149. by using \fB\-\-caid\fR parameter.
  150. .TP
  151. \fB\-C\fR, \fB\-\-caid\fR <caid>
  152. Directly set CAID. This is useful if you have couple of CA streams from
  153. one CA but with different CAIDs or CAS that is unsupported by \fB\-\-ca\-system\fR
  154. parameter.
  155. .TP
  156. \fB\-Y\fR, \fB\-\-const\-cw\fR <code_word>
  157. Set constant code word to be used for decryption. The \fB<code_word>\fR should
  158. contain 32 hex chars. For example using \fBa1a2a3a4a5a6a7a8b1b2b3b4b5b6b7b8\fR
  159. as parameter will set even code word to \fBa1a2a3a4a5a6a7a8\fR and odd code
  160. word to \fBb1b2b3b4b5b6b7b8\fR.
  161. .TP
  162. \fB\-Q\fR, \fB\-\-biss\-key\fR <biss_key>
  163. Set BISS key to be used for decryption. The \fB<biss_key>\fR should
  164. contain 12 chars (hex). For example \fB112233445566\fR is valid BISS key.
  165. If the BISS key contains 16 chars this means that the key CRC is embeded
  166. in the key. These keys are also supported (they are the same as using
  167. constant code word with same code words for even and odd keys).
  168. .TP
  169. .SH CAMD OPTIONS
  170. .PP
  171. .TP
  172. \fB\-A\fR, \fB\-\-camd\-proto\fR <protocol>
  173. Set CAMD server protocol. Valid protocols are \fBCS378X\fR and \fBNEWCAMD\fR.
  174. If this option is not used the default protocol is \fBCS378X\fR (camd35 over
  175. tcp).
  176. .TP
  177. \fB\-s\fR, \fB\-\-camd\-server\fR <hostname[:port]>
  178. Set CAMD server address. You can use IPv4/IPv6 address or hostname. If the port
  179. is not set then \fB2233\fR is used as default port. 2233 is the default port
  180. for CS378X protocol but for NEWCAMD protocol you probably should choose other
  181. port number. To set static IPv6 address you have to put in in brackets (\fB[]\fR)
  182. for example: \fB[1234::5678]:2233\fR
  183. .TP
  184. \fB\-U\fR, \fB\-\-camd\-user\fR <username>
  185. Set CAMD user name. The default is \fBuser\fR.
  186. .TP
  187. \fB\-P\fR, \fB\-\-camd\-pass\fR <password>
  188. Set CAMD user password. The default is \fBpass\fR.
  189. .TP
  190. \fB\-B\fR, \fB\-\-camd\-des\-key\fR <des_key>
  191. Set DES key used by NEWCAMD protocol. The default
  192. is \fB0102030405060708091011121314\fR.
  193. .TP
  194. \fB\-4\fR, \fB\-\-ipv4\fR
  195. Connect to CAMD server using only IPv4 addresses of the server. IPv6
  196. addresses would be are ignorred.
  197. .TP
  198. \fB\-6\fR, \fB\-\-ipv6\fR
  199. Connect to CAMD server using only IPv6 addresses of the server. IPv4
  200. addresses would be are ignorred.
  201. .TP
  202. .SH EMM OPTIONS
  203. .PP
  204. .TP
  205. \fB\-e\fR, \fB\-\-emm\fR
  206. Enable sending EMM's to CAMD for processing. By default EMM processing
  207. is \fBdisabled\fR and only ECM are processed.
  208. .TP
  209. \fB\-Z\fR, \fB\-\-emm\-pid\fR <pid>
  210. Set EMM pid manually. This option is useful for services that have
  211. couple of EMM streams from one CA system. Without this option tsdecrypt
  212. always chooses the first stream from the chosen CA system.
  213. .TP
  214. \fB\-E\fR, \fB\-\-emm\-only\fR <hierarchy>
  215. Disable ECM processing and stream output. This option is useful if the EMM
  216. stream has very high rate and is interfering with ECM processing. Using
  217. \-\-emm\-only you can run special tsdecrypt dedicated only to card auto update.
  218. .TP
  219. \fB\-f\fR, \fB\-\-emm\-report\-time\fR <seconds>
  220. Set interval for EMM reports. The default is \fB60\fR seconds. Set to \fB0\fR
  221. to disable EMM reports.
  222. .TP
  223. \fB\-a\fR, \fB\-\-emm\-filter\fR <filter_definition>
  224. Add EMM filter described by <filter_definition>. EMM filters are useful if
  225. you want to limit the number of EMMs that should reach your CAMD server.
  226. The basic \fB<filter_defintion>\fR is \fBCommand/Settings\fR where
  227. the commands are: \fBaccept_all\fR, \fBreject_all\fR, \fBaccept\fR
  228. and \fBreject\fR.
  229. For more information about filtering and for example filters, please
  230. read \fBFILTERING\fR file that comes with tsdecrypt. This option can be
  231. used multiple times to define up to \fB16\fR different filters.
  232. .TP
  233. .SH ECM OPTIONS
  234. .PP
  235. .TP
  236. \fB\-X\fR, \fB\-\-ecm\-pid\fR <pid>
  237. Set ECM pid manually. This option is useful for services that have
  238. couple of ECM streams from one CA system. Without this option tsdecrypt
  239. always chooses the first stream from the chosen CA system. Run tsdecrypt
  240. with \-\-debug 2 and look at CA descriptors in PMT to see what CA streams
  241. are available.
  242. .TP
  243. \fB\-H\fR, \fB\-\-ecm\-report\-time\fR <seconds>
  244. Set interval for ECM reports. The default is \fB60\fR seconds. Set to \fB0\fR
  245. to disable ECM reports.
  246. .TP
  247. \fB\-G\fR, \fB\-\-ecm\-irdeto\-type\fR <type>
  248. Set ECM IRDETO type. IRDETO CA send ECMs with different id mixed
  249. into one stream. Only one of the IDs are valid in given time. This
  250. option lets you choose which stream to process. The default stream
  251. type is \fB0\fR.
  252. .TP
  253. \fB\-K\fR, \fB\-\-ecm\-no\-log\fR
  254. Disable logging of ECMs and code words. Code word errors and stats
  255. reports are not affected by this option.
  256. .TP
  257. \fB\-J\fR, \fB\-\-cw\-warn\-time\fR <seconds>
  258. After how much seconds to warn if valid code word was not received.
  259. The default is \fB60\fR seconds. Set to \fB0\fR to disable the warning.
  260. .TP
  261. .SH DEBUG OPTIONS
  262. .PP
  263. .TP
  264. \fB\-n\fR, \fB\-\-ecm\-file\fR <file.txt>
  265. Read ECM from text file and send it to CAMD server for processing. This
  266. option must be used along with \fB\-\-caid\fR and \fB\-\-input-service\fR
  267. options.
  268. The file should be normal text file, the format of the file is described
  269. bellow.
  270. .TP
  271. \fB\-m\fR, \fB\-\-emm\-file\fR <file.txt>
  272. Read EMM from text file and send it to CAMD server for processing. This
  273. option must be used along with \fB\-\-caid\fR and \fB\-\-input-service\fR
  274. options.
  275. Bellow is an example text file, lines starting with # are ignored and
  276. also 0x prefixes are ignored. Any other symbol in the file is processed
  277. as hex number. An example file might look like this:
  278. .nf
  279. # comment
  280. aa bb cc dd ee
  281. ff 01 02 03 04
  282. # Other comment
  283. 0x05 0x06 0x07
  284. .fi
  285. .SH EVENTS
  286. Notification events are sent when \fB\-\-notify\-program\fR and \fB\-\-ident\fR
  287. options are used. The event parameters are set as environmental variables
  288. before executing the external notification program. The variables are:
  289. \fB_TS\fR Unix timestamp of the event.
  290. \fB_IDENT\fR tsdecrypt ident parameter with "/" replaced by "\-".
  291. \fB_MESSAGE_ID\fR Event message id (for example START, STOP, etc...).
  292. \fB_MESSAGE_MSG\fR Event message id with "_" replaced by " ".
  293. \fB_MESSAGE_TEXT\fR Event message text. Human readable event message.
  294. currently defined events are:
  295. \fBSTART\fR tsdecrypt was started.
  296. \fBCODE_WORD_OK\fR Valid code word was received and decryption is
  297. working ok.
  298. \fBNO_CODE_WORD\fR No valid code word was received for X seconds. The
  299. decryption process have been suspended until valid
  300. code word is received.
  301. \fBNO_EMM_RECEIVED\fR No EMM packet have been received for X seconds.
  302. \fBINPUT_TIMEOUT\fR There was no data on the input.
  303. \fBINPUT_OK\fR The data have appeared on the input.
  304. \fBSTOP\fR tsdecrypt was stopped.
  305. See \fBnotify\-script.example\fR for an example on how to create external
  306. notification program.
  307. .SH EXAMPLES
  308. To get a quick start here are some example command lines. The default
  309. CA system is set to CONAX, you can change it using \fB\-\-ca-system\fR parameter.
  310. .nf
  311. # Decrypt multicast stream from 239.0.50.11:5000 using 10.0.1.1:2233
  312. # as camd server and output decrypted result to 239.78.78.78:5000
  313. tsdecrypt --camd-server 10.0.1.1 \\
  314. --input 239.0.50.11:5000 --output 239.78.78.78:5000
  315. # Same as above but enable EMM processing
  316. tsdecrypt --emm --camd-server 10.0.1.1:2233 \\
  317. --input 239.0.50.11:5000 --output 239.78.78.78:5000
  318. # Same as above but do not filter output stream thus allowing
  319. # EIT/TOT/NIT, etc tables to passthrough
  320. tsdecrypt --no-output-filter --emm --camd-server 10.0.1.1 \\
  321. --input 239.0.50.11:5000 --output 239.78.78.78:5000
  322. # Choose program/service_id to decrypt. Useful when the input is MPTS
  323. tsdecrypt --camd-server 10.0.1.1 --input-service 1234 \\
  324. --input 239.0.50.11:5000 --output 239.78.78.78:5000
  325. # Read stream over RTP and process VIACCESS encoded channel
  326. tsdecrypt --ca-system VIACCESS --emm --camd-server 10.0.1.1:2233 \\
  327. --input-rtp --input 239.0.50.11:5000 --output 239.78.78.78:5000
  328. # Decrypt stream encypted with CAID 0x0963 (NDS, sky)
  329. tsdecrypt --camd-server 10.0.1.1 --ca-system NDS --caid 0x0963 \\
  330. --input 239.0.50.11:5000 --output 239.78.78.78:5000
  331. # Send only EMMs to OSCAM for CAID 0x0963 (NDS, sky)
  332. tsdecrypt --camd-server 10.0.1.1 --emm-only --caid 0x0963 \\
  333. --input 239.0.50.11:5000 --output /dev/null
  334. # Decrypt stream encypted with CAID 0x5581 (Bulcrypt)
  335. tsdecrypt --camd-server 10.0.1.1 --caid 0x5581 \\
  336. --input 239.0.50.11:5000 --output 239.78.78.78:5000
  337. # Decrypt BISS encrypted stream
  338. tsdecrypt --biss-key 0x112233445566 --input 239.0.50.11:5000 \\
  339. --output 239.78.78.78:5000
  340. # Decrypt file encypted with constant code word
  341. tsdecrypt --const-cw 0x00000000000000001111111111111111 \\
  342. --input encrypted-file.ts --output decrypted-file.ts
  343. # Send ECM from file
  344. tsdecrypt --ecm-file ecm.txt --caid 0x5581 --input-service 12345 \\
  345. --camd-server example.com
  346. .fi
  347. .SH SEE ALSO
  348. See the README file for more information. If you have questions, remarks,
  349. problems or you just want to contact the developer, write to:
  350. \fIgeorgi@unixsol.org\fP
  351. .TP
  352. For more info, see the website at
  353. .I http://georgi.unixsol.org/programs/tsdecrypt/
  354. .SH AUTHORS
  355. Written by Georgi Chorbadzhiyski <\fBgeorgi@unixsol.org\fR>
  356. .SH LICENSE
  357. This program is free software; you can redistribute it and/or modify it under
  358. the terms of version 2 of the GNU General Public License as published by the
  359. Free Software Foundation.