|
1 | 1 | # SysSpecter |
2 | | -System analyzer API for linux ! writen in golang. |
| 2 | +<div align="center"> |
| 3 | + <img alt="Linux" src="https://img.shields.io/static/v1?style=for-the-badge&message=Linux&color=222222&logo=Linux&logoColor=FCC624&label="> |
| 4 | + <img alt="Go" src="https://img.shields.io/static/v1?style=for-the-badge&message=Go&color=00ADD8&logo=Go&logoColor=FFFFFF&label="> |
| 5 | + <img alt="Simple Analytics" src="https://img.shields.io/static/v1?style=for-the-badge&message=Analytics&color=FF4F64&logo=Simple+Analytics&logoColor=FFFFFF&label="> |
| 6 | +</div> |
| 7 | + |
| 8 | +<div align="center"> |
| 9 | + <img alt="GitHub go.mod Go version" src="https://img.shields.io/github/go-mod/go-version/aDarkDev/SysSpecter"> |
| 10 | + <img alt="GoDoc" src="https://img.shields.io/github/languages/top/aDarkDev/SysSpecter"> |
| 11 | + <a url="https://pkg.go.dev/github.com/valyala/fasthttp"><img alt="GoDoc" src="https://pkg.go.dev/badge/github.com/valyala/fasthttp"></a> |
| 12 | + <img alt="GitHub commits since tagged version (branch)" src="https://img.shields.io/github/commits-since/aDarkDev/SysSpecter/v1.1/main"> |
| 13 | + <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/aDarkDev/SysSpecter"> |
| 14 | + <img alt="GitHub forks" src="https://img.shields.io/github/forks/aDarkDev/SysSpecter"> |
| 15 | +</div> |
| 16 | + |
| 17 | +<!-- PROJECT LOGO --> |
| 18 | +<br /> |
| 19 | +<div align="center"> |
| 20 | + <a href="https://github.com/aDarkDev/SysSpecter"> |
| 21 | + <img src="images/logo.png" alt="Logo" width="300" height="300"> |
| 22 | + </a> |
| 23 | + |
| 24 | + <h3 align="center">SysSpecter</h3> |
| 25 | + |
| 26 | + <p align="center"> |
| 27 | + Welcome to SysSpecter - System Analyzer API for linux! |
| 28 | + <br /> |
| 29 | + <br /> |
| 30 | + · |
| 31 | + <a href="https://github.com/aDarkDev/SysSpecter/issues">Report Bug</a> |
| 32 | + · |
| 33 | + <a href="https://github.com/aDarkDev/SysSpecter/issues">Request Feature</a> |
| 34 | + </p> |
| 35 | +</div> |
| 36 | + |
| 37 | +SysSpecter is a comprehensive tool designed to monitor and report various aspects of network traffic and system status. It offers real-time insights into network connections, interface lists, system performance, memory usage, disk space, and more, making it an invaluable resource for system administrators and network engineers. |
| 38 | + |
| 39 | +## Features |
| 40 | + |
| 41 | +- **Network Traffic Analysis**: Monitor incoming and outgoing network traffic, including bytes, packets, errors, and dropped packets. |
| 42 | +- **System Health Monitoring**: Keep tabs on the overall status of your system, including memory usage and disk space. |
| 43 | +- **Real-Time Updates**: Get per-second updates on network traffic to identify potential issues promptly. |
| 44 | + |
| 45 | + |
| 46 | +To install SysSpecter, clone this repository to your local machine: |
| 47 | + |
| 48 | +```bash |
| 49 | +git clone https://github.com/aDarkDev/SysSpecter.git |
| 50 | +cd SysSpecter |
| 51 | +``` |
| 52 | + |
| 53 | +next install golang: |
| 54 | + |
| 55 | +```bash |
| 56 | +sudo apt install golang-go |
| 57 | +``` |
| 58 | + |
| 59 | +next install require libraries: |
| 60 | + |
| 61 | +```bash |
| 62 | +go mod tidy |
| 63 | +``` |
| 64 | + |
| 65 | +ًRun: |
| 66 | +```bsah |
| 67 | +sudo go run . |
| 68 | +``` |
| 69 | + |
| 70 | +<div align="center"> |
| 71 | + <img alt="ScriptPic" src="images/script-image.png"> |
| 72 | +</div> |
| 73 | + |
| 74 | +Or you can use latest compiled file from [here](https://github.com/aDarkDev/SysSpecter/releases) |
| 75 | +## Usage |
| 76 | + |
| 77 | +After installation, you can start the SysSpecter service. Here are some examples of how to use the available endpoints: |
| 78 | + |
| 79 | + |
| 80 | +### Get Network Traffic per Second |
| 81 | + |
| 82 | +```bash |
| 83 | +curl http://localhost:port/network/traffic/per_second |
| 84 | +``` |
| 85 | + |
| 86 | +Example Response: |
| 87 | +```json |
| 88 | +{"incoming": 2.51,"outgoing": 0.21} |
| 89 | +``` |
| 90 | +### List Network Interfaces |
| 91 | + |
| 92 | +```bash |
| 93 | +curl http://localhost:port/network/interface_list |
| 94 | +``` |
| 95 | + |
| 96 | +Example Response: |
| 97 | +```json |
| 98 | +["docker0","lo","nekoray-tun","wlo1"] |
| 99 | +``` |
| 100 | + |
| 101 | +### Get Network Connections |
| 102 | + |
| 103 | +```bash |
| 104 | +curl http://localhost:port/network/connections |
| 105 | +``` |
| 106 | + |
| 107 | +Example Response: |
| 108 | +```json |
| 109 | +[ |
| 110 | + { |
| 111 | + "dest_ip": "127.0.0.1", |
| 112 | + "dest_port": "8877", |
| 113 | + "source_ip": "127.0.0.1", |
| 114 | + "source_port": "53492", |
| 115 | + "protocol":"tcp" |
| 116 | + }, |
| 117 | + { |
| 118 | + "dest_ip": "142.250.185.66", |
| 119 | + "dest_port": "443", |
| 120 | + "source_ip": "172.19.0.1", |
| 121 | + "source_port": "41714", |
| 122 | + "protocol":"tcp" |
| 123 | + } |
| 124 | + ... |
| 125 | +] |
| 126 | +``` |
| 127 | + |
| 128 | +### System Status |
| 129 | + |
| 130 | +```bash |
| 131 | +curl http://localhost:port/system/status |
| 132 | +``` |
| 133 | + |
| 134 | +Example Response: |
| 135 | +```json |
| 136 | +{ |
| 137 | + "cpu_count": 8, |
| 138 | + "cpu_usage": 5.569620253177614, |
| 139 | + "mem_size": 15685.328125, |
| 140 | + "mem_usage": 25.0707020195027, |
| 141 | + "uptime_int": 39155, |
| 142 | + "uptime_str": "0 day(s) 10 hour(s) 52 min(s)" |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +### Memory info |
| 147 | + |
| 148 | +```bash |
| 149 | +curl http://localhost:port/system/memory |
| 150 | +``` |
| 151 | + |
| 152 | +Example Response: |
| 153 | +```json |
| 154 | +{ |
| 155 | + "mem_alloc": 974296, |
| 156 | + "mem_heap_alloc": 974296, |
| 157 | + "mem_size": 15685.328125, |
| 158 | + "mem_swap": 1024454656, |
| 159 | + "mem_sys": 13781776, |
| 160 | + "mem_total_alloc": 3719680 |
| 161 | +} |
| 162 | +``` |
| 163 | + |
| 164 | +### Disks info |
| 165 | + |
| 166 | +```bash |
| 167 | +curl http://localhost:port/system/disks |
| 168 | +``` |
| 169 | + |
| 170 | +Example Response: |
| 171 | +```json |
| 172 | +{ |
| 173 | + "/": 25.907221257048235, |
| 174 | + "/boot/efi": 36.42069498697917, |
| 175 | + "/dev": 0, |
| 176 | + "/dev/hugepages": 0, |
| 177 | + "/dev/mqueue": 0, |
| 178 | + "/dev/pts": 0, |
| 179 | + "/dev/shm": 0.8571405802197716, |
| 180 | + "/home/ghost": 25.907221257048235, |
| 181 | + "/proc": 0, |
| 182 | + "/proc/sys/fs/binfmt_misc": 0, |
| 183 | + "/run": 0.6352961685489796, |
| 184 | + "/run/credentials/systemd-sysusers.service": 0, |
| 185 | + "/run/lock": 0.078125, |
| 186 | + "/run/user/1000": 0.009214432291355368, |
| 187 | + "/run/user/1000/doc": 0, |
| 188 | + "/run/user/1000/gvfs": 0, |
| 189 | + "/snap/code/149": 100, |
| 190 | +} |
| 191 | +``` |
| 192 | + |
| 193 | +### Network Traffic graph |
| 194 | + |
| 195 | +- `curl http://localhost:port/network/traffic/graph` |
| 196 | +- Html live graph, open in browser: `http://localhost:port/network/traffic/live_graph` |
| 197 | + |
| 198 | +<div style="display: flex; justify-content: space-between; align-items: center;"> |
| 199 | + <img src="https://github.com/aDarkDev/SysSpecter/assets/121636230/721bb665-da5f-4c59-b573-c2d9d91da58b" width="500" height="200"> |
| 200 | + <img src="https://github.com/aDarkDev/SysSpecter/assets/121636230/106c939b-9e3c-4346-a430-40581123e485" width="500" height="200"> |
| 201 | +</div> |
| 202 | + |
| 203 | + |
| 204 | +### Incoming Network Traffic |
| 205 | + |
| 206 | +- **Bytes**: `curl http://localhost:port/network/incoming/bytes?interface=<interface>` |
| 207 | +- **Packets**: `curl http://localhost:port/network/incoming/packets?interface=<interface>` |
| 208 | +- **Errors**: `curl http://localhost:port/network/incoming/errors?interface=<interface>` |
| 209 | +- **Dropped**: `curl http://localhost:port/network/incoming/dropped?interface=<interface>` |
| 210 | + |
| 211 | +### Outgoing Network Traffic |
| 212 | + |
| 213 | +- **Bytes**: `curl http://localhost:port/network/outgoing/bytes?interface=<interface>` |
| 214 | +- **Packets**: `curl http://localhost:port/network/outgoing/packets?interface=<interface>` |
| 215 | +- **Errors**: `curl http://localhost:port/network/outgoing/errors?interface=<interface>` |
| 216 | +- **Dropped**: `curl http://localhost:port/network/outgoing/dropped?interface=<interface>` |
| 217 | + |
| 218 | +## Contributing |
| 219 | + |
| 220 | +Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. |
| 221 | + |
| 222 | +1. Fork the Project |
| 223 | +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) |
| 224 | +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) |
| 225 | +4. Push to the Branch (`git push origin feature/AmazingFeature`) |
| 226 | +5. Open a Pull Request |
| 227 | + |
| 228 | +## License |
| 229 | + |
| 230 | +Distributed under the MIT License. See `LICENSE` for more information. |
| 231 | + |
| 232 | +## Contact |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | +Project Link: [https://github.com/aDarkDev/SysSpecter](https://github.com/aDarkDev/SysSpecter) |
| 237 | + |
0 commit comments