Scanner掃瞄器的原始碼

2021-06-02 22:42:47 字數 1803 閱讀 6600

#include

#include

#include

#define iport 80//目標web server埠

.#define szsign 「500 13\r\nserver: microsoft-iis/5.0″//根據此標誌來檢查目標是否有漏洞

#pragma comment(lib,」ws2_32.lib」)

/////

//定義&初始化全域性變數

char *sendbuff=」get /null.printer\n」,//傳送的請求buff

currenttarget[52]=,//存放最後乙個執行緒將掃瞄的目標

turn[4][2]=;//顯示進度時的字元

int sendbufflen=strlen(sendbuff),//傳送的buff長度

iconntimeout,//tcp connect timeout

ii=0,//掃瞄進度

itotal;//伺服器總數

handle hsemaphore=null,//信標核心物件控制代碼,用來控制線程數量

hstdout;//console標準輸出控制代碼,做進度顯示的時候用的

struct timeval timeout;//連線、傳送和接收的超時值

dword sleeptime;//每個乙個執行緒後等待的時間

/*sleeptime值根據使用者輸入的執行緒數量[threadnum]和tcp connecttimeout[conntimeo]來計算。確保在conntimeo時間左右開threadnum個執行緒。這樣在conntimeo時間後,所開的執行緒開始陸續超時退出,可以繼續穩定的開執行緒,可以有效的保證同時有threadnum個執行緒在執行。

*////

void showerror(char *);//顯示出錯資訊函式

bool resetcursor(void);//重置游標位置,執行緒輸出的時候呼叫的

dword winapi showproinfo(lpvoid);//顯示進度資訊

dword winapi scan(lpvoid);//掃瞄函式

void usage(char *);//幫助函式

///int main(int argc,char **argv)

//get target range

int startnet=inet_addr(argv[1]);

int stopnet=inet_addr(argv[2]);

int starthost=ntohl(startnet);

int stophost=ntohl(stopnet);

//取得執行緒數量

maxthread=atoi(argv[3]);

//取得conn超時時間

iconntimeout=atoi(argv[4]);

//檢查引數合法性

if((iconntimeout>6) || (iconntimeout<2) || (maxthread<1) || (maxthread>500) || (stophost」

「\n\nnotice」

「\n    startip stopip ==>不要忘記stopip必須比startip大 」

「\n    threadnum ==>請輸如1-500之間的數字」

「\n    conntimeo ==>tcp連線超時時,請輸入2-6″

「\n\nexample」

「\n    %s 192.168.0.0 192.168.255.255 200 2″,proname,proname,proname);

}

Scanner類 掃瞄器接受輸入資料

j a提供scanner工具類實現獲取使用者輸入。基本語法如下 scanner s new scanner system.in 通過scanner類的next 與nextline 方法獲取輸入的字串,在讀取前我們一般需要使用hasnext 與hasnextline 判斷是否還有輸入的資料。使用nex...

掃瞄器詳解

一 掃瞄器的定義 掃瞄器是一種獲取影象的裝置,並將資訊轉為電腦可以顯示 編輯 儲存和輸出的數字格式。即可以完成以下工作 在檔案中插隊圖和 將文字識別,免去打字 將傳真檔案掃到庫中存檔 在多 中加入影象 在報刊中加入有效表達主題。二 掃瞄器的工作原理 將光線照到待掃瞄的稿件上,光線反向回平後再由乙個稱...

用C寫的乙個掃瞄器原始碼

include include 編譯時需使用的庫 pragma comment lib,wsock32.lib select 成員定義 define zero fd set 0 變數定義 int maxth,scanok,scannum int portip,hoststart,hoststop,s...