⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipexport.c

📁 Linux 上的socket嗅探器
💻 C
📖 第 1 页 / 共 3 页
字号:
                /* Offset */
                sprintf(itemsg,"Offset= %d",tcphdr.doflag.Offset);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+12,1));

                /* Reserved */
                sprintf(itemsg,"Reserved= %d",tcphdr.doflag.Reserved);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+12,2));

                /* URG */
                sprintf(itemsg,"URG= %d",tcphdr.doflag.URG);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+13,1));

                /* ACK */
                sprintf(itemsg,"ACK= %d",tcphdr.doflag.ACK);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+13,1));

                /* PSH */
                sprintf(itemsg,"PSH= %d",tcphdr.doflag.PSH);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+13,1));

                /* RST */

                sprintf(itemsg,"RST= %d",tcphdr.doflag.RST);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+13,1));

                /* SYN */
                sprintf(itemsg,"SYN= %d",tcphdr.doflag.SYN);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+13,1));


                /* FIN */
                sprintf(itemsg,"FIN= %d",tcphdr.doflag.FIN);
                tmpitem=AcheTreeInsertItem(subsubitem,itemsg,-1);
                SetAcheTreeData(tmpitem,ACHETREE_ITEMDATA(curpos+13,1));
            }

            /* Window size            */
            sprintf(itemsg,"Window size= %d",tcphdr.winsize);
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos+14,2));

            /* Checksum               */
            sprintf(itemsg,"Checksum= %d",tcphdr.chksum);
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos+16,2));

            /* Urgent pointer         */
            sprintf(itemsg,"Urgent pointer= %d",tcphdr.urgp);
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos+18,2));

        }// TCP head

        /* -------------------- TCP data ------------------------ */
        if(buflen-20>0)
        {
            sprintf(itemsg,"Data [length= %d]",buflen-20);
            subitem=AcheTreeInsertItem(rootitem,itemsg,-1);
            SetAcheTreeData(subitem,ACHETREE_ITEMDATA(curpos+20,buflen-20));


        }// TCP data
    }

    /* -------------------- end of export ------------------------ */
}

void ExportTree_ETH_IP_EGP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    /* 8, Exterior Gateway Protocol.  */
{

}

void ExportTree_ETH_IP_PUP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    // 12, pup
{
}

void ExportTree_ETH_IP_UDP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    // 17, user datagram protocol
{
    char itemsg[256];
    ACHETREE *subsubitem, *subitem, *rootitem;
    UDPHDR udphdr;
    int freei;

    BufGetUDPhdr(&udphdr,lpbuf);
    /* -------------------- UDP  ------------------------ */

    sprintf(itemsg,"UDP [length= %d]",buflen);
    rootitem = AcheTreeInsertItem(lptree,itemsg,-1);
    SetAcheTreeData(rootitem,ACHETREE_ITEMDATA(curpos,buflen));
    {
        /* -------------------- UDP header ------------------------ */
        sprintf(itemsg,"Head [length= %d]",8);
        subitem=AcheTreeInsertItem(rootitem,itemsg,-1);
        SetAcheTreeData(subitem,ACHETREE_ITEMDATA(curpos,8));
        {
            // source port
            sprintf(itemsg,"Source port= %d",udphdr.source);
            for(freei=0;freei<MAX_POPULERPORT;freei++)
            {
               if(populer_port[freei].type==udphdr.source)
               {
                  sprintf(itemsg,"Source port= %d [%s]",udphdr.source,populer_port[freei].info);
                  break;
               }
            }
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos,2));

            // dest port
            sprintf(itemsg,"Destination port= %d",udphdr.dest);
            for(freei=0;freei<MAX_POPULERPORT;freei++)
            {
               if(populer_port[freei].type==udphdr.dest)
               {
                  sprintf(itemsg,"Destination port= %d [%s]",udphdr.dest,populer_port[freei].info);
                  break;
               }
            }
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos+2,2));

            // length
            sprintf(itemsg,"Length= %d",udphdr.len);
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos+4,2));

            // checksum
            sprintf(itemsg,"Checksum= %d",udphdr.check);
            subsubitem=AcheTreeInsertItem(subitem,itemsg,-1);
            SetAcheTreeData(subsubitem,ACHETREE_ITEMDATA(curpos+6,2));
        }// UDP head

        /* -------------------- UDP data ------------------------ */
        if(buflen-8>0)
        {
            sprintf(itemsg,"Data [length= %d]",buflen-8);
            subitem=AcheTreeInsertItem(rootitem,itemsg,-1);
            SetAcheTreeData(subitem,ACHETREE_ITEMDATA(curpos+8,buflen-8));

        }// UDP data
    }

    /* -------------------- end of export ------------------------ */
}


void ExportTree_ETH_IP_IDP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    /* 22, xns idp    */
{



}

void ExportTree_ETH_IP_TP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 29, SO Transport Protocol Class 4.  */


{



}

void ExportTree_ETH_IP_IPV6(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 41,IPv6 header.  */
{



}

void ExportTree_ETH_IP_ROUTING(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 43,IPv6 routing header.  */
{



}

void ExportTree_ETH_IP_FRAGMENT(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 44,IPv6 fragmentation header.  */
{



}

void ExportTree_ETH_IP_RSVP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 46,Reservation Protocol.  */
{




}

void ExportTree_ETH_IP_GRE(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 47,General Routing Encapsulation.  */
{



}

void ExportTree_ETH_IP_ESP(

        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 50,encapsulating security payload.  */
{

}

void ExportTree_ETH_IP_AH(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 51,authentication header.  */
{



}

void ExportTree_ETH_IP_ICMPV6(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 58,ICMPv6.  */
{




}

void ExportTree_ETH_IP_NONE(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 59,IPv6 no next header.  */
{



}

void ExportTree_ETH_IP_DSTOPTS(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 60,IPv6 destination options.  */
{



}


void ExportTree_ETH_IP_ND(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    /* 77, UNOFFICIAL net disk proto   */
{




}

void ExportTree_ETH_IP_MTP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 92,Multicast Transport Protocol.  */
{



}

void ExportTree_ETH_IP_ENCAP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 98,Encapsulation Header.  */
{



}

void ExportTree_ETH_IP_PIM(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 103,Protocol Independent Multicast.  */
{



}

void ExportTree_ETH_IP_COMP(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen) 	   /* 108,Compression Header Protocol.  */
{



}

void ExportTree_ETH_IP_RAW(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    /* 255, raw IP packet   */
{



}


void ExportTree_ETH_IP_MAX(
        ACHETREE *lptree,
        unsigned short curpos,
        unsigned char *lpbuf, unsigned short buflen)    /* 256     */
{



}










        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -