Created
January 29, 2016 21:43
-
-
Save leonardocordeiro/c7b33edf711d0ae6969c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String nome = "Leonardo"; | |
String senha = "' or 1=1 #"; | |
Connection cnn = DriverManager.getConnection("jdbc:mysql://localhost/sql_injection", "root", ""); | |
PreparedStatement statement = cnn.prepareStatement("select * from Usuario where nome = '" + nome + "' and senha='" + senha + "';"); | |
ResultSet resultSet = statement.executeQuery(); | |
while(resultSet.next()) | |
System.out.println(resultSet.getString("nome")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment