Skip to content

Commit 13ef30d

Browse files
davidmcgrewGitHub Enterprise
authored andcommitted
Merge pull request #403 from network-intelligence/dev
Merging dev 2.6.4 into trunk
2 parents fd87d28 + f711416 commit 13ef30d

Some content is hidden

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

89 files changed

+5627
-2484
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.3
1+
2.6.4

doc/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# CHANGELOG for Mercury
22

3+
## VERSION 2.6.4
4+
* Added reporting of HTTP CONNECT proxies in JSON output.
5+
* Added FTP command channel reporting in JSON output.
6+
* Added SSH crypto assessment.
7+
* Refactored weighted naive bayes classifier and eliminated
8+
intermedate data structures that had been used during
9+
initialization.
10+
* Several minor fixes and defensive coding additions
11+
* Added normalization for TLS/QUIC Server Names and HTTP Hosts
12+
* Added test cases for CBOR.
13+
* Improved error checking and unit test cases for IPv4 and IPv6 address textual representations.
14+
* Added detectors for Domain Faking and Fake TLS.
15+
316
## VERSION 2.6.3
417
* Revamped SSH metadata and fingerprints.
518
* Minor improvements to reassembly.

doc/sphinx/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ WARN_LOGFILE =
784784
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
785785
# Note: If this tag is empty the current directory is searched.
786786

787-
INPUT = ../../src/libmerc/datum.h
787+
INPUT = ../../src/libmerc/datum.h ../../src/libmerc/watchlist.hpp ../../src/libmerc/ip_address.hpp
788788

789789
# This tag can be used to specify the character encoding of the source files
790790
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

doc/sphinx/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

99
project = 'mercury'
10-
copyright = '2023, Cisco Systems'
10+
copyright = '2024, Cisco Systems'
1111
author = 'Cisco Systems'
1212
with open('../../../VERSION') as VERSION:
1313
release = VERSION.read()
@@ -45,5 +45,5 @@
4545
}
4646

4747
breathe_projects_source = {
48-
"mercury" : ( "../../../", ["src/libmerc/datum.h"])
48+
"mercury" : ( "../../../", ["src/libmerc/datum.h", "src/libmerc/watchlist.hpp", "src/libmerc/ip_address.hpp"] )
4949
}

doc/sphinx/source/datum.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.. Mercury documentation subfile
2+
3+
Data Parsing and Lexing
4+
=======================
5+
6+
Datum
7+
-----
8+
9+
.. doxygenstruct:: datum
10+
:project: mercury
11+
:members:
12+
13+
.. doxygenclass:: writeable
14+
:project: mercury
15+
:members:
16+
17+
.. doxygenstruct:: data_buffer
18+
:project: mercury
19+
:members:
20+
21+
.. doxygenclass:: pad
22+
:project: mercury
23+
:members:
24+
25+
.. doxygenclass:: encoded
26+
:project: mercury
27+
:members:
28+
29+
.. doxygenclass:: type_codes
30+
:project: mercury
31+
:members:
32+
33+
.. doxygenclass:: literal
34+
:project: mercury
35+
:members:
36+
37+
.. doxygenclass:: literal_byte
38+
:project: mercury
39+
:members:
40+
41+
.. doxygenclass:: skip_bytes
42+
:project: mercury
43+
:members:
44+
45+
.. doxygenclass:: lookahead
46+
:project: mercury
47+
:members:
48+
49+
.. doxygenclass:: acceptor
50+
:project: mercury
51+
:members:
52+
53+
.. doxygenclass:: optional
54+
:project: mercury
55+
:members:
56+
57+
.. doxygenclass:: ignore
58+
:project: mercury
59+
:members:
60+
61+
.. doxygengroup:: byteorder
62+
:project: mercury
63+
64+
.. doxygengroup:: bitoperations
65+
:project: mercury
66+

doc/sphinx/source/identifiers.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.. Mercury documentation master file, created by
2+
sphinx-quickstart on Mon Aug 14 16:13:10 2023.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Domain Names and Addresses
7+
========================================
8+
9+
Internet Protocol (IP) Addresses
10+
---------------------------------
11+
12+
.. doxygenclass:: ipv4_address
13+
:project: mercury
14+
:members:
15+
16+
.. doxygenstruct:: ipv6_address
17+
:project: mercury
18+
:members:
19+
20+
.. doxygenclass:: ipv4_address_string
21+
:project: mercury
22+
:members:
23+
24+
.. doxygenclass:: ipv6_address_string
25+
:project: mercury
26+
:members:
27+
28+
.. doxygenfunction:: normalize_ip_address
29+
:project: mercury
30+
31+
.. doxygennamespace:: normalized
32+
:project: mercury
33+
:members:
34+
35+
36+
Host and Server Identifiers
37+
----------------------------
38+
39+
.. doxygentypedef:: dns_name_t
40+
:project: mercury
41+
42+
.. doxygentypedef:: host_identifier
43+
:project: mercury
44+
45+
.. doxygenclass:: server_identifier
46+
:project: mercury
47+
:members:

