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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? pp_telnet.c

?? 著名的入侵檢測(cè)系統(tǒng)snort的最新版本的源碼
?? C
字號(hào):
/* * Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License Version 2 as * published by the Free Software Foundation.  You may not use, modify or * distribute this program under any other version of the GNU General * Public License. * * 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. *//* Snort Preprocessor for Telnet Negotiation Normalization*//* $Id$ *//* pp_telnet.c  *  * Purpose:  Telnet sessions can contain telnet negotiation strings  *           that can disrupt pattern matching.  This plugin detects  *           negotiation strings in stream and "normalizes" them much like *           the http_decode preprocessor normalizes encoded URLs * * * official registry of options * http://www.iana.org/assignments/telnet-options * * Arguments:  None *    * Effect:  The telnet nogiation data is removed from the payload * * Comments: * *//* your preprocessor header file goes here */#ifdef HAVE_CONFIG_H#include "config.h"#endif#ifdef HAVE_STRINGS_H#include <strings.h>#endif#include <sys/types.h>#include "ftpp_eo_log.h"#include "pp_telnet.h"#include "ftpp_return_codes.h"//#include "decode.h"#include "debug.h"#include "stream_api.h"#define NUL 0x00#define CR 0x0d#define LF 0x0a/* This is the allowable number of 8 bit characters, * ie, non-ASCII, before we declare this packet/stream * as encrypted. */#define CONSECUTIVE_8BIT_THRESHOLD 3//extern u_int8_t DecodeBuffer[DECODE_BLEN]; /* decode.c *//* * Function: normalize_telnet(Packet *) * * Purpose: Perform the preprocessor's intended function.  This can be *          simple (statistics collection) or complex (IP defragmentation) *          as you like.  Try not to destroy the performance of the whole *          system by trying to do too much.... * * Arguments: p => pointer to the current packet data struct  * * Returns: void function * */int normalize_telnet(FTPTELNET_GLOBAL_CONF *GlobalConf,                     TELNET_SESSION *tnssn, SFSnortPacket *p,                     int iMode){    int ret = FTPP_NORMALIZED;    const unsigned char *read_ptr, *sb_start = NULL;    int saw_ayt = 0;    const unsigned char *start = _dpd.altBuffer; /* decode.c */    unsigned char *write_ptr;    const unsigned char *end;    int normalization_required = 0;    int consec_8bit_chars = 0;        /* Telnet commands are handled in here.    * They can be 2 bytes long -- ie, IAC NOP, IAC AYT, etc.    * Sub-negotiation strings are at least 4 bytes, IAC SB x IAC SE */    if(p->payload_size < 2)    {        if (tnssn && iMode == FTPP_SI_CLIENT_MODE)            tnssn->consec_ayt = 0;        return FTPP_SUCCESS;    }        /* setup the pointers */    read_ptr = p->payload;    end = p->payload + p->payload_size;        /* look to see if we have any telnet negotiaion codes in the payload */    while(!normalization_required && (read_ptr < end))    {        /* look for the start of a negotiation string */        if(*read_ptr == (unsigned char) TNC_IAC)        {            /* set a flag for stage 2 normalization */            normalization_required = 1;        }        else        {            /* Okay, it wasn't an IAC */            if (*read_ptr > 0x7F)            {                consec_8bit_chars++;                if (consec_8bit_chars > CONSECUTIVE_8BIT_THRESHOLD)                {                    /* This data stream had a series of 8 bit characters.                     * It is very likely encrypted.  This handles the case                     * where we either missed the option negotiation, or                     * lost state of an already encrypted telnet session.                     */                    if (tnssn)                    {                        tnssn->encr_state = 1;                        if (tnssn->global_conf->encrypted.alert)                        {                            /* Alert on encrypted channel */                            telnet_eo_event_log(tnssn, TELNET_EO_ENCRYPTED,                                NULL, NULL);                        }                        if (!tnssn->global_conf->check_encrypted_data)                        {                            /* Mark this session & packet as one to ignore */                            _dpd.streamAPI->stop_inspection(p->stream_session_ptr, p,                                                        SSN_DIR_BOTH, -1, 0);                            /* No point to do further normalization */                            return FTPP_ALERT;                        }                    }                    break;                }            }            else            {                consec_8bit_chars = 0;            }        }                read_ptr++;    }        if(!normalization_required)    {        DEBUG_WRAP(DebugMessage(DEBUG_FTPTELNET, "Nothing to process!\n"););        if (tnssn && iMode == FTPP_SI_CLIENT_MODE)            tnssn->consec_ayt = 0;        return FTPP_SUCCESS;    }        /*    * if we found telnet negotiation strings OR backspace characters,    * we're going to have to normalize the data    *    * Note that this is always ( now: 2002-08-12 ) done to a    * alternative data buffer.    */        /* rewind the data stream to p->data */    read_ptr = p->payload;        /* setup for overwriting the negotaiation strings with     * the follow-on data    */     write_ptr = (unsigned char *) _dpd.altBuffer;        /* walk thru the remainder of the packet */    while((read_ptr < end) &&          (write_ptr < ((unsigned char *) _dpd.altBuffer) + _dpd.altBufferLen))    {        saw_ayt = 0;        /* if the following byte isn't a subnegotiation initialization */        if(((read_ptr + 1) < end) &&            (*read_ptr == (unsigned char) TNC_IAC) &&            (*(read_ptr + 1) != (unsigned char) TNC_SB))        {            /* NOPs are two bytes long */            switch(* ((unsigned char *)(read_ptr + 1)))            {            case TNC_NOP:                read_ptr += 2;                break;            case TNC_EAC:                read_ptr += 2;                /* wind it back a character */                if(write_ptr  > start)                {                    write_ptr--;                }                break;            case TNC_EAL:                read_ptr += 2;                /* wind it back a line? */                /* Go back to previous CR NULL or CR LF? */                while (write_ptr > start)                {                    /* Go to previous char */                    write_ptr--;                                        if ((*write_ptr == CR) &&                        ((*(write_ptr+1) == NUL) || (*(write_ptr+1) == LF)) )                    {                    /* Okay, found the CR NUL or CR LF, move it forward past                    * those two -- that is the beginning of this line                        */                        write_ptr+=2;                        break;                    }                }                break;                /* These are two bytes long */            case TNC_AYT:                saw_ayt = 1;                if (tnssn)                {                    tnssn->consec_ayt++;                    if ((tnssn->telnet_conf->ayt_threshold > 0) &&                        (tnssn->consec_ayt >                            tnssn->telnet_conf->ayt_threshold))                    {                        /* Alert on consecutive AYT commands */                        telnet_eo_event_log(tnssn, TELNET_EO_AYT_OVERFLOW,                            NULL, NULL);                        tnssn->consec_ayt = 0;                        return FTPP_ALERT;                    }                }                /* Fall through */            case TNC_BRK:            case TNC_DM:            case TNC_IP:            case TNC_AO:            case TNC_GA:#ifdef RFC1184            case TNC_EOF:            case TNC_SUSP:            case TNC_ABOR:#endif#ifdef RFC885            case TNC_EOR:#endif                read_ptr += 2;                break;            case TNC_SE:                /* Uh, what the heck is a Subnegotiation-end                 * doing here without SB?.  could generate an alert.                 * Will just normalize it out since we may have                 * processed the SB in a previous packet.                 */                read_ptr += 2;                break;            case TNC_IAC:                /* IAC IAC -- means the IAC character (0xff) should be                * in the data stream since it was escaped */                read_ptr++; /* skip past the first IAC */                *write_ptr++ = *read_ptr++;                break;            case TNC_WILL:            case TNC_WONT:            case TNC_DO:            case TNC_DONT:                read_ptr += 3;                break;            default:                /* move the read ptr up 2 bytes */                read_ptr += 2;            }            /* If not an AYT, reset it */            if (!saw_ayt)            {                if (tnssn && iMode == FTPP_SI_CLIENT_MODE)                    tnssn->consec_ayt = 0;            }        }        /* check for subnegotiation */        else if(((read_ptr + 1) < end) &&            (*read_ptr == (unsigned char) TNC_IAC) &&            (*(read_ptr+1) == (unsigned char) TNC_SB))        {            sb_start = read_ptr;            switch (*(read_ptr+2))            {            case 0x26: /* Encryption -- RFC 2946 */                /* printf("Telnet: Saw SB for Encryption\n"); */                read_ptr += 3;                switch (*read_ptr)                {#ifdef TRACK_ENCRYPTION_NEGOTIATION                case 0x00:                    /* Client sending the Encryption IS marker                     * followed by address. */                    {                        read_ptr++;                        if (*read_ptr != 0x00)                            /* Encryption type is not NULL */                        {                            /* printf("Encryption being negotiated by                             * telnet client\n"); */                        }                    }                    break;#endif                case 0x03:                    /* Client sending the Encryption START marker                     * followed by address. */                    {                        read_ptr++;                        /* printf("Encryption started by telnet client\n"); */                        if (tnssn)                        {                            tnssn->encr_state = 1;                            if (tnssn->global_conf->encrypted.alert)                            {                                /* Alert on encrypted channel */                                telnet_eo_event_log(tnssn, TELNET_EO_ENCRYPTED,                                    NULL, NULL);                            }                            if (!tnssn->global_conf->check_encrypted_data)                            {                                /* Mark this session & packet as one to ignore */                                _dpd.streamAPI->stop_inspection(p->stream_session_ptr, p,                                                        SSN_DIR_BOTH, -1, 0);                                /* No point to do further normalization */                                return FTPP_ALERT;                            }                        }                    }                    break;                }                break;            }                        /* find the end of the subneg -- this handles when there are             * embedded IAC IACs within a sub negotiation.  Just looking             * for the TNC_SE could cause problems.  Similarly, just looking             * for the TNC_IAC could end it too early. */            while(read_ptr < end)            {                if ((*read_ptr == (unsigned char) TNC_IAC) &&                    (*(read_ptr+1) == (unsigned char) TNC_SE))                {                    sb_start = NULL;                    break;                }                read_ptr++;            }            if (sb_start)            {                /* Didn't find the IAC SE.  Normalize out the IAC SB                 * and restart from there. Presumption is this is                 * just someone trying to fool us, since we usually                 * see the entire IAC SB ... IAC SE in one packet. */                read_ptr = sb_start+2;                if (!tnssn)                {                    /* Its an FTP session */                    ret = FTPP_ALERT;                }                else if (tnssn->global_conf->global_telnet.detect_anomalies)                {                    /* Alert on SB without SE */                    telnet_eo_event_log(tnssn, TELNET_EO_SB_NO_SE,                        NULL, NULL);                    ret = FTPP_ALERT;                }                continue;            }                        /* Okay, found the IAC SE -- move past it */            if (read_ptr < end)            {                read_ptr += 2;            }                        if (tnssn && iMode == FTPP_SI_CLIENT_MODE)                tnssn->consec_ayt = 0;        }        else        {            DEBUG_WRAP(DebugMessage(DEBUG_FTPTELNET,                "overwriting %2X(%c) with %2X(%c)\n",                (unsigned char)(*write_ptr&0xFF), *write_ptr,                 (unsigned char)(*read_ptr & 0xFF), *read_ptr););                        /* overwrite the negotiation bytes with the follow-on bytes */            switch(* ((unsigned char *)(read_ptr)))            {            case 0x7F: /* Delete */            case 0x08: /* Backspace/Ctrl-H */                /* wind it back a character */                if (write_ptr > start)                {                    write_ptr--;                }                read_ptr++;                break;            default:                *write_ptr++ = *read_ptr++;                break;            }                        if (tnssn && iMode == FTPP_SI_CLIENT_MODE)                tnssn->consec_ayt = 0;        }    }        p->flags |= FLAG_ALT_DECODE;        p->normalized_payload_size = write_ptr - start;        /* DEBUG_WRAP(DebugMessage(DEBUG_FTPTELNET,     "Converted buffer after telnet normalization:\n");    PrintNetData(stdout, (char *) _dpd.altBuffer, p->normalized_payload_size););    */    return ret;}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲在线观看免费| 国产麻豆成人传媒免费观看| 免费av网站大全久久| 成人福利视频网站| 欧美一级片免费看| 一区二区三区久久久| 国产激情一区二区三区桃花岛亚洲| 欧美又粗又大又爽| 中文字幕色av一区二区三区| 久久精品国产网站| 欧美三级日韩在线| 亚洲激情成人在线| 成人免费福利片| 国产亚洲精品免费| 久久国产婷婷国产香蕉| 欧美日本一区二区三区四区| 一区二区三区日韩欧美精品| 国产福利视频一区二区三区| www久久精品| 久久国产免费看| 欧美一区二区视频在线观看2022 | 国产精品66部| 日韩精品一区二区三区蜜臀| 亚洲高清视频在线| 欧美性xxxxxx少妇| 亚洲一区二区在线视频| 色婷婷亚洲一区二区三区| 一区精品在线播放| 99精品视频在线播放观看| 国产精品久久久久久久久图文区| 国产成人免费9x9x人网站视频| 久久综合九色综合欧美就去吻| 久久91精品国产91久久小草| 日韩午夜精品电影| 国产一区欧美二区| 精品卡一卡二卡三卡四在线| 精品一区二区三区的国产在线播放| 日韩欧美综合在线| 国产乱淫av一区二区三区| 久久综合av免费| 国产福利一区二区三区视频| 欧美国产禁国产网站cc| 99国产精品国产精品毛片| 亚洲欧美一区二区三区国产精品| 日本丶国产丶欧美色综合| 亚洲成人av福利| 精品国产1区二区| 国产乱一区二区| 亚洲男同性恋视频| 日韩一卡二卡三卡四卡| 国产一区二区免费在线| 亚洲欧洲日韩在线| 91精品婷婷国产综合久久性色| 久久精品久久精品| 国产精品狼人久久影院观看方式| 91麻豆国产香蕉久久精品| 婷婷开心久久网| 欧美va亚洲va| 91视频www| 美女国产一区二区三区| 国产精品久久久久久亚洲伦| 欧美日本不卡视频| 国产91丝袜在线18| 日韩国产精品91| 国产精品久久毛片| 欧美一区二区三区成人| 成人教育av在线| 首页国产欧美日韩丝袜| 国产日本欧美一区二区| 欧美性受xxxx| 成人国产精品免费| 日韩av一区二区三区四区| 国产精品国产三级国产aⅴ入口 | 日韩av一二三| 中文字幕高清一区| 欧美一区二区三区日韩视频| 成人午夜在线播放| 亚洲午夜精品久久久久久久久| 精品黑人一区二区三区久久| 91黄视频在线| 国产成人综合自拍| 日本欧美一区二区三区| 亚洲精品视频在线观看网站| 久久亚洲精品小早川怜子| 欧美日韩国产免费| 91丨九色丨黑人外教| 国内久久精品视频| 免费成人在线影院| 婷婷久久综合九色综合绿巨人| 国产精品国产三级国产三级人妇 | 日韩理论在线观看| 国产日韩欧美亚洲| 日韩一区二区免费视频| 精品视频一区二区三区免费| av一区二区久久| 国产综合成人久久大片91| 香港成人在线视频| 亚洲精品高清在线观看| 国产精品女主播在线观看| 精品久久一区二区三区| 91精品久久久久久久99蜜桃| 欧美亚洲尤物久久| 欧美羞羞免费网站| 在线免费一区三区| 在线视频一区二区三| 色综合久久综合| 色欧美片视频在线观看在线视频| 丰满白嫩尤物一区二区| 国产成人免费视频网站| 丰满放荡岳乱妇91ww| 国产精品一二三在| 国产大陆亚洲精品国产| 国产成人精品免费视频网站| 国产一区二区电影| 韩国欧美一区二区| 国产一区二区精品久久| 国产精品18久久久久久久网站| 激情国产一区二区| 国产美女视频一区| 国产成人精品亚洲日本在线桃色 | 91亚洲国产成人精品一区二区三| 国产精品综合网| 成人app软件下载大全免费| www.av精品| 欧美综合天天夜夜久久| 欧美精品成人一区二区三区四区| 欧美精品日韩综合在线| 91精品国产91综合久久蜜臀| 欧美成va人片在线观看| 久久久五月婷婷| 中文字幕亚洲综合久久菠萝蜜| 亚洲欧洲精品一区二区精品久久久 | 欧美网站大全在线观看| 欧美色老头old∨ideo| 欧美精选在线播放| 亚洲精品在线观看视频| 国产丝袜在线精品| 亚洲综合色婷婷| 天天操天天综合网| 国产一区在线看| 99久久久精品| 欧美一级片在线观看| 久久久精品综合| 亚洲免费观看高清在线观看| 五月婷婷另类国产| 国产成人高清视频| 欧美性色综合网| 久久综合九色综合欧美就去吻| 日韩久久一区二区| 日本不卡视频在线| 91影院在线观看| 91麻豆精品国产| 国产精品久久久久影视| 日日欢夜夜爽一区| 99久久综合99久久综合网站| 欧美日本乱大交xxxxx| 欧美激情一区在线| 日韩在线a电影| a级精品国产片在线观看| 日韩欧美一二区| 一区二区高清视频在线观看| 久久国产精品色| 欧美日韩一区二区三区在线看| 久久久精品蜜桃| 日本午夜一本久久久综合| hitomi一区二区三区精品| 日韩精品一区二区三区四区视频| 亚洲免费视频成人| 国产成人亚洲精品狼色在线| 欧美日韩在线播放三区四区| 国产精品久线观看视频| 久国产精品韩国三级视频| 91高清视频在线| 亚洲国产成人私人影院tom| 美女免费视频一区| 欧美三级乱人伦电影| 国产精品久久久一本精品| 国产一区二区成人久久免费影院| 欧美系列日韩一区| 亚洲精品久久久蜜桃| 成人免费高清视频在线观看| xnxx国产精品| 免费在线成人网| 3d动漫精品啪啪| 亚洲一区二区三区四区在线免费观看 | 91看片淫黄大片一级| 国产午夜三级一区二区三| 麻豆91免费观看| 欧美一区二区三区在线看| 亚洲福利视频导航| 欧美色手机在线观看| 亚洲综合色成人| 欧美性受xxxx| 五月激情综合网| 91精品免费观看| 久久电影国产免费久久电影| 91精品国产手机| 激情丁香综合五月| 久久久久久久久久久久久久久99| 国内精品第一页|