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

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