C++ to achieve youku tudou video advertising methods

  • 2020-04-02 03:03:39
  • OfStack

In this paper, the example of C++ to achieve youku tudou to video advertising methods. Share with you for your reference. Specific analysis is as follows:

Before writing a tool, good or not I do not know, I use it well, the compiler environment VC6.0, the principle is to change the HOST file, but also changed other places, you can look at the source code, temporarily support XP, WIN7 did not write, the code may be a bit messy, interested friends can change.


// guanggaoDlg.cpp : implementation file 
WIN32_FIND_DATA FindFileData; 
void CGuanggaoDlg::OnButton1()  
{ 
//Shielding function
CopyFile("C:\WINDOWS\system32\drivers\etc\hosts","C:\WINDOWS\system32\drivers\etc\bak.hosts",TRUE); 
    TCHAR lujing[MAX_PATH] = "C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\"; 
    TCHAR lujing2[MAX_PATH] = "C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\"; 
    TCHAR youku[MAX_PATH] = "\static.youku.com"; 
    TCHAR tudou[MAX_PATH] = "\js.tudouui.com"; 
    HANDLE hFist = FindFirstFile("C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\*",&FindFileData); 
    FindNextFile (hFist, &FindFileData); 
    FindNextFile (hFist, &FindFileData); 
    strcat(lujing,FindFileData.cFileName); 
    strcat(lujing2,FindFileData.cFileName); 
    LPSTR dedaoquanlujing = strcat(lujing,youku); 
    LPSTR dedaoquanlujing2 = strcat(lujing2,tudou); 
    SHFILEOPSTRUCT filecaoz; 
    ZeroMemory(&filecaoz,sizeof(filecaoz)); 
    filecaoz.wFunc = FO_DELETE; 
    filecaoz.fFlags = FOF_NOCONFIRMATION|FOF_SIMPLEPROGRESS; 
    filecaoz.hNameMappings = NULL; 
    filecaoz.hwnd = NULL; 
    filecaoz.lpszProgressTitle = NULL; 
    filecaoz.pFrom = dedaoquanlujing; 
    SHFileOperation(&filecaoz); 
    SHFILEOPSTRUCT filecaoz2; 
    ZeroMemory(&filecaoz2,sizeof(filecaoz2)); 
    filecaoz.wFunc = FO_DELETE; 
    filecaoz.fFlags = FOF_NOCONFIRMATION|FOF_SIMPLEPROGRESS; 
    filecaoz.hNameMappings = NULL; 
    filecaoz.hwnd = NULL; 
    filecaoz.lpszProgressTitle = NULL; 
    filecaoz.pFrom = dedaoquanlujing2; 
    SHFileOperation(&filecaoz2); 
    SetFileAttributes(dedaoquanlujing,0); 
    DeleteFile(dedaoquanlujing); 
    DeleteFile(dedaoquanlujing2); 
    HANDLE wenjian = CreateFile(dedaoquanlujing,GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); 
    HANDLE wenjian2 = CreateFile(dedaoquanlujing2,GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); 
    SetFileAttributes(dedaoquanlujing,0); 
    SetFileAttributes(dedaoquanlujing2,0); 
    CloseHandle(hFist); 
    CloseHandle(wenjian); 
    CloseHandle(wenjian2); 
  //HOST 
    SetFileAttributes("C:\WINDOWS\system32\drivers\etc\hosts",0); 
    HANDLE wenjianjubing = CreateFile("C:\WINDOWS\system32\drivers\etc\hosts",GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); 
    //To youku
    DWORD sizebuff = 0; 
    char a1[] = {"#youkurn"}; 
    char a2[] = {"127.0.0.1 atm.youku.comrn"}; 
    char a3[] = {"127.0.0.1 Fvid.atm.youku.comrn"}; 
    char a4[] = {"127.0.0.1 html.atm.youku.comrn"}; 
    char a5[] = {"127.0.0.1 valb.atm.youku.comrn"}; 
    char a6[] = {"127.0.0.1 valf.atm.youku.comrn"}; 
    char a7[] = {"127.0.0.1 valo.atm.youku.comrn"}; 
    char a8[] = {"127.0.0.1 valp.atm.youku.comrn"}; 
    char a9[] = {"127.0.0.1 lstat.youku.comrn"}; 
    char a10[] = {"127.0.0.1 speed.lstat.youku.comrn"}; 
    char a11[] = {"127.0.0.1 urchin.lstat.youku.comrn"}; 
    char a12[] = {"127.0.0.1 stat.youku.comrn"}; 
    char a13[] = {"127.0.0.1 valc.atm.youku.comrn"}; 
    char a14[] = {"127.0.0.1 vid.atm.youku.comrn"}; 
    char a15[] = {"127.0.0.1 walp.atm.youku.comrn"}; 
    char a16[] = {"127.0.0.1 static.lstat.youku.comrn"}; 
    WriteFile(wenjianjubing,a1,sizeof(a1)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a2,sizeof(a2)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a3,sizeof(a3)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a4,sizeof(a4)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a5,sizeof(a5)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a6,sizeof(a6)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a7,sizeof(a7)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a8,sizeof(a8)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a9,sizeof(a9)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a10,sizeof(a10)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a11,sizeof(a11)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a12,sizeof(a12)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a13,sizeof(a13)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a14,sizeof(a14)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a15,sizeof(a15)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a16,sizeof(a16)-1,&sizebuff,NULL); 
  //To potato
    char b0[] = {"#tudourn"}; 
    char b1[]={"127.0.0.1 adextensioncontrol.tudou.comrn"}; 
    char b2[]={"127.0.0.1 iwstat.tudou.comrn"}; 
    char b3[]={"127.0.0.1 nstat.tudou.comrn"}; 
    char b4[]={"127.0.0.1 stats.tudou.comrn"}; 
    char b5[]={"127.0.0.1 *.p2v.tudou.com*rn"}; 
    char b6[]={"127.0.0.1 at-img1.tdimg.comrn"}; 
    char b7[]={"127.0.0.1 at-img2.tdimg.comrn"}; 
    char b8[]={"127.0.0.1 at-img3.tdimg.comrn"}; 
    char b9[]={"127.0.0.1 adplay.tudou.comrn"}; 
    char b10[]={"127.0.0.1 adcontrol.tudou.comrn"}; 
    char b11[]={"127.0.0.1 stat.tudou.comrn"}; 
    WriteFile(wenjianjubing,b0,sizeof(b0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b1,sizeof(b1)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b2,sizeof(b2)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b3,sizeof(b3)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b4,sizeof(b4)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b5,sizeof(b5)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b6,sizeof(b6)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b7,sizeof(b7)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b8,sizeof(b8)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b9,sizeof(b9)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b10,sizeof(b10)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,b11,sizeof(b11)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,a15,sizeof(a15)-1,&sizebuff,NULL); 
  //To cool 6
    char c0[] = {"#ku6rn"}; 
    char c1[]={"127.0.0.1 1.allyes.com.cnrn"}; 
    char c2[]={"127.0.0.1 analytics.ku6.comrn"}; 
    char c3[]={"127.0.0.1 gug.ku6cdn.comrn"}; 
    char c4[]={"127.0.0.1 ku6.allyes.comrn"}; 
    char c5[]={"127.0.0.1 ku6afp.allyes.comrn"}; 
    char c6[]={"127.0.0.1 pq.stat.ku6.comrn"}; 
    char c7[]={"127.0.0.1 st.vq.ku6.cnrn"}; 
    char c8[]={"127.0.0.1 stat0.888.ku6.comrn"}; 
    char c9[]={"127.0.0.1 stat1.888.ku6.comrn"}; 
    char c10[]={"127.0.0.1 stat2.888.ku6.comrn"}; 
    char c11[]={"127.0.0.1 stat3.888.ku6.comrn"}; 
    char c12[]={"127.0.0.1 static.ku6.comrn"}; 
    char c13[]={"127.0.0.1 v0.stat.ku6.comrn"}; 
    char c14[]={"127.0.0.1 v1.stat.ku6.comrn"}; 
    char c15[]={"127.0.0.1 v2.stat.ku6.comrn"}; 
    char c16[]={"127.0.0.1 v3.stat.ku6.comrn"}; 
    WriteFile(wenjianjubing,c0,sizeof(c0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c1,sizeof(c1)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c2,sizeof(c2)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c3,sizeof(c3)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c4,sizeof(c4)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c5,sizeof(c5)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c6,sizeof(c6)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c7,sizeof(c7)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c8,sizeof(c8)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c9,sizeof(c9)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c10,sizeof(c10)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c11,sizeof(c11)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c12,sizeof(c12)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c13,sizeof(c13)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c14,sizeof(c14)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c15,sizeof(c15)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,c16,sizeof(c16)-1,&sizebuff,NULL); 
  // // Go to qiyi advertising  
    char d0[] = {"#qiyirn"}; 
    char d1[]={"127.0.0.1 afp.qiyi.comrn"}; 
    char d2[]={"127.0.0.1 focusbaiduafp.allyes.comrn"}; 
    WriteFile(wenjianjubing,d0,sizeof(d0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,d1,sizeof(d1)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,d2,sizeof(d2)-1,&sizebuff,NULL); 
  //Sina's video
    char e0[] = {"#sinarn"}; 
    char e3[]={"127.0.0.1 dcads.sina.com.cnrn"}; 
    WriteFile(wenjianjubing,e0,sizeof(e0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,e3,sizeof(e3)-1,&sizebuff,NULL); 
  //To PPTV
    char f0[] = {"#pptvrn"}; 
    char f4[]={"127.0.0.1 pp2.pptv.comrn"}; 
    WriteFile(wenjianjubing,f0,sizeof(f0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,f4,sizeof(f4)-1,&sizebuff,NULL); 
  //sohu
    char g0[] = {"#sohurn"}; 
    char g5[]={"127.0.0.1images.sohu.comrn"}; 
    WriteFile(wenjianjubing,g0,sizeof(g0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,g5,sizeof(g5)-1,&sizebuff,NULL); 
  //Letv
    char h0[] = {"#leshirn"}; 
    char h6[]={"127.0.0.1 pro.letv.comrn"}; 
    WriteFile(wenjianjubing,h0,sizeof(h0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,h6,sizeof(h6)-1,&sizebuff,NULL); 
  //Thunder look at
    char j0[] = {"#xunleirn"}; 
    char j1[]={"127.0.0.1 mcfg.sandai.netrn"}; 
    char j2[]={"127.0.0.1 biz5.sandai.netrn"}; 
    char j3[]={"127.0.0.1 server1.adpolestar.netrn"}; 
    char j4[]={"127.0.0.1 advstat.xunlei.comrn"}; 
    char j5[]={"127.0.0.1 mpv.sandai.netrn"}; 
    WriteFile(wenjianjubing,j0,sizeof(j0)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,j1,sizeof(j1)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,j2,sizeof(j2)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,j3,sizeof(j3)-1,&sizebuff,NULL); 
    WriteFile(wenjianjubing,j3,sizeof(j3)-1,&sizebuff,NULL); 
  //QQ 
  char qq1[]={"#qqrn"}; 
  char qq2[]={"127.0.0.1 adslvfile.qq.comrn"}; 
  char qq3[]={"127.0.0.1 adsfile.qq.comrn"}; 
  WriteFile(wenjianjubing,qq1,sizeof(qq1)-1,&sizebuff,NULL); 
  WriteFile(wenjianjubing,qq2,sizeof(qq2)-1,&sizebuff,NULL); 
  BOOL bWite = WriteFile(wenjianjubing,qq3,sizeof(qq3)-1,&sizebuff,NULL); 
    if(bWite != 0) 
    { 
      AfxMessageBox(" Shielding success !"); 
      SetFileAttributes("C:\WINDOWS\system32\drivers\etc\hosts",1); 
      system("echo y|cacls C:\WINDOWS\system32\drivers\etc\hosts /g everyone:r"); 
      return; 
    } 
    else 
    { 
      AfxMessageBox(" Had blocked !"); 
      return; 
    } 
  } 
  void CGuanggaoDlg::OnButton2()  
  { 
  //restore
    TCHAR lujing[MAX_PATH] = "C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\"; 
    TCHAR lujing2[MAX_PATH] = "C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\"; 
    TCHAR mingche2[MAX_PATH] = "\static.youku.com"; 
    TCHAR tudou[MAX_PATH] = "\js.tudouui.com"; 
    HANDLE hFist2 = FindFirstFile("C:\Documents and Settings\Administrator\Application Data\Macromedia\Flash Player\#SharedObjects\*",&FindFileData); 
    FindNextFile (hFist2, &FindFileData); 
    FindNextFile (hFist2, &FindFileData); 
    strcat(lujing,FindFileData.cFileName); 
    strcat(lujing2,FindFileData.cFileName); 
    LPSTR dedaoquanlujing = strcat(lujing,mingche2); 
    LPSTR dedaoquanlujing2 = strcat(lujing2,tudou); 
    DeleteFile(dedaoquanlujing); 
    DeleteFile(dedaoquanlujing2); 
    CloseHandle(hFist2); 
    system("echo y|cacls C:\WINDOWS\system32\drivers\etc\hosts /g everyone:f"); 
    SetFileAttributes("C:\WINDOWS\system32\drivers\etc\hosts",0); 
    BOOL bCpy = CopyFile("C:\WINDOWS\system32\drivers\etc\bak.hosts","C:\WINDOWS\system32\drivers\etc\hosts",FALSE); 
    if(bCpy != 0) 
    { 
      AfxMessageBox(" Restore success !"); 
      return; 
    } 
    else 
    { 
      AfxMessageBox(" Restore failure !"); 
      return; 
    } 
  } 
  void CGuanggaoDlg::OnButton3()  
  { 
    //Youku test
    ShellExecute(NULL,"open","http://www.youku.com",NULL,NULL,SW_SHOWNORMAL); 
  }

Hope that the article described in the C++ programming to help you.


Related articles: