Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IVRE integration #742

Merged
merged 56 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
666d817
Split VNC output (vnc/vnc-info) to mimic Nmap behavior
p-l- Sep 5, 2016
dd04d9c
Support UDP banner
p-l- Oct 28, 2016
aba7ff7
Add ports for WSUS
p-l- Jan 20, 2017
8ec0f52
Add AT&T box ssl service
p-l- Sep 5, 2017
be134c8
Change default User-Agent
p-l- Feb 17, 2018
616c902
transmit_thread wait to make sure receive_thread is ready
p-l- Apr 17, 2018
45ec257
Support for protocol ISAKMP (UDP/500)
p-l- Apr 20, 2018
e6ee36b
smb: log boottime
p-l- Apr 23, 2019
36c2931
Raise max collected banner length to 8192
p-l- Apr 25, 2019
1160d9e
ssh: get cipher suites & keys
Aug 21, 2018
7b3b59c
X509: use separate entries for server cert and trust chain certs
p-l- Mar 3, 2020
d0945f2
telnet: output raw chars so that IVRE can use Nmap fingerprints
p-l- Mar 11, 2020
82f81be
Add probes for X11 and Java RMI
p-l- Mar 20, 2020
83f0fdc
Add probes for MongoDB & Kerberos
p-l- Mar 25, 2020
fc88c05
Add a DICOM probe from Nmap script dicom-ping
p-l- Mar 27, 2020
b3eb7bf
Add an LDAP probe
p-l- Mar 28, 2020
79504a9
Add a SIP probe
p-l- Mar 28, 2020
ec4b952
Add an RTSP probe
p-l- Mar 31, 2020
764cf10
Add an RPC probe
p-l- Mar 31, 2020
1a3b4f2
Add a DNS probe
p-l- Apr 22, 2020
80c2162
Add a Docker probe
p-l- Oct 6, 2020
fda7620
Add a Redis probe
p-l- Oct 6, 2020
faf52f0
Add a NotesRPC probe
p-l- Oct 14, 2020
b5ad10b
Add a Microsoft SQL Server probe
p-l- Dec 14, 2020
e50fe98
Add an AFP probe
p-l- Feb 22, 2021
e136dd6
Add multiple possible values for syn-cookies
Frky Aug 18, 2022
c47842d
Add SSL 1.2 banner
Frky Aug 18, 2022
b2721a1
Add an iteration over next protocols in case one fails
Frky Aug 18, 2022
94c0107
Support for --tcpmss to explicitly set MSS in TCP packet template; fo…
mzpqnxow Jan 17, 2022
d15f613
Fix bug in --echo for IPv6 ranges
Frky Oct 26, 2022
b87427c
Handle IPv6 CIDR with --echo between /0 and /63
Frky Oct 26, 2022
f08c0c8
Add an option in masscan to output the ordered list of CIDR ranges (#2)
Frky Dec 6, 2022
c5d11a5
Add a fork-specific part to the README
p-l- Aug 12, 2023
2e02e76
Merge pull request #5 from robertdavidgraham/master
p-l- Aug 12, 2023
5b644c9
Run unit tests on Github Actions
gpotter2 Apr 5, 2023
bf08ea4
Tests: fix Telnet selftest
p-l- May 12, 2023
b5e049f
Tests: fix count_cidr_bits() selftest (I have no idea what I'm doing)
p-l- May 12, 2023
022e830
Merge pull request #6 from p-l-/github-actions
p-l- Aug 12, 2023
b75028a
README: add badges
p-l- Aug 12, 2023
3af1601
Merge pull request #7 from p-l-/readme-add-badges
p-l- Aug 12, 2023
561cd1d
Save or echo --adapter-port/--source-port value or range
mzpqnxow Oct 19, 2023
882391e
Merge pull request #11 from p-l-/upstream
p-l- Nov 2, 2023
e35e817
avoid merge conflicts
robertdavidgraham Nov 9, 2023
0d0c88f
more temp reversions
robertdavidgraham Nov 9, 2023
7aa740d
Merge pull request #740 from ivre/master
robertdavidgraham Nov 9, 2023
19cc149
RECONNECT feature for TCP, so that multiple banners can be collected …
robertdavidgraham Nov 10, 2023
ab952a7
redid sending TCP data
robertdavidgraham Nov 10, 2023
69c80c6
stack renaming
robertdavidgraham Nov 11, 2023
681ae43
FIN-WAIT-1
robertdavidgraham Nov 11, 2023
48bbcd7
CLOSE-WAIT and LAST-ACK states
robertdavidgraham Nov 12, 2023
0e0fc1d
split stack-tcp-app.c
robertdavidgraham Nov 13, 2023
f732ded
split stack-tcp-app.c
robertdavidgraham Nov 13, 2023
c7801f1
tcp-app fixes, and errmsg
robertdavidgraham Nov 13, 2023
963af1b
tcp.state bugs fixed
robertdavidgraham Nov 14, 2023
25da986
cosmetic fixes
robertdavidgraham Nov 16, 2023
9cd6a29
Merge pull request #741 from robertdavidgraham/master
robertdavidgraham Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[![Masscan unittests](https://github.com/robertdavidgraham/masscan/actions/workflows/unittests.yml/badge.svg?branch=master)](https://github.com/robertdavidgraham/masscan/actions/workflows/unittests.yml/?branch=master)
[![Follow on Twitter](https://img.shields.io/twitter/follow/erratarob.svg?logo=twitter)](https://twitter.com/erratarob)
[![Follow on Mastodon](https://img.shields.io/mastodon/follow/109293216115833216?domain=https%3A%2F%2Finfosec.exchange&style=social)](https://infosec.exchange/@erratarob)
[![unittests](https://github.com/robertdavidgraham/masscan/actions/workflows/unittests.yml/badge.svg?branch=master)](https://github.com/robertdavidgraham/masscan/actions/workflows/unittests.yml/?branch=master)

# MASSCAN: Mass IP port scanner

Expand Down
14 changes: 13 additions & 1 deletion src/event-timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
code and causing the bug to come back again.
*/
#include "event-timeout.h"
#include "logger.h"
#include "util-logger.h"
#include "util-malloc.h"
#include <stdint.h>
#include <stdlib.h>
Expand All @@ -48,6 +48,13 @@ struct Timeouts {
*/
uint64_t current_index;

/**
* Counts the number of outstanding timeouts. Adding a timeout increments
* this number, and removing a timeout decrements this number. The
* program shouldn't exit until this number is zero.
*/
uint64_t outstanding_count;

/**
* The number of slots is a power-of-2, so the mask is just this
* number minus 1
Expand Down Expand Up @@ -104,6 +111,8 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry,
unsigned index;

/* Unlink from wherever the entry came from */
if (entry->timestamp)
timeouts->outstanding_count--;
timeout_unlink(entry);

if (entry->prev) {
Expand All @@ -122,6 +131,8 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry,
entry->prev = &timeouts->slots[index];
if (entry->next)
entry->next->prev = &entry->next;

timeouts->outstanding_count++;
}

/***************************************************************************
Expand Down Expand Up @@ -155,6 +166,7 @@ timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp)
}

/* unlink this entry from the timeout system */
timeouts--;
timeout_unlink(entry);

/* return a pointer to the structure holding this entry */
Expand Down
11 changes: 11 additions & 0 deletions src/event-timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stddef.h> /* offsetof*/
#include "util-bool.h" /* <stdbool.h> */
#if defined(_MSC_VER)
#undef inline
#define inline _inline
Expand Down Expand Up @@ -34,6 +35,16 @@ struct TimeoutEntry {
unsigned offset;
};

/***************************************************************************
***************************************************************************/
static inline bool
timeout_is_unlinked(const struct TimeoutEntry *entry) {
if (entry->prev == 0 || entry->next == 0)
return true;
else
return false;
}

/***************************************************************************
***************************************************************************/
static inline void
Expand Down
34 changes: 20 additions & 14 deletions src/in-binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "in-filter.h"
#include "in-report.h"
#include "util-malloc.h"
#include "util-logger.h"

#include <stdlib.h>
#include <assert.h>
Expand Down Expand Up @@ -485,17 +486,24 @@ _binaryfile_parse(struct Output *out, const char *filename,
goto end;
}

LOG(0, "[+] --readscan %s\n", filename);

if (feof(fp)) {
LOG(0, "[-] %s: file is empty\n", filename);
goto end;
}

/* first record is pseudo-record */
bytes_read = fread(buf, 1, 'a'+2, fp);
if (bytes_read < 'a'+2) {
perror(filename);
LOG(0, "[-] %s: %s\n", filename, strerror(errno));
goto end;
}

/* Make sure it's got the format string */
if (memcmp(buf, "masscan/1.1", 11) != 0) {
fprintf(stderr,
"%s: unknown file format (expeced \"masscan/1.1\")\n",
LOG(0,
"[-] %s: unknown file format (expeced \"masscan/1.1\")\n",
filename);
goto end;
}
Expand Down Expand Up @@ -557,7 +565,7 @@ _binaryfile_parse(struct Output *out, const char *filename,
length = (length << 7) | (buf[0] & 0x7F);
}
if (length > BUF_MAX) {
fprintf(stderr, "file corrupt\n");
LOG(0, "[-] file corrupt\n");
goto end;
}

Expand All @@ -582,7 +590,7 @@ _binaryfile_parse(struct Output *out, const char *filename,
break;
case 4:
if (fread(buf+bytes_read,1,1,fp) != 1) {
fprintf(stderr, "read() error\n");
LOG(0, "[-] read() error\n");
exit(1);
}
bytes_read++;
Expand Down Expand Up @@ -617,12 +625,12 @@ _binaryfile_parse(struct Output *out, const char *filename,
//goto end;
break;
default:
fprintf(stderr, "file corrupt: unknown type %u\n", type);
LOG(0, "[-] file corrupt: unknown type %u\n", type);
goto end;
}
total_records++;
if ((total_records & 0xFFFF) == 0)
fprintf(stderr, "%s: %8" PRIu64 "\r", filename, total_records);
LOG(0, "[+] %s: %8" PRIu64 "\r", filename, total_records);
}

end:
Expand All @@ -641,15 +649,15 @@ _binaryfile_parse(struct Output *out, const char *filename,
* other formats. This preserves the original timestamps.
*****************************************************************************/
void
read_binary_scanfile(struct Masscan *masscan,
readscan_binary_scanfile(struct Masscan *masscan,
int arg_first, int arg_max, char *argv[])
{
struct Output *out;
int i;

//readscan_report_init();


/*
* Create the output system, such as XML or JSON output
*/
out = output_create(masscan, 0);

/*
Expand All @@ -672,10 +680,8 @@ read_binary_scanfile(struct Masscan *masscan,
_binaryfile_parse(out, argv[i], &masscan->targets, &masscan->banner_types);
}

/* Done! */
output_destroy(out);

//readscan_report_print();

}


2 changes: 1 addition & 1 deletion src/in-binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct Masscan;
* JSON or XML.
*/
void
read_binary_scanfile(struct Masscan *masscan,
readscan_binary_scanfile(struct Masscan *masscan,
int arg_first, int arg_max, char *argv[]);

#endif
Expand Down
Loading