BOOL CChromClean::CleanChromePass(CString& strInPath) { sqlite3* pDB = NULL; BOOL bRet = TRUE; if (strInPath.Find(L'|')==-1) { bRet = FALSE; return bRet; } TCHAR szBuffer[MAX_PATH] = {0}; ::SHGetSpecialFolderPath( NULL, szBuffer, CSIDL_LOCAL_APPDATA, FALSE); CString strPath = szBuffer; strPath += _T("\\Google\\Chrome\\User Data\\Default"); CString strDbPath = L""; strPath += L"\\"; FindFileInDirectory(strPath.GetBuffer(),strDbPath,_T("Web Data")); strPath.ReleaseBuffer(); if (strDbPath.GetLength()>=0) { KW2UTF8 szDataPath(strDbPath.GetBuffer()); strDbPath.ReleaseBuffer(); char* szError = NULL; char szSql[MAX_PATH] = {0}; int nResult = sqlite3_open(szDataPath, &pDB); if (nResult != SQLITE_OK) { goto _exit_1; } sprintf_s(szSql, MAX_PATH - 1, "delete from logins"); nResult = sqlite3_exec(pDB, szSql, 0, 0, &szError); if(nResult != SQLITE_OK) { } _exit_1: if (pDB) { sqlite3_close(pDB); pDB = NULL; } } strDbPath = L""; FindFileInDirectory(strPath.GetBuffer(),strDbPath,_T("Login Data")); strPath.ReleaseBuffer(); if (strDbPath.GetLength()>=0) { KW2UTF8 szDataPath(strDbPath.GetBuffer()); strDbPath.ReleaseBuffer(); char* szError = NULL; char szSql[MAX_PATH] = {0}; int nResult = sqlite3_open(szDataPath, &pDB); if (nResult != SQLITE_OK) { bRet = FALSE; goto _exit_2; } sprintf_s(szSql, MAX_PATH - 1, "delete from logins"); nResult = sqlite3_exec(pDB, szSql, 0, 0, &szError); if(nResult != SQLITE_OK) { } _exit_2: if (pDB) { sqlite3_close(pDB); pDB = NULL; } } bRet = TRUE; return TRUE; }
BOOL CChromClean::ScanChromePass() { if (!_CheckChromeExist()) { g_vsNoinstallapp.Add(CHROME_PASSWORD); return TRUE; } CSimpleArray<CString> vec_file; CString strPath; g_fnScanFile(g_pMain,BEGINPROC(CHROME_PASSWORD),0,0,0); std::wstring str; std::vector<std::wstring>::iterator it; for (it = g_listProcessName.begin(); it != g_listProcessName.end(); it++ ) { str = *it; transform(str.begin(), str.end(), str.begin(), towlower); if (str == L"chrome.exe") { str = L"正在运行,跳过"; goto _exit_; } } str = L""; if (m_bScan ==TRUE) { TCHAR szBuffer[MAX_PATH] = {0}; ::SHGetSpecialFolderPath( NULL, szBuffer, CSIDL_LOCAL_APPDATA, FALSE); strPath = szBuffer; strPath += _T("\\Google\\Chrome\\User Data\\Default"); sqlite3* pDB = NULL; sqlite3_stmt* sspStart = NULL; CString strDbPath = L""; strPath += L"\\"; FindFileInDirectory(strPath.GetBuffer(),strDbPath,_T("Web Data")); strPath.ReleaseBuffer(); if (strDbPath.GetLength()>=0) { KW2UTF8 szDataPath(strDbPath.GetBuffer()); int nResult = sqlite3_open(szDataPath, &pDB); if (nResult != SQLITE_OK) { goto _exit_1; } nResult = sqlite3_prepare(pDB, "select * from logins", -1, &sspStart, 0); if (nResult != SQLITE_OK) { goto _exit_1; } nResult = sqlite3_step(sspStart); if(nResult == SQLITE_ROW) { CString strOutPut = strDbPath; strOutPut += L"|logins"; g_fnScanFile(g_pMain, CHROME_PASSWORD, strOutPut, 0, 0); } _exit_1: if (sspStart) { sqlite3_finalize(sspStart); sspStart = NULL; } if (pDB) { sqlite3_close(pDB); pDB = NULL; } } strDbPath = L""; FindFileInDirectory(strPath.GetBuffer(),strDbPath,_T("Login Data")); strPath.ReleaseBuffer(); if (strDbPath.GetLength()>=0) { KW2UTF8 szDataPath(strDbPath.GetBuffer()); strDbPath.ReleaseBuffer(); int nResult = sqlite3_open(szDataPath, &pDB); if (nResult != SQLITE_OK) { goto _exit_2; } nResult = sqlite3_prepare(pDB, "select * from logins", -1, &sspStart, 0); if (nResult != SQLITE_OK) { goto _exit_2; } nResult = sqlite3_step(sspStart); if(nResult == SQLITE_ROW) { CString strOutPut = strDbPath; strOutPut += L"|logins"; g_fnScanFile(g_pMain, CHROME_PASSWORD, strOutPut, 0, 0); } _exit_2: if (sspStart) { sqlite3_finalize(sspStart); sspStart = NULL; } if (pDB) { sqlite3_close(pDB); pDB = NULL; } } } _exit_: g_fnScanFile(g_pMain,ENDPROC(CHROME_PASSWORD),str.c_str(),0,0); return TRUE; }
void CFindFileTraverse::RunFindFile() { CString strDirectory = L""; for (int i = 0; i < (int)m_DirWorks.size() && !g_bStop[0]; i++) { DIRECTORYWORK& dirwork = m_DirWorks[i]; if(dirwork.bIsLeaf) { for (int iIndex = 0;iIndex<(int)dirwork.strDirectory.size();iIndex++) { strDirectory = dirwork.strDirectory.at(iIndex); if(dirwork.bDefaultSelect && !Is_Dlg_Init) { if (m_piTraverseFile && !g_bStop[0]) m_piTraverseFile->TraverseProcess(dirwork.id); CString strPath; if (RunVideoCacheFile(dirwork.id, strPath)) { if(strPath.GetLength()!=0) { if ( strPath[ strPath.GetLength() - 1 ] != _T('\\') ) strPath += _T('\\'); } strDirectory = strPath; } else { if (strDirectory.GetLength() <= 0 && dirwork.id != WIN_HUISHOUZHAN) { goto Exit0; } BOOL bFilter = FALSE; for(size_t ivIndex = 0; ivIndex < dirwork.strFilt.size(); ivIndex++) { if(CFilterTool::Instance()._DoFindFuncMap(dirwork.strFilt.at(ivIndex),strDirectory)) { bFilter = TRUE; break; } } if(bFilter) { goto Exit0; } if (dirwork.id != WIN_HUISHOUZHAN) { if ( strDirectory[ strDirectory.GetLength() - 1 ] != _T('\\') ) strDirectory += _T('\\'); } FindFileInDirectory(strDirectory, dirwork.strExtArray, dirwork.bRecursive ? 15 : 0, 0, m_piTraverseFile, NULL, dirwork.id, dirwork.strFilt, dirwork.strFriendName); } } } Exit0: if (m_piTraverseFile&&!Is_Dlg_Init&&dirwork.bDefaultSelect) m_piTraverseFile->TraverseProcessEnd(dirwork.id,strDirectory); } } if ( m_piTraverseFile) m_piTraverseFile->TraverseFinished(); }
BOOL CChromClean::ScanChrome() { //文件部分 if (!_CheckChromeExist()) { g_vsNoinstallapp.Add(BROWSERSCLEAN_CHROME); return TRUE; } CSimpleArray<CString> vec_file; CString strPath; std::wstring str; g_fnScanFile(g_pMain,BEGINPROC(BROWSERSCLEAN_CHROME),0,0,0); std::vector<std::wstring>::iterator it; for (it = g_listProcessName.begin(); it != g_listProcessName.end(); it++ ) { str = *it; transform(str.begin(), str.end(), str.begin(), towlower); if (str == L"chrome.exe") { str = L"正在运行,跳过"; goto _exit_; } } str = L""; if (m_bScan ==TRUE) { TCHAR szBuffer[MAX_PATH] = {0}; ::SHGetSpecialFolderPath( NULL, szBuffer, CSIDL_LOCAL_APPDATA, FALSE); strPath = szBuffer; strPath += _T("\\Google\\Chrome\\User Data\\Default\\Cache"); m_appHistory.CommfunFile(BROWSERSCLEAN_CHROME,strPath,vec_file); strPath = szBuffer; strPath += _T("\\Google\\Chrome\\User Data\\Default\\Media Cache"); m_appHistory.CommfunFile(BROWSERSCLEAN_CHROME,strPath,vec_file); //vec_file.Add(_T("Cookies")); //vec_file.Add(_T("Extension Cookies")); vec_file.Add(_T("Archived History")); //vec_file.Add(_T("History")); //vec_file.Add(_T("History-journal")); //vec_file.Add(_T("Thumbnails")); //vec_file.Add(_T("Thumbnails-journal")); vec_file.Add(_T("Current Tabs")); vec_file.Add(_T("Current Session")); vec_file.Add(_T("Last Tabs")); vec_file.Add(_T("Last Session")); vec_file.Add(_T("Safe Browsing Bloom")); vec_file.Add(_T("History Index*")); vec_file.Add(_T("Visited Links")); //vec_file.Add(_T("Extension Cookies")); strPath = szBuffer; strPath += _T("\\Google\\Chrome\\User Data\\Default"); m_appHistory.CommfunFile(BROWSERSCLEAN_CHROME,strPath,vec_file); vec_file.RemoveAll(); sqlite3* pDB = NULL; sqlite3_stmt* sspStart = NULL; CString strDbPath = L""; strPath += L"\\"; FindFileInDirectory(strPath.GetBuffer(),strDbPath,_T("History")); strPath.ReleaseBuffer(); if (strDbPath.GetLength()>=0) { KW2UTF8 szDataPath(strDbPath.GetBuffer()); strDbPath.ReleaseBuffer(); int nResult = sqlite3_open(szDataPath, &pDB); if (nResult != SQLITE_OK) { goto _exit_1; } nResult = sqlite3_prepare(pDB, "select * from segments", -1, &sspStart, 0); if (nResult != SQLITE_OK) { goto _exit_1; } nResult = sqlite3_step(sspStart); if(nResult == SQLITE_ROW) { CString strOutPut = strDbPath; strOutPut += L"|segments"; g_fnScanFile(g_pMain, BROWSERSCLEAN_CHROME, strOutPut, 0, 0); } _exit_1: if (sspStart) { sqlite3_finalize(sspStart); sspStart = NULL; } if (pDB) { sqlite3_close(pDB); pDB = NULL; } nResult = sqlite3_open(szDataPath, &pDB); if (nResult != SQLITE_OK) { goto _exit_2; } nResult = sqlite3_prepare(pDB, "select * from visits", -1, &sspStart, 0); if (nResult != SQLITE_OK) { goto _exit_2; } nResult = sqlite3_step(sspStart); if(nResult == SQLITE_ROW) { CString strOutPut = strDbPath; strOutPut += L"|visits"; g_fnScanFile(g_pMain, BROWSERSCLEAN_CHROME, strOutPut, 0, 0); } _exit_2: if (sspStart) { sqlite3_finalize(sspStart); sspStart = NULL; } if (pDB) { sqlite3_close(pDB); pDB = NULL; } } } _exit_: g_fnScanFile(g_pMain,ENDPROC(BROWSERSCLEAN_CHROME),str.c_str(),0,0); return TRUE; }
/* ------------------- D R E A M - D O C ------------------------------- ** Nom : ** Entree(s) : ** Sortie(s) : ** Val de ret : ** Sujet : ** Dependance : ** Auteur : Olivier Juan ** Version : ------------------------------------------------------------------------*/ int FindDirectory(unsigned char *tname,FileDescriptor **FD) { unsigned char *Buffer,*dname,*tempname; LittlePathTableDescriptor *LPTD; unsigned long PosInPathTable,TableSectorLength,TableLength; unsigned char BoolName,i,DirectoryNbr,PosInTree=0; short DirectoryLength; int readres; i=FindLastSeparator(tname); dname=(i==0?NULL:(unsigned char *)malloc(i+1)); for (BoolName=1;BoolName<=i;BoolName++)dname[BoolName-1]=tname[BoolName]; if (dname!=NULL)dname[i]=0; for (;BoolName<strlen(tname);BoolName++)tname[BoolName-i-1]=tname[BoolName]; if (tname!=NULL)tname[BoolName-i-1]=0; TableLength=IsoPrimaryVolume.PathTableLength; TableSectorLength=((unsigned long)(TableLength/IsoPrimaryVolume.SectorSize))+(TableLength%IsoPrimaryVolume.SectorSize>0?1:0); Buffer=(unsigned char *)malloc(TableSectorLength*IsoPrimaryVolume.SectorSize); if ((readres = read(1,TableSectorLength,IsoPrimaryVolume.FirstSectorNumInFirstLittleEndianPathTable,Buffer)) != 0) { printf("read a renvoye: %d\n", readres); return ISO_READ_ERR; } LPTD=(LittlePathTableDescriptor *)Buffer; if (LPTD->NameLength!=1) { printf("Erreur je ne trouve pas le ROOT\n"); return 2; } if (dname==NULL) { PosInPathTable=LPTD->FirstSectorNumber; LPTD=NULL; free(Buffer); return FindFileInDirectory(tname,PosInPathTable,FD); } tempname=dname; PosInPathTable=sizeof(LittlePathTableDescriptor)+LPTD->NameLength; PosInTree=1;DirectoryNbr=1; while((DirectoryLength=FindSeparator(tempname))!=-1) { BoolName=0; while (PosInPathTable<TableLength) { LPTD=(LittlePathTableDescriptor *)(Buffer+PosInPathTable);DirectoryNbr++; PosInPathTable+=sizeof(LittlePathTableDescriptor)+LPTD->NameLength; if (LPTD->ParentDirectortDescriptorNumber==PosInTree) { if (LPTD->NameLength==DirectoryLength) { i=0; do {BoolName=(tempname[i]==(LPTD->Name)[i]);i++;} while ((BoolName)&&(i<DirectoryLength)); if (BoolName) break; } } else if (LPTD->ParentDirectortDescriptorNumber>PosInTree) return 4; } if (BoolName==0) return 4; tempname+=DirectoryLength+1; PosInTree=DirectoryNbr; } PosInPathTable=LPTD->FirstSectorNumber; LPTD=NULL;tempname=NULL; free(Buffer);free(dname); return FindFileInDirectory(tname,PosInPathTable,FD); }