Commit 59991b0f authored by robertdavidgraham's avatar robertdavidgraham
Browse files

#86 --capture html

parent 148b58bb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -255,6 +255,13 @@ one port.
    contents of the BASE64 encoded string are decoded, then used as the hello
    string that greets the server.

  * `--capture <type>` or `--nocapture <type>`: when doing banners (`--banner`), this
    determines what to capture from the banners. By default, only the TITLE field from
	HTML documents is captured, to get the entire document, use `--capture html`.
	By default, the entire certificate from SSL is captured, to disable this, use
	`--nocapture cert`. Currently, only the values `html` and `cert` are currently
	supported for this option, but many more will be added in the future.
    

## CONFIGURATION FILE FORMAT

+20 −5
Original line number Diff line number Diff line
@@ -346,19 +346,31 @@ http_parse(
        }
        break;
    case CONTENT:
        {
            unsigned next = i;

            id = smack_search_next(
                                   banner1->html_fields,
                                   &state2,
                                   px, &i, (unsigned)length);
            i--;
                                   px, &next, (unsigned)length);

            if (banner1->is_capture_html) {
                banout_append(banout, PROTO_HTML_FULL, &px[i], next-i);
            }

            if (id != SMACK_NOT_FOUND) {
                //field_name(banout, id, html_fields);
                //banout_append_char(banout, PROTO_HTML_TITLE, ':');
                state = CONTENT_TAG;
            }

            i = next - 1;
        }
        break;
    case CONTENT_TAG:
        for (; i<length; i++) {
            if (banner1->is_capture_html) {
                banout_append_char(banout, PROTO_HTML_FULL, px[i]);
            }

            if (px[i] == '>') {
                state = CONTENT_FIELD;
                break;
@@ -366,6 +378,9 @@ http_parse(
        }
        break;
    case CONTENT_FIELD:
        if (banner1->is_capture_html) {
            banout_append_char(banout, PROTO_HTML_FULL, px[i]);
        }
        if (px[i] == '<')
            state = CONTENT;
        else {