亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dps.c

?? its a full portscan... it works for all type of scanning. here we use libcap
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
 * Dynamic Port Scanner (DPS)
 * dps.c -- DPS core functions implementation
 *
 * Copyright (c) 2006 - 2008 AR Samhuri <ar@securebits.org>
 * ALL RIGHTS RESERVED.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * My Include
 */
#include "./dps.h"

/*
 * DPS Function Implementations
 */

void dps_init()
{
    int i;
    struct libnet_ether_addr *mac_addr;

    printf(
        "============================================================\n"
        BANNER "\n"
        COPYRIGHT "\n"
        "============================================================\n" );
    if( cfg.verbosity )
        printf("Initializing DPS...\n");
    /* 
     * Catch the interrupt signal so the prgram can print
     * the results before exiting
     */
    if( dps_catch_signal( SIGINT, dps_signal_handler ) == -1 )
    {
        printf("Cannot catch SIGINT signal.\n");
        exit( EXIT_FAILURE );
    }

    /* Initialize Libpcap, Libnet, and other DPS variables */

    /* Finding the device if the user didn't specify one */
    if( cfg.device == NULL )
    {
        cfg.device = pcap_lookupdev( pcap_cfg.p_errbuf );
        if( cfg.device == NULL )
        {
            printf("Error while looking for an interface: %s\n", pcap_cfg.p_errbuf );
            exit( EXIT_FAILURE );
        }
    }

    /* Opening the device */
    pcap_cfg.p = pcap_open_live( cfg.device, SNAPLEN, PROMISC, TIMEOUT, pcap_cfg.p_errbuf );
    if( pcap_cfg.p == NULL )
    {
        printf("Cannot open the device: %s\n", pcap_cfg.p_errbuf );
        exit( EXIT_FAILURE );
    }

    /* Checking the Data Link of the device */
    if( pcap_datalink( pcap_cfg.p ) != DLT_EN10MB )
    {
        printf("This program works only on Ethernet networks\n");
        pcap_close( pcap_cfg.p );
        exit( EXIT_FAILURE );
    }

    /* Setting up the Subnet Mask and Local Network Address */
    if( pcap_lookupnet( cfg.device, &pcap_cfg.local_net, &pcap_cfg.netmask, pcap_cfg.p_errbuf ) == -1 )
    {
        printf("Cannot set up the subnet mask and network address: %s\n", pcap_cfg.p_errbuf );
        pcap_close( pcap_cfg.p );
        exit( EXIT_FAILURE );
    }

    /* set the nonblock mode on the sniffin interface */
    pcap_setnonblock( pcap_cfg.p, 1, pcap_cfg.p_errbuf );

    /* Initialize the Libnet Context */
    libnet_cfg.l = libnet_init( LIBNET_LINK, cfg.device, libnet_cfg.l_errbuf );
    if( libnet_cfg.l == NULL )
    {
        printf("Cannot initialize Libnet context: %s\n", libnet_cfg.l_errbuf );
        exit( EXIT_FAILURE );
    }

    /* Get the Local IP Address */
    local_ip_addr = libnet_get_ipaddr4( libnet_cfg.l );

    /* Get the Local MAC Address */
    mac_addr = libnet_get_hwaddr( libnet_cfg.l );
    if( mac_addr == NULL )
    {
        printf("Cannot probe for local MAC: %s\n", libnet_geterror( libnet_cfg.l ) );
        exit( EXIT_FAILURE );
    }
    local_eth_addr = ( u_int8_t * ) malloc( HRD_ADDR_LENGTH );
    for( i = 0; i < HRD_ADDR_LENGTH; i++ )
        local_eth_addr[ i ] = mac_addr->ether_addr_octet[ i ];

    /* Set the Target IP Address */
    if( cfg.resolve )
        target_ip = libnet_name2addr4( NULL, cfg.target_ips, LIBNET_RESOLVE );
    else
        target_ip = libnet_name2addr4( NULL, cfg.target_ips, LIBNET_DONT_RESOLVE );
    if( target_ip == -1 )
    {
        printf("Incorrect IP Address: %s\n", cfg.target_ips );
        exit( EXIT_FAILURE );
    }

    /* 
     * If the target IP is NOT within the local net,
     * We need to get the IP of the default gateway.
     *
     * The remote MAC is the MAC of target IP if it's
     * within the local net, and it is the MAC of the
     * default gateway if the target IP is NOT within
     * the local net.
     */
    if( ( target_ip & pcap_cfg.netmask ) != pcap_cfg.local_net )
    {
        default_gateway = get_default_gateway();
        if( default_gateway == 0 )
        {
            printf("The target IP is unreachable. Default gateway couldn't be found\n");
            exit( EXIT_FAILURE );
        }
        remote_eth = get_macOfip( default_gateway );
        if( remote_eth == NULL )
        {
            printf("Couldn't ARP %s\n", libnet_addr2name4( default_gateway, LIBNET_DONT_RESOLVE ) );
            exit( EXIT_FAILURE );
        }
    }
    else
    {
        remote_eth = get_macOfip( target_ip );
        if( remote_eth == NULL )
        {
            printf("Couldn't ARP %s\n", libnet_addr2name4( target_ip, LIBNET_DONT_RESOLVE ) );
            exit( EXIT_FAILURE );
        }
        default_gateway = 0; /* unneeded */
    }

    /* Up-to-now, we have the following in our hands:
     * local_ip_addr       Local IP Address
     * local_eth_adddr     Local MAC Address
     * remote_eth          Remote MAC Address
     * target_ip           Target IP Address
     * pcap_cfg.netmask    Local Subnet Mask
     * pcap_cfg.local_net  Local Network Address
     * default_gateway     Gateway IP Address [?!]
     */

    /* Initialize the port list */
    if( !cfg.port_list )
    {
        cfg.port_list = ( char * ) malloc( 10 );
        strcpy( cfg.port_list, "1-1024" );
    }
    if( libnet_plist_chain_new( libnet_cfg.l, &libnet_cfg.plist, cfg.port_list ) == -1 )
    {
        printf("libnet_plist_chain_new(): %s\n", libnet_geterror( libnet_cfg.l ) );
        exit( EXIT_FAILURE );
    }
}

void dps_scan()
{
    int       received, i;
    u_int16_t bport,
              eport,
              src_port,
              dst_port;
    u_int32_t spoofed_src_ip,
              poisoned_ip;
    u_int8_t  *rcv_packet;
    time_t    start_time;
    time_t    scan_begin;
    time_t    scan_end;

    struct pcap_pkthdr       header;
    struct libnet_ipv4_hdr   *ip;
    struct libnet_tcp_hdr    *tcp;
    struct libnet_udp_hdr    *udp;
    struct libnet_icmpv4_hdr *icmp;
    struct port_data         *current_port;

    if( cfg.verbosity )
        printf("Starting Scanning...\n");
    /* 
     * if the user specified the Ping option,
     * we need to ping the target before scanning.
     * the target won't be scanned if it's unpingable
     */
    if( cfg.ping != 0 )
        if( dps_ping() == 0 )
        {
            printf("The target host is not PINGable. try -P0 to disable PINGing\n");
            exit( EXIT_FAILURE );
        }

    result.data = ( struct port_data * ) malloc( sizeof( struct port_data ) );
    result.counter       = 0;
    result.open          = 0;
    result.closed        = 0;
    result.filtered      = 0;
    result.unfiltered    = 0;
    result.open_filtered = 0;
    current_port = result.data;
    current_port->next = NULL;
    scan_begin = time( NULL );

    /* 
     * Here, we need to go through the list of ports,
     * send ARP poisoning packets (2 packets),
     * send the scan packet (TCP or UDP),
     * and listen for the response (timeout)
     */
    while( libnet_plist_chain_next_pair( libnet_cfg.plist, &bport, &eport ) >= 1 )
    {
        for( dst_port = bport; dst_port <= eport; dst_port++ )
        {
            src_port = generate_random_port( 2 ); /* PORT: 1025 <-> 65535 */

            if( default_gateway ) poisoned_ip = default_gateway;
            else                  poisoned_ip = target_ip;

            do
            {
                spoofed_src_ip = generate_random_ip( pcap_cfg.local_net, pcap_cfg.netmask );
            }while( spoofed_src_ip == poisoned_ip || spoofed_src_ip == pcap_cfg.local_net );

            current_port->spoofed_ip = spoofed_src_ip;
            current_port->port       = dst_port;
            result.counter ++;
            if( cfg.verbosity == 2 )
                printf("PORT [%d] SPOOFED IP [%s] ", current_port->port,
                        libnet_addr2name4( spoofed_src_ip, LIBNET_DONT_RESOLVE ) );

            /* 
             * Poison the remote end with the following:
             * spoofed_src_ip   Source IP Address
             * poisoned_ip      Destination IP Address
             * local_eth_addr   Source MAC Address
             * remote_eth       Destination MAC Address
             */

            /*
             * QUICK ARP POISONING LESSON:
             * To effectively poison a host, send two ARP packets.
             * The first is a fake ARP request.
             * The second is a fake ARP reply.
             * That works on:
             * Linux systems
             * All windows systems: WIN9X, WINNT, WIN2k, WINXP,...
             * Cisco systems: Router IOS, L3 Switch, PIX FW,...
             */

            dps_build_arp( ARPOP_REQUEST, spoofed_src_ip, poisoned_ip, local_eth_addr, remote_eth );
            dps_write_packet();
            usleep( 50000 );
            dps_build_arp( ARPOP_REPLY, spoofed_src_ip, poisoned_ip, local_eth_addr, remote_eth );
            dps_write_packet();
            usleep( 50000 );

            /* 
             * For the scan packet, we have now:
             * src_port        Source Port Address
             * dst_port        Destination Port Address
             * spoofed_src_ip  Source IP Address
             * target_ip       Destination IP Address
             */

            /* Build the scan packet */
            if( strcmp( cfg.scan_type, "UDP" ) != 0 )
            {
                dps_build_tcp( tcp_control, src_port, dst_port, spoofed_src_ip, target_ip,
                               local_eth_addr, remote_eth );
                current_port->sent_control = tcp_control;

                /* set the filter:
                 * src host target_ip and dst host spoofed_src_ip
                 * and tcp src port dst_port and dst port src_port
                 */
                pcap_cfg.f_code = ( char * ) malloc( 100 );
                sprintf(pcap_cfg.f_code,
                        "src host %s and dst host %s and tcp src port %d and dst port %d\0",
                        libnet_addr2name4( target_ip, LIBNET_DONT_RESOLVE ),
                        libnet_addr2name4( spoofed_src_ip, LIBNET_DONT_RESOLVE),
                        dst_port, src_port );
            }
            else
            {
                dps_build_udp( src_port, dst_port, spoofed_src_ip, target_ip,
                               local_eth_addr, remote_eth );
	       	pcap_cfg.f_code = ( char * ) malloc( 200 );
                sprintf( pcap_cfg.f_code,
                         "src host %s and dst host %s and icmp or "
                         "src host %s and dst host %s and udp src port %d and dst port %d\n",
                         libnet_addr2name4( target_ip, LIBNET_DONT_RESOLVE ),
                         libnet_addr2name4( spoofed_src_ip, LIBNET_DONT_RESOLVE ),
                         libnet_addr2name4( target_ip, LIBNET_DONT_RESOLVE ),

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区在线观看视频| 亚洲电影视频在线| 午夜日韩在线电影| 国产69精品一区二区亚洲孕妇| 91国偷自产一区二区三区观看| 久久伊99综合婷婷久久伊| 亚洲激情自拍偷拍| 成人av在线影院| 久久亚洲影视婷婷| 蜜臀av一区二区| 欧美日韩久久一区二区| 国产精品久久看| 国产乱一区二区| 日韩精品资源二区在线| 图片区小说区国产精品视频| 91亚洲午夜精品久久久久久| 国产香蕉久久精品综合网| 麻豆一区二区99久久久久| 欧美另类z0zxhd电影| 一区二区三区蜜桃| 91同城在线观看| 综合av第一页| 91在线免费看| 日韩美女精品在线| 波多野结衣中文字幕一区二区三区| 精品成人在线观看| 紧缚捆绑精品一区二区| 欧美一级搡bbbb搡bbbb| 日韩av不卡一区二区| 宅男噜噜噜66一区二区66| 亚洲成人黄色小说| 欧美丰满少妇xxxbbb| 午夜视频一区在线观看| 欧美日韩午夜在线| 天涯成人国产亚洲精品一区av| 欧美日韩在线播放三区四区| 丝袜诱惑制服诱惑色一区在线观看 | 黄色日韩三级电影| 精品国产伦一区二区三区观看方式| 蜜桃视频第一区免费观看| 日韩欧美亚洲国产另类| 国模套图日韩精品一区二区| 精品国产乱子伦一区| 国产精品中文字幕日韩精品 | 精品一区二区影视| 国产亚洲欧洲一区高清在线观看| 国产一区二区三区综合 | 欧美精品粉嫩高潮一区二区| 亚洲永久免费视频| 91精品国产综合久久久久久久久久| 日韩国产在线一| 久久久久九九视频| 99久久伊人网影院| 中文字幕欧美日韩一区| 99久久久免费精品国产一区二区| 国产精品成人免费| 51久久夜色精品国产麻豆| 精品一区二区久久久| 1024精品合集| 欧美一区二区在线免费播放| 国产精品一区二区在线看| 亚洲视频1区2区| 日韩一级片网址| 成人高清视频免费观看| 日日夜夜精品视频免费| 日本一区二区三区免费乱视频 | 国产精品美女久久久久久久久久久| 91丨porny丨首页| 免费美女久久99| 国产精品国模大尺度视频| 7777精品伊人久久久大香线蕉的| 国产黄色91视频| 一区二区三区**美女毛片| 精品国产凹凸成av人导航| 91老司机福利 在线| 蜜臀av国产精品久久久久| 欧美激情一区二区在线| 精品视频一区二区不卡| 国产福利一区二区三区视频 | 亚洲色大成网站www久久九九| 欧美精品视频www在线观看 | 久久国产尿小便嘘嘘| 中文字幕一区在线观看| 精品久久久久久久久久久久包黑料| 精品国产91亚洲一区二区三区婷婷 | 欧洲一区二区三区免费视频| 日本免费新一区视频| 中文字幕不卡在线观看| 日韩欧美中文字幕一区| 91久久国产最好的精华液| 国产乱码精品一品二品| 蜜臀91精品一区二区三区| 伊人夜夜躁av伊人久久| 中文字幕 久热精品 视频在线| 欧美老人xxxx18| 欧美性极品少妇| 一本一道综合狠狠老| 丁香婷婷深情五月亚洲| 国产精品自拍在线| 精品无码三级在线观看视频| 青草国产精品久久久久久| 一区二区免费视频| 亚洲欧美激情视频在线观看一区二区三区| 精品少妇一区二区三区视频免付费| 欧美日韩中文字幕精品| 色综合久久久久综合体桃花网| 成人免费视频一区| 国产很黄免费观看久久| 精品视频999| 懂色av噜噜一区二区三区av| 国产一区二区三区黄视频 | 欧美午夜视频网站| 91亚洲国产成人精品一区二区三 | 麻豆久久久久久| 免费在线观看精品| 欧美bbbbb| 毛片av一区二区三区| 久久精品久久综合| 精品一区二区日韩| 国产乱码精品1区2区3区| 国产在线国偷精品免费看| 国产精品一区二区免费不卡 | 久久se精品一区二区| 亚洲精品大片www| 亚洲四区在线观看| 一区二区三区不卡视频在线观看| 亚洲精品大片www| 亚洲综合自拍偷拍| 亚洲mv在线观看| 蜜桃一区二区三区在线观看| 久久99国产精品麻豆| 国产成人精品一区二区三区四区 | 香蕉久久夜色精品国产使用方法 | 亚洲成人免费视| 亚洲综合小说图片| 午夜视频久久久久久| 奇米四色…亚洲| 国产一区二区三区久久悠悠色av | 色狠狠色噜噜噜综合网| 欧美片网站yy| 日韩欧美色电影| 中文字幕色av一区二区三区| 一区二区三区资源| 免费国产亚洲视频| a在线播放不卡| 欧美高清你懂得| 国产欧美日韩精品a在线观看| 亚洲色图欧美偷拍| 免费观看成人鲁鲁鲁鲁鲁视频| 国产最新精品免费| 色婷婷久久综合| 日韩精品一区二区三区swag| 国产精品视频你懂的| 亚洲成av人影院| 欧美一级艳片视频免费观看| 久久综合99re88久久爱| 亚洲视频综合在线| 麻豆一区二区99久久久久| 粉嫩在线一区二区三区视频| 欧美日韩精品一区二区三区四区 | ...av二区三区久久精品| 亚洲综合成人网| 国产成人免费av在线| 欧美日韩一区成人| 中文字幕一区二区在线观看| 日本va欧美va瓶| 欧洲日韩一区二区三区| 国产日韩精品久久久| 日韩高清不卡在线| 色哟哟欧美精品| 国产视频在线观看一区二区三区 | 国产精品欧美一级免费| 天堂va蜜桃一区二区三区漫画版| 从欧美一区二区三区| 91精品国产手机| 久久久久久麻豆| 另类小说视频一区二区| 在线亚洲免费视频| 国产精品乱码久久久久久| 精品系列免费在线观看| 欧美三级视频在线观看| 亚洲欧美一区二区在线观看| 韩日av一区二区| 91精品在线麻豆| 午夜精品免费在线观看| 色综合欧美在线| 亚洲欧洲精品天堂一级| 国产精品69毛片高清亚洲| 欧美一级片在线观看| 天堂久久一区二区三区| 欧美无人高清视频在线观看| 亚洲男人都懂的| 91免费看`日韩一区二区| 国产精品国产馆在线真实露脸| 国产成人午夜99999| 国产日韩欧美精品在线| 国产91在线观看丝袜| 欧美国产激情二区三区| 成人av综合一区| 亚洲精品乱码久久久久|