Commit ceb917b9 authored by Robert David Graham's avatar Robert David Graham
Browse files

vnc

parent 5ca77b95
Loading
Loading
Loading
Loading
+2 −1
Changes for src/masscan-app.c: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ masscan_app_to_string(enum ApplicationProtocol proto)
    case PROTO_NTP:     return "ntp";
    case PROTO_VULN:    return "vuln";
    case PROTO_HEARTBLEED:    return "heartbleed";
    case PROTO_VNC_RFB: return "vnc";
    default:
        sprintf_s(tmp, sizeof(tmp), "(%u)", proto);
        return tmp;
@@ -66,7 +67,7 @@ masscan_string_to_app(const char *str)
        {"ntp", PROTO_NTP},
        {"vuln", PROTO_VULN},
        {"heartbleed", PROTO_HEARTBLEED},
        
        {"vnc", PROTO_VNC_RFB},
        {0,0}
    };
    size_t i;
+2 −1
Changes for src/masscan-app.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ enum ApplicationProtocol {
    PROTO_HTML_FULL,
    PROTO_NTP,              /* network time protocol, udp/123 */
    PROTO_VULN,
    PROTO_HEARTBLEED
    PROTO_HEARTBLEED,
    PROTO_VNC_RFB,
};

const char *
+14
Changes for src/proto-banner1.c: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include "proto-http.h"
#include "proto-ssl.h"
#include "proto-ssh.h"
#include "proto-vnc.h"
#include "masscan-app.h"
#include <ctype.h>
#include <stdlib.h>
@@ -33,6 +34,11 @@ struct Patterns patterns[] = {
    {"\x15\x03\x01",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN},
    {"\x15\x03\x02",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN},
    {"\x15\x03\x03",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN},
    {"RFB 003.003\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, 
    {"RFB 003.005\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, 
    {"RFB 003.007\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, 
    {"RFB 003.008\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, 
    {"RFB 003.009\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, 
    {0,0}
};

@@ -140,6 +146,14 @@ banner1_parse(
                        banout,
                        more);
        break;
    case PROTO_VNC_RFB:
        banner_vnc.parse(    banner1,
                             banner1->http_fields,
                             tcb_state,
                             px, length,
                             banout,
                             more);
        break;
    default:
        fprintf(stderr, "banner1: internal error\n");
        break;
+68
Changes for src/proto-vnc.c: 68 added lines, 0 removed lines.
Original line number Diff line number Diff line
#include "proto-vnc.h"
#include "proto-banner1.h"
#include "unusedparm.h"
#include "masscan-app.h"
#include <ctype.h>


/***************************************************************************
 ***************************************************************************/
static void
vnc_parse(  const struct Banner1 *banner1,
          void *banner1_private,
          struct ProtocolState *pstate,
          const unsigned char *px, size_t length,
          struct BannerOutput *banout,
          struct InteractiveData *more)
{
    unsigned state = pstate->state;
    unsigned i;
    
    UNUSEDPARM(banner1_private);
    UNUSEDPARM(banner1);
    UNUSEDPARM(more);
    
    for (i=0; i<length; i++)
        switch (state) {
            case 0:
                if (px[i] == '\r')
                    continue;
                if (px[i] == '\n' || px[i] == '\0' || !isprint(px[i])) {
                    state = STATE_DONE;
                    continue;
                }
                banout_append_char(banout, PROTO_VNC_RFB, px[i]);
                break;
            default:
                i = (unsigned)length;
                break;
        }
    pstate->state = state;
}

/***************************************************************************
 ***************************************************************************/
static void *
vnc_init(struct Banner1 *banner1)
{
    UNUSEDPARM(banner1);
    return 0;
}


/***************************************************************************
 ***************************************************************************/
static int
vnc_selftest(void)
{
    return 0;
}

/***************************************************************************
 ***************************************************************************/
const struct ProtocolParserStream banner_vnc = {
    "vnc", 5900, 0, 0, 0,
    vnc_selftest,
    vnc_init,
    vnc_parse,
};
+7
Changes for src/proto-vnc.h: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
#ifndef PROTO_VNC_H
#define PROTO_VNC_H
#include "proto-banner1.h"

extern const struct ProtocolParserStream banner_vnc;

#endif
Loading