Skip to content

Commit bf67506

Browse files
davidmcgrewGitHub Enterprise
authored andcommitted
Merge pull request #456 from network-intelligence/dev
Merging dev into trunk
2 parents e7e4083 + b52f7b4 commit bf67506

File tree

93 files changed

+5025
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+5025
-624
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ GENERAL OPTIONS
118118
--certs-json # output certs as JSON, not base64
119119
--metadata # output more protocol metadata in JSON
120120
--raw-features # select protocols to write out raw features string(see --help)
121+
--minimize-ram # minimize the ram usage of mercury library
121122
[-v or --verbose] # additional information sent to stderr
122123
--license # write license information to stdout
123124
--version # write version information to stdout
@@ -190,6 +191,8 @@ DETAILS
190191
tls.certificates TLS serverCertificates
191192
tofsee Tofsee malware communication
192193
wireguard WG handshake initiation message
194+
geneve Geneve encapsulation
195+
vxlan VXLAN encapsualtion
193196
all all of the above
194197
<no option> all of the above
195198
none none of the above
@@ -258,6 +261,9 @@ DETAILS
258261
none None of the above
259262
<no option> None of the above
260263
264+
--minimize-ram minimizes the ram usage of mercury library by reducing classifer
265+
features and minimizing the maximum reassembly segments."
266+
261267
[-v or --verbose] writes additional information to the standard error,
262268
including the packet count, byte count, elapsed time and processing rate, as
263269
well as information about threads and files.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.5
1+
2.7.0

doc/CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
# CHANGELOG for Mercury
2+
* Added a new configuration option, minimize-ram, which reduces
3+
* the RAM usage of mercury library when enabled
4+
5+
## VERSION 2.7.1
6+
* Updated QUIC reassembly logic for reordered QUIC crypto frames
7+
8+
## VERSION 2.7.0
9+
* Added minimal RDP (Remote Desktop Protocol) support, which
10+
reports information about handshakes, security negotiation, and
11+
cookies.
12+
* Added minimal VNC/RFB (Virtual Network Computing / Remote Frame
13+
Buffer) support, which reports handshakes and versions.
14+
* Added MySQL Login support, to report on exposed credentials.
15+
* Added TACACS+ support, which reports on both `encrypted` and
16+
`unencrypted` messages. Details of unencrypted authenticationd
17+
messages are reported in JSON.
18+
* Added minimal TFTP support, which reports file names and modes.
19+
* Extended FTP command channel to multi-line responses.
20+
* Support for reporting outer tunnel parameters and also includes
21+
support for PPoE, VXLAN encapsulation and IP encapsulations.
222

323
## VERSION 2.6.5
424
* Added support for mutli-line FTP responses.

doc/schema.md

Lines changed: 1321 additions & 50 deletions
Large diffs are not rendered by default.

src/config.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ static enum status mercury_config_parse_line(struct mercury_config *cfg,
206206
additional_args = str_append(additional_args, ";");
207207
return status_ok;
208208

209+
} else if ((arg = command_get_argument("minimize-ram", line)) != NULL) {
210+
additional_args = str_append(additional_args, "minimize-ram;");
211+
return status_ok;
212+
209213
} else {
210214
if (line[0] == '#') { /* comment line */
211215
return status_ok;

src/cython/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.6.4'
1+
__version__ = '2.7.0'

src/cython/mercury.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ from cython.operator import dereference
3131
# CC=g++ CXX=g++ python setup.py install
3232

3333
# TODO: actually handle version
34-
__version__ = '2.6.4'
34+
__version__ = '2.7.0'
3535

3636
# imports from mercury's dns
3737
cdef extern from "../libmerc/dns.h":
@@ -415,7 +415,7 @@ cdef class Mercury:
415415
cdef bytes dst_ip_b = dst_ip.encode()
416416
cdef char* dst_ip_c = dst_ip_b
417417

418-
cdef analysis_result ar = self.clf.perform_analysis(fp_str_c, server_name_c, dst_ip_c, dst_port, NULL)
418+
cdef analysis_result ar = self.clf.perform_analysis(fp_str_c, server_name_c, dst_ip_c, dst_port, '')
419419

420420
cdef fingerprint_status fp_status_enum = ar.status
421421
fp_status = fp_status_dict[fp_status_enum]

src/libmerc/analysis.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ classifier *analysis_init_from_archive(int, //verbosity
3333
enum enc_key_type key_type,
3434
const float fp_proc_threshold,
3535
const float proc_dst_threshold,
36-
const bool report_os) {
36+
const bool report_os,
37+
const bool minimize_ram) {
3738

3839
if (enc_key != NULL || key_type != enc_key_type_none) {
3940
//fprintf(stderr, "note: decryption key provided in configuration\n");
@@ -44,7 +45,7 @@ classifier *analysis_init_from_archive(int, //verbosity
4445
}
4546

4647
encrypted_compressed_archive archive{archive_name, enc_key}; // TODO: key type
47-
return new classifier(archive, fp_proc_threshold, proc_dst_threshold, report_os);
48+
return new classifier(archive, fp_proc_threshold, proc_dst_threshold, report_os, minimize_ram);
4849
}
4950

5051

src/libmerc/analysis.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class classifier *analysis_init_from_archive(int verbosity,
4141
enum enc_key_type key_type,
4242
float fp_proc_threshold,
4343
float proc_dst_threshold,
44-
bool report_os);
44+
bool report_os,
45+
bool minimize_ram=false);
4546

4647
int analysis_finalize(classifier *c);
4748

@@ -104,9 +105,10 @@ class fingerprint_data {
104105
common_data *c,
105106
bool &malware_database,
106107
size_t total_cnt,
107-
bool report_os
108+
bool report_os,
109+
bool minimize_ram
108110
) :
109-
classifier{process_info,total_cnt},
111+
classifier{process_info, total_cnt, minimize_ram},
110112
malware_db{malware_database},
111113
subnet_data_ptr{subnets},
112114
common{c},
@@ -535,7 +537,7 @@ class classifier {
535537
return(true);
536538
}
537539

538-
void process_fp_db_line(std::string &line_str, bool report_os) {
540+
void process_fp_db_line(std::string &line_str, bool report_os, bool minimize_ram) {
539541

540542
rapidjson::Document fp;
541543
fp.Parse(line_str.c_str());
@@ -593,7 +595,8 @@ class classifier {
593595
&common,
594596
MALWARE_DB,
595597
total_count,
596-
report_os
598+
report_os,
599+
minimize_ram
597600
);
598601

599602
if (fp.HasMember("str_repr") && fp["str_repr"].IsString()) {
@@ -655,7 +658,8 @@ class classifier {
655658
classifier(class encrypted_compressed_archive &archive,
656659
float fp_proc_threshold,
657660
float proc_dst_threshold,
658-
bool report_os) : os_dictionary{}, subnets{}, fpdb{}, resource_version{} {
661+
bool report_os,
662+
bool minimize_ram) : os_dictionary{}, subnets{}, fpdb{}, resource_version{} {
659663

660664
// reserve attribute for encrypted_dns watchlist
661665
//
@@ -710,7 +714,7 @@ class classifier {
710714
if (threshold_set) {
711715
printf_err(log_debug, "loading fingerprint_db_lite.json\n");
712716
while (archive.getline(line_str)) {
713-
process_fp_db_line(line_str, report_os);
717+
process_fp_db_line(line_str, report_os, minimize_ram);
714718
}
715719
got_fp_db = true;
716720
print_fp_counts();
@@ -723,7 +727,7 @@ class classifier {
723727
else if (!threshold_set || lite_db || full_db) {
724728
printf_err(log_debug, "loading fingerprint_db.json\n");
725729
while (archive.getline(line_str)) {
726-
process_fp_db_line(line_str, report_os);
730+
process_fp_db_line(line_str, report_os, minimize_ram);
727731
}
728732
print_fp_counts();
729733
}

0 commit comments

Comments
 (0)