doc/sphinx/source/index.rst

Lines changed: 9 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,82 +7,21 @@ Mercury Library Documentation
77
===================================
88

99
.. toctree::
10-
:maxdepth: 3
10+
intro
11+
datum
12+
identifiers
13+
python
14+
:maxdepth: 2
1115
:caption: Contents:
1216

13-
.. doxygenstruct:: datum
14-
:project: mercury
15-
:members:
16-
17-
.. doxygenclass:: writeable
18-
:project: mercury
19-
:members:
20-
21-
.. doxygenstruct:: data_buffer
22-
:project: mercury
23-
:members:
24-
25-
.. doxygenclass:: pad
26-
:project: mercury
27-
:members:
28-
29-
.. doxygenclass:: encoded
30-
:project: mercury
31-
:members:
32-
33-
.. doxygenclass:: type_codes
34-
:project: mercury
35-
:members:
36-
37-
.. doxygenclass:: literal
38-
:project: mercury
39-
:members:
40-
41-
.. doxygenclass:: literal_byte
42-
:project: mercury
43-
:members:
44-
45-
.. doxygenclass:: skip_bytes
46-
:project: mercury
47-
:members:
48-
49-
.. doxygenclass:: lookahead
50-
:project: mercury
51-
:members:
52-
53-
.. doxygenclass:: acceptor
54-
:project: mercury
55-
:members:
56-
57-
.. doxygenclass:: optional
58-
:project: mercury
59-
:members:
60-
61-
.. doxygenclass:: ignore
62-
:project: mercury
63-
:members:
64-
65-
.. doxygenclass:: sequence
66-
:project: mercury
67-
:members:
68-
69-
.. doxygengroup:: byteorder
70-
:project: mercury
71-
72-
.. doxygengroup:: bitoperations
73-
:project: mercury
74-
75-
Mercury Python Library Documentation
76-
====================================
77-
78-
.. automodule:: mercury
79-
:members:
80-
:show-inheritance:
81-
8217

8318
Indices and tables
8419
==================
8520

8621
* :ref:`genindex`
8722
* :ref:`modindex`
8823
* :ref:`search`
24+
25+
Table of Contents
26+
^^^^^^^^^^^^^^^^^
27+

doc/sphinx/source/intro.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
Introduction
4+
============
5+
6+
This documentation presents the interface to the Mercury C++ classes
7+
and functions for parsing, lexing, and manipulating data.
8+
9+
This documentation is a work in progress, and much of the code is not
10+
yet covered.
11+

doc/sphinx/source/python.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Mercury Python Library
2+
======================
3+
4+
.. automodule:: mercury
5+
:members:
6+
:exclude-members: ECHConfig
7+
:show-inheritance:

src/Makefile.in

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ compiler_version:
105105
#.PHONY: libmerc-and-mercury
106106
#libmerc-and-mercury: libmerc.a mercury # TODO: delete
107107

108-
# implicit rules for building object files from .c and .cc files
108+
# implicit rules for building object files from .c, .cpp, and .cc files
109109
#
110110
%.o: %.c
111111
$(CXX) $(CFLAGS) -c $<
112112
%.o: %.cc
113113
$(CXX) $(CFLAGS) -c $<
114+
%.o: %.cpp
115+
$(CXX) $(CFLAGS) -c $<
114116

115117
# the target mercury rebuilds mercury, and is dependent on the actual
116118
# libmerc.a file, but it does not trigger any check to see if
@@ -188,6 +190,12 @@ cert_analyze: cert_analyze.cc libmerc/asn1.h
188190
cms: cms.cpp libmerc/asn1.h
189191
$(CXX) $(CFLAGS) cms.cpp libmerc/asn1.cc libmerc/asn1/oid.cc $(LDFLAGS) -lcrypto -o cms
190192

193+
dns-trie: dns-trie.cpp dns_trie.hpp fpdb_reader.hpp
194+
$(CXX) $(CFLAGS) dns-trie.cpp -o dns-trie
195+
196+
unit_test: unit_test.cpp
197+
$(CXX) $(CFLAGS) -UNDEBUG unit_test.cpp -o unit_test
198+
191199
os_identifier: os_identifier.cc os-identification/os_identifier.h
192200
$(CXX) $(CFLAGS) -I libmerc/ os_identifier.cc -lz -o os_identifier
193201

