Skip to content

Commit 894907c

Browse files
authored
Merge pull request #1 from out-sec/http-parsing-update
Full HTTP parsing added + updated README with HTTP example
2 parents 94f7c20 + f856d1c commit 894907c

43 files changed

Lines changed: 1051 additions & 3989 deletions

Some content is hidden

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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@
4444

4545
# debug information files
4646
*.dwo
47+
build/
48+
config/interface.cfg

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ configure_file("${CMAKE_SOURCE_DIR}/config/interface.cfg"
1414
set(SOURCES
1515
src/main.cpp
1616
src/entry.cpp
17+
src/parsers/http.cpp
1718
src/parsers/ethernet.cpp
1819
src/parsers/ipv4.cpp
20+
src/parsers/http.cpp
1921
src/utils/decEthernet.cpp
2022
# src/utils/hex.cpp
23+
src/utils/decHttp.cpp
2124
src/config/interface.cpp
2225
src/utils/decIPv4.cpp
2326
src/parsers/arp.cpp

README.md

Lines changed: 117 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,124 @@
1-
# NetGuard
1+
NetGuard:
2+
NetGuard is a high-performance Network Intrusion Detection System (NIDS) implemented in modern C++ with CMake. It provides real-time network traffic analysis, multi-layer protocol parsing, custom rule-based detection, and a threat alerting system. Designed for extensibility, NetGuard aims to evolve into a Network Intrusion Prevention System (NIPS) with active mitigation capabilities.
23

3-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4-
[![C++](https://img.shields.io/badge/C%2B%2B-%2300599C?style=for-the-badge&logo=cplusplus&logoColor=white)](https://isocpp.org/)
4+
Features
5+
Core Capabilities
56

6-
NetGuard is a high-performance Network Intrusion Detection System (NIDS) implemented in modern C++ with CMake. It provides real-time network traffic analysis, multi-layer protocol parsing, custom rule-based detection, and a threat alerting system. Designed for extensibility, NetGuard aims to evolve into a Network Intrusion Prevention System (NIPS) with active mitigation capabilities.
7+
Packet Processing:
8+
9+
Ethernet frame parsing
10+
11+
IPv4 and IPv6 support
12+
13+
TCP, UDP, and ICMP analysis
14+
15+
Full HTTP request and response parsing with all standard headers
16+
17+
Detection Engine:
18+
19+
Signature-based detection
20+
21+
Protocol anomaly detection
22+
23+
Stateful pattern matching
24+
25+
Custom rule support
26+
27+
Performance:
28+
29+
Multi-threaded processing
30+
31+
Zero-copy parsing
32+
33+
Rule optimization
34+
35+
Supported Protocols
36+
37+
Ethernet
38+
39+
IP (v4)
40+
41+
ARP
42+
43+
TCP
44+
45+
UDP
746

8-
## Features
9-
10-
### Core Capabilities
11-
- **Packet Processing**:
12-
- Ethernet frame parsing
13-
- IPv4 and IPv6 support
14-
- TCP, UDP, and ICMP analysis
15-
- HTTP header inspection
16-
- **Detection Engine**:
17-
- Signature-based detection
18-
- Protocol anomaly detection
19-
- Stateful pattern matching
20-
- Custom rule support
21-
- **Performance**:
22-
- Multi-threaded processing
23-
- Zero-copy parsing
24-
- Rule optimization
25-
26-
### Supported Protocols
27-
- Ethernet
28-
- IP (v4)
29-
- ARP
30-
- TCP
31-
- UDP
32-
- ICMP
33-
- HTTP
34-
35-
### Future Protocol Support
36-
To enhance detection capabilities, we plan to add support for the following protocols:
37-
- [ ] DNS
38-
- [ ] FTP
39-
- [ ] SMTP
40-
- [ ] SSH
41-
- [ ] TLS/SSL
42-
- [ ] SMB
43-
- [ ] RDP
44-
45-
## Project Structure
46-
47-
```
47+
ICMP
48+
49+
HTTP
50+
51+
Future Protocol Support
4852
NetGuard/
4953
├── config/ # Network interface configuration
5054
│ └── interface.cfg
51-
├── docs/ # Project documentation
55+
├── docs/ # Project documentation
5256
│ └── design.md
53-
├── include/ # Header files
54-
│ ├── config/ # Interface configuration
55-
│ ├── parsing/ # Packet parsing headers
56-
│ ├── rules/ # Rule processing headers
57-
│ └── utils/ # Utility functions
58-
├── rules/ # Rule definition files
59-
│ ├── exploits/ # Exploit-specific rules
60-
│ └── protocols/ # Protocol-specific rules
61-
├── src/ # Source code
62-
│ ├── config/ # Interface configuration implementation
63-
│ ├── parsing/ # Packet parsing implementation
64-
│ ├── rules/ # Rule engine implementation
65-
│ └── utils/ # Utility implementations
66-
├── tests/ # Unit and integration tests
67-
└── CMakeLists.txt # Build configuration
68-
```
69-
70-
## Dependencies
71-
- C++17 compiler (e.g., GCC 9+, Clang 10+, MSVC 2019+)
72-
- CMake 3.14+
73-
- libpcap 1.9.0+ (for Linux/macOS) or npcap (for Windows)
74-
75-
## Installation
76-
77-
### Linux/macOS
78-
1. Install dependencies:
79-
```
80-
sudo apt-get install libpcap-dev cmake g++
81-
```
82-
2. Clone the repository:
83-
```
84-
git clone https://github.com/out-sec/NetGuard.git
85-
cd NetGuard
86-
```
87-
3. Build the project:
88-
```
89-
mkdir build
90-
cd build
91-
cmake -DCMAKE_BUILD_TYPE=Release ..
92-
make -j$(nproc)
93-
```
94-
95-
### Windows
96-
1. Install npcap from [https://npcap.com](https://npcap.com)
97-
2. Install CMake from [https://cmake.org/download/](https://cmake.org/download/)
98-
3. Install a C++ compiler (e.g., Visual Studio 2019+ with C++ tools)
99-
4. Clone the repository and build using CMake GUI or command line.
100-
101-
## Usage
102-
1. **Configure the Network Interface**:
103-
Edit `config/interface.cfg` to specify the network interface to monitor (e.g., `eth0`).
104-
2. **Define Detection Rules**:
105-
Create or modify rule files in `rules/protocols/` or `rules/exploits/`. Refer to [Rule Syntax Guide](docs/rule_syntax.md) for details.
106-
3. **Run NetGuard**:
107-
```
108-
sudo ./build/netguard
109-
```
110-
Note: Running as root is required to capture packets.
111-
112-
## Contributing
113-
We welcome contributions! Please read our [Contribution Guidelines](CONTRIBUTION.md) for detailed instructions on how to contribute, including setting up the development environment and submitting pull requests.
114-
115-
## License
116-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
117-
118-
## Contact
119-
For questions or feedback, please contact us at [contact@out-sec.org](mailto:contact@out-sec.org) or open an issue on [GitHub](https://github.com/out-sec/NetGuard/issues).
120-
121-
## Contributors
122-
We extend our gratitude to all contributors who have helped shape NetGuard. View the full list of contributors [here](https://github.com/out-sec/NetGuard/graphs/contributors).
57+
├── include/ # Header files
58+
│ ├── config/
59+
│ ├── parsing/
60+
│ ├── rules/
61+
│ └── utils/
62+
├── rules/
63+
│ ├── exploits/
64+
│ └── protocols/
65+
├── src/
66+
│ ├── config/
67+
│ ├── parsing/
68+
│ ├── rules/
69+
│ └── utils/
70+
├── tests/
71+
└── CMakeLists.txt
72+
73+
Dependencies:
74+
75+
C++17 compiler (GCC 9+, Clang 10+, MSVC 2019+)
76+
77+
CMake 3.14+
78+
79+
libpcap 1.9.0+ (Linux/macOS) or npcap (Windows)
80+
81+
Installation:
82+
Linux/macOS
83+
sudo apt-get install libpcap-dev cmake g++
84+
git clone https://github.com/out-sec/NetGuard.git
85+
cd NetGuard
86+
mkdir build && cd build
87+
cmake -DCMAKE_BUILD_TYPE=Release ..
88+
make -j$(nproc)
89+
Windows
90+
91+
Install npcap from https://npcap.com
92+
93+
Install CMake from https://cmake.org/download/
94+
95+
Install a C++ compiler (Visual Studio 2019+ with C++ tools)
96+
97+
Clone the repository and build with CMake
98+
99+
Usage
100+
1. Configure the Network Interface
101+
102+
Edit:
103+
config/interface.cfg
104+
Example:
105+
interface=ens33
106+
2. Run NetGuard (Live Capture Mode)
107+
sudo ./build/netguard
108+
Root privileges are required for packet capture.
109+
110+
3. Test with a .pcap File
111+
112+
You can replay captured traffic into the monitored interface:
113+
sudo apt install tcpreplay
114+
sudo tcpreplay --intf1=ens33 sample.pcap
115+
Or modify the source code to read .pcap files directly for offline analysis.
116+
117+
Contributing
118+
119+
We welcome contributions! See CONTRIBUTION.md for guidelines.
120+
121+
License
122+
123+
MIT License — see LICENSE.
124+

0 commit comments

Comments
 (0)