|
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. |
2 | 3 |
|
3 | | -[](https://opensource.org/licenses/MIT) |
4 | | -[](https://isocpp.org/) |
| 4 | +Features |
| 5 | +Core Capabilities |
5 | 6 |
|
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 |
7 | 46 |
|
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 |
48 | 52 | NetGuard/ |
49 | 53 | ├── config/ # Network interface configuration |
50 | 54 | │ └── interface.cfg |
51 | | -├── docs/ # Project documentation |
| 55 | +├── docs/ # Project documentation |
52 | 56 | │ └── 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