@@ -206,6 +214,9 @@ decode: decode.cc
206214
pcap: pcap.cc pcap_file_io.h
207215
$(CXX) $(CFLAGS) pcap.cc -o pcap
208216

217+
remap: remap.cpp libmerc/tls.cc libmerc/http.cc libmerc/match.cc libmerc/asn1.cc libmerc/asn1/oid.cc libmerc/addr.cc
218+
$(CXX) $(CFLAGS) -std=c++20 remap.cpp libmerc/tls.cc libmerc/http.cc libmerc/match.cc libmerc/asn1.cc libmerc/asn1/oid.cc libmerc/addr.cc -lcrypto -o remap
219+
209220
pcap_filter: pcap_filter.cc pcap_file_io.c libmerc
210221
$(CXX) $(CFLAGS) pcap_filter.cc pcap_file_io.c libmerc/libmerc.a -lz -lcrypto -pthread -o pcap_filter
211222

@@ -233,7 +244,7 @@ endif
233244

234245
#MERC_OBJ = $(MERC:%.o=%.c)
235246

236-
libmerc_test: libmerc_test.c $(LIBMERC_SO) Makefile.in
247+
libmerc_test: run_unit_test libmerc_test.c $(LIBMERC_SO) Makefile.in
237248
$(CC) -Wall -std=c11 libmerc_test.c -pthread -L./libmerc $(LIBMERC_SO) -lz -lcrypto -o libmerc_test
238249
@echo $(COLOR_GREEN) "To run before 'make install', export LD_LIBRARY_PATH=$(shell pwd)/libmerc" $(COLOR_OFF)
239250

@@ -251,7 +262,7 @@ intercept.so: intercept.cc libmerc.a
251262

252263
.PHONY: clean
253264
clean: libmerc-clean
254-
rm -rf mercury libmerc_test libmerc_util intercept_server tls_scanner cert_analyze os_identifier archive_reader batch_gcd string cbor decode pcap pcap_filter format intercept.so gmon.out *.o *.json.gz
265+
rm -rf mercury libmerc_test libmerc_util intercept_server tls_scanner cert_analyze os_identifier archive_reader batch_gcd string cbor unit_test decode pcap pcap_filter format intercept.so dns-trie gmon.out *.o *.json.gz
255266
for file in Makefile.in README.md configure.ac; do if [ -e "$$file~" ]; then rm -f "$$file~" ; fi; done
256267
for file in mercury.c libmerc_test.c tls_scanner.cc cert_analyze.cc $(MERC) $(MERC_H); do if [ -e "$$file~" ]; then rm -f "$$file~" ; fi; done
257268

@@ -324,8 +335,19 @@ cppcheck: $(MERC)
324335
cppcheck --language=c++ --std=c++17 --force --enable=all -URAPIDJSON_DOXYGEN_RUNNING --template='{file}:{line}:{severity}:{message}' $^
325336
cd libmerc && $(MAKE) cppcheck
326337

338+
# the run_unit_test target builds and runs a simple application that
339+
# invokes all of the unit_test functions available in the libmerc/
340+
# subdirectory
341+
#
342+
# note: there are much more extensive unit tests in the ./unit_tests
343+
# subdirectory
344+
#
345+
.PHONY: run_unit_test
346+
run_unit_test: unit_test
347+
./unit_test
348+
327349
.PHONY: test
328-
test: mercury libmerc_driver
350+
test: run_unit_test mercury libmerc_driver
329351
cd ../test && $(MAKE)
330352

331353
major=$(shell cat ../VERSION | grep -o "^[0-9]*")

src/cbor.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ int main(int argc, char *argv[]) {
8383
}
8484
}
8585
if (decode_fdc) {
86-
static const size_t MAX_DST_ADDR_LEN = 48;
87-
static const size_t MAX_SNI_LEN = 257;
88-
static const size_t MAX_USER_AGENT_LEN = 512;
8986
static const size_t MAX_FP_STR_LEN = 4096;
9087
char fp_str[MAX_FP_STR_LEN];
9188
char dst_ip_str[MAX_DST_ADDR_LEN];

src/classify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char *argv[]) {
6464
}
6565

6666
classifier *c = analysis_init_from_archive(0, // verbosity
67-
"../../../2025-02-6/resources-mp.tgz",
67+
resource_file.c_str(),
6868
nullptr,
6969
enc_key_type_none,
7070
0,

src/cython/_version.py

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

0 commit comments

Comments
 (0)