|
@@ -135,7 +135,8 @@ uint32_t camd35_auth = 0;
|
135
|
135
|
AES_KEY camd35_aes_encrypt_key;
|
136
|
136
|
AES_KEY camd35_aes_decrypt_key;
|
137
|
137
|
|
138
|
|
-int emm_filter = 0;
|
|
138
|
+int emm_send = 1;
|
|
139
|
+int pid_filter = 1;
|
139
|
140
|
|
140
|
141
|
struct in_addr output_addr;
|
141
|
142
|
unsigned int output_port;
|
|
@@ -150,7 +151,6 @@ void show_help() {
|
150
|
151
|
printf("\n");
|
151
|
152
|
printf(" Options:\n");
|
152
|
153
|
printf(" -c ca_system | default: %s valid: IRDETO, CONNAX, CRYPTOWORKS\n", ts_get_CA_sys_txt(req_CA_sys));
|
153
|
|
- printf(" -e | Disable EMM processing.\n");
|
154
|
154
|
printf("\n");
|
155
|
155
|
printf(" CAMD35 server options:\n");
|
156
|
156
|
printf(" -s server_addr | default: disabled (format 1.2.3.4:2233)\n");
|
|
@@ -162,18 +162,26 @@ void show_help() {
|
162
|
162
|
printf(" -i output_intf | default: %s\n", inet_ntoa(output_intf));
|
163
|
163
|
printf(" -t output_ttl | default: %d\n", output_ttl);
|
164
|
164
|
printf("\n");
|
165
|
|
- printf(" Misc options:\n");
|
166
|
|
- printf(" -D debug_level | level 0 - default messages\n");
|
167
|
|
- printf(" level 1 - show PSI tables\n");
|
168
|
|
- printf(" level 2 - show EMMs\n");
|
169
|
|
- printf(" level 3 - show duplicate ECMs\n");
|
170
|
|
- printf(" level 4 - packet debug\n");
|
|
165
|
+ printf(" Filtering options:\n");
|
|
166
|
+ printf(" -e | EMM send (default: %s).\n", emm_send ? "enabled" : "disabled");
|
|
167
|
+ printf(" | - Send EMMs to CAMD server for processing.\n");
|
|
168
|
+ printf("\n");
|
|
169
|
+ printf(" -p | Output PID filter (default: %s).\n", pid_filter ? "enabled" : "disabled");
|
|
170
|
+ printf(" | - When PID filter is enabled only PAT/PMT/SDT/data\n");
|
|
171
|
+ printf(" | - packets are left in the output.\n");
|
|
172
|
+ printf("\n");
|
|
173
|
+ printf(" -D debug_level | Message debug level. Bigger levels includes the levels bellow.\n");
|
|
174
|
+ printf(" | 0 - default messages\n");
|
|
175
|
+ printf(" | 1 - show PSI tables\n");
|
|
176
|
+ printf(" | 2 - show EMMs\n");
|
|
177
|
+ printf(" | 3 - show duplicate ECMs\n");
|
|
178
|
+ printf(" | 4 - packet debug\n");
|
171
|
179
|
printf("\n");
|
172
|
180
|
}
|
173
|
181
|
|
174
|
182
|
void parse_options(int argc, char **argv) {
|
175
|
183
|
int j, ca_err = 0, server_err = 1, output_addr_err = 0, output_intf_err = 0;
|
176
|
|
- while ((j = getopt(argc, argv, "ces:o:i:t:U:P:D:h")) != -1) {
|
|
184
|
+ while ((j = getopt(argc, argv, "cFs:o:i:t:U:P:epD:h")) != -1) {
|
177
|
185
|
char *p = NULL;
|
178
|
186
|
switch (j) {
|
179
|
187
|
case 'c':
|
|
@@ -186,9 +194,6 @@ void parse_options(int argc, char **argv) {
|
186
|
194
|
else
|
187
|
195
|
ca_err = 1;
|
188
|
196
|
break;
|
189
|
|
- case 'e':
|
190
|
|
- emm_filter = 1;
|
191
|
|
- break;
|
192
|
197
|
|
193
|
198
|
case 's':
|
194
|
199
|
p = strrchr(optarg, ':');
|
|
@@ -226,6 +231,13 @@ void parse_options(int argc, char **argv) {
|
226
|
231
|
camd35_pass = optarg;
|
227
|
232
|
break;
|
228
|
233
|
|
|
234
|
+ case 'e':
|
|
235
|
+ emm_send = !emm_send;
|
|
236
|
+ break;
|
|
237
|
+ case 'p':
|
|
238
|
+ pid_filter = !pid_filter;
|
|
239
|
+ break;
|
|
240
|
+
|
229
|
241
|
case 'D':
|
230
|
242
|
debug_level = atoi(optarg);
|
231
|
243
|
break;
|
|
@@ -248,7 +260,6 @@ void parse_options(int argc, char **argv) {
|
248
|
260
|
exit(1);
|
249
|
261
|
}
|
250
|
262
|
ts_LOGf("CA System : %s\n", ts_get_CA_sys_txt(req_CA_sys));
|
251
|
|
- ts_LOGf("EMM : %s\n", emm_filter ? "filter" : "process");
|
252
|
263
|
ts_LOGf("Server addr: %s:%u\n", inet_ntoa(camd35_server_addr), camd35_server_port);
|
253
|
264
|
ts_LOGf("Server user: %s\n", camd35_user);
|
254
|
265
|
ts_LOGf("Server pass: %s\n", camd35_pass);
|
|
@@ -257,7 +268,8 @@ void parse_options(int argc, char **argv) {
|
257
|
268
|
ts_LOGf("Output intf: %s\n", inet_ntoa(output_intf));
|
258
|
269
|
ts_LOGf("Output ttl : %d\n", output_ttl);
|
259
|
270
|
}
|
260
|
|
-
|
|
271
|
+ ts_LOGf("EMM send : %s\n", emm_send ? "enabled" : "disabled");
|
|
272
|
+ ts_LOGf("PID filter : %s\n", pid_filter ? "enabled" : "disabled");
|
261
|
273
|
}
|
262
|
274
|
|
263
|
275
|
static int connect_to(struct in_addr ip, int port) {
|
|
@@ -493,6 +505,9 @@ void process_emm(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
|
493
|
505
|
|
494
|
506
|
show_ts_pack(pid, "emm", NULL, ts_packet);
|
495
|
507
|
|
|
508
|
+ if (!emm_send)
|
|
509
|
+ return;
|
|
510
|
+
|
496
|
511
|
ts->emm = ts_privsec_push_packet(ts->emm, ts_packet);
|
497
|
512
|
if (!ts->emm->initialized)
|
498
|
513
|
return;
|
|
@@ -508,8 +523,7 @@ void process_emm(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
|
508
|
523
|
sec->section_data_len,
|
509
|
524
|
dump);
|
510
|
525
|
}
|
511
|
|
- if (!emm_filter)
|
512
|
|
- camd35_send_emm(ts->emm_caid, sec->section_data, sec->section_data_len);
|
|
526
|
+ camd35_send_emm(ts->emm_caid, sec->section_data, sec->section_data_len);
|
513
|
527
|
ts_privsec_copy(ts->emm, ts->last_emm);
|
514
|
528
|
ts_privsec_clear(ts->emm);
|
515
|
529
|
}
|