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.

notify-script.example 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. # Example tsdecrypt notify script
  3. # Written by Georgi Chorbadzhiyski
  4. #
  5. # *** Released as PUBLIC DOMAIN ***
  6. # *** Do whatever you want with this code ***
  7. # tsdecrypt sets its stack size to 64k which is very low and
  8. # causes sendmail to segfault, so increase the stack size to 2Mb
  9. ulimit -s 2048
  10. EMAIL_ENABLED="yes"
  11. EMAIL_TO="georgi@unixsol.org" # !!! Change this !!!
  12. EMAIL_FROM="georgi@unixsol.org" # !!! Change this !!!
  13. EMAIL_SUBJECT_PREFIX="[tsdecrypt]"
  14. EMAIL_PROGRAM="/usr/sbin/sendmail -t -i"
  15. LOG_ENABLED="yes"
  16. LOG_DIR="."
  17. LOG_FILE="$LOG_DIR/notify.${_IDENT}.notify.log"
  18. STATUS_ENABLED="yes"
  19. STATUS_FILE="$LOG_DIR/status.${_IDENT}"
  20. # Environmental vars that are set by the calling process (tsdecrypt):
  21. # _TS Unix timestamp of the event.
  22. # _IDENT tsdecrypt ident (--ident parameter).
  23. # _INPUT_ADDR Input address and port (for example 239.1.2.3:5000).
  24. # _OUTPUT_ADDR Output address and port (for example 239.9.8.7:5000).
  25. # _MESSAGE_ID Event message id (For example START, STOP, etc...).
  26. # _MESSAGE_TEXT Event message text. Human readable event message.
  27. # _MESSAGE_MSG Event message id lower cased and "_" is replaced with " "
  28. export PATH="/bin:/usr/bin:/usr/local/bin"
  29. export LC_ALL=C
  30. if [ -z "${_IDENT}" -o -z "${_TS}" ]
  31. then
  32. echo "This script must be run from tsdecrypt."
  33. echo "In order for tsdecrypt to run this script use --ident and --notify-prg options."
  34. echo
  35. echo "Example:"
  36. echo " tsdecrypt --ident SOURCE/CHANNEL --notify-program ./notify-script.example --camd-server x.x.x.x"
  37. echo
  38. exit 1
  39. fi
  40. if [ "$LOG_ENABLED" = "yes" ]
  41. then
  42. LOG_DATE="$(date +%F\ %T\ %z -d @${_TS})"
  43. printf "%s | %s | %-16s | %s\n" \
  44. "$LOG_DATE" \
  45. "${_IDENT}" \
  46. "${_MESSAGE_ID}" \
  47. "${_MESSAGE_TEXT}" \
  48. >> $LOG_FILE
  49. fi
  50. if [ "$STATUS_ENABLED" = "yes" ]; then
  51. # Run tsdecrypt with --notify-wait otherwise the events might get here out of order
  52. echo "${_IDENT}|${_TS}|${_MESSAGE_ID}|${_MESSAGE_TEXT}|${_INPUT_ADDR}|${_OUTPUT_ADDR}" > $STATUS_FILE.tmp
  53. mv $STATUS_FILE.tmp $STATUS_FILE
  54. fi
  55. if [ "$EMAIL_ENABLED" = "yes" ]
  56. then
  57. if [ -x $EMAIL_PROGRAM ]; then
  58. (
  59. echo "To: <$EMAIL_TO>"
  60. echo "From: <$EMAIL_FROM>"
  61. echo "Return-Path: <$EMAIL_FROM>"
  62. echo "Subject: $EMAIL_SUBJECT_PREFIX ${_IDENT} ${_MESSAGE_MSG}"
  63. echo "X-IDENT: ${_IDENT}"
  64. echo "X-MSG-ID: ${_MESSAGE_ID}"
  65. echo "X-Input: ${_INPUT_ADDR}"
  66. echo "X-Output: ${_OUTPUT_ADDR}"
  67. echo "X-Mailer: tsdecrypt"
  68. echo
  69. echo "${_IDENT} ${_MESSAGE_TEXT}"
  70. ) | $EMAIL_PROGRAM
  71. fi
  72. fi