Skip to content

Commit

Permalink
robertdavidgraham#86 --capture html
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdavidgraham committed Feb 18, 2014
1 parent 148b58b commit 59991b0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
7 changes: 7 additions & 0 deletions doc/masscan.8.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ one port.
* `--hello-string[<port>] <base64>`: same as `--hello-file` except that the
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
Expand Down
25 changes: 20 additions & 5 deletions src/proto-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,26 +346,41 @@ 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;
}
break;

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;
}
}
break;
case CONTENT_FIELD:
if (banner1->is_capture_html) {
banout_append_char(banout, PROTO_HTML_FULL, px[i]);
}
if (px[i] == '<')
state = CONTENT;
else {
Expand Down

0 comments on commit 59991b0

Please sign in to comment.