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 16KB

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