/*************************************** ************************************* ****************************************************************************/ static void text_out_banner(struct Output *out, FILE *fp, time_t timestamp, unsigned ip, unsigned ip_proto, unsigned port, enum ApplicationProtocol proto, unsigned ttl, const unsigned char *px, unsigned length) { char banner_buffer[4096]; UNUSEDPARM(out); UNUSEDPARM(ttl); fprintf(fp, "%s %s %u %u.%u.%u.%u %u %s %s\n", "banner", name_from_ip_proto(ip_proto), port, (ip>>24)&0xFF, (ip>>16)&0xFF, (ip>> 8)&0xFF, (ip>> 0)&0xFF, (unsigned)timestamp, masscan_app_to_string(proto), normalize_string(px, length, banner_buffer, sizeof(banner_buffer)) ); }
static void xml_out_status(struct Output *out, FILE *fp, time_t timestamp, int status, unsigned ip, unsigned ip_proto, unsigned port, unsigned reason, unsigned ttl) { char reason_buffer[128]; UNUSEDPARM(out); fprintf(fp, "<host endtime=\"%u\">" "<address addr=\"%u.%u.%u.%u\" addrtype=\"ipv4\"/>" "<ports>" "<port protocol=\"%s\" portid=\"%u\">" "<state state=\"%s\" reason=\"%s\" reason_ttl=\"%u\"/>" "</port>" "</ports>" "</host>" "\r\n", (unsigned)timestamp, (ip>>24)&0xFF, (ip>>16)&0xFF, (ip>> 8)&0xFF, (ip>> 0)&0xFF, name_from_ip_proto(ip_proto), port, status_string(status), reason_string(reason, reason_buffer, sizeof(reason_buffer)), ttl ); }
static void xml_out_banner(struct Output *out, FILE *fp, time_t timestamp, unsigned ip, unsigned ip_proto, unsigned port, enum ApplicationProtocol proto, const unsigned char *px, unsigned length) { char banner_buffer[4096]; UNUSEDPARM(out); fprintf(fp, "<host endtime=\"%u\">" "<address addr=\"%u.%u.%u.%u\" addrtype=\"ipv4\"/>" "<ports>" "<port protocol=\"%s\" portid=\"%u\">" "<service name=\"%s\" banner=\"%s\">" "</service>" "</port>" "</ports>" "</host>" "\r\n", (unsigned)timestamp, (ip>>24)&0xFF, (ip>>16)&0xFF, (ip>> 8)&0xFF, (ip>> 0)&0xFF, name_from_ip_proto(ip_proto), port, masscan_app_to_string(proto), normalize_string(px, length, banner_buffer, sizeof(banner_buffer)) ); }
static void text_out_status(struct Output *out, FILE *fp, time_t timestamp, int status, unsigned ip, unsigned ip_proto, unsigned port, unsigned reason, unsigned ttl) { UNUSEDPARM(ttl); UNUSEDPARM(reason); UNUSEDPARM(out); fprintf(fp, "%s %s %u %u.%u.%u.%u %u\n", status_string(status), name_from_ip_proto(ip_proto), port, (ip>>24)&0xFF, (ip>>16)&0xFF, (ip>> 8)&0xFF, (ip>> 0)&0xFF, (unsigned)timestamp ); }
static void text_out_status(struct Output *out, FILE *fp, time_t timestamp, int status, unsigned ip, unsigned ip_proto, unsigned port, unsigned reason, unsigned ttl) { const char *service = port_to_service(port, ip_proto); UNUSEDPARM(ttl); UNUSEDPARM(reason); UNUSEDPARM(out); fprintf(fp, "%s %s %u %u.%u.%u.%u %u %s\n", status_string(status), name_from_ip_proto(ip_proto), port, (ip>>24)&0xFF, (ip>>16)&0xFF, (ip>> 8)&0xFF, (ip>> 0)&0xFF, (unsigned)timestamp, service ); fflush(fp); }