|
SASC
DVBSoftCAM
|
00001 00002 #include <stdlib.h> 00003 #include <stdio.h> 00004 00005 #include "data.h" 00006 #include "system.h" 00007 #include "log.h" 00008 #include "compat.h" 00009 #include <vdr/sources.h> 00010 00011 #include <libsi/section.h> 00012 SI::TOT __dummy; 00013 00014 int main(int argc, char *argv[]) 00015 { 00016 if(argc<6) { 00017 printf("usage: %s <lib-dir> <plugin-dir> <caid> <provid> <source> <ecm-dump>\n",argv[0]); 00018 return 1; 00019 } 00020 DllsLoad(argv[1]); 00021 InitAll(argv[2]); 00022 LogAll(); 00023 cLogging::SetModuleOption(LCLASS(7,0x20<<2),false); // Nagra L_SYS_DISASM 00024 cLogging::SetModuleOption(LCLASS(7,0x20<<4),false); // Nagra L_SYS_CPUSTATS 00025 cLogging::SetModuleOption(LCLASS(16,0x20<<5),false); // Viacsess L_SYS_DISASM 00026 unsigned char ecm[4096]; 00027 int len=ReadRaw(argv[6],ecm,sizeof(ecm)); 00028 00029 int caid=strtol(argv[3],0,0); 00030 int provid=strtol(argv[4],0,0); 00031 printf("using caid %04x provid %04x\n",caid,provid); 00032 cEcmInfo ecmD("dummy",0x123,caid,provid); 00033 ecmD.SetSource(10,cSource::FromString(argv[5]),120); 00034 cSystem *sys=0; 00035 int lastPri=0; 00036 while((sys=cSystems::FindBySysId(caid,false,lastPri))) { 00037 lastPri=sys->Pri(); 00038 printf("processing with module '%s'\n",sys->Name()); 00039 bool res=false; 00040 for(int i=0; i<len;) { 00041 int s=SCT_LEN(&ecm[i]); 00042 if(sys->ProcessECM(&ecmD,&ecm[i])) { 00043 printf("resulting CW: "); 00044 SDump(sys->CW(),16); 00045 res=true; 00046 } 00047 i+=s; 00048 } 00049 delete sys; 00050 if(res) break; 00051 } 00052 }