This tool allows you to get passwords from email, file transfer and IRC clients. Works on Windows and Linux(via Wine). Includes both 32 and 64-bit versions. If you need the ssh password and use the exact account in a file transfer program that supports FTP(such as filezilla) then you can recover your SSH account. You may be able to recover your IMAP by using POP3 or SMTP protocol in the email client. Includes a batch file for each protocol.
unit tcppasswdUnit1; //Source code {$RESOURCE tcppasswd-res.res} interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,mshtml, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, IdCmdTCPServer, IdFTPServer, Vcl.OleCtrls, IdReply, IdFTPListOutput, Vcl.StdCtrls, IdContext, winsock, IdIrcServer, IdPOP3Server, IdSMTPServer, printers, IdCommandHandlers, Vcl.Menus, IdExplicitTLSClientServerBase; const CONNECTION_WELCOME= 'delphijustin TCP Password Recovery (http://delplink.xyz/password)'; PORT_MIN=1024; PORT_BASE=MAXWORD-PORT_MIN; PORT_INVALID=MAXWORD+1; APPVER=1.00; SWITCH_IRC='/IRC'; SWITCH_FTP='/FTP'; SWITCH_SMTP='/SMTP'; SWITCH_POP3='/POP3'; Service_Info_Line='For %s Use Port %u'; MEMO_FOOTER= 'Use localhost as the hostname or 127.0.0.1 as the IP.'#13#10'When done change the hostname and port number back in your client.'; type TPassLogWND = class(TForm) IdFTPServer1: TIdFTPServer; Memo1: TMemo; IdIRCServer1: TIdIRCServer; IdPOP3Server1: TIdPOP3Server; IdSMTPServer1: TIdSMTPServer; MainMenu1: TMainMenu; File1: TMenuItem; SaveResults1: TMenuItem; Exit1: TMenuItem; Clipboard1: TMenuItem; CopyFTPPort1: TMenuItem; CopyIRCPort1: TMenuItem; CopySMTPPort1: TMenuItem; CopyPOP3Port1: TMenuItem; CopyAll1: TMenuItem; SaveDialog1: TSaveDialog; Help1: TMenuItem; About1: TMenuItem; procedure IdFTPServer1UserAccount(ASender: TIdFTPServerContext; const AUsername, APassword, AAcount: string; var AAuthenticated: Boolean); procedure IdFTPServer1UserLogin(ASender: TIdFTPServerContext; const AUsername, APassword: string; var AAuthenticated: Boolean); procedure IdFTPServer1ListenException(AThread: TIdListenerThread; AException: Exception); procedure FormCreate(Sender: TObject); procedure IdPOP3Server1CheckUser(aContext: TIdContext; aServerContext: TIdPOP3ServerContext); procedure IdSMTPServer1UserLogin(ASender: TIdSMTPServerContext; const AUsername, APassword: string; var VAuthenticated: Boolean); procedure IdIRCServer1CommandPass(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandUser(AContext: TIdCommand; UserName, HostName, ServerName, RealName: string); procedure IdIRCServer1CommandUserHost(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandUsers(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandVersion(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandWallops(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandWho(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandWhoIs(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandWhoWas(AContext: TIdCommand; AParm1, AParm2, AParm3: string); procedure IdIRCServer1CommandStats(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandSummon(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandSQuit(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandServer(AContext: TIdCommand; ServerName, Hopcount, Info: string); procedure IdIRCServer1CommandPong(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandPing(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandQuit(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandOther(AContext: TIdCommand; Command, AParm: string); procedure IdIRCServer1CommandMode(AContext: TIdCommand; AParm1, AParm2, AParm3, AParm4, AParm5: string); procedure IdIRCServer1CommandList(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandLinks(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandInfo(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandConnect(AContext: TIdCommand; AParm1, AParm2, AParm3: string); procedure IdIRCServer1CommandPart(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandOper(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandPrivMsg(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandJoin(AContext: TIdCommand; AParm1, AParm2: string); procedure CopyFTPPort1Click(Sender: TObject); procedure CopyIRCPort1Click(Sender: TObject); procedure CopySMTPPort1Click(Sender: TObject); procedure CopyPOP3Port1Click(Sender: TObject); procedure CopyAll1Click(Sender: TObject); procedure Exit1Click(Sender: TObject); procedure SaveResults1Click(Sender: TObject); procedure IdIRCServer1CommandAway(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandAdmin(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandError(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandInvite(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandIsOn(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandKick(AContext: TIdCommand; AParm1, AParm2, AParm3: string); procedure IdIRCServer1CommandKill(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandNames(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandNick(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandNotice(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandRehash(AContext: TIdCommand); procedure IdIRCServer1CommandRestart(AContext: TIdCommand); procedure IdIRCServer1CommandTime(AContext: TIdCommand; AParm: string); procedure IdIRCServer1CommandTopic(AContext: TIdCommand; AParm1, AParm2: string); procedure IdIRCServer1CommandTrace(AContext: TIdCommand; AParm: string); procedure About1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; TPacketFlag=(DisconnectAfterSend,objIdCommand,objIdContext); TPacketFlags=set of TPacketFlag; var PassLogWND: TPassLogWND; args:tstringlist; ircnick:string='Unknown'; implementation uses clipbrd; {$R *.dfm} function PortTCPIsOpen(dwPort : Word) : boolean; var client : sockaddr_in;//sockaddr_in is used by Windows Sockets to specify a local or remote endpoint address sock : Integer; begin client.sin_family := AF_INET; client.sin_port := htons(dwPort);//htons converts a u_short from host to TCP/IP network byte order. client.sin_addr.s_addr := INADDR_LOOPBACK; //Use loopback address. sock :=socket(AF_INET, SOCK_STREAM, 0);//The socket function creates a socket Result:=connect(sock,client,SizeOf(client))=0;//establishes a connection to a specified socket. end; procedure sendPackets(obj:TObject;Server:TComponent;Username, password:string;flags:tpacketflags); var packets:tresourcestream; strpack:tstringlist; port:word; begin port:=0; with passlogwnd do begin if server=idircserver1 then port:=6667; if server=idftpserver1 then port:=21; if server=idsmtpserver1 then port:=25; if server=idpop3server1 then port:=110; end; try packets:=tresourcestream.CreateFromID(hinstance,port,'PACKETS'); except exit; end; strpack:=tstringlist.Create; strpack.LoadFromStream(packets); strpack.Text:=stringreplace(strpack.Text,'{IRCNICK}',IRCNICK,[rfreplaceall]); strpack.Text:=stringreplace(strpack.Text,'{PASSWORD}',PASSWORD,[rfreplaceall]); strpack.Text:=stringreplace(strpack.Text,'{USERNAME}',USERNAME,[rfreplaceall]); if objIdCOMMAND in flags then begin TIdCommand(obj).PerformReply:=false; TIDcommand(obj).Context.Connection.WriteRFCStrings(strpack); if disconnectaftersend in flags then tidcommand(obj).Context.Connection.Disconnect; end; if objIdContext in flags then begin TIdContext(obj).Connection.WriteRFCStrings(strpack); if disconnectAfterSend in flags then tidcontext(obj).Connection.Disconnect; end; packets.Free; strpack.Free; end; function results:tstringlist; var I: Integer; begin result:=tstringlist.Create; for I := 0 to passlogwnd.Memo1.Lines.IndexOf('')-1 do result.Add(passlogwnd.Memo1.Lines[i]); end; procedure logWrite(text:array of string;server:tcomponent); var I:Integer; S,serv:String; begin serv:='Warning'; with passlogwnd do begin if server=idircserver1 then serv:='IRC'; if server=idftpserver1 then serv:='FTP'; if SERVER=IDSMTPSERVER1 then SERV:='SMTP'; if SERVER=IDPOP3SERVER1 THEN SERV:='POP3'; end; S:=format('[%s] %s: ',[timetostr(time),serv]); for I :=0 to length(text)-1 do s:=s+text[i]; passlogwnd.Memo1.Lines.Insert(0,s); end; function randport:word; label newport; begin newport: result:=random(PORT_BASE)+PORT_MIN; if porttcpisopen(result)then goto newport; end; procedure TPassLogWND.About1Click(Sender: TObject); var msgbox:msgboxparams; begin zeromemory(@msgbox,sizeof(msgbox)); msgbox.cbSize:=sizeof(msgbox); msgbox.hwndOwner:=handle; msgbox.hInstance:=hinstance; msgbox.lpszText:=strfmt(stralloc(1024), 'delphijustin TCP Password recovery v%f'#13#10'By Justin Roeder',[appver]); msgbox.lpszCaption:='About'; msgbox.dwStyle:=mb_usericon; msgbox.lpszIcon:=makeintresource(1); messageboxindirect(msgbox); strdispose(msgbox.lpszText); end; procedure TPassLogWND.CopyAll1Click(Sender: TObject); begin clipboard.AsText:= memo1.Text; end; procedure TPassLogWND.CopyFTPPort1Click(Sender: TObject); begin clipboard.AsText:=uinttostr(idftpserver1.DefaultPort); end; procedure TPassLogWND.CopyIRCPort1Click(Sender: TObject); begin clipboard.AsText:=uinttostr(idircserver1.DefaultPort); end; procedure TPassLogWND.CopyPOP3Port1Click(Sender: TObject); begin clipboard.AsText:=uinttostr(idpop3server1.DefaultPort); end; procedure TPassLogWND.CopySMTPPort1Click(Sender: TObject); begin clipboard.AsText:=uinttostr(idsmtpserver1.DefaultPort); end; procedure TPassLogWND.Exit1Click(Sender: TObject); begin close; end; function startServicesThread(P:pointer):dword;stdcall; begin with passlogwnd do begin idftpserver1.DefaultDataPort:=randport; if strtouintdef(args.Values[SWITCH_IRC],PORT_INVALID)<PORT_INVALID then idircserver1.DefaultPort:=strtouint(args.Values[SWITCH_IRC]); if strtouintdef(args.Values[SWITCH_FTP],PORT_INVALID)<PORT_INVALID then idFTPserver1.DefaultPort:=strtouint(args.Values[SWITCH_FTP]); if strtouintdef(args.Values[SWITCH_SMTP],PORT_INVALID)<PORT_INVALID then idSMTPserver1.DefaultPort:=strtouint(args.Values[SWITCH_SMTP]); if strtouintdef(args.Values[SWITCH_POP3],PORT_INVALID)<PORT_INVALID then idpop3server1.DefaultPort:=strtouint(args.Values[SWITCH_POP3]); idftpserver1.Greeting.Text.Text:=connection_welcome; idircserver1.Greeting.Text.Text:=connection_welcome; idsmtpserver1.Greeting.Text.Text:=connection_welcome; idpop3server1.Greeting.Text.Text:=connection_welcome;; idftpserver1.Active:=(Args.IndexOf(switch_ftp)>0)or(strtouintdef(args.Values[ switch_ftp],port_invalid)<port_invalid); idircserver1.Active:=(Args.IndexOf(switch_irc)>0)or(strtouintdef(args.Values[ switch_irc],port_invalid)<port_invalid); idpop3server1.Active:=(Args.IndexOf(switch_pop3)>0)or(strtouintdef(args.Values[ switch_pop3],port_invalid)<port_invalid); idsmtpserver1.Active:=(Args.IndexOf(switch_smtp)>0)or(strtouintdef(args.Values[ switch_smtp],port_invalid)<port_invalid); memo1.Clear; MEMO1.Lines.Add(''); if idftpserver1.Active then memo1.Lines.Add(format(service_info_line,['FTP',idftpserver1.DefaultPort])); if idsmtpserver1.Active then memo1.Lines.Add(format(service_info_line,['SMTP',idSMTPserver1.DefaultPort])); if idircserver1.Active then memo1.Lines.Add(format(service_info_line,['IRC',idIRCserver1.DefaultPort])); if idpop3server1.Active then memo1.Lines.Add(format(service_info_line,['POP3',idPOP3server1.DefaultPort])); if memo1.Lines.Count=1 then begin memo1.Lines.Add('No service loaded please load it by typing '+extractfilename( paramstr(0))+' <protocols> at the command prompt.'); memo1.Lines.Add('Avalible protocols:'); memo1.Lines.Add('/FTP'); MEMO1.Lines.Add('/IRC'); MEMO1.Lines.Add('/POP3'); MEMO1.Lines.Add('/SMTP'); memo1.Lines.Add( 'To set a custom port simply put a equal sign and port number after the protocol name.') end; memo1.Lines.Add(memo_footer); end; end; procedure TPassLogWND.FormCreate(Sender: TObject); var tid:dword; begin args:=tstringlist.Create; args.Delimiter:=#32; args.DelimitedText:=strpas(getcommandline); randomize; createthread(nil,0,@startservicesthread,nil,0,tid); end; procedure TPassLogWND.IdFTPServer1ListenException(AThread: TIdListenerThread; AException: Exception); var port:word; begin port:=athread.Server.DefaultPort; logWrite([ 'Port ',uinttostr(port),' Cannot listen: ',aexception.ClassName,': ', aexception.Message],nil); end; procedure TPassLogWND.IdFTPServer1UserAccount(ASender: TIdFTPServerContext; const AUsername, APassword, AAcount: string; var AAuthenticated: Boolean); begin idftpserver1userlogin(asender,ausername,apassword,aauthenticated); end; procedure TPassLogWND.IdFTPServer1UserLogin(ASender: TIdFTPServerContext; const AUsername, APassword: string; var AAuthenticated: Boolean); var strpack:tstringlist; begin logWrite(['Username: ',ausername,' Password: ',apassword,''],idftpserver1); AAuthenticated:=false; strpack:=tstringlist.Create; strpack.Text:='530 Your username is '+ausername+' and password is '+apassword; asender.Connection.WriteRFCStrings(strpack); strpack.Free; asender.Connection.Disconnect; end; procedure TPassLogWND.IdIRCServer1CommandAdmin(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandAway(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandConnect(AContext: TIdCommand; AParm1, AParm2, AParm3: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandError(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandInfo(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandInvite(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandIsOn(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandJoin(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandKick(AContext: TIdCommand; AParm1, AParm2, AParm3: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandKill(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandLinks(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandList(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandMode(AContext: TIdCommand; AParm1, AParm2, AParm3, AParm4, AParm5: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandNames(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandNick(AContext: TIdCommand; AParm1, AParm2: string); begin IRCNick:=aparm1; end; procedure TPassLogWND.IdIRCServer1CommandNotice(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandOper(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandOther(AContext: TIdCommand; Command, AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandPart(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandPass(AContext: TIdCommand; AParm: string); begin logwrite(['Nickname: ',ircnick,' Password: ',aparm],idircserver1); sendpackets(acontext,idircserver1,'',aparm,[objIdCommand]); end; procedure TPassLogWND.IdIRCServer1CommandPing(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandPong(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandPrivMsg(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandQuit(AContext: TIdCommand; AParm: string); begin AContext.Disconnect:=true; end; procedure TPassLogWND.IdIRCServer1CommandRehash(AContext: TIdCommand); begin // end; procedure TPassLogWND.IdIRCServer1CommandRestart(AContext: TIdCommand); begin // end; procedure TPassLogWND.IdIRCServer1CommandServer(AContext: TIdCommand; ServerName, Hopcount, Info: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandSQuit(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandStats(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandSummon(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandTime(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandTopic(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandTrace(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandUser(AContext: TIdCommand; UserName, HostName, ServerName, RealName: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandUserHost(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandUsers(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandVersion(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandWallops(AContext: TIdCommand; AParm: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandWho(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandWhoIs(AContext: TIdCommand; AParm1, AParm2: string); begin // end; procedure TPassLogWND.IdIRCServer1CommandWhoWas(AContext: TIdCommand; AParm1, AParm2, AParm3: string); begin // end; procedure TPassLogWND.IdPOP3Server1CheckUser(aContext: TIdContext; aServerContext: TIdPOP3ServerContext); begin logwrite(['Username: ',aservercontext.Username,' Password: ', aservercontext.Password],idpop3server1); sendpackets(acontext,idpop3server1,aservercontext.Username,aservercontext.Password, [disconnectAfterSend,objIdContext]); end; procedure TPassLogWND.IdSMTPServer1UserLogin(ASender: TIdSMTPServerContext; const AUsername, APassword: string; var VAuthenticated: Boolean); var strpack:tstringlist; begin Logwrite(['Username: ',ausername,' Password: ',apassword],idsmtpserver1); vauthenticated:=true; strpack:=tstringlist.Create; strpack.Text:='500 Your username is '+ausername+' and Password is '+aPASSWORD; asender.Connection.WriteRFCStrings(strpack); strpack.Free; end; procedure TPassLogWND.SaveResults1Click(Sender: TObject); var txt:tstringlist; begin if not savedialog1.Execute then exit; txt:=results; txt.SaveToFile(savedialog1.FileName); txt.Free; end; end.