SASC
DVBSoftCAM

testTPS.c

Go to the documentation of this file.
00001 
00002 #include <stdlib.h>
00003 #include <stdio.h>
00004 
00005 #define TESTER
00006 #include "crypto.h"
00007 #include "data.h"
00008 #include "system-common.h"
00009 #include "compat.h"
00010 
00011 #include "systems/viaccess/viaccess.h"
00012 #include "systems/viaccess/viaccess.c"
00013 
00014 // ----------------------------------------------------------------
00015 
00016 class cTransponderTime;
00017 
00018 class cSatTimeHook : public cLogHook {
00019 private:
00020 public:
00021   cSatTimeHook(cTransponderTime *Ttime);
00022   ~cSatTimeHook();
00023   virtual void Process(int pid, unsigned char *data);
00024   };
00025 
00026 cSatTimeHook::cSatTimeHook(cTransponderTime *Ttime)
00027 :cLogHook(HOOK_SATTIME,"sattime")
00028 {}
00029 
00030 cSatTimeHook::~cSatTimeHook()
00031 {}
00032 
00033 void cSatTimeHook::Process(int pid, unsigned char *data)
00034 {}
00035 
00036 // ----------------------------------------------------------------
00037 
00038 class cTpsAuHook : public cLogHook {
00039 public:
00040   cTpsAuHook(void);
00041   virtual ~cTpsAuHook();
00042   virtual void Process(int pid, unsigned char *data);
00043   void DummyProcess(unsigned char *data, int size);
00044   };
00045 
00046 #include "systems/viaccess/tps.c"
00047 #include "systems/viaccess/st20.c"
00048 
00049 cTpsAuHook::cTpsAuHook(void)
00050 :cLogHook(HOOK_TPSAU,"tpsau")
00051 {}
00052 
00053 cTpsAuHook::~cTpsAuHook()
00054 {}
00055 
00056 void cTpsAuHook::Process(int pid, unsigned char *data)
00057 {
00058 }
00059 
00060 void cTpsAuHook::DummyProcess(unsigned char *data, int size)
00061 {
00062   tpskeys.Load(false);
00063   if(data && size) {
00064     cOpenTVModule mod(2,data,size);
00065     tpskeys.ProcessAu(&mod);
00066     }
00067   else {
00068     tpskeys.LoadBin();
00069     }
00070   tpskeys.Purge(time(0));
00071   tpskeys.Save();
00072 }
00073 
00074 // ----------------------------------------------------------------
00075 
00076 int main(int argc, char *argv[])
00077 {
00078   if(argc<3) {
00079     printf("usage: %s <plugin-dir> <TPSBIN|OTV> <decomp-bin>\n",argv[0]);
00080     return 1;
00081     }
00082 
00083   InitAll(argv[1]);
00084   LogAll();
00085   cLogging::SetModuleOption(LCLASS(L_SYS,L_SYS_DISASM),false);
00086   if(!strcasecmp(argv[2],"OTV")) {
00087     FILE *f=fopen(argv[3],"r");
00088     if(f) {
00089       fseek(f,0,SEEK_END);
00090       int size=ftell(f);
00091       fseek(f,0,SEEK_SET);
00092       unsigned char *data=(unsigned char *)malloc(size);
00093       if(fread(data,1,size,f)<=0) ;
00094       fclose(f);
00095       printf("read %d bytes from %s\n",size,argv[3]);
00096 
00097       cTpsAuHook hook;
00098       hook.DummyProcess(data,size);
00099       }
00100     }
00101   else if(!strcasecmp(argv[2],"TPSBIN")) {
00102     cTpsAuHook hook;
00103     hook.DummyProcess(0,0);
00104     }
00105   return 0;
00106 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines