rhadeed

SQL injection dengan menggunakan JAVA

In Tulisan saya on March 15, 2010 at 10:46 am

ini dia source kode yg saat ampuh di Java
SQLInjection😀 nice..
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import javasql.ResultSetMetaData
import javasql.SQLException
import javax.sql.rowset.JdbcRowSet
import com.sun.rowset.JdbcRowSetImpl

/**
*
* @author Radit
*/
public class JdbcRowSetTest
{
static final String JDBL_DRIVER=”com.mysql.jdbc.Driver”;
static final String DATABASE_URL=”jdbc.mysql://localhost/books”;
static final String USERNAME=”jhtp6″;
static final String PASSWORD=”jhtp6″;

public JdbcRowSetTest()
{
try
{
Class.forName(JDBC_DRIVER);

JdbcRowSet rowset=new JdbcRowSet();
rowset.setUrl(DATABASE_URL);
rowset.setUsername(USERNAME);
rowset.setPassword(PASSWORD);
rowset.setCommand(“SELECT*FROM authors”);
rowset.execute();

ResultSetMetaData metaData=rowset.getMetaData();
int numberOfColumns = metaData.getColumnCount();
System.out.println(“Authors Table of books Database : “);

for (int i=1 ; i<= numberOfColumns; i++)
System.out.printf("%-8s\t",metaData.getColumnName(i));
System.out.println();

While (rowSet.next())
{
for (int i=1; i<= numberOfColumns; i++)
System.out.printf("%-8s\t",rowSet,getObject(i));
System.out.println();

catch(SQLException sqlException)
{
sqlException.printStaskTrace();
System.exit(1);

}
catch (ClassNotFoundException classNotFound)
{
ClassNotFound.PrintStaskTrace()
System.exit(1);

}
}
public static void main(String args[]);
{
JdbcRowSet Window=new JdbcRowSetTest();
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: