Compare commits
766
Commits
2.8
...
3.2-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6735bb35c6 | ||
|
|
17d80419d9 | ||
|
|
60e3ac6b39 | ||
|
|
cd4f8051dd | ||
|
|
e4512dbcb9 | ||
|
|
7b2f89ef25 | ||
|
|
15bb7ae433 | ||
|
|
a50169a7b3 | ||
|
|
dd80ec869a | ||
|
|
1714d7aa52 | ||
|
|
90e08b3568 | ||
|
|
080e23e30e | ||
|
|
edce5a8c1f | ||
|
|
c8ccf33f07 | ||
|
|
ee979ac14a | ||
|
|
3eb9907dd7 | ||
|
|
fdf8dd724f | ||
|
|
37121a9b58 | ||
|
|
bbaf9147b6 | ||
|
|
9796fdc0e9 | ||
|
|
e0a058af67 | ||
|
|
80e9826040 | ||
|
|
bf7dcd63c3 | ||
|
|
b287dccecf | ||
|
|
cb34c6b233 | ||
|
|
fd94270507 | ||
|
|
03cf975c07 | ||
|
|
428661c00b | ||
|
|
5c52c00ea4 | ||
|
|
f89f25c118 | ||
|
|
d4ae8a5f16 | ||
|
|
7234f36949 | ||
|
|
2efc09a20e | ||
|
|
3fa61a394b | ||
|
|
582a01303f | ||
|
|
97fb50e837 | ||
|
|
a3da5604a3 | ||
|
|
af6c86de28 | ||
|
|
34984f1aec | ||
|
|
83bbb4cb69 | ||
|
|
ff4f32ff48 | ||
|
|
33d761a55a | ||
|
|
2bd89be3e2 | ||
|
|
5cad39f0e8 | ||
|
|
3be263aafc | ||
|
|
452ba1f339 | ||
|
|
ec15089208 | ||
|
|
af661bd652 | ||
|
|
4613515635 | ||
|
|
2009361b89 | ||
|
|
f027ab1ae7 | ||
|
|
fa26c62b0c | ||
|
|
0faba29351 | ||
|
|
2701cc9491 | ||
|
|
88fc9232ff | ||
|
|
0703ab5ac5 | ||
|
|
418ea234ae | ||
|
|
3e99b73635 | ||
|
|
6dbe81588f | ||
|
|
2b6a639192 | ||
|
|
9e87645022 | ||
|
|
626fcf1418 | ||
|
|
5b11c2ffc5 | ||
|
|
8486eb08ea | ||
|
|
ce4f4fbe2f | ||
|
|
3422574c17 | ||
|
|
b3138d5e3e | ||
|
|
0bf2ca56a8 | ||
|
|
b97360d931 | ||
|
|
579dd7dff9 | ||
|
|
ff89a14b49 | ||
|
|
b5b2260f2e | ||
|
|
39b1ad3087 | ||
|
|
c68ea3067b | ||
|
|
4e538b1e4d | ||
|
|
5c8c2d843a | ||
|
|
ea957687e1 | ||
|
|
c84ed5a712 | ||
|
|
ab2a011cf9 | ||
|
|
d86d632fe6 | ||
|
|
87d228f78e | ||
|
|
a7a4bf32d3 | ||
|
|
e20c4acbde | ||
|
|
daf15e70bf | ||
|
|
daa1171593 | ||
|
|
dc5fecfc92 | ||
|
|
79e1ec9f50 | ||
|
|
902a1c7b4c | ||
|
|
5b88867084 | ||
|
|
4749e61bdb | ||
|
|
4f230943cf | ||
|
|
6186e1ab01 | ||
|
|
9fe8bf018a | ||
|
|
e082134a0d | ||
|
|
cedbf3b636 | ||
|
|
5f6fd8d2a5 | ||
|
|
cbb755666e | ||
|
|
1d024ece7a | ||
|
|
77db14fd7a | ||
|
|
5a40f9b7fd | ||
|
|
931f51bd77 | ||
|
|
283588a37b | ||
|
|
812505b56b | ||
|
|
98d9f524f9 | ||
|
|
0023a96f80 | ||
|
|
9f7b1c84f2 | ||
|
|
e1047b324b | ||
|
|
10738a0ca3 | ||
|
|
fe312ffbe1 | ||
|
|
24f2cd6fc1 | ||
|
|
cbabbd5865 | ||
|
|
da5208ee68 | ||
|
|
bccf1c433a | ||
|
|
cc7593fe5a | ||
|
|
5571ce114d | ||
|
|
4dd887e516 | ||
|
|
a3e06da2a8 | ||
|
|
dc21079851 | ||
|
|
5987ec6014 | ||
|
|
757b0c602f | ||
|
|
498b346219 | ||
|
|
3e66bbc5bc | ||
|
|
3ba7667887 | ||
|
|
fd943d6000 | ||
|
|
691778df33 | ||
|
|
81c3f5813c | ||
|
|
fdf402d027 | ||
|
|
f0014a5a24 | ||
|
|
53a5be3399 | ||
|
|
f389969c0b | ||
|
|
dc02afa3ea | ||
|
|
d1fb41a161 | ||
|
|
ef16591f3f | ||
|
|
29dd45838d | ||
|
|
798bb6e2e1 | ||
|
|
2332cbfefe | ||
|
|
a58a135758 | ||
|
|
634457615c | ||
|
|
cb825766ea | ||
|
|
8b01056b21 | ||
|
|
f6c7a33177 | ||
|
|
daae1cc9b1 | ||
|
|
499c80535b | ||
|
|
9fb3a57a71 | ||
|
|
257ec7cc5f | ||
|
|
73c7ccdb65 | ||
|
|
cffb11fbc9 | ||
|
|
23421b47d9 | ||
|
|
1cab9fe838 | ||
|
|
27ea04c08e | ||
|
|
5c225b8a2e | ||
|
|
4961241c62 | ||
|
|
843204299c | ||
|
|
09cd95d54a | ||
|
|
1d3bef41a4 | ||
|
|
e21fe5d594 | ||
|
|
9133955219 | ||
|
|
acb74905a5 | ||
|
|
ed3fff554a | ||
|
|
7ebe6a0c82 | ||
|
|
87333aa68c | ||
|
|
e593319ba0 | ||
|
|
812a3e7099 | ||
|
|
1097f5488d | ||
|
|
b90410e335 | ||
|
|
deed27cbef | ||
|
|
ea001b439a | ||
|
|
14e5adc7c2 | ||
|
|
81012b3201 | ||
|
|
406aa12468 | ||
|
|
2c2bb11c9b | ||
|
|
1bd63d68a5 | ||
|
|
bf5e9b7b0b | ||
|
|
7fe9dddf65 | ||
|
|
6d7f3976f3 | ||
|
|
65d526d8f6 | ||
|
|
56eeb965bf | ||
|
|
c4d476cc58 | ||
|
|
23b0b8625d | ||
|
|
558983c99c | ||
|
|
c8d6f2845f | ||
|
|
1a115cac5a | ||
|
|
11401edfe7 | ||
|
|
239842b821 | ||
|
|
606ff10ecf | ||
|
|
d37b69ce9c | ||
|
|
226a9abf22 | ||
|
|
f26096ee4c | ||
|
|
2b3ef7e762 | ||
|
|
d62526f9ed | ||
|
|
e66d7216b8 | ||
|
|
fbc59c5f81 | ||
|
|
32dc9e3225 | ||
|
|
b4468239b9 | ||
|
|
95c1282ef4 | ||
|
|
a7b0457753 | ||
|
|
7da7ae622b | ||
|
|
a95cfcc989 | ||
|
|
a65c959940 | ||
|
|
d328c3bccc | ||
|
|
8368568443 | ||
|
|
c223bb1f10 | ||
|
|
c7efd0892f | ||
|
|
ae9429408b | ||
|
|
0ce56d5714 | ||
|
|
509cfcb556 | ||
|
|
3b203d57e9 | ||
|
|
68d66b780c | ||
|
|
f94d6cca7d | ||
|
|
382217887b | ||
|
|
537c11a985 | ||
|
|
bdc0719e76 | ||
|
|
fc82cdfa4a | ||
|
|
e98b994a39 | ||
|
|
a58c838c4c | ||
|
|
f91f2c57ef | ||
|
|
68b7986d9b | ||
|
|
ead0325deb | ||
|
|
0b819badd2 | ||
|
|
3754e6dd12 | ||
|
|
da029607a0 | ||
|
|
803dc6ff77 | ||
|
|
65a629304c | ||
|
|
51cfdfb0d8 | ||
|
|
53108c9ff1 | ||
|
|
82a186e096 | ||
|
|
e467fe9aa6 | ||
|
|
7a1940e1f7 | ||
|
|
6b7c56c909 | ||
|
|
470d30ac23 | ||
|
|
7e87bfd039 | ||
|
|
ab9ccf9eb9 | ||
|
|
15ec013af8 | ||
|
|
748f10c0d6 | ||
|
|
8181d63a95 | ||
|
|
d0e7e69552 | ||
|
|
0558d641f2 | ||
|
|
ac46a4dd58 | ||
|
|
fb56b042c0 | ||
|
|
6298ecc271 | ||
|
|
a26fe08aa6 | ||
|
|
5b2c0f68fe | ||
|
|
e695dd6ead | ||
|
|
953571e3d8 | ||
|
|
01455c3188 | ||
|
|
a5210af823 | ||
|
|
9e42b525ec | ||
|
|
02d69b72f5 | ||
|
|
c998e2e9ef | ||
|
|
a3a85106a1 | ||
|
|
75302a10bd | ||
|
|
2ab0433aca | ||
|
|
e272db0f7f | ||
|
|
3580765ba3 | ||
|
|
cb79d89f83 | ||
|
|
2e178d0f05 | ||
|
|
edf0b171e2 | ||
|
|
148506ede8 | ||
|
|
c0a08d9ca2 | ||
|
|
4802987178 | ||
|
|
1cd7cf9990 | ||
|
|
4830755fac | ||
|
|
124545e1ed | ||
|
|
af01e61c89 | ||
|
|
9400a3b9ef | ||
|
|
6e314ea6d7 | ||
|
|
dfd962a8bc | ||
|
|
cfcbfe1e8f | ||
|
|
0e54f87b18 | ||
|
|
9f5e5b90e5 | ||
|
|
d619ba0857 | ||
|
|
fbea243e56 | ||
|
|
d062386656 | ||
|
|
d2f04f5bdf | ||
|
|
42c8d3ac27 | ||
|
|
d53563ab46 | ||
|
|
3d5f0ee315 | ||
|
|
ecdb7cdc55 | ||
|
|
fd38b752c4 | ||
|
|
64804a2a24 | ||
|
|
b603cb4530 | ||
|
|
8f2c7c0638 | ||
|
|
044ba7697a | ||
|
|
e6bd64b3ea | ||
|
|
56db916833 | ||
|
|
12cf0c4763 | ||
|
|
0a92e0f532 | ||
|
|
e6f9177fdb | ||
|
|
c3f6a4a57a | ||
|
|
653c209253 | ||
|
|
0974075fa0 | ||
|
|
53e1ee3475 | ||
|
|
46affea055 | ||
|
|
0ffe5cf1ff | ||
|
|
d023f9bf2d | ||
|
|
b2832cee8e | ||
|
|
960aa77b6d | ||
|
|
58daa5ed7d | ||
|
|
437e8bd706 | ||
|
|
1a5c7daaf6 | ||
|
|
c1ba4764b5 | ||
|
|
7cb3cb7353 | ||
|
|
604abaf81c | ||
|
|
8b157bb13f | ||
|
|
a8c71dcd20 | ||
|
|
363a8f6282 | ||
|
|
5b314cf1c3 | ||
|
|
02783bd7c6 | ||
|
|
d5c918d258 | ||
|
|
6b044335cd | ||
|
|
cbe20d3740 | ||
|
|
21bc84e837 | ||
|
|
203359ed7f | ||
|
|
24a26a2e94 | ||
|
|
0a7521060a | ||
|
|
6b5a9aa992 | ||
|
|
2dfdaa4d70 | ||
|
|
f2504494fe | ||
|
|
256858d2e5 | ||
|
|
10873bfe35 | ||
|
|
e939f1c1d1 | ||
|
|
b2c8cb655c | ||
|
|
4bdbf02c2d | ||
|
|
f83b2a0940 | ||
|
|
76ec74cbf1 | ||
|
|
8ae5da1472 | ||
|
|
d8067cdc1d | ||
|
|
67dbcb7375 | ||
|
|
3180f279c8 | ||
|
|
1982e6cef9 | ||
|
|
d2f0a8d493 | ||
|
|
37cb113c45 | ||
|
|
04a97fa72b | ||
|
|
8897aa6acb | ||
|
|
c247a9d191 | ||
|
|
4fd7e5734a | ||
|
|
3dbf7bbabb | ||
|
|
8f20e482ce | ||
|
|
329a33ed59 | ||
|
|
77edf1f680 | ||
|
|
7f510c10fe | ||
|
|
a559ba20b1 | ||
|
|
b19bfa1e20 | ||
|
|
6a22bee2ca | ||
|
|
e45237a93f | ||
|
|
a62cf10233 | ||
|
|
1361c8fbdf | ||
|
|
f2a5bbef17 | ||
|
|
016d568c2b | ||
|
|
02609114d3 | ||
|
|
53ea3481ea | ||
|
|
59b8399923 | ||
|
|
3b06d2191c | ||
|
|
e9df2b187c | ||
|
|
bc1b266174 | ||
|
|
b0c68dc29b | ||
|
|
c839dcb74c | ||
|
|
05aa27e477 | ||
|
|
7c788f0779 | ||
|
|
5099646938 | ||
|
|
277b4a060a | ||
|
|
17f560a1cd | ||
|
|
194cdcf581 | ||
|
|
7de9fd7170 | ||
|
|
0e9918464b | ||
|
|
ce40155377 | ||
|
|
4dc60f151d | ||
|
|
937dcb38ea | ||
|
|
4170eb3a1d | ||
|
|
c3a5650071 | ||
|
|
62fa0908a3 | ||
|
|
d2c0b9872d | ||
|
|
3709e673d9 | ||
|
|
0b62c0ad45 | ||
|
|
0ed679e795 | ||
|
|
b706730e10 | ||
|
|
bd83847027 | ||
|
|
d3348ff730 | ||
|
|
e29032085d | ||
|
|
19dbcaa3a9 | ||
|
|
3f56b2476a | ||
|
|
8246467022 | ||
|
|
90c28e9d63 | ||
|
|
64513b1c0e | ||
|
|
e8d501158e | ||
|
|
d92015a092 | ||
|
|
5c2e495792 | ||
|
|
421f819b8a | ||
|
|
ab9246f51f | ||
|
|
e2e05cd499 | ||
|
|
bdcc6dc173 | ||
|
|
f9716c5139 | ||
|
|
bae36d2e25 | ||
|
|
cbda4c2af1 | ||
|
|
f678486393 | ||
|
|
518df786ed | ||
|
|
16da3f58cc | ||
|
|
cf0ca7db51 | ||
|
|
0d8a161d15 | ||
|
|
487110693c | ||
|
|
3287dfbff4 | ||
|
|
ac1f7d71dd | ||
|
|
a716d5a317 | ||
|
|
7e3fd16b0d | ||
|
|
e152e687a5 | ||
|
|
10e560a508 | ||
|
|
2fc68a441d | ||
|
|
64ed0ac6b3 | ||
|
|
ce79626679 | ||
|
|
8f4e8d8254 | ||
|
|
62c9766cc1 | ||
|
|
f0013e826e | ||
|
|
5fd79567f0 | ||
|
|
11e9fd8cef | ||
|
|
2b0945b88d | ||
|
|
23780a655d | ||
|
|
9f83bf4624 | ||
|
|
00e639d513 | ||
|
|
659f75138c | ||
|
|
d7c2ced475 | ||
|
|
2e01a1fe53 | ||
|
|
e687a73cb2 | ||
|
|
6966e0d19b | ||
|
|
7d9ed162c7 | ||
|
|
848c9db4fb | ||
|
|
16fe2574b1 | ||
|
|
c3c975a51a | ||
|
|
a265b50a66 | ||
|
|
67a1455619 | ||
|
|
844e2bab3b | ||
|
|
b1583cc29e | ||
|
|
0f9107bef3 | ||
|
|
068611e8ba | ||
|
|
1f417fe67d | ||
|
|
8186b72c11 | ||
|
|
4c0cc80771 | ||
|
|
9c8c165a2c | ||
|
|
84ce1861a2 | ||
|
|
990d06d10c | ||
|
|
3e1c811780 | ||
|
|
b96b618443 | ||
|
|
65bdd0de9a | ||
|
|
086c511a11 | ||
|
|
c5fffce96c | ||
|
|
d457b07f9f | ||
|
|
a0a8149833 | ||
|
|
241cfb319b | ||
|
|
9b80c6314d | ||
|
|
3d21c33409 | ||
|
|
b3c88a7e24 | ||
|
|
886d575157 | ||
|
|
2a8f9c3a81 | ||
|
|
2cbad47d7b | ||
|
|
eb154bac69 | ||
|
|
ab178e62f5 | ||
|
|
bc4c48fa0b | ||
|
|
5d5d056849 | ||
|
|
f1ad951bf6 | ||
|
|
d0436e7b29 | ||
|
|
2616dcb424 | ||
|
|
eb6afa17c0 | ||
|
|
77409a3833 | ||
|
|
49a02c9b96 | ||
|
|
1bf23dc2a8 | ||
|
|
fce2cd9817 | ||
|
|
2c4495e483 | ||
|
|
6781485c42 | ||
|
|
d27e7e2786 | ||
|
|
68f6310222 | ||
|
|
c328452687 | ||
|
|
536b520750 | ||
|
|
8b8fd25626 | ||
|
|
e98eb294c7 | ||
|
|
b1270fc7bb | ||
|
|
9eb1676b4b | ||
|
|
aea91781aa | ||
|
|
9a6f6d9fe4 | ||
|
|
e4e40e3c70 | ||
|
|
84aeee49bd | ||
|
|
6011790d79 | ||
|
|
2acffb4163 | ||
|
|
b837f3753d | ||
|
|
d043cd2ac7 | ||
|
|
dbf8c24ecb | ||
|
|
c50709a8d0 | ||
|
|
1231b81839 | ||
|
|
d2fe21ddff | ||
|
|
2134f83948 | ||
|
|
3d3cae1f20 | ||
|
|
1e8a43d51e | ||
|
|
e7c0ac37d8 | ||
|
|
385e848a0f | ||
|
|
9f42a4482a | ||
|
|
fdeecf5d41 | ||
|
|
51ac583d83 | ||
|
|
e226f99e4e | ||
|
|
f73dc61ff8 | ||
|
|
90547c4fd2 | ||
|
|
c6e832be18 | ||
|
|
cce8a6026f | ||
|
|
419160f351 | ||
|
|
3c4a959c1e | ||
|
|
800deb3f54 | ||
|
|
49f5beab84 | ||
|
|
a6fe581d48 | ||
|
|
ff1234cce3 | ||
|
|
32665e6417 | ||
|
|
b2f7a52f98 | ||
|
|
4ebc8d54f4 | ||
|
|
9c3e623bb4 | ||
|
|
e1b7005c2b | ||
|
|
398e9718ea | ||
|
|
a0be9ea639 | ||
|
|
fbe87ed640 | ||
|
|
23af4d8211 | ||
|
|
bfc3a00e6c | ||
|
|
40f55e2d06 | ||
|
|
3e044a759b | ||
|
|
5c38e7b126 | ||
|
|
32c61d3ea1 | ||
|
|
ea80c4dacc | ||
|
|
7f66f1053f | ||
|
|
734305e111 | ||
|
|
3369716fc3 | ||
|
|
cdf61de129 | ||
|
|
786ea3c0f9 | ||
|
|
9a899c54c9 | ||
|
|
2148568347 | ||
|
|
5c6c64ed1d | ||
|
|
b99ef159ed | ||
|
|
a9ce7ccb83 | ||
|
|
b715467da6 | ||
|
|
63173e7360 | ||
|
|
d398b0aba6 | ||
|
|
8ff68a58f2 | ||
|
|
f55391f99d | ||
|
|
a262f8dd29 | ||
|
|
c6ca6ec712 | ||
|
|
1ec160d4c9 | ||
|
|
6b8234d938 | ||
|
|
b6db991710 | ||
|
|
6ff9b8b90e | ||
|
|
e781ddfa43 | ||
|
|
a0d8ce4159 | ||
|
|
974abaa275 | ||
|
|
ccea4669de | ||
|
|
db36294dcb | ||
|
|
b13780c6e0 | ||
|
|
6d00b59bb8 | ||
|
|
72b05fed75 | ||
|
|
e2d2ca5fe0 | ||
|
|
d43cfe1ead | ||
|
|
11004de056 | ||
|
|
f3faaec9d8 | ||
|
|
8350b7269f | ||
|
|
6bce0c4a9c | ||
|
|
4bda18a079 | ||
|
|
46499a53aa | ||
|
|
57ef7c1276 | ||
|
|
b8867642fc | ||
|
|
e902478bd3 | ||
|
|
b50635cb89 | ||
|
|
cbb31fa204 | ||
|
|
20bac32e1f | ||
|
|
f394102b80 | ||
|
|
dc375aed81 | ||
|
|
c85f7de2c1 | ||
|
|
ac3a618458 | ||
|
|
6081e46ad9 | ||
|
|
c990d6bbd9 | ||
|
|
4ad12dcd19 | ||
|
|
dea4f784e2 | ||
|
|
20c3d90163 | ||
|
|
7053721aae | ||
|
|
adcb05d213 | ||
|
|
11639dcc8b | ||
|
|
44dd09b438 | ||
|
|
7280fc7d31 | ||
|
|
e93ccab279 | ||
|
|
5294945554 | ||
|
|
9ca87a620a | ||
|
|
b54863edc6 | ||
|
|
065d0c7e9f | ||
|
|
e2fcb942e8 | ||
|
|
cfdf832d3a | ||
|
|
098c4228fb | ||
|
|
79a0cfbcdb | ||
|
|
e923ca4f17 | ||
|
|
95ba3fa142 | ||
|
|
2fcc4f3e73 | ||
|
|
1657686eb4 | ||
|
|
c0835968af | ||
|
|
4b2fbdb277 | ||
|
|
2ce4adf09d | ||
|
|
1777841ec1 | ||
|
|
f570eccf81 | ||
|
|
67dfddd065 | ||
|
|
9a4d01cb26 | ||
|
|
5c758d4564 | ||
|
|
fc531334ae | ||
|
|
5a018e0bc0 | ||
|
|
f8fb1f838c | ||
|
|
7b16c68e92 | ||
|
|
af2dc0860c | ||
|
|
acd3db13f8 | ||
|
|
c8a867bf29 | ||
|
|
17c49b2e6d | ||
|
|
9bdc021f98 | ||
|
|
c65025f7b0 | ||
|
|
ea32d535eb | ||
|
|
92c769f206 | ||
|
|
343ee0c9b6 | ||
|
|
8b1c68aed3 | ||
|
|
929cbbb7fc | ||
|
|
22e323528e | ||
|
|
52533c3b66 | ||
|
|
563215a05e | ||
|
|
4ac60d88d7 | ||
|
|
3e2e616507 | ||
|
|
da7e595fcf | ||
|
|
829a284d48 | ||
|
|
c0d9dc9969 | ||
|
|
cc15389729 | ||
|
|
edd4f2e37d | ||
|
|
8205f2c6f1 | ||
|
|
dd9db5d0b7 | ||
|
|
9590b18fdd | ||
|
|
7cb7a12f96 | ||
|
|
5ce5bae99d | ||
|
|
8fdef484f6 | ||
|
|
65e842effa | ||
|
|
2c43b61798 | ||
|
|
a1ac31062d | ||
|
|
06b05e21c6 | ||
|
|
3f460ad5a9 | ||
|
|
e9e647f043 | ||
|
|
e8c84f3c5d | ||
|
|
f3161309ff | ||
|
|
ef1b8e36a0 | ||
|
|
79634a6789 | ||
|
|
d8ec0a9229 | ||
|
|
bc1b4885de | ||
|
|
4b71727661 | ||
|
|
cc39ef0946 | ||
|
|
e47c0c3e49 | ||
|
|
81d3fc8a24 | ||
|
|
cc51253007 | ||
|
|
a4d797f832 | ||
|
|
6ed8ccfa46 | ||
|
|
c4f513f6e7 | ||
|
|
4ea8eaf103 | ||
|
|
00ed2653fe | ||
|
|
179b93d625 | ||
|
|
3e43e77b1c | ||
|
|
b66606bc16 | ||
|
|
b6ac750e21 | ||
|
|
936a95e10e | ||
|
|
13e8354f37 | ||
|
|
0fe7f16ecf | ||
|
|
784f4e4bba | ||
|
|
1e616b227b | ||
|
|
4830aa9a14 | ||
|
|
5f26149938 | ||
|
|
1891f687b6 | ||
|
|
41b75485eb | ||
|
|
1a3f2b3f0d | ||
|
|
5b7a08bac3 | ||
|
|
e814cd0b9e | ||
|
|
709a87c8d4 | ||
|
|
4e8055742e | ||
|
|
3979c28cac | ||
|
|
e6813846b8 | ||
|
|
165decdf6c | ||
|
|
4441bc7033 | ||
|
|
a015cb7f48 | ||
|
|
5c7e0a0319 | ||
|
|
c43bec826d | ||
|
|
a3b564eb92 | ||
|
|
1b9955e9ef | ||
|
|
5da363cbde | ||
|
|
53119e71f4 | ||
|
|
fcc9c76249 | ||
|
|
f29f9bbb38 | ||
|
|
04b543caa9 | ||
|
|
3f9383c343 | ||
|
|
0d2f8f4498 | ||
|
|
53e64df8e2 | ||
|
|
f97be61e8b | ||
|
|
9604386698 | ||
|
|
7b2d9adbdf | ||
|
|
d592902553 | ||
|
|
08ca25c9c8 | ||
|
|
e5a95cf92e | ||
|
|
1a2b8a98a6 | ||
|
|
0d0d6893fc | ||
|
|
3b185a00fa | ||
|
|
a00ad9fc92 | ||
|
|
b96e6a9e2d | ||
|
|
ea1ea99ce1 | ||
|
|
e99a0abfba | ||
|
|
361ab030bc | ||
|
|
33d17dbf1f | ||
|
|
8a09ca2180 | ||
|
|
1bbb992ca6 | ||
|
|
4dd51a165c | ||
|
|
8365afee8d | ||
|
|
0961caec1b | ||
|
|
1bf9351a67 | ||
|
|
3cb0b3fc7b | ||
|
|
ffb1b9c14f | ||
|
|
82817c1cac | ||
|
|
173a04007f | ||
|
|
83d5627c4d | ||
|
|
6f8a01ca18 | ||
|
|
5b6526cc5a | ||
|
|
5e24b32467 | ||
|
|
2f14b8abbf | ||
|
|
74715b12b0 | ||
|
|
7415af5086 | ||
|
|
85776a532d | ||
|
|
bb2f35fe79 | ||
|
|
1290706fad | ||
|
|
4e7fa82aff | ||
|
|
796472cf84 | ||
|
|
a455e0d8d4 | ||
|
|
55c4108d8b | ||
|
|
2ef19c7e49 | ||
|
|
e27022b698 | ||
|
|
153c77c2cd | ||
|
|
6693151052 | ||
|
|
1915a63cf2 | ||
|
|
c496c7975f | ||
|
|
8dbe7818eb | ||
|
|
1df5b453cb | ||
|
|
0b5e5a5f82 | ||
|
|
f47be6ef60 | ||
|
|
f592b9fc31 | ||
|
|
6b1f158322 | ||
|
|
99748cddcc | ||
|
|
e2cd89e354 | ||
|
|
e5f6f68cd6 | ||
|
|
e2ad6bf79f | ||
|
|
ef9f395cb6 | ||
|
|
e6f8a66197 | ||
|
|
5656a41f69 | ||
|
|
96ed31874d | ||
|
|
db91837647 | ||
|
|
6c9fbc2ddb | ||
|
|
7237f7081f | ||
|
|
54f90c7556 | ||
|
|
43890b31fc | ||
|
|
b1282da542 | ||
|
|
22e431ca67 | ||
|
|
b1bd7d6f8c | ||
|
|
6c1d236a03 | ||
|
|
89d548f9d3 | ||
|
|
fde4380422 | ||
|
|
aaa686b9fe | ||
|
|
03b0aa7185 | ||
|
|
518dbbc96b | ||
|
|
59f683858b | ||
|
|
c339211ac7 | ||
|
|
93582a4204 | ||
|
|
a99754d88b | ||
|
|
476fbbfe4e | ||
|
|
e91123e17a |
@@ -0,0 +1,17 @@
|
||||
version: 3.1.{build}
|
||||
branches:
|
||||
only:
|
||||
- dev
|
||||
environment:
|
||||
matrix:
|
||||
- COMPILER: mingw
|
||||
MINGW_DIR: c:\msys64\mingw32
|
||||
|
||||
before_build:
|
||||
- set Path=%MINGW_DIR%\bin;%Path%
|
||||
|
||||
build_script:
|
||||
- set Path=%MINGW_DIR%\bin;c:\msys64\usr\bin;
|
||||
- bash autogen.sh
|
||||
- cd src/lib
|
||||
- make
|
||||
@@ -0,0 +1,3 @@
|
||||
*.sh -crlf
|
||||
*.ac -crlf
|
||||
*.am -crlf
|
||||
+162
-21
@@ -1,36 +1,177 @@
|
||||
language: c
|
||||
|
||||
os:
|
||||
- osx
|
||||
- linux
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
# osx use always clang for build...
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
include:
|
||||
- os: osx
|
||||
compiler: clang
|
||||
|
||||
install:
|
||||
#macos
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
|
||||
#linux
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update || true; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install build-essential; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install libpcap-dev libtool autoconf automake autogen; fi
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
dist: bionic
|
||||
arch: arm64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
dist: bionic
|
||||
arch: arm64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
|
||||
# Targets below have been disabled as we have no way
|
||||
# to debug on tsuch platforms at the moment
|
||||
# - os: linux
|
||||
# compiler: gcc
|
||||
# dist: bionic
|
||||
# arch: s390x
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - libpcap-dev
|
||||
# - autogen
|
||||
#
|
||||
# - os: linux
|
||||
# compiler: clang
|
||||
# dist: bionic
|
||||
# arch: s390x
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - libpcap-dev
|
||||
# - autogen
|
||||
|
||||
- os: linux
|
||||
compiler: gcc-8
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-8
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||
|
||||
- os: linux
|
||||
compiler: gcc-9
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-9
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-9 && CXX=g++-9"
|
||||
|
||||
- os: linux
|
||||
compiler: clang-8
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-8
|
||||
packages:
|
||||
- clang-8
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-8 && CXX=clang++-8"
|
||||
|
||||
- os: linux
|
||||
compiler: clang-7
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||
|
||||
- name: fuzza
|
||||
env: CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" LDFLAGS="-g -fsanitize=address" QA_FUZZ=asan CC=clang-7 && CXX=clang++-7 ASAN_SYMBOLIZER_PATH=/usr/local/clang-7.0.0/bin/llvm-symbolizer
|
||||
os: linux
|
||||
compiler: clang-7
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
- name: fuzzm
|
||||
env: CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" LDFLAGS="-g -fsanitize=memory" QA_FUZZ=msan CC=clang-7 && CXX=clang++-7 MSAN_SYMBOLIZER_PATH=/usr/local/clang-7.0.0/bin/llvm-symbolizer
|
||||
os: linux
|
||||
compiler: clang-7
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
- name: fuzzu
|
||||
env: CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=fuzzer-no-link" CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fno-sanitize-recover=undefined,integer -fsanitize=fuzzer-no-link" LDFLAGS="-g -fsanitize=undefined" QA_FUZZ=ubsan CC=clang-7 && CXX=clang++-7
|
||||
os: linux
|
||||
compiler: clang-7
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- autogen
|
||||
|
||||
|
||||
before_install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
|
||||
before_script:
|
||||
- ./autogen.sh
|
||||
# - lcov --directory . --zerocounters
|
||||
|
||||
script:
|
||||
- ./configure
|
||||
- if [ -n "$QA_FUZZ" ]; then ./configure --enable-fuzztargets ; else ./configure ; fi
|
||||
- make
|
||||
|
||||
after_script:
|
||||
#after_script:
|
||||
- cd tests
|
||||
- ./do.sh
|
||||
|
||||
|
||||
+159
-4
@@ -1,5 +1,160 @@
|
||||
# CHANGELOG
|
||||
|
||||
#### nDPI 3.2 (February 2020)
|
||||
|
||||
## New Features
|
||||
* New API calls
|
||||
* Protocol detection: ndpi_is_protocol_detected
|
||||
* Categories: ndpi_load_categories_file / ndpi_load_category
|
||||
* JSON/TLV serialization: ndpi_serialize_string_boolean / ndpi_serialize_uint32_boolean
|
||||
* Patricia tree: ndpi_load_ipv4_ptree
|
||||
* Module initialization: ndpi_init_detection_module / ndpi_finalize_initalization
|
||||
* Base64 encoding: ndpi_base64_encode
|
||||
* JSON exprot: ndpi_flow2json
|
||||
* Print protocol: ndpi_get_l4_proto_name / ndpi_get_l4_proto_info
|
||||
* Libfuzz integration
|
||||
* Implemented Community ID hash (API call ndpi_flowv6_flow_hash and ndpi_flowv4_flow_hash)
|
||||
* Detection of RCE in HTTP GET requests via PCRE
|
||||
* Integration of the libinjection library to detect SQL injections and XSS type attacks in HTTP requests
|
||||
|
||||
## New Supported Protocols and Services
|
||||
* TLS
|
||||
* Added ALPN support
|
||||
* Added export of supported version in TLS header
|
||||
* Added Telnet dissector with metadata extraction
|
||||
* Added Zabbix dissector
|
||||
* Added POP3/IMAP metadata extraction
|
||||
* Added FTP user/password extraction
|
||||
* Added NetBIOS metadata extraction
|
||||
* Added Kerberos metadata extraction
|
||||
* Implemented SQL Injection and XSS attack detection
|
||||
* Host-based detection improvements and changes
|
||||
* Added Microsoft range
|
||||
* Added twitch.tv website
|
||||
* Added brasilbandalarga.com.br and .eaqbr.com.br as EAQ
|
||||
* Added 20.180.0.0/14, 20.184.0.0/13 range as Skype
|
||||
* Added 52.84.0.0/14 range as Amazon
|
||||
* Added ^pastebin.com
|
||||
* Changed 13.64.0.0/11 range from Skype to Microsoft
|
||||
* Refreshed Whatsapp server list, added *whatsapp-*.fbcdn.net IPs
|
||||
* Added public DNSoverHTTPS servers
|
||||
|
||||
## Improvements
|
||||
* Reworked and improved the TLS dissector
|
||||
* Reworked Kerberos dissector
|
||||
* Improved DNS response decoding
|
||||
* Support for DNS continuous flow dissection
|
||||
* Improved Python bindings
|
||||
* Improved Ethereum support
|
||||
* Improved categories detection with streaming and HTTP
|
||||
* Support for IP-based detection to compute the application protocol
|
||||
* Renamed protocol 104 to IEC60870 (more meaningful)
|
||||
* Added failed authentication support with FTP
|
||||
* Renamed DNSoverHTTPS to handle bot DoH and DoT
|
||||
* Implemented stacked DPI decoding
|
||||
* Improvements for CapWAP and Bloomberg
|
||||
* Improved SMB dissection
|
||||
* Improved SSH dissection
|
||||
* Added capwap support
|
||||
* Modified API signatures for ndpi_ssl_version2str / ndpi_detection_giveup
|
||||
* Removed ndpi_pref_http_dont_dissect_response / ndpi_pref_dns_dont_dissect_response (replaced by ndpi_extra_dissection_possible)
|
||||
|
||||
## Fixes
|
||||
* Fixed memory invalid access in SMTP and leaks in TLS
|
||||
* Fixed a few memory leaks
|
||||
* Fixrd invalid memory access in a few protocol dissectors (HTTP, memcached, Citrix, STUN, DNS, Amazon Video, TLS, Viber)
|
||||
* Fixed IPv6 address format across the various platforms/distributions
|
||||
* Fixed infinite loop in ndpi_workflow_process_packet
|
||||
* Fixed SHA1 certificate detection
|
||||
* Fixed custom protocol detection
|
||||
* Fixed SMTP dissection (including email)
|
||||
* Fixed Telnet dissection and invalid password report
|
||||
* Fixed invalid category matching in HTTP
|
||||
* Fixed Skype and STUN false positives
|
||||
* Fixed SQL Injection detection
|
||||
* Fixed invalid SMBv1 detection
|
||||
* Fixed SSH dissection
|
||||
* Fixed ndpi_ssl_version2str
|
||||
* Fixed ndpi_extra_dissection_possible
|
||||
* Fixed out of bounds read in ndpi_match_custom_category
|
||||
|
||||
## Misc
|
||||
* ndpiReader
|
||||
* CSV output enhancements
|
||||
* Added tunnelling decapsulation
|
||||
* Improved HTTP reporting
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
#### nDPI 3.0 (October 2019)
|
||||
|
||||
## New Features
|
||||
* nDPI now reports the protocol ASAP even when specific fields have not yet been dissected because such packets have not yet been observed. This is important for inline applications that can immediately act on traffic. Applications that need full dissection need to call the new API function ndpi_extra_dissection_possible() to check if metadata dissection has been completely performed or if there is more to read before declaring it completed.
|
||||
* TLS (formerly identified as SSL in nDPI v2.x) is now dissected more deeply, certificate validity is extracted as well certificate SHA-1.
|
||||
* nDPIreader can now export data in CSV format with option `-C`
|
||||
* Implemented Sequence of Packet Length and Time (SPLT) and Byte Distribution (BD) as specified by Cisco Joy (https://github.com/cisco/joy). This allows malware activities on encrypted TLS streams. Read more at https://blogs.cisco.com/security/detecting-encrypted-malware-traffic-without-decryption
|
||||
* Available as library and in `ndpiReader` with option `-J`
|
||||
* Promoted usage of protocol categories rather than protocol identifiers in order to classify protocols. This allows application protocols to be clustered in families and thus better managed by users/developers rather than using hundred of protocols unknown to most of the people.
|
||||
* Added Inter-Arrival Time (IAT) calculation used to detect protocol misbehaviour (e.g. slow-DoS detection)
|
||||
* Added data analysis features for computign metrics such as entropy, average, stddev, variance on a single and consistent place that will prevent when possible. This should ease traffic analysis on monitoring/security applications. New API calls have been implemented such as ndpi_data_XXX() to handle these calculations.
|
||||
* Initial release of Python bindings available under nDPI/python.
|
||||
* Implemented search of human readable strings for promoting data exfiltration detection
|
||||
* Available as library and in `ndpiReader` with option `-e`
|
||||
* Fingerprints
|
||||
* JA3 (https://github.com/salesforce/ja3)
|
||||
* HASSH (https://github.com/salesforce/hassh)
|
||||
* DHCP
|
||||
* Implemented a library to serialize/deserialize data in both Type-Length-Value (TLV) and JSON format
|
||||
* Used by nProbe/ntopng to exchange data via ZMQ
|
||||
|
||||
## New Supported Protocols and Services
|
||||
|
||||
* DTLS (i.e. TLS over UDP)
|
||||
* Hulu
|
||||
* TikTok/Musical.ly
|
||||
* WhatsApp Video
|
||||
* DNSoverHTTPS
|
||||
* Datasaver
|
||||
* Line protocol
|
||||
* Google Duo and Hangout merged
|
||||
* WireGuard VPN
|
||||
* IMO
|
||||
* Zoom.us
|
||||
|
||||
## Improvements
|
||||
|
||||
* TLS
|
||||
* Organizations
|
||||
* Ciphers
|
||||
* Certificate analysis
|
||||
* Added PUBLISH/SUBSCRIBE methods to SIP
|
||||
* Implemented STUN cache to enhance matching of STUN-based protocols
|
||||
* Dissection improvements
|
||||
* Viber
|
||||
* WhatsApp
|
||||
* AmazonVideo
|
||||
* SnapChat
|
||||
* FTP
|
||||
* QUIC
|
||||
* OpenVPN support for UDP-based VPNs
|
||||
* Facebook Messenger mobile
|
||||
* Various improvements for STUN, Hangout and Duo
|
||||
* Added new categories: CUSTOM_CATEGORY_ANTIMALWARE, NDPI_PROTOCOL_CATEGORY_MUSIC, NDPI_PROTOCOL_CATEGORY_VIDEO, NDPI_PROTOCOL_CATEGORY_SHOPPING, NDPI_PROTOCOL_CATEGORY_PRODUCTIVITY and NDPI_PROTOCOL_CATEGORY_FILE_SHARING
|
||||
* Added NDPI_PROTOCOL_DANGEROUS classification
|
||||
|
||||
## Fixes
|
||||
|
||||
* Fixed the dissection of certain invalid DNS responses
|
||||
* Fixed Spotify dissection
|
||||
* Fixed false positives with FTP and FTP_DATA
|
||||
* Fix to discard STUN over TCP flows
|
||||
* Fixed MySQL dissector
|
||||
* Fix category detection due to missing initialization
|
||||
* Fix DNS rsp_addr missing in some tiny responses
|
||||
* Various hardening fixes
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
#### nDPI 2.8 (March 2019)
|
||||
|
||||
## New Supported Protocols and Services
|
||||
@@ -75,10 +230,10 @@
|
||||
* Deb and RPM packages: ndpi with shared libraries and binaries, ndpi-dev with headers and static libraries
|
||||
* Protocols now have an optional subprotocol: Spotify cannot have subprotocols, DNS can (DNS.Spotify)
|
||||
* New API functions:
|
||||
- ndpi_fill_ip_protocol_category to handle ICMP flows category
|
||||
- ndpi_flowv4_flow_hash and ndpi_flowv6_flow_hash to support the Community ID Flow Hashing (https://github.com/corelight/community-id-spec)
|
||||
- ndpi_protocol2id to print the protocol as ID
|
||||
- ndpi_get_custom_category_match to search host in custom categories
|
||||
* ndpi_fill_ip_protocol_category to handle ICMP flows category
|
||||
* ndpi_flowv4_flow_hash and ndpi_flowv6_flow_hash to support the Community ID Flow Hashing (https://github.com/corelight/community-id-spec)
|
||||
* ndpi_protocol2id to print the protocol as ID
|
||||
* ndpi_get_custom_category_match to search host in custom categories
|
||||
* Changed ndpi_detection_giveup API: guess is now part of the call
|
||||
* Added DPDK support to ndpiReader
|
||||
* Removed Musical.ly protocol (service no longer used)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# How to contribute
|
||||
|
||||
Please keep all code, comments, issues and pull requests in English, otherwise they will be **removed**.
|
||||
|
||||
## Found a bug?
|
||||
|
||||
- First, check there are no already open issues for the bug. See [here](https://github.com/ntop/nDPI/issues).
|
||||
- If there is not open issue addressing the bug, [open a new one](https://github.com/ntop/nDPI/issues/new).
|
||||
- Make sure to include a **descriptive and clear title and description**, including the **version of nDPI** being used.
|
||||
- Try to include steps to reproduce the bug.
|
||||
- If applicable, try to provide a stacktrace.
|
||||
- Providing a simple test case which shows the bug would help resolve the issue faster.
|
||||
|
||||
## Written a new protocol dissector?
|
||||
|
||||
- Ensure you have followed the guide in the [README](https://github.com/ntop/nDPI#how-to-add-a-new-protocol-dissector).
|
||||
- Open a new pull request with a **clear, descriptive** title.
|
||||
- Ensure the pull request passes CI testing. Any pull request which fails CI will be **ignored**.
|
||||
- If possible, add a new test for the new protocol. See [existing tests](https://github.com/ntop/nDPI/tree/dev/tests) for examples.
|
||||
|
||||
## Written a fix for a bug?
|
||||
|
||||
- Open a new pull request with a **clear, descriptive** title.
|
||||
- If there is an open issue for the bug, ensure the description of the pull request contains `Fixes #issue_number`.
|
||||
- Ensure the pull request passes CI testing. Any pull request which fails CI will be **ignored**.
|
||||
|
||||
Finally, thank you for your contributions.
|
||||
+5
-1
@@ -1,7 +1,11 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = src/lib example tests
|
||||
|
||||
pkgconfigdir = $(prefix)/libdata/pkgconfig
|
||||
if BUILD_FUZZTARGETS
|
||||
SUBDIRS += fuzz
|
||||
endif
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libndpi.pc
|
||||
|
||||
EXTRA_DIST = autogen.sh
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[](https://travis-ci.org/ntop/nDPI)
|
||||
[](https://lgtm.com/projects/g/ntop/nDPI/context:cpp)
|
||||
[](https://lgtm.com/projects/g/ntop/nDPI/alerts)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:ndpi)
|
||||
|
||||
## What is nDPI ?
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
NDPI_MAJOR="2"
|
||||
NDPI_MINOR="7"
|
||||
NDPI_MAJOR="3"
|
||||
NDPI_MINOR="2"
|
||||
NDPI_PATCH="0"
|
||||
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
|
||||
|
||||
@@ -45,4 +45,4 @@ cat configure | sed "s/#define PACKAGE/#define NDPI_PACKAGE/g" | sed "s/#define
|
||||
cat configure.tmp > configure
|
||||
|
||||
chmod +x configure
|
||||
./configure $*
|
||||
./configure "$*"
|
||||
|
||||
+96
-65
@@ -4,10 +4,22 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
AC_ARG_WITH(llvm_sanitizer, [ --with-llvm-sanitizer Build with support for the LLVM address sanitizer])
|
||||
|
||||
AS_IF([test "${with_llvm_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -g -O2 -Wno-unused-value -fsanitize=address -fno-omit-frame-pointer"
|
||||
LDFLAGS="${LDFLAGS} -fsanitize=address"
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
])
|
||||
|
||||
LT_INIT
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC_STDC
|
||||
AC_LANG_WERROR
|
||||
AX_PTHREAD
|
||||
|
||||
NDPI_VERSION_SHORT="@NDPI_VERSION_SHORT@"
|
||||
@@ -30,7 +42,7 @@ if test -d ".git"; then :
|
||||
GIT_RELEASE="${PACKAGE_VERSION}-${GIT_NUM}-${GIT_TAG}"
|
||||
else
|
||||
GIT_RELEASE="${PACKAGE_VERSION}"
|
||||
GIT_DATE=`date`
|
||||
GIT_DATE=`date -u -r CHANGELOG.md`
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "${GIT_RELEASE}", [GIT Release])
|
||||
@@ -38,6 +50,7 @@ AC_DEFINE_UNQUOTED(NDPI_GIT_DATE, "${GIT_DATE}", [Last GIT change])
|
||||
|
||||
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h])
|
||||
|
||||
ADDITIONAL_LIBS=
|
||||
PCAP_HOME=$HOME/PF_RING/userland
|
||||
|
||||
DPDK_TARGET=
|
||||
@@ -65,89 +78,108 @@ SYSTEM=`uname -s`
|
||||
if test $SYSTEM = "Darwin"; then
|
||||
CC=clang
|
||||
fi
|
||||
|
||||
if test $ax_cv_PTHREAD_CLANG = "yes"; then
|
||||
CC=clang
|
||||
|
||||
CUSTOM_NDPI=
|
||||
|
||||
if test -d ../nDPI-custom; then :
|
||||
CUSTOM_NDPI="-DCUSTOM_NDPI_PROTOCOLS"
|
||||
AC_MSG_RESULT([Compiling with custom nDPI protocols])
|
||||
fi
|
||||
|
||||
HS_LIB=
|
||||
HS_INC=
|
||||
|
||||
AC_ARG_WITH(hyperscan, [ --with-hyperscan Enable nDPI build with Intel Hyperscan])
|
||||
|
||||
if test "${with_hyperscan+set}" = set; then
|
||||
AS_IF([test "${with_hyperscan+set}" = set],[
|
||||
BKP=$LIBS
|
||||
LIBS="$LIBS -lstdc++ -lm"
|
||||
AC_CHECK_LIB([hs], [hs_compile_multi], AC_DEFINE_UNQUOTED(HAVE_HYPERSCAN, 1, [Intel Hyperscan is present]))
|
||||
LIBS=$BKP
|
||||
|
||||
if test "x$ac_cv_lib_hs_hs_compile_multi" = xyes; then :
|
||||
AS_IF([test "x$ac_cv_lib_hs_hs_compile_multi" = xyes],[
|
||||
AC_CHECK_LIB([m], [pow])
|
||||
AC_CHECK_LIB([stdc++], [main])
|
||||
HS_INC=`pkg-config --cflags libhs`
|
||||
HS_LIB=`pkg-config --libs libhs`
|
||||
LDFLAGS="$LDFLAGS $HS_LIB"
|
||||
PKG_CHECK_MODULES([HS],[libhs])
|
||||
LDFLAGS="$LDFLAGS $HS_LIBS"
|
||||
AC_MSG_RESULT([compiling with Intel Hyperscan])
|
||||
else
|
||||
],[
|
||||
AC_MSG_RESULT([Intel Hyperscan not found, exiting. See https://github.com/intel/hyperscan/blob/master/doc/dev-reference/getting_started.rst for install/build instructions])
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
if test -f $PCAP_HOME/libpcap/libpcap.a; then :
|
||||
echo "Using libpcap from $PCAP_HOME"
|
||||
PCAP_INC="-I $PCAP_HOME/libpcap"
|
||||
PCAP_LIB="$PCAP_HOME/libpcap/libpcap.a $PCAP_HOME/lib/libpfring.a $LIBNUMA `$PCAP_HOME/lib/pfring_config --libs`"
|
||||
|
||||
AC_CHECK_LIB([rt], [clock_gettime], [PCAP_LIB="$PCAP_LIB -lrt"])
|
||||
AC_CHECK_LIB([nl], [nl_handle_alloc], [PCAP_LIB="$PCAP_LIB -lnl"])
|
||||
# The dlopen() function is in libdl on GLIBC-based systems
|
||||
# and in the C library for *BSD systems
|
||||
AC_CHECK_LIB([dl], [dlopen, dlsym], [DL_LIB="-ldl"],
|
||||
[AC_CHECK_LIB([c], [dlopen, dlsym], [DL_LIB="-lc"],
|
||||
[AC_MSG_ERROR([unable to find the dlopen(), dlsym() functions]) ]) ])
|
||||
else
|
||||
AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"])
|
||||
|
||||
if test $ac_cv_lib_pcap_pcap_open_live = "no"; then :
|
||||
echo ""
|
||||
echo "ERROR: Missing libpcap(-dev) library required to compile the example application"
|
||||
echo "ERROR: Please install it and try again"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl> https://github.com/json-c/json-c
|
||||
AC_ARG_ENABLE([json-c],
|
||||
AS_HELP_STRING([--disable-json-c], [Disable json-c support]))
|
||||
|
||||
AS_IF([test "x$enable_json_c" != "xno"], [
|
||||
PKG_CONFIG_PATH=/usr/local/share/pkgconfig:$PKG_CONFIG_PATH
|
||||
pkg-config --exists json-c
|
||||
AS_IF([test "$?" == "0"],
|
||||
[
|
||||
CFLAGS="$CFLAGS $(pkg-config --cflags json-c)"
|
||||
LDFLAGS="$LDFLAGS $(pkg-config --libs json-c)"
|
||||
AC_CHECK_LIB(json-c, json_object_new_object, AC_DEFINE_UNQUOTED(HAVE_JSON_C, 1, [The JSON-C library is present]))
|
||||
],
|
||||
[
|
||||
JSONC_HOME="$HOME/json-c"
|
||||
if test -d "$JSONC_HOME"; then :
|
||||
CFLAGS="$CFLAGS -I $JSONC_HOME"
|
||||
LDFLAGS="$LDFLAGS $JSONC_HOME/.libs/libjson-c.a"
|
||||
AC_MSG_RESULT([Found json-c in $JSONC_HOME])
|
||||
AC_DEFINE_UNQUOTED(HAVE_JSON_C, 1, [The JSON-C library is present])
|
||||
fi
|
||||
])
|
||||
])
|
||||
case "$host" in
|
||||
*-*-mingw32*|*-*-msys)
|
||||
CFLAGS="${CFLAGS} -DOS_WIN32"
|
||||
LDFLAGS="${LDFLAGS} -lws2_32 -lucrtbase"
|
||||
;;
|
||||
*)
|
||||
if test -f $PCAP_HOME/libpcap/libpcap.a; then :
|
||||
echo "Using libpcap from $PCAP_HOME"
|
||||
PCAP_INC="-I $PCAP_HOME/libpcap"
|
||||
PCAP_LIB="$PCAP_HOME/libpcap/libpcap.a $PCAP_HOME/lib/libpfring.a $LIBNUMA `$PCAP_HOME/lib/pfring_config --libs`"
|
||||
AC_CHECK_LIB([rt], [clock_gettime], [PCAP_LIB="$PCAP_LIB -lrt"])
|
||||
AC_CHECK_LIB([nl], [nl_handle_alloc], [PCAP_LIB="$PCAP_LIB -lnl"])
|
||||
# The dlopen() function is in libdl on GLIBC-based systems
|
||||
# and in the C library for *BSD systems
|
||||
AC_CHECK_LIB([dl], [dlopen, dlsym], [DL_LIB="-ldl"],[AC_CHECK_LIB([c], [dlopen, dlsym], [DL_LIB="-lc"],[AC_MSG_ERROR([unable to find the dlopen(), dlsym() functions]) ]) ])
|
||||
else
|
||||
AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"])
|
||||
if test $ac_cv_lib_pcap_pcap_open_live = "no"; then :
|
||||
echo ""
|
||||
echo "ERROR: Missing libpcap(-dev) library required to compile the example application"
|
||||
echo "ERROR: Please install it and try again"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE([debug-messages],
|
||||
AS_HELP_STRING([--enable-debug-messages], [Define NDPI_ENABLE_DEBUG_MESSAGES=1]), [
|
||||
AC_DEFINE(NDPI_ENABLE_DEBUG_MESSAGES, 1, [Enable ndpi_debug_messages]) ])
|
||||
|
||||
AC_ARG_ENABLE(fuzztargets,
|
||||
AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
|
||||
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
|
||||
AS_IF([test "x$enable_fuzztargets" = "xyes"], [
|
||||
AC_PROG_CXX
|
||||
AC_LANG_PUSH(C++)
|
||||
tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
|
||||
LIB_FUZZING_ENGINE=-fsanitize=fuzzer
|
||||
AC_SUBST(LIB_FUZZING_ENGINE)
|
||||
])
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
|
||||
AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/types.h>
|
||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
|
||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
|
||||
(void)Data;
|
||||
(void)Size;
|
||||
return 0;
|
||||
}
|
||||
]])],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
has_sanitizefuzzer=yes],
|
||||
[ AC_MSG_RESULT(no) ]
|
||||
)
|
||||
_AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
|
||||
AC_LANG_POP()
|
||||
])
|
||||
AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
|
||||
|
||||
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile])
|
||||
dnl> PCRE
|
||||
AC_ARG_WITH(pcre, [ --with-pcre Enable nDPI build with libpcre])
|
||||
if test "${with_pcre+set}" = set; then :
|
||||
AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE_UNQUOTED(HAVE_PCRE, 1, [libpcre(-dev) is present]))
|
||||
if test "x$ac_cv_lib_pcre_pcre_compile" = xyes; then :
|
||||
ADDITIONAL_LIBS=-lpcre
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile python/Makefile fuzz/Makefile])
|
||||
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
|
||||
AC_SUBST(GIT_RELEASE)
|
||||
AC_SUBST(NDPI_MAJOR)
|
||||
@@ -158,10 +190,9 @@ AC_SUBST(SVN_DATE)
|
||||
AC_SUBST(JSON_C_LIB)
|
||||
AC_SUBST(PCAP_INC)
|
||||
AC_SUBST(PCAP_LIB)
|
||||
AC_SUBST(ADDITIONAL_LIBS)
|
||||
AC_SUBST(DL_LIB)
|
||||
AC_SUBST(HS_LIB)
|
||||
AC_SUBST(HS_INC)
|
||||
AC_SUBST(DPDK_TARGET)
|
||||
AC_SUBST(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||
|
||||
AC_SUBST(CUSTOM_NDPI)
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -8,17 +8,26 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
E32F1ECB20844620005739B7 /* whatsapp.c in Sources */ = {isa = PBXBuildFile; fileRef = E32F1ECA20844620005739B7 /* whatsapp.c */; };
|
||||
E35D5510228BA70600A80DED /* ajp.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D5506228BA70400A80DED /* ajp.c */; };
|
||||
E35D5511228BA70600A80DED /* snmp_proto.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D5507228BA70400A80DED /* snmp_proto.c */; };
|
||||
E35D5512228BA70600A80DED /* modbus.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D5508228BA70400A80DED /* modbus.c */; };
|
||||
E35D5513228BA70600A80DED /* ookla.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D5509228BA70400A80DED /* ookla.c */; };
|
||||
E35D5514228BA70600A80DED /* upnp.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D550A228BA70400A80DED /* upnp.c */; };
|
||||
E35D5515228BA70600A80DED /* memcached.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D550B228BA70500A80DED /* memcached.c */; };
|
||||
E35D5516228BA70600A80DED /* mdns_proto.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D550C228BA70500A80DED /* mdns_proto.c */; };
|
||||
E35D5517228BA70600A80DED /* fbzero.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D550D228BA70500A80DED /* fbzero.c */; };
|
||||
E35D5518228BA70600A80DED /* nest_log_sink.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D550E228BA70500A80DED /* nest_log_sink.c */; };
|
||||
E35D5519228BA70600A80DED /* mining.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D550F228BA70600A80DED /* mining.c */; };
|
||||
E35D551D228BA80000A80DED /* sha1-fast.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D551B228BA80000A80DED /* sha1-fast.c */; };
|
||||
E35D551E228BA80000A80DED /* ht_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = E35D551C228BA80000A80DED /* ht_hash.c */; };
|
||||
E35D551F228BA88700A80DED /* ndpi_patricia.c in Sources */ = {isa = PBXBuildFile; fileRef = E395430820255354000BBA0D /* ndpi_patricia.c */; };
|
||||
E3953F5420254989000BBA0D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5320254989000BBA0D /* AppDelegate.m */; };
|
||||
E3953F5720254989000BBA0D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5620254989000BBA0D /* ViewController.m */; };
|
||||
E3953F5920254989000BBA0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3953F5820254989000BBA0D /* Assets.xcassets */; };
|
||||
E3953F5C2025498A000BBA0D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E3953F5A2025498A000BBA0D /* Main.storyboard */; };
|
||||
E3953F5F2025498A000BBA0D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5E2025498A000BBA0D /* main.m */; };
|
||||
E395430B20255354000BBA0D /* Makefile.am in Resources */ = {isa = PBXBuildFile; fileRef = E39540A520255353000BBA0D /* Makefile.am */; };
|
||||
E395430C20255354000BBA0D /* ndpi_define.h.in in Resources */ = {isa = PBXBuildFile; fileRef = E39540A720255353000BBA0D /* ndpi_define.h.in */; };
|
||||
E395431720255354000BBA0D /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = E39540BC20255353000BBA0D /* Makefile */; };
|
||||
E395431820255354000BBA0D /* Makefile.am in Resources */ = {isa = PBXBuildFile; fileRef = E39540BD20255353000BBA0D /* Makefile.am */; };
|
||||
E395431920255354000BBA0D /* Makefile.in in Resources */ = {isa = PBXBuildFile; fileRef = E39540BE20255353000BBA0D /* Makefile.in */; };
|
||||
E395431A20255354000BBA0D /* Makefile.simple in Resources */ = {isa = PBXBuildFile; fileRef = E39540BF20255353000BBA0D /* Makefile.simple */; };
|
||||
E395431B20255354000BBA0D /* ndpi_content_match.c.inc in Sources */ = {isa = PBXBuildFile; fileRef = E39540C020255353000BBA0D /* ndpi_content_match.c.inc */; };
|
||||
E395431C20255354000BBA0D /* ndpi_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E39540C120255353000BBA0D /* ndpi_main.c */; };
|
||||
E39543A320255354000BBA0D /* afp.c in Sources */ = {isa = PBXBuildFile; fileRef = E395414B20255353000BBA0D /* afp.c */; };
|
||||
@@ -60,7 +69,6 @@
|
||||
E39543C720255354000BBA0D /* edonkey.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417120255353000BBA0D /* edonkey.c */; };
|
||||
E39543C820255354000BBA0D /* fasttrack.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417220255353000BBA0D /* fasttrack.c */; };
|
||||
E39543C920255354000BBA0D /* fiesta.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417320255353000BBA0D /* fiesta.c */; };
|
||||
E39543CA20255354000BBA0D /* filetopia.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417420255353000BBA0D /* filetopia.c */; };
|
||||
E39543CB20255354000BBA0D /* fix.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417520255353000BBA0D /* fix.c */; };
|
||||
E39543CC20255354000BBA0D /* florensia.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417620255353000BBA0D /* florensia.c */; };
|
||||
E39543CD20255354000BBA0D /* ftp_control.c in Sources */ = {isa = PBXBuildFile; fileRef = E395417720255353000BBA0D /* ftp_control.c */; };
|
||||
@@ -90,10 +98,8 @@
|
||||
E39544ED20255354000BBA0D /* mail_pop.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429720255354000BBA0D /* mail_pop.c */; };
|
||||
E39544EE20255354000BBA0D /* mail_smtp.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429820255354000BBA0D /* mail_smtp.c */; };
|
||||
E39544EF20255354000BBA0D /* maplestory.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429920255354000BBA0D /* maplestory.c */; };
|
||||
E39544F020255354000BBA0D /* mdns.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429A20255354000BBA0D /* mdns.c */; };
|
||||
E39544F120255354000BBA0D /* megaco.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429B20255354000BBA0D /* megaco.c */; };
|
||||
E39544F220255354000BBA0D /* mgcp.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429C20255354000BBA0D /* mgcp.c */; };
|
||||
E39544F320255354000BBA0D /* mms.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429D20255354000BBA0D /* mms.c */; };
|
||||
E39544F420255354000BBA0D /* mpegts.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429E20255354000BBA0D /* mpegts.c */; };
|
||||
E39544F520255354000BBA0D /* mqtt.c in Sources */ = {isa = PBXBuildFile; fileRef = E395429F20255354000BBA0D /* mqtt.c */; };
|
||||
E39544F620255354000BBA0D /* msn.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542A020255354000BBA0D /* msn.c */; };
|
||||
@@ -134,9 +140,7 @@
|
||||
E395451920255354000BBA0D /* skype.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C320255354000BBA0D /* skype.c */; };
|
||||
E395451A20255354000BBA0D /* smb.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C420255354000BBA0D /* smb.c */; };
|
||||
E395451B20255354000BBA0D /* smpp.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C520255354000BBA0D /* smpp.c */; };
|
||||
E395451C20255354000BBA0D /* snmp.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C620255354000BBA0D /* snmp.c */; };
|
||||
E395451D20255354000BBA0D /* socks45.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C720255354000BBA0D /* socks45.c */; };
|
||||
E395451E20255354000BBA0D /* socrates.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C820255354000BBA0D /* socrates.c */; };
|
||||
E395451F20255354000BBA0D /* someip.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542C920255354000BBA0D /* someip.c */; };
|
||||
E395452020255354000BBA0D /* sopcast.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542CA20255354000BBA0D /* sopcast.c */; };
|
||||
E395452120255354000BBA0D /* soulseek.c in Sources */ = {isa = PBXBuildFile; fileRef = E39542CB20255354000BBA0D /* soulseek.c */; };
|
||||
@@ -189,6 +193,19 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
E32F1ECA20844620005739B7 /* whatsapp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = whatsapp.c; sourceTree = "<group>"; };
|
||||
E35D5506228BA70400A80DED /* ajp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ajp.c; sourceTree = "<group>"; };
|
||||
E35D5507228BA70400A80DED /* snmp_proto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = snmp_proto.c; sourceTree = "<group>"; };
|
||||
E35D5508228BA70400A80DED /* modbus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = modbus.c; sourceTree = "<group>"; };
|
||||
E35D5509228BA70400A80DED /* ookla.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ookla.c; sourceTree = "<group>"; };
|
||||
E35D550A228BA70400A80DED /* upnp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = upnp.c; sourceTree = "<group>"; };
|
||||
E35D550B228BA70500A80DED /* memcached.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memcached.c; sourceTree = "<group>"; };
|
||||
E35D550C228BA70500A80DED /* mdns_proto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdns_proto.c; sourceTree = "<group>"; };
|
||||
E35D550D228BA70500A80DED /* fbzero.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fbzero.c; sourceTree = "<group>"; };
|
||||
E35D550E228BA70500A80DED /* nest_log_sink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nest_log_sink.c; sourceTree = "<group>"; };
|
||||
E35D550F228BA70600A80DED /* mining.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mining.c; sourceTree = "<group>"; };
|
||||
E35D551A228BA7DF00A80DED /* ht_hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ht_hash.h; sourceTree = "<group>"; };
|
||||
E35D551B228BA80000A80DED /* sha1-fast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "sha1-fast.c"; sourceTree = "<group>"; };
|
||||
E35D551C228BA80000A80DED /* ht_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ht_hash.c; sourceTree = "<group>"; };
|
||||
E3953F4F20254989000BBA0D /* ndpiExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ndpiExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E3953F5220254989000BBA0D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
E3953F5320254989000BBA0D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
@@ -212,7 +229,6 @@
|
||||
E39540BC20255353000BBA0D /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
E39540BD20255353000BBA0D /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
|
||||
E39540BE20255353000BBA0D /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = "<group>"; };
|
||||
E39540BF20255353000BBA0D /* Makefile.simple */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.simple; sourceTree = "<group>"; };
|
||||
E39540C020255353000BBA0D /* ndpi_content_match.c.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = ndpi_content_match.c.inc; sourceTree = "<group>"; };
|
||||
E39540C120255353000BBA0D /* ndpi_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ndpi_main.c; sourceTree = "<group>"; };
|
||||
E395414B20255353000BBA0D /* afp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = afp.c; sourceTree = "<group>"; };
|
||||
@@ -255,7 +271,6 @@
|
||||
E395417120255353000BBA0D /* edonkey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = edonkey.c; sourceTree = "<group>"; };
|
||||
E395417220255353000BBA0D /* fasttrack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fasttrack.c; sourceTree = "<group>"; };
|
||||
E395417320255353000BBA0D /* fiesta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fiesta.c; sourceTree = "<group>"; };
|
||||
E395417420255353000BBA0D /* filetopia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = filetopia.c; sourceTree = "<group>"; };
|
||||
E395417520255353000BBA0D /* fix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fix.c; sourceTree = "<group>"; };
|
||||
E395417620255353000BBA0D /* florensia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = florensia.c; sourceTree = "<group>"; };
|
||||
E395417720255353000BBA0D /* ftp_control.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ftp_control.c; sourceTree = "<group>"; };
|
||||
@@ -285,10 +300,8 @@
|
||||
E395429720255354000BBA0D /* mail_pop.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mail_pop.c; sourceTree = "<group>"; };
|
||||
E395429820255354000BBA0D /* mail_smtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mail_smtp.c; sourceTree = "<group>"; };
|
||||
E395429920255354000BBA0D /* maplestory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = maplestory.c; sourceTree = "<group>"; };
|
||||
E395429A20255354000BBA0D /* mdns.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdns.c; sourceTree = "<group>"; };
|
||||
E395429B20255354000BBA0D /* megaco.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = megaco.c; sourceTree = "<group>"; };
|
||||
E395429C20255354000BBA0D /* mgcp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mgcp.c; sourceTree = "<group>"; };
|
||||
E395429D20255354000BBA0D /* mms.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mms.c; sourceTree = "<group>"; };
|
||||
E395429E20255354000BBA0D /* mpegts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegts.c; sourceTree = "<group>"; };
|
||||
E395429F20255354000BBA0D /* mqtt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mqtt.c; sourceTree = "<group>"; };
|
||||
E39542A020255354000BBA0D /* msn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msn.c; sourceTree = "<group>"; };
|
||||
@@ -329,9 +342,7 @@
|
||||
E39542C320255354000BBA0D /* skype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = skype.c; sourceTree = "<group>"; };
|
||||
E39542C420255354000BBA0D /* smb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smb.c; sourceTree = "<group>"; };
|
||||
E39542C520255354000BBA0D /* smpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smpp.c; sourceTree = "<group>"; };
|
||||
E39542C620255354000BBA0D /* snmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = snmp.c; sourceTree = "<group>"; };
|
||||
E39542C720255354000BBA0D /* socks45.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = socks45.c; sourceTree = "<group>"; };
|
||||
E39542C820255354000BBA0D /* socrates.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = socrates.c; sourceTree = "<group>"; };
|
||||
E39542C920255354000BBA0D /* someip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = someip.c; sourceTree = "<group>"; };
|
||||
E39542CA20255354000BBA0D /* sopcast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sopcast.c; sourceTree = "<group>"; };
|
||||
E39542CB20255354000BBA0D /* soulseek.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = soulseek.c; sourceTree = "<group>"; };
|
||||
@@ -482,7 +493,6 @@
|
||||
E39540BC20255353000BBA0D /* Makefile */,
|
||||
E39540BD20255353000BBA0D /* Makefile.am */,
|
||||
E39540BE20255353000BBA0D /* Makefile.in */,
|
||||
E39540BF20255353000BBA0D /* Makefile.simple */,
|
||||
E39540C020255353000BBA0D /* ndpi_content_match.c.inc */,
|
||||
E39540C120255353000BBA0D /* ndpi_main.c */,
|
||||
E39540C220255353000BBA0D /* protocols */,
|
||||
@@ -530,7 +540,6 @@
|
||||
E395417120255353000BBA0D /* edonkey.c */,
|
||||
E395417220255353000BBA0D /* fasttrack.c */,
|
||||
E395417320255353000BBA0D /* fiesta.c */,
|
||||
E395417420255353000BBA0D /* filetopia.c */,
|
||||
E395417520255353000BBA0D /* fix.c */,
|
||||
E395417620255353000BBA0D /* florensia.c */,
|
||||
E395417720255353000BBA0D /* ftp_control.c */,
|
||||
@@ -560,10 +569,8 @@
|
||||
E395429720255354000BBA0D /* mail_pop.c */,
|
||||
E395429820255354000BBA0D /* mail_smtp.c */,
|
||||
E395429920255354000BBA0D /* maplestory.c */,
|
||||
E395429A20255354000BBA0D /* mdns.c */,
|
||||
E395429B20255354000BBA0D /* megaco.c */,
|
||||
E395429C20255354000BBA0D /* mgcp.c */,
|
||||
E395429D20255354000BBA0D /* mms.c */,
|
||||
E395429E20255354000BBA0D /* mpegts.c */,
|
||||
E395429F20255354000BBA0D /* mqtt.c */,
|
||||
E39542A020255354000BBA0D /* msn.c */,
|
||||
@@ -604,9 +611,7 @@
|
||||
E39542C320255354000BBA0D /* skype.c */,
|
||||
E39542C420255354000BBA0D /* smb.c */,
|
||||
E39542C520255354000BBA0D /* smpp.c */,
|
||||
E39542C620255354000BBA0D /* snmp.c */,
|
||||
E39542C720255354000BBA0D /* socks45.c */,
|
||||
E39542C820255354000BBA0D /* socrates.c */,
|
||||
E39542C920255354000BBA0D /* someip.c */,
|
||||
E39542CA20255354000BBA0D /* sopcast.c */,
|
||||
E39542CB20255354000BBA0D /* soulseek.c */,
|
||||
@@ -647,6 +652,16 @@
|
||||
E39542EE20255354000BBA0D /* zattoo.c */,
|
||||
E39542EF20255354000BBA0D /* zeromq.c */,
|
||||
E32F1ECA20844620005739B7 /* whatsapp.c */,
|
||||
E35D5506228BA70400A80DED /* ajp.c */,
|
||||
E35D550D228BA70500A80DED /* fbzero.c */,
|
||||
E35D550C228BA70500A80DED /* mdns_proto.c */,
|
||||
E35D550B228BA70500A80DED /* memcached.c */,
|
||||
E35D550F228BA70600A80DED /* mining.c */,
|
||||
E35D5508228BA70400A80DED /* modbus.c */,
|
||||
E35D550E228BA70500A80DED /* nest_log_sink.c */,
|
||||
E35D5509228BA70400A80DED /* ookla.c */,
|
||||
E35D5507228BA70400A80DED /* snmp_proto.c */,
|
||||
E35D550A228BA70400A80DED /* upnp.c */,
|
||||
);
|
||||
path = protocols;
|
||||
sourceTree = "<group>";
|
||||
@@ -675,6 +690,7 @@
|
||||
E39542F120255354000BBA0D /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E35D551A228BA7DF00A80DED /* ht_hash.h */,
|
||||
E39542F220255354000BBA0D /* actypes.h */,
|
||||
E39542F320255354000BBA0D /* ahocorasick.h */,
|
||||
E39542F420255354000BBA0D /* libcache.h */,
|
||||
@@ -688,6 +704,8 @@
|
||||
E39542F820255354000BBA0D /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E35D551C228BA80000A80DED /* ht_hash.c */,
|
||||
E35D551B228BA80000A80DED /* sha1-fast.c */,
|
||||
E395430020255354000BBA0D /* ahocorasick.c */,
|
||||
E395430120255354000BBA0D /* libcache.c */,
|
||||
E395430820255354000BBA0D /* ndpi_patricia.c */,
|
||||
@@ -769,14 +787,10 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E395430C20255354000BBA0D /* ndpi_define.h.in in Resources */,
|
||||
E395431A20255354000BBA0D /* Makefile.simple in Resources */,
|
||||
E395430B20255354000BBA0D /* Makefile.am in Resources */,
|
||||
E395431920255354000BBA0D /* Makefile.in in Resources */,
|
||||
E3953F5920254989000BBA0D /* Assets.xcassets in Resources */,
|
||||
E39547942026B2AA000BBA0D /* capture.pcap in Resources */,
|
||||
E395455D202558E6000BBA0D /* protos.txt in Resources */,
|
||||
E3953F5C2025498A000BBA0D /* Main.storyboard in Resources */,
|
||||
E395431820255354000BBA0D /* Makefile.am in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -787,20 +801,20 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E39544F320255354000BBA0D /* mms.c in Sources */,
|
||||
E39544F220255354000BBA0D /* mgcp.c in Sources */,
|
||||
E39543B420255354000BBA0D /* checkmk.c in Sources */,
|
||||
E39543D720255354000BBA0D /* http.c in Sources */,
|
||||
E39543A420255354000BBA0D /* aimini.c in Sources */,
|
||||
E39543DD20255354000BBA0D /* jabber.c in Sources */,
|
||||
E35D5510228BA70600A80DED /* ajp.c in Sources */,
|
||||
E395452820255354000BBA0D /* steam.c in Sources */,
|
||||
E39543C720255354000BBA0D /* edonkey.c in Sources */,
|
||||
E39543B520255354000BBA0D /* ciscovpn.c in Sources */,
|
||||
E35D5511228BA70600A80DED /* snmp_proto.c in Sources */,
|
||||
E39543B120255354000BBA0D /* bittorrent.c in Sources */,
|
||||
E395452E20255354000BBA0D /* telegram.c in Sources */,
|
||||
E39543DA20255354000BBA0D /* icecast.c in Sources */,
|
||||
E395450620255354000BBA0D /* postgres.c in Sources */,
|
||||
E395451E20255354000BBA0D /* socrates.c in Sources */,
|
||||
E395450B20255354000BBA0D /* quic.c in Sources */,
|
||||
E39543A820255354000BBA0D /* armagetron.c in Sources */,
|
||||
E39543D120255354000BBA0D /* gtp.c in Sources */,
|
||||
@@ -811,7 +825,6 @@
|
||||
E395452620255354000BBA0D /* starcraft.c in Sources */,
|
||||
E39543B620255354000BBA0D /* citrix.c in Sources */,
|
||||
E395451320255354000BBA0D /* rtsp.c in Sources */,
|
||||
E39543CA20255354000BBA0D /* filetopia.c in Sources */,
|
||||
E39544F120255354000BBA0D /* megaco.c in Sources */,
|
||||
E39543A920255354000BBA0D /* flash.c in Sources */,
|
||||
E39544F820255354000BBA0D /* mysql.c in Sources */,
|
||||
@@ -832,10 +845,12 @@
|
||||
E395451420255354000BBA0D /* rx.c in Sources */,
|
||||
E39543DC20255354000BBA0D /* irc.c in Sources */,
|
||||
E395450320255354000BBA0D /* oscar.c in Sources */,
|
||||
E35D551D228BA80000A80DED /* sha1-fast.c in Sources */,
|
||||
E39543BC20255354000BBA0D /* dcerpc.c in Sources */,
|
||||
E395454020255355000BBA0D /* world_of_warcraft.c in Sources */,
|
||||
E39543A620255354000BBA0D /* apple_push.c in Sources */,
|
||||
E395451920255354000BBA0D /* skype.c in Sources */,
|
||||
E35D551E228BA80000A80DED /* ht_hash.c in Sources */,
|
||||
E39543AC20255354000BBA0D /* popo.c in Sources */,
|
||||
E39543BF20255354000BBA0D /* diameter.c in Sources */,
|
||||
E39544FF20255354000BBA0D /* ntp.c in Sources */,
|
||||
@@ -847,7 +862,6 @@
|
||||
E39544EC20255354000BBA0D /* mail_imap.c in Sources */,
|
||||
E395450C20255354000BBA0D /* radius.c in Sources */,
|
||||
E395455F202558E6000BBA0D /* ndpiReader.c in Sources */,
|
||||
E395451C20255354000BBA0D /* snmp.c in Sources */,
|
||||
E395452520255354000BBA0D /* ssl.c in Sources */,
|
||||
E39543D420255354000BBA0D /* halflife2_and_mods.c in Sources */,
|
||||
E39544F920255354000BBA0D /* netbios.c in Sources */,
|
||||
@@ -870,11 +884,13 @@
|
||||
E395450D20255354000BBA0D /* rdp.c in Sources */,
|
||||
E39544EA20255354000BBA0D /* lisp.c in Sources */,
|
||||
E39544EF20255354000BBA0D /* maplestory.c in Sources */,
|
||||
E35D5519228BA70600A80DED /* mining.c in Sources */,
|
||||
E39544EB20255354000BBA0D /* lotus_notes.c in Sources */,
|
||||
E395451F20255354000BBA0D /* someip.c in Sources */,
|
||||
E39543DF20255354000BBA0D /* kerberos.c in Sources */,
|
||||
E39543A720255354000BBA0D /* applejuice.c in Sources */,
|
||||
E395452020255354000BBA0D /* sopcast.c in Sources */,
|
||||
E35D5517228BA70600A80DED /* fbzero.c in Sources */,
|
||||
E39543AD20255354000BBA0D /* secondlife.c in Sources */,
|
||||
E395450720255354000BBA0D /* pplive.c in Sources */,
|
||||
E395453120255354000BBA0D /* tftp.c in Sources */,
|
||||
@@ -883,6 +899,7 @@
|
||||
E39543D620255354000BBA0D /* hep.c in Sources */,
|
||||
E39543E020255354000BBA0D /* kontiki.c in Sources */,
|
||||
E39544FA20255354000BBA0D /* netflow.c in Sources */,
|
||||
E35D5513228BA70600A80DED /* ookla.c in Sources */,
|
||||
E395454220255355000BBA0D /* xdmcp.c in Sources */,
|
||||
E39544F720255354000BBA0D /* mssql_tds.c in Sources */,
|
||||
E395451A20255354000BBA0D /* smb.c in Sources */,
|
||||
@@ -890,11 +907,12 @@
|
||||
E395450520255354000BBA0D /* pcanywhere.c in Sources */,
|
||||
E39547902026A51A000BBA0D /* ahocorasick.c in Sources */,
|
||||
E395452320255354000BBA0D /* ssdp.c in Sources */,
|
||||
E35D5518228BA70600A80DED /* nest_log_sink.c in Sources */,
|
||||
E395431B20255354000BBA0D /* ndpi_content_match.c.inc in Sources */,
|
||||
E395450120255354000BBA0D /* openvpn.c in Sources */,
|
||||
E395453920255354000BBA0D /* vhua.c in Sources */,
|
||||
E39544F020255354000BBA0D /* mdns.c in Sources */,
|
||||
E39543C920255354000BBA0D /* fiesta.c in Sources */,
|
||||
E35D5514228BA70600A80DED /* upnp.c in Sources */,
|
||||
E395454120255355000BBA0D /* xbox.c in Sources */,
|
||||
E395453D20255355000BBA0D /* warcraft3.c in Sources */,
|
||||
E39543D220255354000BBA0D /* guildwars.c in Sources */,
|
||||
@@ -902,12 +920,14 @@
|
||||
E395450E20255354000BBA0D /* redis_net.c in Sources */,
|
||||
E395455420255355000BBA0D /* node.c in Sources */,
|
||||
E39543CE20255354000BBA0D /* ftp_data.c in Sources */,
|
||||
E35D551F228BA88700A80DED /* ndpi_patricia.c in Sources */,
|
||||
E395451D20255354000BBA0D /* socks45.c in Sources */,
|
||||
E395451820255354000BBA0D /* skinny.c in Sources */,
|
||||
E395453620255354000BBA0D /* tvuplayer.c in Sources */,
|
||||
E39543CC20255354000BBA0D /* florensia.c in Sources */,
|
||||
E3953F5720254989000BBA0D /* ViewController.m in Sources */,
|
||||
E39544F520255354000BBA0D /* mqtt.c in Sources */,
|
||||
E35D5516228BA70600A80DED /* mdns_proto.c in Sources */,
|
||||
E39543C220255354000BBA0D /* dns.c in Sources */,
|
||||
E39543B920255354000BBA0D /* corba.c in Sources */,
|
||||
E39543B320255354000BBA0D /* btlib.c in Sources */,
|
||||
@@ -927,6 +947,7 @@
|
||||
E395453E20255355000BBA0D /* whoisdas.c in Sources */,
|
||||
E39543BB20255354000BBA0D /* csgo.c in Sources */,
|
||||
E395450A20255354000BBA0D /* qq.c in Sources */,
|
||||
E35D5512228BA70600A80DED /* modbus.c in Sources */,
|
||||
E395431C20255354000BBA0D /* ndpi_main.c in Sources */,
|
||||
E39543BD20255354000BBA0D /* dhcp.c in Sources */,
|
||||
E395454520255355000BBA0D /* zeromq.c in Sources */,
|
||||
@@ -935,6 +956,7 @@
|
||||
E395451120255354000BBA0D /* rtmp.c in Sources */,
|
||||
E39544FE20255354000BBA0D /* non_tcp_udp.c in Sources */,
|
||||
E39543C020255354000BBA0D /* directconnect.c in Sources */,
|
||||
E35D5515228BA70600A80DED /* memcached.c in Sources */,
|
||||
E39543D020255354000BBA0D /* gnutella.c in Sources */,
|
||||
E39543D320255354000BBA0D /* h323.c in Sources */,
|
||||
E395453720255354000BBA0D /* ubntac2.c in Sources */,
|
||||
@@ -1087,6 +1109,7 @@
|
||||
"$(inherited)",
|
||||
"APP_HAS_OWN_MAIN=1",
|
||||
"NDPI_LOG_DEBUG2=NDPI_LOG_DEBUG2_XCODE_PROJ",
|
||||
NDPI_LIB_COMPILATION,
|
||||
);
|
||||
INFOPLIST_FILE = ndpiExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
@@ -1105,6 +1128,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"APP_HAS_OWN_MAIN=1",
|
||||
"NDPI_LOG_DEBUG2=NDPI_LOG_DEBUG2_XCODE_PROJ",
|
||||
NDPI_LIB_COMPILATION,
|
||||
);
|
||||
INFOPLIST_FILE = ndpiExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
|
||||
@@ -17,7 +17,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
|
||||
APP = ndpiReader.dpdk
|
||||
LIBNDPI = $(PWD)/../src/lib/libndpi.a
|
||||
|
||||
SRCS-y := ndpi_util.c ndpiReader.c
|
||||
SRCS-y := reader_util.c intrusion_detection.c ndpiReader.c
|
||||
|
||||
CFLAGS += -g
|
||||
CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-parameter -I $(PWD)/../src/include @CFLAGS@ -DUSE_DPDK
|
||||
|
||||
+20
-7
@@ -1,21 +1,34 @@
|
||||
CC=@CC@
|
||||
CFLAGS=-g -I../src/include @CFLAGS@
|
||||
LIBNDPI=../src/lib/libndpi.a
|
||||
LDFLAGS=$(LIBNDPI) @PCAP_LIB@ -lpthread @LDFLAGS@
|
||||
OBJS=ndpiReader.o ndpi_util.o
|
||||
CXX=@CXX@
|
||||
SRCHOME=../src
|
||||
CFLAGS=-g -fPIC -DPIC -I$(SRCHOME)/include @CFLAGS@
|
||||
LIBNDPI=$(SRCHOME)/lib/libndpi.a
|
||||
LDFLAGS=$(LIBNDPI) @PCAP_LIB@ @ADDITIONAL_LIBS@ -lpthread -lm @LDFLAGS@
|
||||
HEADERS=intrusion_detection.h reader_util.h $(SRCHOME)/include/ndpi_api.h \
|
||||
$(SRCHOME)/include/ndpi_typedefs.h $(SRCHOME)/include/ndpi_protocol_ids.h
|
||||
OBJS=ndpiReader.o reader_util.o intrusion_detection.o
|
||||
PREFIX?=@prefix@
|
||||
|
||||
all: ndpiReader @DPDK_TARGET@
|
||||
|
||||
ndpiReader: $(OBJS) $(LIBNDPI)
|
||||
$(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS)
|
||||
EXECUTABLE_SOURCES := ndpiReader.c
|
||||
COMMON_SOURCES := $(filter-out $(EXECUTABLE_SOURCES),$(wildcard *.c ))
|
||||
|
||||
libndpiReader.a: $(COMMON_SOURCES:%.c=%.o) $(LIBNDPI)
|
||||
ar rsv libndpiReader.a $(COMMON_SOURCES:%.c=%.o)
|
||||
|
||||
ndpiReader: libndpiReader.a $(LIBNDPI) $(EXECUTABLE_SOURCES:%.c=%.o)
|
||||
$(CXX) $(CFLAGS) $(EXECUTABLE_SOURCES:%.c=%.o) libndpiReader.a -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.c $(HEADERS) Makefile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin/
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/ndpi
|
||||
cp ndpiReader $(DESTDIR)$(PREFIX)/bin/
|
||||
cp protos.txt $(DESTDIR)$(PREFIX)/share/ndpi/ndpiProtos.txt
|
||||
cp mining_hosts.txt $(DESTDIR)$(PREFIX)/share/ndpi/ndpiCustomCategory.txt
|
||||
[ -f build/app/ndpiReader.dpdk ] && cp build/app/ndpiReader.dpdk $(DESTDIR)$(PREFIX)/bin/ || true
|
||||
[ -f ndpiReader.dpdk ] && cp ndpiReader.dpdk $(DESTDIR)$(PREFIX)/bin/ || true
|
||||
|
||||
@@ -23,7 +36,7 @@ dpdk:
|
||||
make -f Makefile.dpdk
|
||||
|
||||
check:
|
||||
cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I../src/include -I/usr/local/include/json-c *.c
|
||||
cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I$(SRCHOME)/include *.c
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o ndpiReader ndpiReader.dpdk
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Format: name\tcategory_id
|
||||
internetbadguys.com 100
|
||||
144.139.247.220 100
|
||||
@@ -0,0 +1,468 @@
|
||||
/*
|
||||
* intrusion_detection.c
|
||||
*
|
||||
* Copyright (C) 2011-19 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "intrusion_detection.h"
|
||||
|
||||
double normalize(ndpi_norm_value* tresholds){
|
||||
if(tresholds->upper_bound != tresholds->lower_bound){
|
||||
tresholds->norm_value = (tresholds->value - tresholds->lower_bound) / (tresholds->upper_bound - tresholds->lower_bound);
|
||||
}else{
|
||||
if(tresholds->value > tresholds->upper_bound){
|
||||
tresholds->norm_value = 1 + (tresholds->value - tresholds->lower_bound) / tresholds->upper_bound;
|
||||
}else{
|
||||
tresholds->norm_value = 1 - (tresholds->value - tresholds->lower_bound) / tresholds->upper_bound;
|
||||
}
|
||||
|
||||
}
|
||||
if(tresholds->norm_value >= 0){
|
||||
return tresholds->norm_value * tresholds->weight;
|
||||
}
|
||||
else{
|
||||
return (1 - tresholds->norm_value) * tresholds->weight;
|
||||
}
|
||||
}
|
||||
|
||||
double get_flow_score(ndpi_norm_value* scores, int n_metrics){
|
||||
double flow_score = 0;
|
||||
for(int i=0; i<n_metrics; i++){
|
||||
flow_score += normalize(&scores[i]);
|
||||
}
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
double Ddos_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_c_to_s_avg */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 70.0;
|
||||
scores[i].upper_bound = 263.4799999999999;
|
||||
scores[i].weight = 0.21257330032661592;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_c_to_s);
|
||||
|
||||
/* pktlen_s_to_c_max */
|
||||
i++;
|
||||
scores[i].lower_bound = 90.0;
|
||||
scores[i].upper_bound = 2974.0;
|
||||
scores[i].weight = 0.21073785073559176;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 72.7;
|
||||
scores[i].upper_bound = 1130.4199999999996;
|
||||
scores[i].weight = 0.21257330032661592;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_stddev */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 906.0;
|
||||
scores[i].weight = 0.20990954527912953;
|
||||
scores[i].value = ndpi_data_stddev(flow->pktlen_s_to_c);
|
||||
|
||||
/* fin */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.07710300166602348;
|
||||
scores[i].value = flow->fin_count;
|
||||
|
||||
/* s_to_c_fin */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.07710300166602348;
|
||||
scores[i].value = flow->dst2src_fin_count;
|
||||
|
||||
// sum = 1.0
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Dos_goldeneye_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_s_to_c_max */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 74.0;
|
||||
scores[i].upper_bound = 3292.6699999999764;
|
||||
scores[i].weight = 0.3123007140611667;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_s_to_c);
|
||||
/* pktlen_s_to_c_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 68.7;
|
||||
scores[i].upper_bound = 1354.0569999999987;
|
||||
scores[i].weight = 0.23802038891633356;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_stddev */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 959.4469999999993;
|
||||
scores[i].weight = 0.3111779763775991;
|
||||
scores[i].value = ndpi_data_stddev(flow->pktlen_s_to_c);
|
||||
|
||||
/* syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.0464364305923564;
|
||||
scores[i].value = flow->syn_count;
|
||||
|
||||
/* c_to_s_syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 1.0;
|
||||
scores[i].weight = 0.04562805946018772;
|
||||
scores[i].value = flow->src2dst_syn_count;
|
||||
|
||||
/* s_to_c_syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.0464364305923564;
|
||||
scores[i].value = flow->dst2src_syn_count;
|
||||
|
||||
// sum = 0.9999999999999998
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Dos_hulk_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* duration */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 539.40668006422;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = (l - f);
|
||||
|
||||
/* src2dst_packets */
|
||||
i++;
|
||||
scores[i].lower_bound = 2.0;
|
||||
scores[i].upper_bound = 41.0;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = flow->src2dst_packets;
|
||||
|
||||
/* dst2src_packets */
|
||||
i++;
|
||||
scores[i].lower_bound = 2.0;
|
||||
scores[i].upper_bound = 45.0;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = flow->dst2src_packets;
|
||||
|
||||
/* src2dst_bytes */
|
||||
i++;
|
||||
scores[i].lower_bound = 146.0;
|
||||
scores[i].upper_bound = 6306.300000000001;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = flow->src2dst_bytes;
|
||||
|
||||
/* ack */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 82.0;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = flow->ack_count;
|
||||
|
||||
/* syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = flow->syn_count;
|
||||
|
||||
// sum = 0.9999999999999999
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Dos_slow_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_s_to_c_max */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 90.0;
|
||||
scores[i].upper_bound = 3135.0;
|
||||
scores[i].weight = 0.1760747755022144;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 80.37100000000001;
|
||||
scores[i].upper_bound = 1292.5900000000008;
|
||||
scores[i].weight = 0.17600137023171597;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_s_to_c);
|
||||
|
||||
/* dst2src_bytes */
|
||||
i++;
|
||||
scores[i].lower_bound = 262.0;
|
||||
scores[i].upper_bound = 53227.80000000002;
|
||||
scores[i].weight = 0.16919914849886225;
|
||||
scores[i].value = flow->dst2src_bytes;
|
||||
|
||||
/* syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.168000195747388;
|
||||
scores[i].value = flow->syn_count;
|
||||
|
||||
/* c_to_s_syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 1.0;
|
||||
scores[i].weight = 0.14272431427243143;
|
||||
scores[i].value = flow->src2dst_syn_count;
|
||||
|
||||
/* s_to_c_syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.168000195747388;
|
||||
scores[i].value = flow->dst2src_syn_count;
|
||||
|
||||
// sum = 1.0
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Ftp_patator_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* iat_flow_min */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 24.0;
|
||||
scores[i].weight = 0.002732919254658385;
|
||||
scores[i].value = ndpi_data_min(flow->iat_flow);
|
||||
|
||||
/* pktlen_s_to_c_max */
|
||||
i++;
|
||||
scores[i].lower_bound = 90.0;
|
||||
scores[i].upper_bound = 3393.0;
|
||||
scores[i].weight = 0.007453416149068323;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 81.3;
|
||||
scores[i].upper_bound = 1315.021;
|
||||
scores[i].weight = 0.9833540372670807;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_s_to_c);
|
||||
|
||||
/* dst2src_bytes */
|
||||
i++;
|
||||
scores[i].lower_bound = 256.0;
|
||||
scores[i].upper_bound = 56434.0;
|
||||
scores[i].weight = 0.0034782608695652175;
|
||||
scores[i].value = flow->dst2src_bytes;
|
||||
|
||||
/* fin */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.0014906832298136647;
|
||||
scores[i].value = flow->fin_count;
|
||||
|
||||
/* rst */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.0014906832298136647;
|
||||
scores[i].value = flow->rst_count;
|
||||
|
||||
// sum = 1.0
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Hearthbleed_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* iat_flow_max */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 595213.3999999999;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = ndpi_data_max(flow->iat_flow);
|
||||
|
||||
/* iat_flow_stddev */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 245377.74799999973;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = ndpi_data_stddev(flow->iat_flow);
|
||||
|
||||
/* pktlen_s_to_c_max */
|
||||
i++;
|
||||
scores[i].lower_bound = 74.0;
|
||||
scores[i].upper_bound = 3380.0;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 70.0;
|
||||
scores[i].upper_bound = 1344.6399999999996;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_stddev */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 944.6399999999996;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = ndpi_data_stddev(flow->pktlen_s_to_c);
|
||||
|
||||
/* duration */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 711.6677598000391;
|
||||
scores[i].weight = 0.16666666666666666;
|
||||
scores[i].value = (l - f);
|
||||
|
||||
// sum = 0.9999999999999999
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Infiltration_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_c_to_s_max */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 72.0;
|
||||
scores[i].upper_bound = 1840.739999999998;
|
||||
scores[i].weight = 0.11937557392102846;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_c_to_s);
|
||||
|
||||
/* pktlen_c_to_s_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 70.0;
|
||||
scores[i].upper_bound = 296.56599999999816;
|
||||
scores[i].weight = 0.12526782981328435;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_c_to_s);
|
||||
|
||||
/* pktlen_s_to_c_max */
|
||||
i++;
|
||||
scores[i].lower_bound = 90.0;
|
||||
scores[i].upper_bound = 3496.1399999999776;
|
||||
scores[i].weight = 0.13927150290786652;
|
||||
scores[i].value = ndpi_data_max(flow->pktlen_s_to_c);
|
||||
|
||||
/* pktlen_s_to_c_avg */
|
||||
i++;
|
||||
scores[i].lower_bound = 72.6;
|
||||
scores[i].upper_bound = 1367.7959999999991;
|
||||
scores[i].weight = 0.12182430364248545;
|
||||
scores[i].value = ndpi_data_average(flow->pktlen_s_to_c);
|
||||
|
||||
/* src2dst_bytes */
|
||||
i++;
|
||||
scores[i].lower_bound = 144.0;
|
||||
scores[i].upper_bound = 7847.69999999999;
|
||||
scores[i].weight = 0.12059993878175697;
|
||||
scores[i].value = flow->src2dst_bytes;
|
||||
|
||||
/* dst2src_bytes */
|
||||
i++;
|
||||
scores[i].lower_bound = 236.0;
|
||||
scores[i].upper_bound = 74486.7799999998;
|
||||
scores[i].weight = 0.3736608509335782;
|
||||
scores[i].value = flow->dst2src_bytes;
|
||||
|
||||
// sum = 1.0
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
|
||||
double Ssh_patator_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* fin */
|
||||
int i = 0;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.0033738191632928477;
|
||||
scores[i].value = flow->fin_count;
|
||||
|
||||
/* psh */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 30.0;
|
||||
scores[i].weight = 0.33076923076923076;
|
||||
scores[i].value = flow->psh_count;
|
||||
|
||||
/* c_to_s_syn */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 1.0;
|
||||
scores[i].weight = 0.0004048582995951417;
|
||||
scores[i].value = flow->src2dst_syn_count;
|
||||
|
||||
/* c_to_s_psh */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 12.0;
|
||||
scores[i].weight = 0.33130904183535764;
|
||||
scores[i].value = flow->src2dst_psh_count;
|
||||
|
||||
/* s_to_c_fin */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 2.0;
|
||||
scores[i].weight = 0.0033738191632928477;
|
||||
scores[i].value = flow->dst2src_fin_count;
|
||||
|
||||
/* s_to_c_psh */
|
||||
i++;
|
||||
scores[i].lower_bound = 0.0;
|
||||
scores[i].upper_bound = 30.0;
|
||||
scores[i].weight = 0.33076923076923076;
|
||||
scores[i].value = flow->dst2src_psh_count;
|
||||
|
||||
// sum = 1.0
|
||||
double flow_score = get_flow_score(scores, n_metrics);
|
||||
free(scores);
|
||||
return flow_score;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* intrusion_detection.h
|
||||
*
|
||||
* Copyright (C) 2011-19 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INTRUSION_DETECTION_H_
|
||||
#define _INTRUSION_DETECTION_H_
|
||||
|
||||
/*
|
||||
Code to detect attacks reported in
|
||||
|
||||
https://www.unb.ca/cic/datasets/ids-2017.html
|
||||
https://www.unb.ca/cic/datasets/ids-2018.html
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "reader_util.h"
|
||||
#include "ndpi_api.h"
|
||||
|
||||
typedef struct norm_values{
|
||||
double upper_bound;
|
||||
double lower_bound;
|
||||
double weight;
|
||||
double value;
|
||||
double norm_value;
|
||||
}ndpi_norm_value;
|
||||
|
||||
double normalize(ndpi_norm_value* tresholds);
|
||||
|
||||
double get_flow_score(ndpi_norm_value* scores, int n_metrics);
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
double Ddos_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Dos_goldeneye_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Dos_hulk_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Dos_slow_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Ftp_patator_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Hearthbleed_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Infiltration_score(struct ndpi_flow_info* flow);
|
||||
|
||||
double Ssh_patator_score(struct ndpi_flow_info* flow);
|
||||
|
||||
#endif /* _INTRUSION_DETECTION_H_ */
|
||||
Executable
+136
@@ -0,0 +1,136 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (C) 2019 - ntop.org
|
||||
#
|
||||
# nDPI is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# nDPI is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
# 1) Generate a CSV file using the ndpiReader tool. Example:
|
||||
# ./ndpiReader -C sample.json -i sample.pcap
|
||||
#
|
||||
# 2) Open Google Chrome and type in the URL 'chrome://tracing/'
|
||||
#
|
||||
# 3) Inside Chrome click on 'Load' or drop sample.json in the
|
||||
# Chrome window to visualize the output
|
||||
#
|
||||
|
||||
import sys
|
||||
import json
|
||||
|
||||
protos = {}
|
||||
lastId = 1
|
||||
|
||||
def get_timestamp(seen):
|
||||
tok = seen.split(".")
|
||||
return int(tok[0]) * 1000 + int(tok[1])
|
||||
|
||||
def get_record(toks, csv_fields):
|
||||
global protos
|
||||
global lastId
|
||||
|
||||
if len(toks) < 11:
|
||||
return None
|
||||
|
||||
record = dict()
|
||||
ndpiProtocol = toks[10]
|
||||
|
||||
ndpi_protos = ndpiProtocol.split(".")
|
||||
if(len(ndpi_protos) == 1):
|
||||
app_proto = ndpi_protos[0]
|
||||
else:
|
||||
app_proto = ndpi_protos[1]
|
||||
|
||||
id = protos.get(ndpiProtocol)
|
||||
if(id == None):
|
||||
lastId = lastId + 1
|
||||
protos[ndpiProtocol] = lastId
|
||||
id = lastId
|
||||
#print(ndpiProtocol+"="+str(id))
|
||||
|
||||
ip_address = toks[5]
|
||||
server_name = toks[11]
|
||||
record["cat"] = "flow"
|
||||
record["pid"] = ip_address
|
||||
record["tid"] = ndpiProtocol # id
|
||||
record["ts"] = get_timestamp(toks[2])
|
||||
record["ph"] = "X"
|
||||
record["name"] = app_proto
|
||||
|
||||
if(server_name == ""):
|
||||
args = {}
|
||||
else:
|
||||
args = { "name": server_name }
|
||||
record["args"] = args
|
||||
record["dur"] = get_timestamp(toks[3]) - record["ts"]
|
||||
|
||||
# if we do not have the legend we just return
|
||||
if csv_fields is None:
|
||||
return record
|
||||
|
||||
# Otherwise we just add everything we find as a string
|
||||
if(0):
|
||||
idx = 0
|
||||
for tok in toks:
|
||||
name = csv_fields[idx]
|
||||
idx += 1
|
||||
record["args"][name] = str(tok)
|
||||
|
||||
return record
|
||||
|
||||
def get_record_dict(filename):
|
||||
csv_fields = None
|
||||
records = []
|
||||
fin = open(filename, "r");
|
||||
for line in fin:
|
||||
line = line.replace("\n","")
|
||||
|
||||
# Get the legend if present
|
||||
if line[0] == '#':
|
||||
csv_fields = []
|
||||
line = line.replace("#", "")
|
||||
toks = line.split(",")
|
||||
for tok in toks:
|
||||
csv_fields.append(tok)
|
||||
continue
|
||||
|
||||
toks = line.split(",")
|
||||
flow_id = int(toks[0])
|
||||
record = get_record(toks, csv_fields)
|
||||
if record is None:
|
||||
print("Error while parsing " + line)
|
||||
continue
|
||||
|
||||
records.append(record)
|
||||
|
||||
json_dict = dict()
|
||||
json_dict["traceEvents"] = records
|
||||
|
||||
return json_dict
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("ndpi2json <csv_file> <json_file>")
|
||||
sys.exit(0)
|
||||
|
||||
record_dict = get_record_dict(sys.argv[1])
|
||||
#print(record_dict)
|
||||
#json_string = json.dumps(json_dict)
|
||||
#print(json_string)
|
||||
|
||||
with open(sys.argv[2], 'w') as fp:
|
||||
json.dump(record_dict, fp)
|
||||
print("Written " + str(len(record_dict["traceEvents"])) + " records")
|
||||
+1179
-1223
File diff suppressed because it is too large
Load Diff
-1133
File diff suppressed because it is too large
Load Diff
+7
-3
@@ -14,11 +14,15 @@ host:"googlesyndication.com"@Google
|
||||
host:"venere.com"@Venere
|
||||
host:"kataweb.it",host:"repubblica.it"@Repubblica
|
||||
host:"ntop"@ntop
|
||||
host:"atv-ext.amazon.com",host:"*.api.amazon.com",host:"*.api.amazonvideo.com"@AmazonVideo
|
||||
host:"*.amazonaws.com"@AmazonVideo
|
||||
host:"*.netflix.com"@Netflix
|
||||
host:"*.lvlt.dash.us.aiv-cdn.net.c.footprint.net"@AmazonVideo
|
||||
host:"api-global.netflix.com"@Netflix
|
||||
# IP based Subprotocols
|
||||
# Format:
|
||||
# ip:<value>,ip:<value>,.....@<subproto>
|
||||
|
||||
ip:213.75.170.11@CustomProtocol
|
||||
|
||||
|
||||
|
||||
ip:8.248.73.247@AmazonPrime
|
||||
ip:54.80.47.130@AmazonPrime
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_util.h
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-19 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -29,7 +29,10 @@
|
||||
#ifndef __NDPI_UTIL_H__
|
||||
#define __NDPI_UTIL_H__
|
||||
|
||||
#include "uthash.h"
|
||||
#include <pcap.h>
|
||||
#include "ndpi_classify.h"
|
||||
#include "ndpi_typedefs.h"
|
||||
|
||||
#ifdef USE_DPDK
|
||||
#include <rte_eal.h>
|
||||
@@ -49,6 +52,14 @@
|
||||
extern int dpdk_port_init(int port, struct rte_mempool *mbuf_pool);
|
||||
#endif
|
||||
|
||||
/* ETTA Spec defiintions for feature readiness */
|
||||
#define ETTA_MIN_PACKETS 10
|
||||
#define ETTA_MIN_OCTETS 4000
|
||||
/** maximum line length */
|
||||
#define LINEMAX 512
|
||||
#define MAX_BYTE_COUNT_ARRAY_LENGTH 256
|
||||
#define MAX_NUM_PKTS 10
|
||||
|
||||
#define MAX_NUM_READER_THREADS 16
|
||||
#define IDLE_SCAN_PERIOD 10 /* msec (use TICK_RESOLUTION = 1000) */
|
||||
#define MAX_IDLE_TIME 30000
|
||||
@@ -73,8 +84,76 @@ extern int dpdk_port_init(int port, struct rte_mempool *mbuf_pool);
|
||||
#define MAX_TABLE_SIZE_2 8192
|
||||
#define INIT_VAL -1
|
||||
|
||||
|
||||
// inner hash table (ja3 -> security state)
|
||||
typedef struct ndpi_ja3_info {
|
||||
char * ja3;
|
||||
ndpi_cipher_weakness unsafe_cipher;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_ja3_info;
|
||||
|
||||
// external hash table (host ip -> <ip string, hash table ja3c, hash table ja3s>)
|
||||
// used to aggregate ja3 fingerprints by hosts
|
||||
typedef struct ndpi_host_ja3_fingerprints {
|
||||
u_int32_t ip;
|
||||
char *ip_string;
|
||||
char *dns_name;
|
||||
ndpi_ja3_info *host_client_info_hasht;
|
||||
ndpi_ja3_info *host_server_info_hasht;
|
||||
|
||||
UT_hash_handle hh;
|
||||
} ndpi_host_ja3_fingerprints;
|
||||
|
||||
|
||||
//inner hash table
|
||||
typedef struct ndpi_ip_dns{
|
||||
u_int32_t ip;
|
||||
char *ip_string;
|
||||
char *dns_name; //server name if any;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_ip_dns;
|
||||
|
||||
//hash table ja3 -> <host, ip, security>, used to aggregate host by ja3 fingerprints
|
||||
typedef struct ndpi_ja3_fingerprints_host{
|
||||
char *ja3; //key
|
||||
ndpi_cipher_weakness unsafe_cipher;
|
||||
ndpi_ip_dns *ipToDNS_ht;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_ja3_fingerprints_host;
|
||||
|
||||
struct flow_metrics {
|
||||
float entropy, average, stddev;
|
||||
};
|
||||
|
||||
struct ndpi_entropy {
|
||||
// Entropy fields
|
||||
struct timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time;
|
||||
u_int16_t src2dst_pkt_len[MAX_NUM_PKTS]; /*!< array of packet appdata lengths */
|
||||
struct timeval src2dst_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
|
||||
u_int16_t dst2src_pkt_len[MAX_NUM_PKTS]; /*!< array of packet appdata lengths */
|
||||
struct timeval dst2src_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
|
||||
struct timeval src2dst_start; /*!< first packet arrival time */
|
||||
struct timeval dst2src_start; /*!< first packet arrival time */
|
||||
u_int32_t src2dst_opackets; /*!< non-zero packet counts */
|
||||
u_int32_t dst2src_opackets; /*!< non-zero packet counts */
|
||||
u_int16_t src2dst_pkt_count; /*!< packet counts */
|
||||
u_int16_t dst2src_pkt_count; /*!< packet counts */
|
||||
u_int32_t src2dst_l4_bytes; /*!< packet counts */
|
||||
u_int32_t dst2src_l4_bytes; /*!< packet counts */
|
||||
u_int32_t src2dst_byte_count[MAX_BYTE_COUNT_ARRAY_LENGTH]; /*!< number of occurences of each byte */
|
||||
u_int32_t dst2src_byte_count[MAX_BYTE_COUNT_ARRAY_LENGTH]; /*!< number of occurences of each byte */
|
||||
u_int32_t src2dst_num_bytes;
|
||||
u_int32_t dst2src_num_bytes;
|
||||
double src2dst_bd_mean;
|
||||
double src2dst_bd_variance;
|
||||
double dst2src_bd_mean;
|
||||
double dst2src_bd_variance;
|
||||
float score;
|
||||
};
|
||||
|
||||
// flow tracking
|
||||
typedef struct ndpi_flow_info {
|
||||
u_int32_t flow_id;
|
||||
u_int32_t hashval;
|
||||
u_int32_t src_ip;
|
||||
u_int32_t dst_ip;
|
||||
@@ -82,25 +161,66 @@ typedef struct ndpi_flow_info {
|
||||
u_int16_t dst_port;
|
||||
u_int8_t detection_completed, protocol, bidirectional, check_extra_packets;
|
||||
u_int16_t vlan_id;
|
||||
ndpi_packet_tunnel tunnel_type;
|
||||
struct ndpi_flow_struct *ndpi_flow;
|
||||
char src_name[48], dst_name[48];
|
||||
u_int8_t ip_version;
|
||||
u_int64_t last_seen;
|
||||
u_int32_t cwr_count, src2dst_cwr_count, dst2src_cwr_count;
|
||||
u_int32_t ece_count, src2dst_ece_count, dst2src_ece_count;
|
||||
u_int32_t urg_count, src2dst_urg_count, dst2src_urg_count;
|
||||
u_int32_t ack_count, src2dst_ack_count, dst2src_ack_count;
|
||||
u_int32_t psh_count, src2dst_psh_count, dst2src_psh_count;
|
||||
u_int32_t syn_count, src2dst_syn_count, dst2src_syn_count;
|
||||
u_int32_t fin_count, src2dst_fin_count, dst2src_fin_count;
|
||||
u_int32_t rst_count, src2dst_rst_count, dst2src_rst_count;
|
||||
u_int32_t c_to_s_init_win, s_to_c_init_win;
|
||||
u_int64_t first_seen, last_seen;
|
||||
u_int64_t src2dst_bytes, dst2src_bytes;
|
||||
u_int64_t src2dst_goodput_bytes, dst2src_goodput_bytes;
|
||||
u_int32_t src2dst_packets, dst2src_packets;
|
||||
u_int32_t has_human_readeable_strings;
|
||||
char human_readeable_string_buffer[32];
|
||||
|
||||
// result only, not used for flow identification
|
||||
ndpi_protocol detected_protocol;
|
||||
|
||||
char info[96];
|
||||
char host_server_name[256];
|
||||
// Flow data analysis
|
||||
struct ndpi_analyze_struct *iat_c_to_s, *iat_s_to_c, *iat_flow,
|
||||
*pktlen_c_to_s, *pktlen_s_to_c;
|
||||
|
||||
char info[160];
|
||||
char flow_extra_info[16];
|
||||
char host_server_name[240];
|
||||
char bittorent_hash[41];
|
||||
|
||||
char dhcp_fingerprint[48];
|
||||
|
||||
struct {
|
||||
char client_info[64], server_info[64];
|
||||
} ssh_ssl;
|
||||
u_int16_t ssl_version;
|
||||
char client_requested_server_name[64], server_info[64],
|
||||
client_hassh[33], server_hassh[33], *server_names,
|
||||
*tls_alpn, *tls_supported_versions,
|
||||
server_organization[64],
|
||||
ja3_client[33], ja3_server[33],
|
||||
sha1_cert_fingerprint[20];
|
||||
u_int8_t sha1_cert_fingerprint_set;
|
||||
time_t notBefore, notAfter;
|
||||
u_int16_t server_cipher;
|
||||
ndpi_cipher_weakness client_unsafe_cipher, server_unsafe_cipher;
|
||||
} ssh_tls;
|
||||
|
||||
struct {
|
||||
char url[256], content_type[64], user_agent[128];
|
||||
u_int response_status_code;
|
||||
} http;
|
||||
|
||||
struct {
|
||||
char username[32], password[32];
|
||||
} telnet;
|
||||
|
||||
void *src_id, *dst_id;
|
||||
|
||||
struct ndpi_entropy entropy;
|
||||
struct ndpi_entropy last_entropy;
|
||||
} ndpi_flow_info_t;
|
||||
|
||||
|
||||
@@ -154,7 +274,7 @@ typedef struct ndpi_workflow {
|
||||
void **ndpi_flows_root;
|
||||
struct ndpi_detection_module_struct *ndpi_struct;
|
||||
u_int32_t num_allocated_flows;
|
||||
} ndpi_workflow_t;
|
||||
} ndpi_workflow_t;
|
||||
|
||||
|
||||
/* TODO: remove wrappers parameters and use ndpi global, when their initialization will be fixed... */
|
||||
@@ -197,6 +317,9 @@ int ndpi_workflow_node_cmp(const void *a, const void *b);
|
||||
void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_flow_info *flow);
|
||||
u_int32_t ethernet_crc32(const void* data, size_t n_bytes);
|
||||
void ndpi_flow_info_freer(void *node);
|
||||
void ndpi_free_flow_data_analysis(struct ndpi_flow_info *flow);
|
||||
const char* print_cipher_id(u_int32_t cipher);
|
||||
float ndpi_flow_get_byte_count_entropy(const uint32_t byte_count[256], unsigned int num_bytes);
|
||||
|
||||
extern int nDPI_LogLevel;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
bin_PROGRAMS = fuzz_process_packet fuzz_ndpi_reader
|
||||
|
||||
fuzz_process_packet_SOURCES = fuzz_process_packet.c
|
||||
fuzz_process_packet_LDFLAGS = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
else
|
||||
fuzz_process_packet_SOURCES += onefile.c
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_process_packet_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_process_packet_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_ndpi_reader_SOURCES = fuzz_ndpi_reader.c
|
||||
fuzz_ndpi_reader_CFLAGS = -I../example/
|
||||
fuzz_ndpi_reader_LDFLAGS = ../example/libndpiReader.a ../src/lib/libndpi.a $(PCAP_LIB) $(ADDITIONAL_LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
fuzz_ndpi_reader_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
else
|
||||
fuzz_ndpi_reader_SOURCES += onefile.c
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_ndpi_reader_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
EXTRA_fuzz_ndpi_reader_DEPENDENCIES = fuzz_ndpi_reader_seed_corpus.zip
|
||||
|
||||
testpcaps := $(wildcard ../tests/pcap/*.pcap)
|
||||
|
||||
fuzz_ndpi_reader_seed_corpus.zip: $(testpcaps)
|
||||
zip -r fuzz_ndpi_reader_seed_corpus.zip $(testpcaps)
|
||||
@@ -0,0 +1,91 @@
|
||||
#include "reader_util.h"
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#include <pcap/pcap.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct ndpi_workflow_prefs *prefs = NULL;
|
||||
|
||||
int nDPI_LogLevel = 0;
|
||||
char *_debug_protocols = NULL;
|
||||
u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0;
|
||||
u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0;
|
||||
u_int8_t enable_joy_stats = 0;
|
||||
u_int8_t human_readeable_string_len = 5;
|
||||
u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 80 /* due to telnet */;
|
||||
|
||||
int bufferToFile(const char * name, const uint8_t *Data, size_t Size) {
|
||||
FILE * fd;
|
||||
if (remove(name) != 0) {
|
||||
if (errno != ENOENT) {
|
||||
printf("failed remove, errno=%d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fd = fopen(name, "wb");
|
||||
if (fd == NULL) {
|
||||
printf("failed open, errno=%d\n", errno);
|
||||
return -2;
|
||||
}
|
||||
if (fwrite (Data, 1, Size, fd) != Size) {
|
||||
fclose(fd);
|
||||
return -3;
|
||||
}
|
||||
fclose(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
pcap_t * pkts;
|
||||
const u_char *pkt;
|
||||
struct pcap_pkthdr *header;
|
||||
int r;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
NDPI_PROTOCOL_BITMASK all;
|
||||
|
||||
if (prefs == NULL) {
|
||||
prefs = calloc(sizeof(struct ndpi_workflow_prefs), 1);
|
||||
if (prefs == NULL) {
|
||||
//should not happen
|
||||
return 1;
|
||||
}
|
||||
prefs->decode_tunnels = 1;
|
||||
prefs->num_roots = 16;
|
||||
prefs->max_ndpi_flows = 1024;
|
||||
prefs->quiet_mode = 0;
|
||||
}
|
||||
bufferToFile("/tmp/fuzz.pcap", Data, Size);
|
||||
|
||||
pkts = pcap_open_offline("/tmp/fuzz.pcap", errbuf);
|
||||
if (pkts == NULL) {
|
||||
return 0;
|
||||
}
|
||||
struct ndpi_workflow * workflow = ndpi_workflow_init(prefs, pkts);
|
||||
// enable all protocols
|
||||
NDPI_BITMASK_SET_ALL(all);
|
||||
ndpi_set_protocol_detection_bitmask2(workflow->ndpi_struct, &all);
|
||||
memset(workflow->stats.protocol_counter, 0,
|
||||
sizeof(workflow->stats.protocol_counter));
|
||||
memset(workflow->stats.protocol_counter_bytes, 0,
|
||||
sizeof(workflow->stats.protocol_counter_bytes));
|
||||
memset(workflow->stats.protocol_flows, 0,
|
||||
sizeof(workflow->stats.protocol_flows));
|
||||
ndpi_finalize_initalization(workflow->ndpi_struct);
|
||||
|
||||
r = pcap_next_ex(pkts, &header, &pkt);
|
||||
while (r > 0) {
|
||||
/* allocate an exact size buffer to check overflows */
|
||||
uint8_t *packet_checked = malloc(header->caplen);
|
||||
memcpy(packet_checked, pkt, header->caplen);
|
||||
ndpi_workflow_process_packet(workflow, header, packet_checked);
|
||||
free(packet_checked);
|
||||
r = pcap_next_ex(pkts, &header, &pkt);
|
||||
}
|
||||
ndpi_workflow_free(workflow);
|
||||
pcap_close(pkts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct ndpi_detection_module_struct *ndpi_info_mod = NULL;
|
||||
struct ndpi_id_struct *src;
|
||||
struct ndpi_id_struct *dst;
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
if (ndpi_info_mod == NULL) {
|
||||
ndpi_info_mod = ndpi_init_detection_module(ndpi_no_prefs);
|
||||
NDPI_PROTOCOL_BITMASK all;
|
||||
NDPI_BITMASK_SET_ALL(all);
|
||||
ndpi_set_protocol_detection_bitmask2(ndpi_info_mod, &all);
|
||||
src = ndpi_malloc(SIZEOF_ID_STRUCT);
|
||||
dst = ndpi_malloc(SIZEOF_ID_STRUCT);
|
||||
}
|
||||
|
||||
struct ndpi_flow_struct *ndpi_flow = ndpi_flow_malloc(SIZEOF_FLOW_STRUCT);
|
||||
memset(ndpi_flow, 0, SIZEOF_FLOW_STRUCT);
|
||||
memset(src, 0, SIZEOF_ID_STRUCT);
|
||||
memset(dst, 0, SIZEOF_ID_STRUCT);
|
||||
ndpi_detection_process_packet(ndpi_info_mod, ndpi_flow, Data, Size, 0, src, dst);
|
||||
ndpi_free_flow(ndpi_flow);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -29,8 +29,8 @@ build-rpm: build-src cleanup-rpm
|
||||
tar cvfz $(HOME)/rpmbuild/SOURCES/ndpi-@PACKAGE_VERSION@.tgz ndpi-@PACKAGE_VERSION@
|
||||
@rm -f $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE)
|
||||
@rpmbuild -bb ./$(APPL).spec --define "buildnumber $(GIT_REVISION)"
|
||||
@if [[ $EUID -ne 0 ]]; then ./rpm-sign.exp $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE); fi
|
||||
@if [[ $EUID -ne 0 ]]; then ./rpm-sign.exp $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(DEV_PACKAGE); fi
|
||||
@if [[ $EUID -ne 0 ]]; then @RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE); fi
|
||||
@if [[ $EUID -ne 0 ]]; then @RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(DEV_PACKAGE); fi
|
||||
@echo ""
|
||||
@echo "Package contents:"
|
||||
@rpm -qpl $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(PACKAGE)
|
||||
|
||||
Vendored
+12
@@ -583,6 +583,7 @@ PACKAGE_URL=''
|
||||
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
RPM_SIGN_CMD
|
||||
MAJOR_RELEASE
|
||||
GIT_REVISION
|
||||
KERNEL
|
||||
@@ -1698,6 +1699,16 @@ PACKAGE_VERSION=`../version.sh --release`
|
||||
MAJOR_RELEASE=`../version.sh --major-release`
|
||||
GIT_REVISION=`../version.sh --revision`
|
||||
|
||||
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 3|cut -d '.' -f 1`
|
||||
if test $CENTOS_RELEASE = "release"; then
|
||||
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 4|cut -d '.' -f 1`
|
||||
fi
|
||||
|
||||
RPM_SIGN_CMD="rpm --addsign"
|
||||
if test "$CENTOS_RELEASE" -ne 8; then
|
||||
RPM_SIGN_CMD="./rpm-sign.exp"
|
||||
fi
|
||||
|
||||
ac_config_files="$ac_config_files Makefile ndpi.spec"
|
||||
|
||||
|
||||
@@ -1710,6 +1721,7 @@ ac_config_files="$ac_config_files Makefile ndpi.spec"
|
||||
|
||||
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
|
||||
@@ -29,6 +29,16 @@ PACKAGE_VERSION=`../version.sh --release`
|
||||
MAJOR_RELEASE=`../version.sh --major-release`
|
||||
GIT_REVISION=`../version.sh --revision`
|
||||
|
||||
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 3|cut -d '.' -f 1`
|
||||
if test $CENTOS_RELEASE = "release"; then
|
||||
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 4|cut -d '.' -f 1`
|
||||
fi
|
||||
|
||||
RPM_SIGN_CMD="rpm --addsign"
|
||||
if test "$CENTOS_RELEASE" -ne 8; then
|
||||
RPM_SIGN_CMD="./rpm-sign.exp"
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile ndpi.spec])
|
||||
|
||||
AC_SUBST(PACKAGE_VERSION)
|
||||
@@ -39,6 +49,7 @@ AC_SUBST(DATE)
|
||||
AC_SUBST(KERNEL)
|
||||
AC_SUBST(GIT_REVISION)
|
||||
AC_SUBST(MAJOR_RELEASE)
|
||||
AC_SUBST(RPM_SIGN_CMD)
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ Version: @PACKAGE_VERSION@
|
||||
Release: %{buildnumber}
|
||||
License: LGPL
|
||||
Group: Networking/Utilities
|
||||
Conflicts: nprobe-dev
|
||||
URL: http://www.ntop.org/products/deep-packet-inspection/ndpi/
|
||||
Source: ndpi-%{version}.tgz
|
||||
Packager: Luca Deri <deri@ntop.org>
|
||||
@@ -13,6 +12,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
%{?el6:Requires: glibc >= 2.3.4 numactl coreutils }
|
||||
AutoReqProv: no
|
||||
|
||||
%define debug_package %{nil}
|
||||
|
||||
%description
|
||||
nDPI Open and Extensible LGPLv3 Deep Packet Inspection Library.
|
||||
|
||||
@@ -61,8 +62,10 @@ cd $RPM_BUILD_ROOT%{libdir}/; ln -s libndpi.so.@PACKAGE_VERSION@ libndpi.so.@MAJ
|
||||
cd $RPM_BUILD_ROOT%{libdir}/; ln -s libndpi.so.@PACKAGE_VERSION@ libndpi.so; cd -
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
|
||||
cp $HOME/nDPI/packages/etc/ld.so.conf.d/ndpi.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d
|
||||
rm -rf $RPM_BUILD_ROOT/usr/local/sbin/ndpi
|
||||
strip $RPM_BUILD_ROOT%{bindir}/*
|
||||
rm -fr %{buildroot}%{includedir}/ndpi_win32.h
|
||||
#sed -i -e "s/#include \"ndpi_win32.h\"//g" %{buildroot}%{includedir}/ndpi_main.h
|
||||
|
||||
%clean
|
||||
rm -fr $RPM_BUILD_ROOT
|
||||
@@ -74,8 +77,10 @@ rm -fr $RPM_BUILD_ROOT
|
||||
/usr/local/lib/libndpi.so.@MAJOR_RELEASE@
|
||||
/usr/local/lib/libndpi.so.@PACKAGE_VERSION@
|
||||
/usr/local/bin/ndpiReader
|
||||
/usr/local/share/ndpi/ndpiCustomCategory.txt
|
||||
/usr/local/share/ndpi/ndpiProtos.txt
|
||||
/etc/ld.so.conf.d/ndpi.conf
|
||||
/usr/local/libdata/pkgconfig/libndpi.pc
|
||||
%{libdir}/pkgconfig/libndpi.pc
|
||||
|
||||
%preun
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
CC=@CC@
|
||||
CFLAGS=-I. -I../src/include -I./src/lib/third_party/include -shared -Wl,
|
||||
#LIBNDPI=../src/lib/libndpi.so.@NDPI_VERSION_SHORT@
|
||||
LIBNDPI=../src/lib/libndpi.a
|
||||
LDFLAGS=$(CFILE) $(LIBNDPI) -lpcap
|
||||
SHARE = -soname,ndpi_wrap
|
||||
SO=ndpi_wrap.so
|
||||
OBJS = ndpi_wrap.o
|
||||
CFILE = ndpi_wrap.c
|
||||
PIC = -fPIC
|
||||
PREFIX?=/usr/local
|
||||
.PHONY: all
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)#do something for linux
|
||||
SHARE=-install_name,ndpiReader.so
|
||||
endif
|
||||
|
||||
all: $(SO)
|
||||
|
||||
$(SO): $(CFILE) $(LIBNDPI) Makefile
|
||||
$(CC) $(CFLAGS)$(SHARE) -o $@ $(PIC) $(LDFLAGS)
|
||||
# ln -s $(LIBNDPI) .
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(SO)
|
||||
@@ -0,0 +1,44 @@
|
||||
nDPI Python bindings
|
||||
--------------------
|
||||
|
||||
This directory contains the Python3 bindings for nDPI. We provide both ctypes and cffi based bindings.
|
||||
|
||||
**ctypes bindings**
|
||||
|
||||
Files:
|
||||
|
||||
* ndpi_typestruct.py
|
||||
* ndpi_wrap.c
|
||||
* Makefile.in
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install scapy
|
||||
python3 ndpi_example.py <interface>
|
||||
python3 ndpi_example.py <pcap_file>
|
||||
|
||||
Code courtesy:
|
||||
|
||||
* Massimo Puddu
|
||||
* Zied Aouini
|
||||
|
||||
**cffi bindings**
|
||||
|
||||
Files:
|
||||
|
||||
* ndpi.py
|
||||
|
||||
|
||||
Example (using NFStream package):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install nfstream
|
||||
python3 flow_printer.py <interface>
|
||||
python3 flow_printer.py <pcap_file>
|
||||
|
||||
Code courtesy:
|
||||
|
||||
* Zied Aouini
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
file: flow_printer.py
|
||||
This file is part of nfstream.
|
||||
|
||||
Copyright (C) 2019 - Zied Aouini <aouinizied@gmail.com>
|
||||
|
||||
nfstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
nfstream is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with nfstream.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from nfstream import NFStreamer
|
||||
import sys
|
||||
|
||||
|
||||
path = sys.argv[1]
|
||||
flow_streamer = NFStreamer(source=path)
|
||||
result = {}
|
||||
try:
|
||||
for flow in flow_streamer:
|
||||
print(flow)
|
||||
try:
|
||||
result[flow.application_name] += flow.total_packets
|
||||
except KeyError:
|
||||
result[flow.application_name] = flow.total_packets
|
||||
print("Summary (Application Name: Packets):")
|
||||
print(result)
|
||||
except KeyboardInterrupt:
|
||||
print("Summary (Application Name: Packets):")
|
||||
print(result)
|
||||
print("Terminated.")
|
||||
+1297
File diff suppressed because it is too large
Load Diff
Executable
+273
@@ -0,0 +1,273 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
file: ndpi_example.py
|
||||
This file is part of nDPI.
|
||||
|
||||
Copyright (C) 2011-19 - ntop.org
|
||||
Copyright (C) 2019 - Zied Aouini <aouinizied@gmail.com> (Incremental improvements)
|
||||
|
||||
nDPI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
nDPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with nDPI.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from ndpi_typestruct import *
|
||||
from ctypes import *
|
||||
from scapy.all import *
|
||||
import sys
|
||||
|
||||
# ------- return type & pcapstruct to declare -------
|
||||
|
||||
|
||||
class WorkFlow(Structure):
|
||||
_fields_ = [("src_ip", c_uint32),
|
||||
("dst_ip", c_uint32),
|
||||
("src_port", c_uint16),
|
||||
("dst_port", c_uint16),
|
||||
("protocol", c_uint8),
|
||||
("packets", c_uint32),
|
||||
("detected_protocol", NDPIProtocol),
|
||||
("detection_completed", c_uint8),
|
||||
("id", c_uint32),
|
||||
("src_id", POINTER(NDPIIdStruct)),
|
||||
("dst_id", POINTER(NDPIIdStruct)),
|
||||
("flow", POINTER(NDPIFlowStruct))]
|
||||
|
||||
|
||||
CMCFUN = CFUNCTYPE(c_int, c_void_p, c_void_p)
|
||||
GUESS = CFUNCTYPE(None, c_void_p, c_int32, c_int, c_void_p)
|
||||
FREE = CFUNCTYPE(None, c_void_p)
|
||||
|
||||
|
||||
def node_proto_guess_walker(nodo, which, depth, user_data):
|
||||
global ndpi_info_mod
|
||||
|
||||
flow = cast(nodo, POINTER(POINTER(WorkFlow))).contents.contents
|
||||
if which == 0 or which == 3: # execute only preorder operation of the tree
|
||||
if flow.detection_completed == 0: # order for tree operation
|
||||
flow.detected_protocol = ndpi.ndpi_detection_giveup(ndpi_info_mod,
|
||||
flow.flow,
|
||||
1,
|
||||
cast(addressof(c_uint8(0)), POINTER(c_uint8)))
|
||||
count_protocol[flow.detected_protocol.app_protocol] += flow.packets
|
||||
|
||||
|
||||
def py_cmp_fun(a, b):
|
||||
fa = cast(a, POINTER(WorkFlow))
|
||||
fb = cast(b, POINTER(WorkFlow))
|
||||
|
||||
if fa.contents.src_ip < fb.contents.src_ip: return -1
|
||||
elif fa.contents.src_ip > fb.contents.src_ip: return 1
|
||||
if fa.contents.src_port < fb.contents.src_port: return -1
|
||||
elif fa.contents.src_port > fb.contents.src_port: return 1
|
||||
if fa.contents.dst_ip < fb.contents.dst_ip: return -1
|
||||
elif fa.contents.dst_ip > fb.contents.dst_ip: return 1
|
||||
if fa.contents.dst_port < fb.contents.dst_port: return -1
|
||||
elif fa.contents.dst_port > fb.contents.dst_port: return 1
|
||||
if fa.contents.protocol < fb.contents.protocol: return -1
|
||||
elif fa.contents.protocol > fb.contents.protocol: return 1
|
||||
return 0
|
||||
|
||||
|
||||
def freer(a):
|
||||
pass
|
||||
|
||||
|
||||
cmp_func = CMCFUN(py_cmp_fun)
|
||||
guess_walker = GUESS(node_proto_guess_walker)
|
||||
free_walk = FREE(freer)
|
||||
|
||||
# --------------------------------------
|
||||
|
||||
# number of analyzed packet
|
||||
packet_number = 0
|
||||
flow_count = 0
|
||||
max_num_udp_dissected_pkts = 16
|
||||
max_num_tcp_dissected_pkts = 10
|
||||
flows_root = c_void_p(None)
|
||||
flows_root_ref = pointer(flows_root)
|
||||
count_protocol = (c_int32 * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + ndpi.ndpi_wrap_ndpi_max_num_custom_protocols() + 1))()
|
||||
lista = [] # used to avoid impropriate memory deallocation from python
|
||||
|
||||
|
||||
# check ndpi version
|
||||
if ndpi.ndpi_get_api_version() != ndpi.ndpi_wrap_get_api_version():
|
||||
print("nDPI Library version mismatch: please make sure this code and the nDPI library are in sync\n")
|
||||
sys.exit(-1)
|
||||
|
||||
# create data structure of ndpi
|
||||
ndpi_info_mod = ndpi.ndpi_init_detection_module()
|
||||
if ndpi_info_mod is None:
|
||||
sys.exit(-1)
|
||||
else:
|
||||
ndpi_ndpi_finalize_initalization(ndpi_info_mod)
|
||||
|
||||
|
||||
def ip2int(ip):
|
||||
"""
|
||||
Convert an IP string to long and then c_uint32
|
||||
"""
|
||||
packedIP = socket.inet_aton(ip)
|
||||
return int(struct.unpack("!I", packedIP)[0])
|
||||
|
||||
|
||||
def get_flow(pkt):
|
||||
global flows_root
|
||||
global flows_root_ref
|
||||
global flow_count
|
||||
|
||||
ip_packet = pkt[1]
|
||||
ip_protocol = ip_packet.proto
|
||||
transport_packet = None
|
||||
|
||||
if ip_protocol == 6 or ip_protocol == 17:
|
||||
transport_packet = pkt[2]
|
||||
if transport_packet is not None:
|
||||
# to avoid two nodes in one binary tree for a flow
|
||||
ip_src = ip2int(ip_packet.src)
|
||||
ip_dst = ip2int(ip_packet.dst)
|
||||
src_port = transport_packet.sport
|
||||
dst_port = transport_packet.dport
|
||||
else:
|
||||
return None
|
||||
# set flows to correct type and data
|
||||
ndpi_flow = pointer(NDPIFlowStruct())
|
||||
memset(ndpi_flow, 0, sizeof(NDPIFlowStruct))
|
||||
if ip_src > ip_dst:
|
||||
flow = WorkFlow(ip_src, ip_dst, src_port, dst_port, int(ip_packet.proto), 0, NDPIProtocol(), 0, 0,
|
||||
pointer(NDPIIdStruct()), pointer(NDPIIdStruct()), ndpi_flow)
|
||||
else:
|
||||
flow = WorkFlow(ip_dst, ip_src, dst_port, src_port, int(ip_packet.proto), 0, NDPIProtocol(), 0, 0,
|
||||
pointer(NDPIIdStruct()), pointer(NDPIIdStruct()), ndpi_flow)
|
||||
flow_ref = pointer(flow)
|
||||
res = ndpi.ndpi_tfind(flow_ref, flows_root_ref, cmp_func)
|
||||
if res is None:
|
||||
ndpi.ndpi_tsearch(flow_ref, pointer(flows_root), cmp_func) # add
|
||||
lista.append(flow)
|
||||
flow_count += 1
|
||||
return pointer(flow)
|
||||
flow = cast(res, POINTER(POINTER(WorkFlow))).contents
|
||||
return flow
|
||||
|
||||
|
||||
def packetcaptured(pkt):
|
||||
global packet_number
|
||||
global ndpi_info_mod
|
||||
|
||||
flow = None
|
||||
h = PcapPktHdr()
|
||||
|
||||
# getting flow
|
||||
try:
|
||||
flow = get_flow(pkt)
|
||||
except AttributeError:
|
||||
pass # ignore packet
|
||||
if flow is None: return
|
||||
|
||||
# filling pcap_pkthdr
|
||||
h.len = h.caplen = len(pkt)
|
||||
h.ts.tv_sec = int(pkt["IP"].time/1000000)
|
||||
h.ts.tv_usec = int(pkt["IP"].time)
|
||||
|
||||
# real work
|
||||
if int(pkt[1].frag) == 0: # not fragmented packet
|
||||
flow.contents.packets += 1
|
||||
packet_number += 1
|
||||
# get ndpi_iphdr address
|
||||
iphdr_addr = cast(c_char_p(pkt[1].build()), c_void_p)
|
||||
ndpi_flow = flow.contents.flow
|
||||
|
||||
if flow.contents.detection_completed is 0:
|
||||
flow.contents.detected_protocol = ndpi.ndpi_detection_process_packet(ndpi_info_mod,
|
||||
ndpi_flow,
|
||||
cast(iphdr_addr, POINTER(c_uint8)),
|
||||
int(pkt[1].len),
|
||||
h.ts.tv_usec,
|
||||
flow.contents.src_id,
|
||||
flow.contents.dst_id)
|
||||
|
||||
flow1 = flow.contents.detected_protocol
|
||||
|
||||
valid = False
|
||||
|
||||
if flow.contents.protocol == 6: valid = flow.contents.packets > max_num_tcp_dissected_pkts
|
||||
elif flow.contents.protocol == 17: valid = flow.contents.packets > max_num_udp_dissected_pkts
|
||||
|
||||
# should we continue anylizing packet or not?
|
||||
if valid or flow1.app_protocol is not 0:
|
||||
if valid or flow1.master_protocol is not 91: # or # 91 is NDPI_PROTOCOL_TLS
|
||||
flow.contents.detection_completed = 1 # protocol found
|
||||
if flow1.app_protocol is 0:
|
||||
flow.contents.detected_protocol = ndpi.ndpi_detection_giveup(ndpi_info_mod,
|
||||
ndpi_flow,
|
||||
1,
|
||||
cast(addressof(c_uint8(0)),
|
||||
POINTER(c_uint8)))
|
||||
|
||||
|
||||
def result():
|
||||
global flows_root_ref
|
||||
global ndpi_info_mod
|
||||
print('\nnumber of analyzed packet: ' + str(packet_number))
|
||||
print('number of flows: ' + str(flow_count))
|
||||
|
||||
ndpi.ndpi_twalk(flows_root_ref.contents, guess_walker, None)
|
||||
|
||||
print('\nDetected protocols:')
|
||||
for i in range(0, ndpi.ndpi_get_num_supported_protocols(ndpi_info_mod)):
|
||||
if count_protocol[i] > 0:
|
||||
print("{}: {} packets".format(
|
||||
cast(ndpi.ndpi_get_proto_name(ndpi_info_mod, i), c_char_p).value.decode('utf-8'),
|
||||
str(count_protocol[i])))
|
||||
|
||||
|
||||
def free(ndpi_struct):
|
||||
ndpi.ndpi_tdestroy(flows_root, free_walk)
|
||||
ndpi.ndpi_exit_detection_module(ndpi_struct)
|
||||
|
||||
|
||||
def initialize(ndpi_struct):
|
||||
all = NDPIProtocolBitMask()
|
||||
ndpi.ndpi_wrap_NDPI_BITMASK_SET_ALL(pointer(all))
|
||||
ndpi.ndpi_set_protocol_detection_bitmask2(ndpi_struct, pointer(all))
|
||||
|
||||
|
||||
print('Using nDPI ' + cast(ndpi.ndpi_revision(), c_char_p).value.decode("utf-8"))
|
||||
|
||||
initialize(ndpi_info_mod)
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("\nUsage: ndpi_example.py <device>")
|
||||
sys.exit(0)
|
||||
|
||||
if "." in sys.argv[1]:
|
||||
print('Reading pcap from file ' + sys.argv[1] + '...')
|
||||
scapy_cap = None
|
||||
try:
|
||||
scapy_cap = rdpcap(sys.argv[1])
|
||||
except FileNotFoundError:
|
||||
print("\nFile not found")
|
||||
except Scapy_Exception:
|
||||
print("\nBad pcap")
|
||||
else:
|
||||
for packet in scapy_cap:
|
||||
packetcaptured(packet)
|
||||
else:
|
||||
print('Capturing live traffic from device ' + sys.argv[1] + '...')
|
||||
try:
|
||||
sniff(iface=sys.argv[1], prn=packetcaptured)
|
||||
except KeyboardInterrupt:
|
||||
print('\nInterrupted\n')
|
||||
except PermissionError:
|
||||
sys.exit('\nRoot privilege required for live capture on interface: {}\n'.format(sys.argv[1]))
|
||||
|
||||
|
||||
result()
|
||||
free(ndpi_info_mod)
|
||||
@@ -0,0 +1,864 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
file: ndpi_typestruct.py
|
||||
This file is part of nDPI.
|
||||
|
||||
Copyright (C) 2011-19 - ntop.org
|
||||
Copyright (C) 2019 - Zied Aouini <aouinizied@gmail.com> (Incremental improvements)
|
||||
|
||||
nDPI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
nDPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with nDPI.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from ctypes import CDLL, Structure, c_uint16, c_int, c_ulong, c_uint32, CFUNCTYPE, c_void_p, POINTER, c_char_p, c_uint8
|
||||
from ctypes import c_char, c_uint, c_int16, c_longlong, c_size_t, Union, c_ubyte, c_uint64, c_int32, c_ushort, cast
|
||||
from os.path import abspath, dirname
|
||||
ndpi = CDLL(dirname(abspath(__file__)) + '/ndpi_wrap.so')
|
||||
|
||||
# ----------------------------------------------- Structures -----------------------------------------------------------
|
||||
|
||||
|
||||
class NDPIDetectionModuleStruct(Structure):
|
||||
pass
|
||||
|
||||
|
||||
class NDPIFlowStruct(Structure):
|
||||
pass
|
||||
|
||||
|
||||
class NDPIProtocol(Structure):
|
||||
_fields_ = [
|
||||
("master_protocol", c_uint16),
|
||||
("app_protocol", c_uint16),
|
||||
("category", c_int)
|
||||
]
|
||||
|
||||
|
||||
class TimeVal(Structure):
|
||||
_fields_ = [("tv_sec", c_ulong), ("tv_usec", c_ulong)]
|
||||
|
||||
|
||||
class PcapPktHdr(Structure):
|
||||
_fields_ = [("ts", TimeVal), ("caplen", c_uint32), ("len", c_uint32)]
|
||||
|
||||
|
||||
class NDPIMask(Structure):
|
||||
_fields_ = [("fds_bits", c_uint32)]
|
||||
|
||||
|
||||
class NDPIProtocolBitMask(Structure):
|
||||
_fields_ = [("fds_bits", NDPIMask * ndpi.ndpi_wrap_ndpi_num_fds_bits())]
|
||||
|
||||
|
||||
class NDPISubprotocolConfStruct(Structure):
|
||||
_fields_ = [("func", CFUNCTYPE(c_void_p, POINTER(NDPIDetectionModuleStruct), c_char_p, c_char_p, c_int))]
|
||||
|
||||
|
||||
class NDPIAutoma(Structure):
|
||||
_fields_ = [
|
||||
("ac_automa", c_void_p),
|
||||
("ac_automa_finalized", c_uint8)
|
||||
]
|
||||
|
||||
|
||||
class NDPINode(Structure):
|
||||
pass
|
||||
|
||||
|
||||
NDPINode._fields_ = [
|
||||
('key', POINTER(c_char)),
|
||||
('left', POINTER(NDPINode)),
|
||||
('right', POINTER(NDPINode)),
|
||||
]
|
||||
|
||||
|
||||
class NDPICallFunctionStruct(Structure):
|
||||
_fields_ = [
|
||||
("detection_bitmask", NDPIProtocolBitMask),
|
||||
("excluded_protocol_bitmask", NDPIProtocolBitMask),
|
||||
("ndpi_selection_bitmask", c_uint32),
|
||||
("func", CFUNCTYPE(None, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))),
|
||||
("detection_feature", c_uint8)
|
||||
]
|
||||
|
||||
|
||||
class NDPIProtoDefaultsT(Structure):
|
||||
_fields_ = [
|
||||
("protoName", c_char_p),
|
||||
("protoCategory", c_uint),
|
||||
("can_have_a_subprotocol", c_uint8),
|
||||
("protoId", c_uint16),
|
||||
("protoIdx", c_uint16),
|
||||
("master_tcp_protoId", c_uint16 * 2),
|
||||
("master_udp_protoId", c_uint16 * 2),
|
||||
("protoBreed", c_uint),
|
||||
("func", CFUNCTYPE(None, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))),
|
||||
]
|
||||
|
||||
|
||||
class NDPIDefaultsPortsTreeNodeT(Structure):
|
||||
_fields_ = [
|
||||
("proto", NDPIProtoDefaultsT),
|
||||
("customUserProto", c_uint8),
|
||||
("default_port", c_int16)
|
||||
]
|
||||
|
||||
|
||||
class SpinlockT(Structure):
|
||||
_fields_ = [("val", c_int)]
|
||||
|
||||
|
||||
class AtomicT(Structure):
|
||||
_fields_ = [("counter", c_int)]
|
||||
|
||||
|
||||
class TimeT(Structure):
|
||||
_fields_ = [("counter", c_longlong)]
|
||||
|
||||
|
||||
class HashIp4pNode(Structure):
|
||||
pass
|
||||
|
||||
|
||||
HashIp4pNode._fields_ = [
|
||||
("next", POINTER(HashIp4pNode)),
|
||||
("prev", POINTER(HashIp4pNode)),
|
||||
("lchg", TimeT),
|
||||
("port", c_uint16),
|
||||
("count", c_uint16, 12),
|
||||
("flag", c_uint16, 4),
|
||||
("ip", c_uint32)
|
||||
]
|
||||
|
||||
|
||||
class HashIp4p(Structure):
|
||||
_fields_ = [
|
||||
("top", POINTER(HashIp4pNode)),
|
||||
("lock",SpinlockT),
|
||||
("len", c_size_t)
|
||||
]
|
||||
|
||||
|
||||
class HashIp4pTable(Structure):
|
||||
_fields_ = [
|
||||
("size", c_size_t),
|
||||
("ipv6", c_int),
|
||||
("lock", SpinlockT),
|
||||
("count", AtomicT),
|
||||
("tbl", HashIp4p)
|
||||
]
|
||||
|
||||
|
||||
class BtAnnounce(Structure):
|
||||
_fields_ = [
|
||||
("hash", c_uint32 * 5),
|
||||
("ip", c_uint32 * 4),
|
||||
("time", c_uint32),
|
||||
("port", c_uint16),
|
||||
("name_len", c_uint8),
|
||||
("name", c_uint8 * 149)
|
||||
]
|
||||
|
||||
|
||||
class NDPILruCacheEntry(Structure):
|
||||
_fields_ = [
|
||||
("key", c_uint32),
|
||||
("is_full", c_uint32, 1),
|
||||
("value", c_uint32, 16),
|
||||
("pad", c_uint32, 15)
|
||||
]
|
||||
|
||||
|
||||
class NDPILruCache(Structure):
|
||||
_fields_ = [
|
||||
("num_entries", c_uint32),
|
||||
("entries", POINTER(NDPILruCacheEntry)),
|
||||
]
|
||||
|
||||
|
||||
class CacheEntry(Structure):
|
||||
pass
|
||||
|
||||
|
||||
CacheEntry._fields_ = [
|
||||
("item", c_void_p),
|
||||
("item_size", c_uint32),
|
||||
("prev", POINTER(CacheEntry)),
|
||||
("next", POINTER(CacheEntry))
|
||||
]
|
||||
|
||||
|
||||
class CacheEntryMap(Structure):
|
||||
pass
|
||||
|
||||
|
||||
CacheEntryMap._fields_ = [
|
||||
("entry", POINTER(CacheEntry)),
|
||||
("next", POINTER(CacheEntryMap)),
|
||||
]
|
||||
|
||||
|
||||
class Cache(Structure):
|
||||
_fields_ = [
|
||||
("size", c_uint32),
|
||||
("max_size", c_uint32),
|
||||
("head", POINTER(CacheEntry)),
|
||||
("tail", POINTER(CacheEntry)),
|
||||
("map", POINTER(POINTER(CacheEntryMap)))
|
||||
]
|
||||
|
||||
|
||||
class CustomCategories(Structure):
|
||||
_fields_ = [
|
||||
("hostnames", NDPIAutoma),
|
||||
("hostnames_shadow", NDPIAutoma),
|
||||
("ipAddresses", c_void_p),
|
||||
("ipAddresses_shadow", c_void_p),
|
||||
("categories_loaded", c_uint8),
|
||||
]
|
||||
|
||||
|
||||
NDPIDetectionModuleStruct._fields_ = [
|
||||
("detection_bitmask", NDPIProtocolBitMask),
|
||||
("generic_http_packet_bitmask", NDPIProtocolBitMask),
|
||||
("current_ts", c_uint32),
|
||||
("ticks_per_second", c_uint32),
|
||||
("custom_category_labels",
|
||||
(c_char * ndpi.ndpi_wrap_num_custom_categories()) * ndpi.ndpi_wrap_custom_category_label_len()),
|
||||
("callback_buffer", NDPICallFunctionStruct * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + 1)),
|
||||
("callback_buffer_size", c_uint32),
|
||||
("callback_buffer_tcp_no_payload", NDPICallFunctionStruct * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + 1)),
|
||||
("callback_buffer_size_tcp_no_payload", c_uint32),
|
||||
("callback_buffer_tcp_payload", NDPICallFunctionStruct * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + 1)),
|
||||
("callback_buffer_size_tcp_payload", c_uint32),
|
||||
("callback_buffer_udp", NDPICallFunctionStruct * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + 1)),
|
||||
("callback_buffer_size_udp", c_uint32),
|
||||
("callback_buffer_non_tcp_udp", NDPICallFunctionStruct * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + 1)),
|
||||
("callback_buffer_size_non_tcp_udp", c_uint32),
|
||||
("tcpRoot", POINTER(NDPIDefaultsPortsTreeNodeT)),
|
||||
("udpRoot", POINTER(NDPIDefaultsPortsTreeNodeT)),
|
||||
("ndpi_log_level", c_uint),
|
||||
("tcp_max_retransmission_window_size", c_uint32),
|
||||
("directconnect_connection_ip_tick_timeout", c_uint32),
|
||||
("subprotocol_conf", NDPISubprotocolConfStruct * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() + 1)),
|
||||
("ndpi_num_supported_protocols", c_uint),
|
||||
("ndpi_num_custom_protocols", c_uint),
|
||||
("host_automa", NDPIAutoma),
|
||||
("content_automa", NDPIAutoma),
|
||||
("subprotocol_automa", NDPIAutoma),
|
||||
("bigrams_automa", NDPIAutoma),
|
||||
("impossible_bigrams_automa", NDPIAutoma),
|
||||
("custom_categories", CustomCategories),
|
||||
("protocols_ptree", c_void_p),
|
||||
("irc_timeout", c_uint32),
|
||||
("gnutella_timeout", c_uint32),
|
||||
("battlefield_timeout", c_uint32),
|
||||
("thunder_timeout", c_uint32),
|
||||
("soulseek_connection_ip_tick_timeout", c_uint32),
|
||||
("rtsp_connection_timeout", c_uint32),
|
||||
("tvants_connection_timeout", c_uint32),
|
||||
("orb_rstp_ts_timeout", c_uint32),
|
||||
("yahoo_detect_http_connections", c_uint8),
|
||||
("yahoo_lan_video_timeout", c_uint32),
|
||||
("zattoo_connection_timeout", c_uint32),
|
||||
("jabber_stun_timeout", c_uint32),
|
||||
("jabber_file_transfer_timeout", c_uint32),
|
||||
("ip_version_limit", c_uint8),
|
||||
("bt_ht", POINTER(HashIp4pTable)),
|
||||
("bt6_ht", POINTER(HashIp4pTable)),
|
||||
("bt_ann", POINTER(BtAnnounce)),
|
||||
("bt_ann_len", c_int),
|
||||
("ookla_cache", POINTER(NDPILruCache)),
|
||||
("tinc_cache", POINTER(Cache)),
|
||||
("proto_defaults", NDPIProtoDefaultsT * (ndpi.ndpi_wrap_ndpi_max_supported_protocols() +
|
||||
ndpi.ndpi_wrap_ndpi_max_num_custom_protocols())),
|
||||
("http_dont_dissect_response", c_uint8, 1),
|
||||
("dns_dont_dissect_response", c_uint8, 1),
|
||||
("direction_detect_disable", c_uint8, 1),
|
||||
("disable_metadata_export", c_uint8, 1),
|
||||
("hyperscan", c_void_p)
|
||||
]
|
||||
|
||||
|
||||
class U6Addr(Union):
|
||||
_fields_ = [
|
||||
("u6_addr8", c_uint8 * 16),
|
||||
("u6_addr16", c_uint16 * 8),
|
||||
("u6_addr32", c_uint32 * 4),
|
||||
("u6_addr64", c_uint64 * 2)
|
||||
]
|
||||
|
||||
|
||||
class NDPIIn6Addr(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [("u6_addr", U6Addr)]
|
||||
|
||||
|
||||
class NDPIIpAddrT(Union):
|
||||
_fields_ = [
|
||||
('ipv4', c_uint32),
|
||||
('ipv4_u_int8_t', c_uint8 * 4),
|
||||
('ipv6', NDPIIn6Addr),
|
||||
]
|
||||
|
||||
|
||||
class NDPIIdStruct(Structure):
|
||||
_fields_ = [
|
||||
('detected_protocol_bitmask', NDPIProtocolBitMask),
|
||||
('rtsp_ip_address', NDPIIpAddrT),
|
||||
('yahoo_video_lan_timer', c_uint32),
|
||||
('irc_port', c_uint16 * 8),
|
||||
('last_time_port_used', c_uint32 * 8),
|
||||
('irc_ts', c_uint32),
|
||||
('gnutella_ts', c_uint32),
|
||||
('battlefield_ts', c_uint32),
|
||||
('thunder_ts', c_uint32),
|
||||
('rtsp_timer', c_uint32),
|
||||
('oscar_last_safe_access_time', c_uint32),
|
||||
('zattoo_ts', c_uint32),
|
||||
('jabber_stun_or_ft_ts', c_uint32),
|
||||
('directconnect_last_safe_access_time', c_uint32),
|
||||
('soulseek_last_safe_access_time', c_uint32),
|
||||
('detected_directconnect_port', c_uint16),
|
||||
('detected_directconnect_udp_port', c_uint16),
|
||||
('detected_directconnect_ssl_port', c_uint16),
|
||||
('bt_port_t', c_uint16 * 8),
|
||||
('bt_port_u', c_uint16 * 8),
|
||||
('jabber_voice_stun_port', c_uint16 * 6),
|
||||
('jabber_file_transfer_port', c_uint16 * 2),
|
||||
('detected_gnutella_port', c_uint16),
|
||||
('detected_gnutella_udp_port1', c_uint16),
|
||||
('detected_gnutella_udp_port2', c_uint16),
|
||||
('soulseek_listen_port', c_uint16),
|
||||
('irc_number_of_port', c_uint8),
|
||||
('oscar_ssl_session_id', c_uint8 * 33),
|
||||
('jabber_voice_stun_used_ports', c_uint8),
|
||||
('yahoo_video_lan_dir', c_uint32, 1),
|
||||
('yahoo_conf_logged_in', c_uint32, 1),
|
||||
('yahoo_voice_conf_logged_in', c_uint32, 1),
|
||||
('rtsp_ts_set', c_uint32, 1),
|
||||
]
|
||||
|
||||
|
||||
class NDPIFlowTcpStruct(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('smtp_command_bitmask', c_uint16),
|
||||
('pop_command_bitmask', c_uint16),
|
||||
('qq_nxt_len', c_uint16),
|
||||
('wa_matched_so_far', c_uint8),
|
||||
('tds_login_version', c_uint8),
|
||||
('irc_stage', c_uint8),
|
||||
('irc_port', c_uint8),
|
||||
('h323_valid_packets', c_uint8),
|
||||
('gnutella_msg_id', c_uint8 * 3),
|
||||
('irc_3a_counter', c_uint32, 3),
|
||||
('irc_stage2', c_uint32, 5),
|
||||
('irc_direction', c_uint32, 2),
|
||||
('irc_0x1000_full', c_uint32, 1),
|
||||
('soulseek_stage', c_uint32, 2),
|
||||
('tds_stage', c_uint32, 3),
|
||||
('usenet_stage', c_uint32, 2),
|
||||
('imesh_stage', c_uint32, 4),
|
||||
('http_setup_dir', c_uint32, 2),
|
||||
('http_stage', c_uint32, 2),
|
||||
('http_empty_line_seen', c_uint32, 1),
|
||||
('http_wait_for_retransmission', c_uint32, 1),
|
||||
('gnutella_stage', c_uint32, 2),
|
||||
('mms_stage', c_uint32, 2),
|
||||
('yahoo_sip_comm', c_uint32, 1),
|
||||
('yahoo_http_proxy_stage', c_uint32, 2),
|
||||
('msn_stage', c_uint32, 3),
|
||||
('msn_ssl_ft', c_uint32, 2),
|
||||
('ssh_stage', c_uint32, 3),
|
||||
('vnc_stage', c_uint32, 2),
|
||||
('telnet_stage', c_uint32, 2),
|
||||
('tls_srv_cert_fingerprint_ctx', c_void_p),
|
||||
('tls_seen_client_cert', c_uint8, 1),
|
||||
('tls_seen_server_cert', c_uint8, 1),
|
||||
('tls_seen_certificate', c_uint8, 1),
|
||||
('tls_srv_cert_fingerprint_found', c_uint8, 1),
|
||||
('tls_srv_cert_fingerprint_processed', c_uint8, 1),
|
||||
('tls_stage', c_uint8, 2),
|
||||
('tls_record_offset', c_int16),
|
||||
('tls_fingerprint_len', c_int16),
|
||||
('tls_sha1_certificate_fingerprint', c_uint8 * 20),
|
||||
('postgres_stage', c_uint32, 3),
|
||||
('ddlink_server_direction', c_uint32, 1),
|
||||
('seen_syn', c_uint32, 1),
|
||||
('seen_syn_ack', c_uint32, 1),
|
||||
('seen_ack', c_uint32, 1),
|
||||
('icecast_stage', c_uint32, 1),
|
||||
('dofus_stage', c_uint32, 1),
|
||||
('fiesta_stage', c_uint32, 2),
|
||||
('wow_stage', c_uint32, 2),
|
||||
('veoh_tv_stage', c_uint32, 2),
|
||||
('shoutcast_stage', c_uint32, 2),
|
||||
('rtp_special_packets_seen', c_uint32, 1),
|
||||
('mail_pop_stage', c_uint32, 2),
|
||||
('mail_imap_stage', c_uint32, 3),
|
||||
('mail_imap_starttls', c_uint32, 2),
|
||||
('skype_packet_id', c_uint8),
|
||||
('citrix_packet_id', c_uint8),
|
||||
('lotus_notes_packet_id', c_uint8),
|
||||
('teamviewer_stage', c_uint8),
|
||||
('prev_zmq_pkt_len', c_uint8),
|
||||
('prev_zmq_pkt', c_char * 10),
|
||||
('ppstream_stage', c_uint32, 3),
|
||||
('memcached_matches', c_uint8),
|
||||
('nest_log_sink_matches', c_uint8),
|
||||
]
|
||||
|
||||
|
||||
class NDPIFlowUdpStruct(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('battlefield_msg_id', c_uint32),
|
||||
('snmp_msg_id', c_uint32),
|
||||
('battlefield_stage', c_uint32, 3),
|
||||
('snmp_stage', c_uint32, 2),
|
||||
('ppstream_stage', c_uint32, 3),
|
||||
('halflife2_stage', c_uint32, 2),
|
||||
('tftp_stage', c_uint32, 1),
|
||||
('aimini_stage', c_uint32, 5),
|
||||
('xbox_stage', c_uint32, 1),
|
||||
('wsus_stage', c_uint32, 1),
|
||||
('skype_packet_id', c_uint8),
|
||||
('teamviewer_stage', c_uint8),
|
||||
('eaq_pkt_id', c_uint8),
|
||||
('eaq_sequence', c_uint32),
|
||||
('rx_conn_epoch', c_uint32),
|
||||
('rx_conn_id', c_uint32),
|
||||
('memcached_matches', c_uint8),
|
||||
('wireguard_stage', c_uint8),
|
||||
('wireguard_peer_index', c_uint32 * 2),
|
||||
]
|
||||
|
||||
|
||||
class L4(Union):
|
||||
_fields_ = [("tcp", NDPIFlowTcpStruct), ("udp", NDPIFlowUdpStruct)]
|
||||
|
||||
|
||||
class Http(Structure):
|
||||
_fields_ = [
|
||||
("method", c_int),
|
||||
("url", c_char_p),
|
||||
("content_type", c_char_p),
|
||||
("num_request_headers", c_uint8),
|
||||
("num_response_headers", c_uint8),
|
||||
("request_version", c_uint8),
|
||||
("response_status_code", c_uint16),
|
||||
]
|
||||
|
||||
|
||||
class Dns(Structure):
|
||||
_fields_ = [
|
||||
("num_queries", c_uint8),
|
||||
("num_answers", c_uint8),
|
||||
("reply_code", c_uint8),
|
||||
("is_query", c_uint8),
|
||||
("query_type", c_uint16),
|
||||
("query_class", c_uint16),
|
||||
("rsp_type", c_uint16),
|
||||
("rsp_addr", NDPIIpAddrT)
|
||||
]
|
||||
|
||||
|
||||
class Ntp(Structure):
|
||||
_fields_ = [("request_code", c_uint8),
|
||||
("version", c_uint8)]
|
||||
|
||||
|
||||
class Kerberos(Structure):
|
||||
_fields_ = [("cname", c_char * 24),
|
||||
("realm", c_char * 24)]
|
||||
|
||||
|
||||
class Ssl(Structure):
|
||||
_fields_ = [
|
||||
("ssl_version", c_uint16),
|
||||
("client_certificate", c_char * 64),
|
||||
("server_certificate", c_char * 64),
|
||||
("server_organization", c_char * 64),
|
||||
('notBefore', c_uint32),
|
||||
('notAfter', c_uint32),
|
||||
("ja3_client", c_char * 33),
|
||||
("ja3_server", c_char * 33),
|
||||
("server_cipher", c_uint16),
|
||||
("server_unsafe_cipher", c_int)
|
||||
]
|
||||
|
||||
|
||||
class Stun(Structure):
|
||||
_fields_ = [
|
||||
("num_udp_pkts", c_uint8),
|
||||
("num_processed_pkts", c_uint8),
|
||||
("num_binding_requests", c_uint8),
|
||||
]
|
||||
|
||||
|
||||
class StunSsl(Structure):
|
||||
_fields_ = [("ssl", Ssl), ("stun", Stun)]
|
||||
|
||||
|
||||
class Ssh(Structure):
|
||||
_fields_ = [
|
||||
("client_signature", c_char * 48),
|
||||
("server_signature", c_char * 48),
|
||||
("hassh_client", c_char * 33),
|
||||
("hassh_server", c_char * 33)
|
||||
]
|
||||
|
||||
|
||||
class Imo(Structure):
|
||||
_fields_ = [
|
||||
("last_one_byte_pkt", c_uint8),
|
||||
("last_byte", c_uint8)
|
||||
]
|
||||
|
||||
|
||||
class Mdns(Structure):
|
||||
_fields_ = [("answer", c_char * 96)]
|
||||
|
||||
|
||||
class Ubntac2(Structure):
|
||||
_fields_ = [("version", c_char * 32)]
|
||||
|
||||
|
||||
class Http2(Structure):
|
||||
_fields_ = [
|
||||
("detected_os", c_char * 32),
|
||||
("nat_ip", c_char * 24)
|
||||
]
|
||||
|
||||
|
||||
class Bittorrent(Structure):
|
||||
_fields_ = [("hash", c_char * 20)]
|
||||
|
||||
|
||||
class Dhcp(Structure):
|
||||
_fields_ = [
|
||||
("fingerprint", c_char * 48),
|
||||
("class_ident", c_char * 48)
|
||||
]
|
||||
|
||||
|
||||
class Protos(Union):
|
||||
_fields_ = [
|
||||
("dns", Dns),
|
||||
("kerberos", Kerberos),
|
||||
("stun_ssl", StunSsl),
|
||||
("ssh", Ssh),
|
||||
("imo", Imo),
|
||||
("mdns", Mdns),
|
||||
("ubntac2", Ubntac2),
|
||||
("http", Http2),
|
||||
("bittorrent", Bittorrent),
|
||||
("dhcp", Dhcp)
|
||||
]
|
||||
|
||||
|
||||
class TincCacheEntry(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('src_address', c_uint32),
|
||||
('dst_address', c_uint32),
|
||||
('dst_port', c_uint16),
|
||||
]
|
||||
|
||||
|
||||
class NDPIIntOneLineStruct(Structure):
|
||||
_fields_ = [
|
||||
('ptr', POINTER(c_uint8)),
|
||||
('len', c_uint16),
|
||||
]
|
||||
|
||||
|
||||
class NDPIIphdr(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('ihl', c_uint8, 4),
|
||||
('version', c_uint8, 4),
|
||||
('tos', c_uint8),
|
||||
('tot_len', c_uint16),
|
||||
('id', c_uint16),
|
||||
('frag_off', c_uint16),
|
||||
('ttl', c_uint8),
|
||||
('protocol', c_uint8),
|
||||
('check', c_uint16),
|
||||
('saddr', c_uint32),
|
||||
('daddr', c_uint32)]
|
||||
|
||||
|
||||
class NDPIIp6Hdrctl(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('ip6_un1_flow', c_uint32),
|
||||
('ip6_un1_plen', c_uint16),
|
||||
('ip6_un1_nxt', c_uint8),
|
||||
('ip6_un1_hlim', c_uint8),
|
||||
]
|
||||
|
||||
|
||||
class NDPIIpv6hdr(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('ip6_hdr', NDPIIp6Hdrctl),
|
||||
('ip6_src', NDPIIn6Addr),
|
||||
('ip6_dst', NDPIIn6Addr),
|
||||
]
|
||||
|
||||
|
||||
class NDPITcpHdr(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('source', c_uint16),
|
||||
('dest', c_uint16),
|
||||
('seq', c_uint32),
|
||||
('ack_seq', c_uint32),
|
||||
('res1', c_uint16, 4),
|
||||
('doff', c_uint16, 4),
|
||||
('fin', c_uint16, 1),
|
||||
('syn', c_uint16, 1),
|
||||
('rst', c_uint16, 1),
|
||||
('psh', c_uint16, 1),
|
||||
('ack', c_uint16, 1),
|
||||
('urg', c_uint16, 1),
|
||||
('ece', c_uint16, 1),
|
||||
('cwr', c_uint16, 1),
|
||||
('window', c_uint16),
|
||||
('check', c_uint16),
|
||||
('urg_ptr', c_uint16),
|
||||
]
|
||||
|
||||
|
||||
class NDPIUdpHdr(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('source', c_uint16),
|
||||
('dest', c_uint16),
|
||||
('len', c_uint16),
|
||||
('check', c_uint16),
|
||||
]
|
||||
|
||||
|
||||
class NDPIPacketStructStack(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('detected_subprotocol_stack', c_uint8 * ndpi.ndpi_wrap_ndpi_procol_size()),
|
||||
('protocol_stack_info', c_uint16)
|
||||
]
|
||||
|
||||
|
||||
class NDPIPacketStruct(Structure):
|
||||
_fields_ = [
|
||||
('iph', POINTER(NDPIIphdr)),
|
||||
('iphv6', POINTER(NDPIIpv6hdr)),
|
||||
('tcp', POINTER(NDPITcpHdr)),
|
||||
('udp', POINTER(NDPIUdpHdr)),
|
||||
('generic_l4_ptr', POINTER(c_uint8)),
|
||||
('payload', POINTER(c_uint8)),
|
||||
('tick_timestamp', c_uint32),
|
||||
('tick_timestamp_l', c_uint64),
|
||||
('detected_protocol_stack', c_uint16 * ndpi.ndpi_wrap_ndpi_procol_size()),
|
||||
('ndpi_packet_stack', NDPIPacketStructStack),
|
||||
('line', NDPIIntOneLineStruct * 64),
|
||||
('host_line', NDPIIntOneLineStruct),
|
||||
('forwarded_line', NDPIIntOneLineStruct),
|
||||
('referer_line', NDPIIntOneLineStruct),
|
||||
('content_line', NDPIIntOneLineStruct),
|
||||
('accept_line', NDPIIntOneLineStruct),
|
||||
('user_agent_line', NDPIIntOneLineStruct),
|
||||
('http_url_name', NDPIIntOneLineStruct),
|
||||
('http_encoding', NDPIIntOneLineStruct),
|
||||
('http_transfer_encoding', NDPIIntOneLineStruct),
|
||||
('http_contentlen', NDPIIntOneLineStruct),
|
||||
('http_cookie', NDPIIntOneLineStruct),
|
||||
('http_origin', NDPIIntOneLineStruct),
|
||||
('http_x_session_type', NDPIIntOneLineStruct),
|
||||
('server_line', NDPIIntOneLineStruct),
|
||||
('http_method', NDPIIntOneLineStruct),
|
||||
('http_response', NDPIIntOneLineStruct),
|
||||
('http_num_headers', c_uint8),
|
||||
('l3_packet_len', c_uint16),
|
||||
('l4_packet_len', c_uint16),
|
||||
('payload_packet_len', c_uint16),
|
||||
('actual_payload_len', c_uint16),
|
||||
('num_retried_bytes', c_uint16),
|
||||
('parsed_lines', c_uint16),
|
||||
('parsed_unix_lines', c_uint16),
|
||||
('empty_line_position', c_uint16),
|
||||
('tcp_retransmission', c_uint8),
|
||||
('l4_protocol', c_uint8),
|
||||
('ssl_certificate_detected', c_uint8, 4),
|
||||
('ssl_certificate_num_checks', c_uint8, 4),
|
||||
('packet_lines_parsed_complete', c_uint8, 1),
|
||||
('packet_direction', c_uint8, 1),
|
||||
('empty_line_position_set', c_uint8, 1),
|
||||
('pad', c_uint8, 5),
|
||||
]
|
||||
|
||||
|
||||
class NDPIFlowStructStack(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
("detected_protocol_stack", c_uint16 * ndpi.ndpi_wrap_ndpi_procol_size()),
|
||||
("protocol_stack_info", c_uint16)
|
||||
]
|
||||
|
||||
|
||||
NDPIFlowStruct._fields_ = [
|
||||
("ndpi_flow_stack", NDPIFlowStructStack),
|
||||
("guessed_protocol_id", c_uint16),
|
||||
("guessed_host_protocol_id", c_uint16),
|
||||
("guessed_category", c_uint16),
|
||||
("guessed_header_category", c_uint16),
|
||||
("l4_proto", c_uint8),
|
||||
("protocol_id_already_guessed", c_uint8, 1),
|
||||
("host_already_guessed", c_uint8, 1),
|
||||
("init_finished", c_uint8, 1),
|
||||
("setup_packet_direction", c_uint8, 1),
|
||||
("packet_direction", c_uint8, 1),
|
||||
("check_extra_packets", c_uint8, 1),
|
||||
("next_tcp_seq_nr", c_uint32 * 2),
|
||||
("max_extra_packets_to_check", c_uint8),
|
||||
("num_extra_packets_checked", c_uint8),
|
||||
("num_processed_pkts", c_uint8),
|
||||
("extra_packets_func", CFUNCTYPE(c_int, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))),
|
||||
("l4", L4),
|
||||
("server_id", POINTER(NDPIIdStruct)),
|
||||
("host_server_name", c_ubyte * 256),
|
||||
("http", Http),
|
||||
("protos", Protos),
|
||||
("excluded_protocol_bitmask", NDPIProtocolBitMask),
|
||||
("category", c_int),
|
||||
('redis_s2d_first_char', c_uint8),
|
||||
('redis_d2s_first_char', c_uint8),
|
||||
('packet_counter', c_uint16),
|
||||
('packet_direction_counter', c_uint16 * 2),
|
||||
('byte_counter', c_uint16 * 2),
|
||||
('bittorrent_stage', c_uint8),
|
||||
('directconnect_stage', c_uint8, 2),
|
||||
('sip_yahoo_voice', c_uint8, 1),
|
||||
('http_detected', c_uint8, 1),
|
||||
('http_upper_protocol', c_uint16),
|
||||
('http_lower_protocol', c_uint16),
|
||||
('rtsprdt_stage', c_uint8, 2),
|
||||
('rtsp_control_flow', c_uint8, 1),
|
||||
('yahoo_detection_finished', c_uint8, 2),
|
||||
('zattoo_stage', c_uint8, 3),
|
||||
('qq_stage', c_uint8, 3),
|
||||
('thunder_stage', c_uint8, 2),
|
||||
('oscar_ssl_voice_stage', c_uint8, 3),
|
||||
('oscar_video_voice', c_uint8, 1),
|
||||
('florensia_stage', c_uint8, 1),
|
||||
('socks5_stage', c_uint8, 2),
|
||||
('socks4_stage', c_uint8, 2),
|
||||
('edonkey_stage', c_uint8, 2),
|
||||
('ftp_control_stage', c_uint8, 2),
|
||||
('rtmp_stage', c_uint8, 2),
|
||||
('pando_stage', c_uint8, 3),
|
||||
('steam_stage1', c_uint16, 3),
|
||||
('steam_stage2', c_uint16, 2),
|
||||
('steam_stage3', c_uint16, 2),
|
||||
('pplive_stage1', c_uint8, 3),
|
||||
('pplive_stage2', c_uint8, 2),
|
||||
('pplive_stage3', c_uint8, 2),
|
||||
('starcraft_udp_stage', c_uint8, 3),
|
||||
('ovpn_session_id', c_uint8 * 8),
|
||||
('ovpn_counter', c_uint8),
|
||||
('tinc_state', c_uint8),
|
||||
('TincCacheEntry', TincCacheEntry),
|
||||
('csgo_strid', c_uint8 * 18),
|
||||
('csgo_state', c_uint8),
|
||||
('csgo_s2', c_uint8),
|
||||
('csgo_id2', c_uint32),
|
||||
('kxun_counter', c_uint16),
|
||||
('iqiyi_counter', c_uint16),
|
||||
('packet', NDPIPacketStruct),
|
||||
('flow', POINTER(NDPIFlowStruct)),
|
||||
('src', POINTER(NDPIIdStruct)),
|
||||
('dst', POINTER(NDPIIdStruct))
|
||||
]
|
||||
|
||||
# ----------------------------------------------- nDPI APIs ------------------------------------------------------------
|
||||
|
||||
""" ndpi_detection_giveup: Function to be called before we give up with detection for a given flow.
|
||||
This function reduces the NDPI_UNKNOWN_PROTOCOL detection. """
|
||||
ndpi.ndpi_detection_giveup.restype = NDPIProtocol
|
||||
ndpi.ndpi_detection_giveup.argtypes = [POINTER(NDPIDetectionModuleStruct),
|
||||
POINTER(NDPIFlowStruct), c_uint8,
|
||||
POINTER(c_uint8)]
|
||||
|
||||
""" ndpi_detection_process_packet: Processes one packet and returns the ID of the detected protocol.
|
||||
This is the MAIN PACKET PROCESSING FUNCTION. """
|
||||
ndpi.ndpi_detection_process_packet.restype = NDPIProtocol
|
||||
ndpi.ndpi_detection_process_packet.argtypes = [POINTER(NDPIDetectionModuleStruct),
|
||||
POINTER(NDPIFlowStruct),
|
||||
POINTER(c_ubyte),
|
||||
c_ushort,
|
||||
c_uint64,
|
||||
POINTER(NDPIIdStruct),
|
||||
POINTER(NDPIIdStruct)]
|
||||
|
||||
""" ndpi_ssl_version2str : Converts ssl version to readable string """
|
||||
ndpi.ndpi_ssl_version2str.restype = c_char_p
|
||||
ndpi.ndpi_ssl_version2str.argtypes = [c_int16, POINTER(c_uint8)]
|
||||
|
||||
""" ndpi_init_detection_module: Returns a new initialized detection module.
|
||||
Note that before you can use it you can still load hosts and do other things. As soon as you are ready to use
|
||||
it do not forget to call first ndpi_finalize_initalization() """
|
||||
ndpi.ndpi_init_detection_module.restype = POINTER(NDPIDetectionModuleStruct)
|
||||
|
||||
|
||||
def ndpi_ndpi_finalize_initalization(detection_module):
|
||||
""" ndpi_finalize_initalization: Completes the initialization (ndpi_revision >= 3.1)"""
|
||||
if cast(ndpi.ndpi_revision(), c_char_p).value.decode("utf-8")[:3] >= '3.1':
|
||||
ndpi.ndpi_finalize_initalization.restype = c_void_p
|
||||
ndpi.ndpi_finalize_initalization.argtypes = [POINTER(NDPIDetectionModuleStruct)]
|
||||
return ndpi.ndpi_finalize_initalization(detection_module)
|
||||
else:
|
||||
# ignore it
|
||||
return None
|
||||
|
||||
|
||||
""" ndpi_tfind: find a node, or return 0. """
|
||||
ndpi.ndpi_tfind.restype = c_void_p
|
||||
|
||||
""" ndpi_tsearch: ftp://ftp.cc.uoc.gr/mirrors/OpenBSD/src/lib/libc/stdlib/tsearch.c
|
||||
find or insert datum into search tree. """
|
||||
ndpi.ndpi_tsearch.restype = c_void_p
|
||||
ndpi.ndpi_tsearch.argtypes = [c_void_p, POINTER(c_void_p), CFUNCTYPE(c_int, c_void_p, c_void_p)]
|
||||
|
||||
""" ndpi_revision: Get the nDPI version release. """
|
||||
ndpi.ndpi_revision.restype = c_void_p
|
||||
|
||||
""" ndpi_get_proto_name: Get the protocol name associated to the ID."""
|
||||
ndpi.ndpi_get_proto_name.restype = c_void_p
|
||||
|
||||
""" ndpi_category_get_name: Get protocol category as string."""
|
||||
ndpi.ndpi_category_get_name.restype = c_void_p
|
||||
|
||||
""" ndpi_get_num_supported_protocols: Get the total number of the supported protocols."""
|
||||
ndpi.ndpi_get_num_supported_protocols.restype = c_uint
|
||||
|
||||
""" ndpi_wrap_NDPI_BITMASK_SET_ALL: memset((char *)(p), 0xFF, sizeof(*(p)))"""
|
||||
ndpi.ndpi_wrap_NDPI_BITMASK_SET_ALL.argtypes = [POINTER(NDPIProtocolBitMask)]
|
||||
|
||||
""" ndpi_set_protocol_detection_bitmask2: Sets the protocol bitmask2."""
|
||||
ndpi.ndpi_set_protocol_detection_bitmask2.argtypes = [POINTER(NDPIDetectionModuleStruct),
|
||||
POINTER(NDPIProtocolBitMask)]
|
||||
|
||||
""" ndpi_twalk: Walk the nodes of a tree. """
|
||||
ndpi.ndpi_twalk.argtypes = [c_void_p, CFUNCTYPE(None, c_void_p, c_int32, c_int, c_void_p), c_void_p]
|
||||
|
||||
""" ndpi_tdestroy: node destroy. """
|
||||
ndpi.ndpi_tdestroy.argtypes = [c_void_p, CFUNCTYPE(None, c_void_p)]
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* ndpi_wrap.c
|
||||
*
|
||||
* Copyright (C) 2011-19 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "ndpi_config.h"
|
||||
#include "ndpi_main.h"
|
||||
|
||||
int ndpi_wrap_get_api_version(){
|
||||
return NDPI_API_VERSION;
|
||||
}
|
||||
|
||||
int ndpi_wrap_ndpi_num_fds_bits(){
|
||||
return NDPI_NUM_FDS_BITS;
|
||||
}
|
||||
|
||||
int ndpi_wrap_num_custom_categories(){
|
||||
return NUM_CUSTOM_CATEGORIES;
|
||||
}
|
||||
|
||||
int ndpi_wrap_custom_category_label_len(){
|
||||
return CUSTOM_CATEGORY_LABEL_LEN;
|
||||
}
|
||||
|
||||
int ndpi_wrap_ndpi_max_supported_protocols(){
|
||||
return NDPI_MAX_SUPPORTED_PROTOCOLS;
|
||||
}
|
||||
|
||||
int ndpi_wrap_ndpi_max_num_custom_protocols(){
|
||||
return NDPI_MAX_NUM_CUSTOM_PROTOCOLS;
|
||||
}
|
||||
|
||||
int ndpi_wrap_ndpi_procol_size(){
|
||||
return NDPI_PROTOCOL_SIZE;
|
||||
}
|
||||
|
||||
void ndpi_wrap_NDPI_BITMASK_SET_ALL(NDPI_PROTOCOL_BITMASK* bitmask){
|
||||
NDPI_ONE(bitmask);
|
||||
}
|
||||
|
||||
void dummy() {
|
||||
/* Dummy call just to cause linker to include the ndpi library */
|
||||
ndpi_tfind(NULL, NULL, NULL);
|
||||
}
|
||||
Binary file not shown.
+228
-35
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_api.h
|
||||
*
|
||||
* Copyright (C) 2011-17 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -58,7 +58,7 @@ extern "C" {
|
||||
* else 0
|
||||
*
|
||||
*/
|
||||
int check_punycode_string(char *buff, int len);
|
||||
int ndpi_check_punycode_string(char *buff, int len);
|
||||
|
||||
|
||||
/**
|
||||
@@ -138,11 +138,23 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* Returns a new initialized detection module
|
||||
* Note that before you can use it you can still load
|
||||
* hosts and do other things. As soon as you are ready to use
|
||||
* it do not forget to call first ndpi_finalize_initalization()
|
||||
*
|
||||
* @par prefs = load preferences
|
||||
* @return the initialized detection module
|
||||
*
|
||||
*/
|
||||
struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs prefs);
|
||||
|
||||
/**
|
||||
* Completes the initialization (2nd step)
|
||||
*
|
||||
* @return the initialized detection module
|
||||
*
|
||||
*/
|
||||
struct ndpi_detection_module_struct *ndpi_init_detection_module(void);
|
||||
void ndpi_finalize_initalization(struct ndpi_detection_module_struct *ndpi_str);
|
||||
|
||||
/**
|
||||
* Frees the memory allocated in the specified flow
|
||||
@@ -206,20 +218,22 @@ extern "C" {
|
||||
*/
|
||||
void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const NDPI_PROTOCOL_BITMASK * detection_bitmask);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Function to be called before we give up with detection for a given flow.
|
||||
* This function reduces the NDPI_UNKNOWN_PROTOCOL detection
|
||||
*
|
||||
* @par ndpi_struct = the detection module
|
||||
* @par flow = the flow given for the detection module
|
||||
* @par enable_guess = guess protocol if unknown
|
||||
* @par protocol_was_guessed = 1 if the protocol was guesses (requires enable_guess = 1), 0 otherwise
|
||||
* @return the detected protocol even if the flow is not completed;
|
||||
*
|
||||
*/
|
||||
ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int8_t enable_guess);
|
||||
u_int8_t enable_guess,
|
||||
u_int8_t *protocol_was_guessed);
|
||||
|
||||
/**
|
||||
* Processes an extra packet in order to get more information for a given protocol
|
||||
@@ -372,13 +386,12 @@ extern "C" {
|
||||
* @return the ID of the matched subprotocol
|
||||
*
|
||||
*/
|
||||
int ndpi_match_host_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *string_to_match,
|
||||
u_int string_to_match_len,
|
||||
ndpi_protocol_match_result *ret_match,
|
||||
u_int16_t master_protocol_id);
|
||||
|
||||
u_int16_t ndpi_match_host_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *string_to_match,
|
||||
u_int string_to_match_len,
|
||||
ndpi_protocol_match_result *ret_match,
|
||||
u_int16_t master_protocol_id);
|
||||
|
||||
/**
|
||||
* Check if the string content passed match with a protocol
|
||||
@@ -392,12 +405,12 @@ extern "C" {
|
||||
* @return the ID of the matched subprotocol
|
||||
*
|
||||
*/
|
||||
int ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *string_to_match,
|
||||
u_int string_to_match_len,
|
||||
ndpi_protocol_match_result *ret_match,
|
||||
u_int16_t master_protocol_id);
|
||||
u_int16_t ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *string_to_match,
|
||||
u_int string_to_match_len,
|
||||
ndpi_protocol_match_result *ret_match,
|
||||
u_int16_t master_protocol_id);
|
||||
/**
|
||||
* Exclude protocol from search
|
||||
*
|
||||
@@ -493,6 +506,21 @@ extern "C" {
|
||||
u_int8_t ndpi_is_subprotocol_informative(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
u_int16_t protoId);
|
||||
|
||||
/**
|
||||
* Set hostname-based protocol
|
||||
*
|
||||
* @par ndpi_mod = the detection module
|
||||
* @par flow = the flow to which this communication belongs to
|
||||
* @par master_protocol = the master protocol for this flow
|
||||
* @par name = the host name
|
||||
* @par name_len = length of the host name
|
||||
*
|
||||
*/
|
||||
int ndpi_match_hostname_protocol(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t master_protocol,
|
||||
char *name, u_int name_len);
|
||||
|
||||
/**
|
||||
* Get protocol category as string
|
||||
*
|
||||
@@ -601,7 +629,17 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
char* path);
|
||||
const char* path);
|
||||
|
||||
/**
|
||||
* Read a file and load the categories
|
||||
*
|
||||
* @par ndpi_mod = the detection module
|
||||
* @par path = the path of the file
|
||||
* @return 0 if the file is loaded correctly;
|
||||
* -1 else
|
||||
*/
|
||||
int ndpi_load_categories_file(struct ndpi_detection_module_struct *ndpi_str, const char* path);
|
||||
|
||||
/**
|
||||
* Get the total number of the supported protocols
|
||||
@@ -670,12 +708,12 @@ extern "C" {
|
||||
*
|
||||
* @par ndpi_struct = the detection module
|
||||
* @par flow = the detected flow
|
||||
* @par certificate = the ssl certificate
|
||||
* @par certificate = the SSL/TLS certificate
|
||||
* @return 1 if the flow is TOR;
|
||||
* 0 else
|
||||
*
|
||||
*/
|
||||
int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
int ndpi_is_tls_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, char *certificate);
|
||||
|
||||
/* Wrappers functions */
|
||||
@@ -734,48 +772,56 @@ extern "C" {
|
||||
*/
|
||||
int ndpi_match_string(void *_automa, char *string_to_match);
|
||||
|
||||
void ndpi_load_ip_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *ip_address_and_mask, ndpi_protocol_category_t category);
|
||||
int ndpi_load_ip_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char *ip_address_and_mask, ndpi_protocol_category_t category);
|
||||
int ndpi_load_hostname_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *name, ndpi_protocol_category_t category);
|
||||
const char *name_to_add, ndpi_protocol_category_t category);
|
||||
int ndpi_load_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char *ip_or_name, ndpi_protocol_category_t category);
|
||||
int ndpi_enable_loaded_categories(struct ndpi_detection_module_struct *ndpi_struct);
|
||||
int ndpi_fill_ip_protocol_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int32_t saddr,
|
||||
u_int32_t daddr,
|
||||
ndpi_protocol *ret);
|
||||
int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *name, unsigned long *id);
|
||||
char *name, u_int name_len, unsigned long *id);
|
||||
void ndpi_fill_protocol_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol *ret);
|
||||
int ndpi_get_custom_category_match(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *name_or_ip, unsigned long *id);
|
||||
char *name_or_ip, u_int name_len, unsigned long *id);
|
||||
int ndpi_set_detection_preferences(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
ndpi_detection_preference pref,
|
||||
int value);
|
||||
|
||||
/* Tells to called on what l4 protocol given application protocol can be found */
|
||||
ndpi_l4_proto_info ndpi_get_l4_proto_info(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_proto_id);
|
||||
const char* ndpi_get_l4_proto_name(ndpi_l4_proto_info proto);
|
||||
|
||||
ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod);
|
||||
u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
|
||||
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
|
||||
u_int ndpi_get_ndpi_detection_module_size();
|
||||
u_int ndpi_get_ndpi_detection_module_size(void);
|
||||
void ndpi_set_log_level(struct ndpi_detection_module_struct *ndpi_mod, u_int l);
|
||||
|
||||
/* LRU cache */
|
||||
struct ndpi_lru_cache* ndpi_lru_cache_init(u_int32_t num_entries);
|
||||
void ndpi_lru_free_cache(struct ndpi_lru_cache *c);
|
||||
u_int8_t ndpi_lru_find_cache(struct ndpi_lru_cache *c, u_int32_t key, u_int8_t clean_key_when_found);
|
||||
void ndpi_lru_add_to_cache(struct ndpi_lru_cache *c, u_int32_t key);
|
||||
u_int8_t ndpi_lru_find_cache(struct ndpi_lru_cache *c, u_int32_t key,
|
||||
u_int16_t *value, u_int8_t clean_key_when_found);
|
||||
void ndpi_lru_add_to_cache(struct ndpi_lru_cache *c, u_int32_t key, u_int16_t value);
|
||||
|
||||
/**
|
||||
* Add a string to match to an automata
|
||||
*
|
||||
* @par The automata initialized with ndpi_init_automa();
|
||||
* @par The (sub)string to search
|
||||
* @par The (sub)string length
|
||||
* @par The id associated with the matched string or 0 id not found.
|
||||
* @return 0 in case of match, or -1 if no match, or -2 if an error occurred.
|
||||
*
|
||||
*/
|
||||
int ndpi_match_string_id(void *_automa, char *string_to_match, unsigned long *id);
|
||||
int ndpi_match_string_id(void *_automa, char *string_to_match, u_int match_len, unsigned long *id);
|
||||
|
||||
/* Utility functions to set ndpi malloc/free/print wrappers */
|
||||
void set_ndpi_malloc(void* (*__ndpi_malloc)(size_t size));
|
||||
@@ -784,10 +830,10 @@ extern "C" {
|
||||
void set_ndpi_flow_free(void (*__ndpi_flow_free)(void *ptr));
|
||||
void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str,
|
||||
ndpi_debug_function_ptr ndpi_debug_printf);
|
||||
void * ndpi_malloc(size_t size);
|
||||
void * ndpi_calloc(unsigned long count, size_t size);
|
||||
void ndpi_free(void *ptr);
|
||||
u_int8_t ndpi_get_api_version();
|
||||
//void * ndpi_malloc(size_t size);
|
||||
//void * ndpi_calloc(unsigned long count, size_t size);
|
||||
//void ndpi_free(void *ptr);
|
||||
u_int8_t ndpi_get_api_version(void);
|
||||
|
||||
/* https://github.com/corelight/community-id-spec */
|
||||
int ndpi_flowv4_flow_hash(u_int8_t l4_proto, u_int32_t src_ip, u_int32_t dst_ip, u_int16_t src_port, u_int16_t dst_port,
|
||||
@@ -795,7 +841,154 @@ extern "C" {
|
||||
int ndpi_flowv6_flow_hash(u_int8_t l4_proto, struct ndpi_in6_addr *src_ip, struct ndpi_in6_addr *dst_ip,
|
||||
u_int16_t src_port, u_int16_t dst_port, u_int8_t icmp_type, u_int8_t icmp_code,
|
||||
u_char *hash_buf, u_int8_t hash_buf_len);
|
||||
u_int8_t ndpi_extra_dissection_possible(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow);
|
||||
u_int8_t ndpi_is_safe_ssl_cipher(u_int32_t cipher);
|
||||
const char* ndpi_cipher2str(u_int32_t cipher);
|
||||
const char* ndpi_tunnel2str(ndpi_packet_tunnel tt);
|
||||
u_int16_t ndpi_guess_host_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow);
|
||||
int ndpi_has_human_readeable_string(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *buffer, u_int buffer_size,
|
||||
u_int8_t min_string_match_len, /* Will return 0 if no string > min_string_match_len have been found */
|
||||
char *outbuf, u_int outbuf_len);
|
||||
char* ndpi_ssl_version2str(u_int16_t version, u_int8_t *unknown_tls_version);
|
||||
void ndpi_patchIPv6Address(char *str);
|
||||
void ndpi_user_pwd_payload_copy(u_int8_t *dest, u_int dest_len, u_int offset,
|
||||
const u_int8_t *src, u_int src_len);
|
||||
u_char* ndpi_base64_decode(const u_char *src, size_t len, size_t *out_len);
|
||||
char* ndpi_base64_encode(unsigned char const* bytes_to_encode, ssize_t in_len);
|
||||
int ndpi_load_ipv4_ptree(struct ndpi_detection_module_struct *ndpi_str,
|
||||
const char *path, u_int16_t protocol_id);
|
||||
|
||||
int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int8_t ip_version,
|
||||
u_int8_t l4_protocol, u_int16_t vlan_id,
|
||||
u_int32_t src_v4, u_int32_t dst_v4,
|
||||
struct ndpi_in6_addr *src_v6, struct ndpi_in6_addr *dst_v6,
|
||||
u_int16_t src_port, u_int16_t dst_port,
|
||||
ndpi_protocol l7_protocol,
|
||||
ndpi_serializer *serializer);
|
||||
|
||||
void ndpi_md5(const u_char *data, size_t data_len, u_char hash[16]);
|
||||
|
||||
/* ptree (trie) API */
|
||||
ndpi_ptree_t* ndpi_ptree_create(void);
|
||||
int ndpi_ptree_insert(ndpi_ptree_t *tree, const ndpi_ip_addr_t *addr, u_int8_t bits, uint user_data);
|
||||
int ndpi_ptree_match_addr(ndpi_ptree_t *tree, const ndpi_ip_addr_t *addr, uint *user_data);
|
||||
void ndpi_ptree_destroy(ndpi_ptree_t *tree);
|
||||
|
||||
/* Serializer */
|
||||
int ndpi_init_serializer_ll(ndpi_serializer *serializer, ndpi_serialization_format fmt,
|
||||
u_int32_t buffer_size);
|
||||
int ndpi_init_serializer(ndpi_serializer *serializer, ndpi_serialization_format fmt);
|
||||
void ndpi_term_serializer(ndpi_serializer *serializer);
|
||||
void ndpi_reset_serializer(ndpi_serializer *serializer);
|
||||
|
||||
int ndpi_serialize_uint32_uint32(ndpi_serializer *serializer,
|
||||
u_int32_t key, u_int32_t value);
|
||||
int ndpi_serialize_uint32_uint64(ndpi_serializer *serializer,
|
||||
u_int32_t key, u_int64_t value);
|
||||
int ndpi_serialize_uint32_int32(ndpi_serializer *serializer,
|
||||
u_int32_t key, int32_t value);
|
||||
int ndpi_serialize_uint32_int64(ndpi_serializer *serializer,
|
||||
u_int32_t key, int64_t value);
|
||||
int ndpi_serialize_uint32_float(ndpi_serializer *serializer,
|
||||
u_int32_t key, float value,
|
||||
const char *format /* e.f. "%.2f" */);
|
||||
int ndpi_serialize_uint32_string(ndpi_serializer *serializer,
|
||||
u_int32_t key, const char *value);
|
||||
int ndpi_serialize_uint32_boolean(ndpi_serializer *serializer,
|
||||
u_int32_t key, u_int8_t value);
|
||||
|
||||
int ndpi_serialize_string_int32(ndpi_serializer *serializer,
|
||||
const char *key, int32_t value);
|
||||
int ndpi_serialize_string_int64(ndpi_serializer *serializer,
|
||||
const char *key, int64_t value);
|
||||
int ndpi_serialize_string_uint32(ndpi_serializer *serializer,
|
||||
const char *key, u_int32_t value);
|
||||
int ndpi_serialize_string_uint32_format(ndpi_serializer *serializer,
|
||||
const char *key, u_int32_t value,
|
||||
const char *format);
|
||||
int ndpi_serialize_string_uint64(ndpi_serializer *serializer,
|
||||
const char *key, u_int64_t value);
|
||||
int ndpi_serialize_string_string(ndpi_serializer *serializer,
|
||||
const char *key, const char *value);
|
||||
int ndpi_serialize_string_binary(ndpi_serializer *serializer,
|
||||
const char *key, const char *_value,
|
||||
u_int16_t vlen);
|
||||
int ndpi_serialize_string_raw(ndpi_serializer *_serializer,
|
||||
const char *key, const char *_value,
|
||||
u_int16_t vlen);
|
||||
int ndpi_serialize_string_float(ndpi_serializer *serializer,
|
||||
const char *key, float value,
|
||||
const char *format /* e.f. "%.2f" */);
|
||||
int ndpi_serialize_string_boolean(ndpi_serializer *serializer,
|
||||
const char *key, u_int8_t value);
|
||||
|
||||
int ndpi_serialize_end_of_record(ndpi_serializer *serializer);
|
||||
int ndpi_serialize_start_of_block(ndpi_serializer *serializer,
|
||||
const char *key);
|
||||
int ndpi_serialize_end_of_block(ndpi_serializer *serializer);
|
||||
char* ndpi_serializer_get_buffer(ndpi_serializer *serializer, u_int32_t *buffer_len);
|
||||
u_int32_t ndpi_serializer_get_buffer_len(ndpi_serializer *serializer);
|
||||
u_int32_t ndpi_serializer_get_internal_buffer_size(ndpi_serializer *serializer);
|
||||
int ndpi_serializer_set_buffer_len(ndpi_serializer *serializer, u_int32_t l);
|
||||
ndpi_serialization_format ndpi_serializer_get_format(ndpi_serializer *serializer);
|
||||
void ndpi_serializer_set_csv_separator(ndpi_serializer *serializer, char separator);
|
||||
|
||||
void ndpi_serializer_create_snapshot(ndpi_serializer *serializer);
|
||||
void ndpi_serializer_rollback_snapshot(ndpi_serializer *serializer);
|
||||
|
||||
/* Deserializer */
|
||||
int ndpi_init_deserializer(ndpi_deserializer *deserializer,
|
||||
ndpi_serializer *serializer);
|
||||
int ndpi_init_deserializer_buf(ndpi_deserializer *deserializer,
|
||||
u_int8_t *serialized_buffer,
|
||||
u_int32_t serialized_buffer_len);
|
||||
|
||||
ndpi_serialization_format ndpi_deserialize_get_format(ndpi_deserializer *_deserializer);
|
||||
ndpi_serialization_type ndpi_deserialize_get_item_type(ndpi_deserializer *deserializer, ndpi_serialization_type *key_type);
|
||||
int ndpi_deserialize_next(ndpi_deserializer *deserializer);
|
||||
|
||||
int ndpi_deserialize_key_uint32(ndpi_deserializer *deserializer, u_int32_t *key);
|
||||
int ndpi_deserialize_key_string(ndpi_deserializer *deserializer, ndpi_string *key);
|
||||
|
||||
int ndpi_deserialize_value_uint32(ndpi_deserializer *deserializer, u_int32_t *value);
|
||||
int ndpi_deserialize_value_uint64(ndpi_deserializer *deserializer, u_int64_t *value);
|
||||
int ndpi_deserialize_value_int32(ndpi_deserializer *deserializer, int32_t *value);
|
||||
int ndpi_deserialize_value_int64(ndpi_deserializer *deserializer, int64_t *value);
|
||||
int ndpi_deserialize_value_float(ndpi_deserializer *deserializer, float *value);
|
||||
int ndpi_deserialize_value_string(ndpi_deserializer *deserializer, ndpi_string *value);
|
||||
|
||||
int ndpi_deserialize_clone_item(ndpi_deserializer *deserializer, ndpi_serializer *serializer);
|
||||
int ndpi_deserialize_clone_all(ndpi_deserializer *deserializer, ndpi_serializer *serializer);
|
||||
|
||||
/* Data analysis */
|
||||
struct ndpi_analyze_struct* ndpi_alloc_data_analysis(u_int16_t _max_series_len);
|
||||
void ndpi_init_data_analysis(struct ndpi_analyze_struct *s, u_int16_t _max_series_len);
|
||||
void ndpi_free_data_analysis(struct ndpi_analyze_struct *d);
|
||||
void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int32_t value);
|
||||
|
||||
float ndpi_data_average(struct ndpi_analyze_struct *s);
|
||||
float ndpi_data_window_average(struct ndpi_analyze_struct *s);
|
||||
|
||||
float ndpi_data_entropy(struct ndpi_analyze_struct *s);
|
||||
float ndpi_data_variance(struct ndpi_analyze_struct *s);
|
||||
float ndpi_data_stddev(struct ndpi_analyze_struct *s);
|
||||
u_int32_t ndpi_data_min(struct ndpi_analyze_struct *s);
|
||||
u_int32_t ndpi_data_max(struct ndpi_analyze_struct *s);
|
||||
float ndpi_data_ratio(u_int32_t sent, u_int32_t rcvd);
|
||||
|
||||
const char* ndpi_data_ratio2str(float ratio);
|
||||
|
||||
void ndpi_data_print_window_values(struct ndpi_analyze_struct *s); /* debug */
|
||||
|
||||
ndpi_url_risk ndpi_validate_url(char *url);
|
||||
|
||||
u_int8_t ndpi_is_protocol_detected(struct ndpi_detection_module_struct *ndpi_str,
|
||||
ndpi_protocol proto);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2016 Cisco Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
* Neither the name of the Cisco Systems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file ndpi_classify.h
|
||||
*
|
||||
* \brief header file for inline Classification functionality
|
||||
*/
|
||||
|
||||
#ifndef NDPI_CLASSIFY_H
|
||||
#define NDPI_CLASSIFY_H
|
||||
|
||||
|
||||
|
||||
/* constants */
|
||||
#define NUM_PARAMETERS_SPLT_LOGREG 208
|
||||
#define NUM_PARAMETERS_BD_LOGREG 464
|
||||
#define MC_BINS_LEN 10
|
||||
#define MC_BINS_TIME 10
|
||||
#define MC_BIN_SIZE_TIME 50
|
||||
#define MC_BIN_SIZE_LEN 150
|
||||
#define MAX_BIN_LEN 1500
|
||||
#define NUM_BD_VALUES 256
|
||||
#define NDPI_TIMESTAMP_LEN 64
|
||||
|
||||
/** Classifier parameter type codes */
|
||||
typedef enum {
|
||||
SPLT_PARAM_TYPE = 0,
|
||||
BD_PARAM_TYPE = 1
|
||||
} classifier_type_codes_t;
|
||||
|
||||
extern float parameters_bd[NUM_PARAMETERS_BD_LOGREG];
|
||||
extern float parameters_splt[NUM_PARAMETERS_SPLT_LOGREG];
|
||||
|
||||
/* Classifier functions */
|
||||
float ndpi_classify(const unsigned short *pkt_len, const struct timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t);
|
||||
|
||||
void ndpi_merge_splt_arrays(const uint16_t *pkt_len, const struct timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times);
|
||||
|
||||
void ndpi_update_params(classifier_type_codes_t param_type, const char *param_file);
|
||||
|
||||
void ndpi_flow_info_freer(void *node);
|
||||
unsigned int ndpi_timer_eq(const struct timeval *a, const struct timeval *b);
|
||||
unsigned int ndpi_timer_lt(const struct timeval *a, const struct timeval *b);
|
||||
void ndpi_timer_sub(const struct timeval *a, const struct timeval *b, struct timeval *result);
|
||||
void ndpi_timer_clear(struct timeval *a);
|
||||
unsigned int ndpi_timeval_to_milliseconds(struct timeval ts);
|
||||
unsigned int ndpi_timeval_to_microseconds(struct timeval ts);
|
||||
void ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len);
|
||||
|
||||
#endif /* NDPI_CLASSIFY_H */
|
||||
@@ -250,7 +250,7 @@
|
||||
|
||||
/** macro to compare 2 IPv6 addresses with each other to identify the "smaller" IPv6 address */
|
||||
#define NDPI_COMPARE_IPV6_ADDRESS_STRUCTS(x,y) \
|
||||
((((u_int64_t *)(x))[0]) < (((u_int64_t *)(y))[0]) || ( (((u_int64_t *)(x))[0]) == (((u_int64_t *)(y))[0]) && (((u_int64_t *)(x))[1]) < (((u_int64_t *)(y))[1])) )
|
||||
((x.u6_addr.u6_addr64[0] < y.u6_addr.u6_addr64[0]) || ((x.u6_addr.u6_addr64[0] == y.u6_addr.u6_addr64[0]) && (x.u6_addr.u6_addr64[1] < y.u6_addr.u6_addr64[1])))
|
||||
|
||||
#define NDPI_NUM_BITS 512
|
||||
|
||||
@@ -338,6 +338,10 @@
|
||||
#define NDPI_MINOR @NDPI_MINOR@
|
||||
#define NDPI_PATCH @NDPI_PATCH@
|
||||
|
||||
/* IMPORTANT: order according to its severity */
|
||||
#define NDPI_CIPHER_SAFE 0
|
||||
#define NDPI_CIPHER_WEAK 1
|
||||
#define NDPI_CIPHER_INSECURE 2
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_main.h
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -112,10 +112,10 @@ extern "C" {
|
||||
extern void ndpi_packet_src_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
|
||||
extern void ndpi_packet_dst_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
|
||||
|
||||
extern char *ndpi_get_ip_string(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const ndpi_ip_addr_t * ip);
|
||||
extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const struct ndpi_packet_struct *packet);
|
||||
extern int ndpi_parse_ip_string(const char *ip_str, ndpi_ip_addr_t *parsed_ip);
|
||||
extern char *ndpi_get_ip_string(const ndpi_ip_addr_t * ip, char *buf, u_int buf_len);
|
||||
extern u_int8_t ndpi_is_ipv6(const ndpi_ip_addr_t *ip);
|
||||
|
||||
extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
|
||||
u_int16_t ndpi_get_proto_by_name(struct ndpi_detection_module_struct *ndpi_mod, const char *name);
|
||||
|
||||
@@ -124,7 +124,7 @@ extern "C" {
|
||||
u_int8_t proto, u_int16_t sport, u_int16_t dport,
|
||||
u_int8_t *user_defined_proto);
|
||||
|
||||
extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto);
|
||||
extern u_int8_t ndpi_is_proto(ndpi_protocol proto, u_int16_t p);
|
||||
|
||||
extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
|
||||
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
@@ -132,7 +132,7 @@ extern "C" {
|
||||
u_int16_t** tcp_master_proto,
|
||||
u_int16_t** udp_master_proto);
|
||||
#/* NDPI_PROTOCOL_NETBIOS */
|
||||
int ndpi_netbios_name_interpret(char *in, char *out, u_int out_len);
|
||||
int ndpi_netbios_name_interpret(char *in, size_t inlen, char *out, u_int out_len);
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*
|
||||
* ndpi_protocol_ids.h
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -23,12 +22,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NDPI_API_H__
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __NDPI_PROTOCOLS_DEFAULT_H__
|
||||
#define __NDPI_PROTOCOLS_DEFAULT_H__
|
||||
#ifndef __NDPI_PROTOCOLS_IDS_H__
|
||||
#define __NDPI_PROTOCOLS_IDS_H__
|
||||
|
||||
#define NDPI_DETECTION_SUPPORT_IPV6
|
||||
#define NDPI_PROTOCOL_SIZE 2
|
||||
@@ -75,17 +70,15 @@ typedef enum {
|
||||
NDPI_PROTOCOL_SKYPE_CALL = 38, /* Skype call and videocalls */
|
||||
NDPI_PROTOCOL_SIGNAL = 39,
|
||||
NDPI_PROTOCOL_MEMCACHED = 40, /* Memcached - Darryl Sokoloski <darryl@egloo.ca> */
|
||||
NDPI_PROTOCOL_SMBV23 = 41, /* SMB version 2/3 */
|
||||
NDPI_PROTOCOL_SMBV23 = 41, /* SMB version 2/3 */
|
||||
NDPI_PROTOCOL_MINING = 42, /* Bitcoin, Ethereum, ZCash, Monero */
|
||||
NDPI_PROTOCOL_NEST_LOG_SINK = 43, /* Nest Log Sink (Nest Protect) - Darryl Sokoloski <darryl@egloo.ca> */
|
||||
NDPI_PROTOCOL_MODBUS = 44, /* Modbus */
|
||||
|
||||
NDPI_PROTOCOL_FREE_45 = 45, /* Free */
|
||||
NDPI_PROTOCOL_FREE_46 = 46, /* Free */
|
||||
|
||||
NDPI_PROTOCOL_WHATSAPP_CALL = 45, /* WhatsApp video ad audio calls go here */
|
||||
NDPI_PROTOCOL_DATASAVER = 46, /* Protocols used to save data on Internet communications */
|
||||
NDPI_PROTOCOL_XBOX = 47,
|
||||
NDPI_PROTOCOL_QQ = 48,
|
||||
NDPI_PROTOCOL_FREE_49 = 49, /* Free */
|
||||
NDPI_PROTOCOL_TIKTOK = 49,
|
||||
NDPI_PROTOCOL_RTSP = 50,
|
||||
NDPI_PROTOCOL_MAIL_IMAPS = 51,
|
||||
NDPI_PROTOCOL_ICECAST = 52,
|
||||
@@ -100,7 +93,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_QQLIVE = 61,
|
||||
NDPI_PROTOCOL_THUNDER = 62,
|
||||
NDPI_PROTOCOL_SOULSEEK = 63,
|
||||
NDPI_PROTOCOL_SSL_NO_CERT = 64,
|
||||
NDPI_PROTOCOL_PS_VUE = 64,
|
||||
NDPI_PROTOCOL_IRC = 65,
|
||||
NDPI_PROTOCOL_AYIYA = 66,
|
||||
NDPI_PROTOCOL_UNENCRYPTED_JABBER = 67,
|
||||
@@ -127,7 +120,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_RDP = 88,
|
||||
NDPI_PROTOCOL_VNC = 89,
|
||||
NDPI_PROTOCOL_PCANYWHERE = 90,
|
||||
NDPI_PROTOCOL_SSL = 91,
|
||||
NDPI_PROTOCOL_TLS = 91,
|
||||
NDPI_PROTOCOL_SSH = 92,
|
||||
NDPI_PROTOCOL_USENET = 93,
|
||||
NDPI_PROTOCOL_MGCP = 94,
|
||||
@@ -173,7 +166,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_LASTFM = 134,
|
||||
NDPI_PROTOCOL_WAZE = 135,
|
||||
NDPI_PROTOCOL_YOUTUBE_UPLOAD = 136, /* Upload files to youtube */
|
||||
NDPI_PROTOCOL_GENERIC = 137, /* Generic protocol used for category matching */
|
||||
NDPI_PROTOCOL_HULU = 137,
|
||||
NDPI_PROTOCOL_CHECKMK = 138,
|
||||
NDPI_PROTOCOL_AJP = 139, /* Leonn Paiva <leonn.paiva@gmail.com> */
|
||||
NDPI_PROTOCOL_APPLE = 140,
|
||||
@@ -225,24 +218,24 @@ typedef enum {
|
||||
NDPI_PROTOCOL_VEVO = 186,
|
||||
NDPI_PROTOCOL_PANDORA = 187,
|
||||
NDPI_PROTOCOL_QUIC = 188, /* Andrea Buscarinu <andrea.buscarinu@gmail.com> - Michele Campus <michelecampus5@gmail.com> */
|
||||
NDPI_PROTOCOL_WHATSAPP_VOICE = 189,
|
||||
NDPI_PROTOCOL_ZOOM = 189, /* Zoom video conference. */
|
||||
NDPI_PROTOCOL_EAQ = 190,
|
||||
NDPI_PROTOCOL_OOKLA = 191,
|
||||
NDPI_PROTOCOL_AMQP = 192,
|
||||
NDPI_PROTOCOL_KAKAOTALK = 193, /* KakaoTalk Chat (no voice call) */
|
||||
NDPI_PROTOCOL_KAKAOTALK_VOICE = 194, /* KakaoTalk Voice */
|
||||
NDPI_PROTOCOL_TWITCH = 195, /* Edoardo Dominici <edoaramis@gmail.com> */
|
||||
NDPI_PROTOCOL_FREE_196 = 196, /* Free */
|
||||
NDPI_PROTOCOL_DOH_DOT = 196, /* DoH (DNS over HTTPS), DoT (DNS over TLS) */
|
||||
NDPI_PROTOCOL_WECHAT = 197,
|
||||
NDPI_PROTOCOL_MPEGTS = 198,
|
||||
NDPI_PROTOCOL_SNAPCHAT = 199,
|
||||
NDPI_PROTOCOL_SINA = 200,
|
||||
NDPI_PROTOCOL_HANGOUT = 201,
|
||||
NDPI_PROTOCOL_HANGOUT_DUO = 201, /* Google Hangout ad Duo (merged as they are very similar) */
|
||||
NDPI_PROTOCOL_IFLIX = 202, /* www.vizuamatix.com R&D team & M.Mallawaarachchie <manoj_ws@yahoo.com> */
|
||||
NDPI_PROTOCOL_GITHUB = 203,
|
||||
NDPI_PROTOCOL_BJNP = 204,
|
||||
NDPI_PROTOCOL_FREE_205 = 205, /* Free */
|
||||
NDPI_PROTOCOL_VIDTO = 206,
|
||||
NDPI_PROTOCOL_FREE_205 = 205,
|
||||
NDPI_PROTOCOL_WIREGUARD = 206,
|
||||
NDPI_PROTOCOL_SMPP = 207, /* Damir Franusic <df@release14.org> */
|
||||
NDPI_PROTOCOL_DNSCRYPT = 208,
|
||||
NDPI_PROTOCOL_TINC = 209, /* William Guglielmo <william@deselmo.com> */
|
||||
@@ -252,7 +245,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_STARCRAFT = 213, /* Matteo Bracci <matteobracci1@gmail.com> */
|
||||
NDPI_PROTOCOL_TEREDO = 214,
|
||||
NDPI_PROTOCOL_HOTSPOT_SHIELD = 215,
|
||||
NDPI_PROTOCOL_HEP = 216, /* sipcapture.org QXIP BV */
|
||||
NDPI_PROTOCOL_IMO = 216,
|
||||
NDPI_PROTOCOL_GOOGLE_DRIVE = 217,
|
||||
NDPI_PROTOCOL_OCS = 218,
|
||||
NDPI_PROTOCOL_OFFICE_365 = 219,
|
||||
@@ -279,14 +272,24 @@ typedef enum {
|
||||
NDPI_PROTOCOL_AMAZON_VIDEO = 240,
|
||||
NDPI_PROTOCOL_GOOGLE_DOCS = 241,
|
||||
NDPI_PROTOCOL_WHATSAPP_FILES = 242, /* Videos, pictures, voice messages... */
|
||||
NDPI_PROTOCOL_TARGUS_GETDATA = 243,
|
||||
NDPI_PROTOCOL_DNP3 = 244,
|
||||
NDPI_PROTOCOL_IEC60870 = 245, /* https://en.wikipedia.org/wiki/IEC_60870-5 */
|
||||
NDPI_PROTOCOL_BLOOMBERG = 246,
|
||||
NDPI_PROTOCOL_CAPWAP = 247,
|
||||
NDPI_PROTOCOL_ZABBIX = 248,
|
||||
|
||||
#ifdef CUSTOM_NDPI_PROTOCOLS
|
||||
#include "../../../nDPI-custom/custom_ndpi_protocol_ids.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
IMPORTANT
|
||||
before allocating a new identifier please fill up
|
||||
one of those named NDPI_PROTOCOL_FREE_XXX and not used
|
||||
(placeholders to avoid protocol renumbering)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* IMPORTANT:NDPI_LAST_IMPLEMENTED_PROTOCOL MUST BE THE LAST ELEMENT */
|
||||
NDPI_LAST_IMPLEMENTED_PROTOCOL
|
||||
} ndpi_protocol_id_t;
|
||||
@@ -294,4 +297,5 @@ typedef enum {
|
||||
#define NDPI_PROTOCOL_NO_MASTER_PROTO NDPI_PROTOCOL_UNKNOWN
|
||||
#define NDPI_MAX_SUPPORTED_PROTOCOLS NDPI_LAST_IMPLEMENTED_PROTOCOL
|
||||
#define NDPI_MAX_NUM_CUSTOM_PROTOCOLS (NDPI_NUM_BITS-NDPI_LAST_IMPLEMENTED_PROTOCOL)
|
||||
#endif
|
||||
|
||||
#endif /* __NDPI_PROTOCOL_IDS_H__ */
|
||||
|
||||
+10
-158
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_protocols.h
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -51,161 +51,6 @@ u_int ndpi_search_tcp_or_udp_raw(struct ndpi_detection_module_struct *ndpi_struc
|
||||
|
||||
void ndpi_search_tcp_or_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
/* Applications and other protocols. */
|
||||
void ndpi_search_diameter(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_lisp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_edonkey(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_fasttrack_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_directconnect(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_applejuice_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_i23v5(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_socrates(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_soulseek_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_msn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_yahoo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_oscar(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sip(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_hep(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_direct_download_link_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_pop_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mail_smtp_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_http_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_http_subprotocol_conf(struct ndpi_detection_module_struct *ndpi_struct, char *attr, char *value, int protocol_id);
|
||||
void ndpi_search_ftp_control(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_usenet_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtsp_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_filetopia_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_vmware(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ssl_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mms_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_shoutcast_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_veohtv_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_openft_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_stun(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tvants_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sopcast(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tvuplayer(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ppstream(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pplive(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_iax(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mgcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_zattoo(struct ndpi_detection_module_struct*ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_qq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_feidian(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ssh_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_thunder(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_activesync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_in_non_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_vnc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_steam(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_halflife2(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_xbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_smb_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_telnet_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ntp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_nfs(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ssdp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_worldofwarcraft(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_postgres_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mysql_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_quake(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_battlefield(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_secondlife(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pcanywhere(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rdp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_snmp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kontiki(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_syslog(struct ndpi_detection_module_struct*ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_netbios(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mdns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ldap(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_warcraft3(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_xdmcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tftp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mssql_tds(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pptp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_stealthnet(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dhcpv6_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_afp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_checkmk(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_florensia(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_maplestory(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dofus(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_world_of_kung_fu(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_fiesta(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_sflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_radius(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_wsus(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_teamview(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_lotus_notes(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_gtp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_spotify(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_openvpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_noe(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_viber(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_teamspeak(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_corba(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rsync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_skinny(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tor(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_whois_das(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_socks5(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_socks4(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rtmp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_pando(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_redis(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_zmq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_vhua(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_telegram(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_starcraft(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ubntac2(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_coap(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mqtt (struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_someip (struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_rx(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_git(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_drda(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_bjnp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_smpp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_tinc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_fix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_csgo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_ajp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_memcached(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_nest_log_sink(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
/* --- INIT FUNCTIONS --- */
|
||||
void init_diameter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -297,7 +142,7 @@ void init_rtsp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
|
||||
void init_sflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_shoutcast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sip_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_hep_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_imo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skinny_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skype_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_smb_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -308,7 +153,7 @@ void init_soulseek_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
|
||||
void init_socks_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_spotify_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssh_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssl_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tls_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_starcraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stealthnet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_steam_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -357,6 +202,7 @@ void init_nintendo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
|
||||
void init_csgo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_checkmk_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_apple_push_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_amazon_video_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_whatsapp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ajp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_fbzero_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -364,4 +210,10 @@ void init_memcached_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
void init_nest_log_sink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ookla_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_modbus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_capwap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zabbix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_wireguard_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_targus_getdata_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dnp3_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_104_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
#endif /* __NDPI_PROTOCOLS_H__ */
|
||||
|
||||
+333
-72
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_typedefs.h
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -35,6 +35,28 @@ typedef enum {
|
||||
NDPI_LOG_DEBUG_EXTRA
|
||||
} ndpi_log_level_t;
|
||||
|
||||
typedef enum {
|
||||
ndpi_l4_proto_unknown = 0,
|
||||
ndpi_l4_proto_tcp_only,
|
||||
ndpi_l4_proto_udp_only,
|
||||
ndpi_l4_proto_tcp_and_udp,
|
||||
} ndpi_l4_proto_info;
|
||||
|
||||
typedef enum {
|
||||
ndpi_no_tunnel = 0,
|
||||
ndpi_gtp_tunnel,
|
||||
ndpi_capwap_tunnel,
|
||||
ndpi_tzsp_tunnel,
|
||||
ndpi_l2tp_tunnel,
|
||||
} ndpi_packet_tunnel;
|
||||
|
||||
typedef enum {
|
||||
ndpi_url_no_problem = 0,
|
||||
ndpi_url_possible_xss,
|
||||
ndpi_url_possible_sql_injection,
|
||||
ndpi_url_possible_rce_injection
|
||||
} ndpi_url_risk;
|
||||
|
||||
/* NDPI_VISIT */
|
||||
typedef enum {
|
||||
ndpi_preorder,
|
||||
@@ -122,6 +144,49 @@ struct ndpi_ethhdr
|
||||
u_int16_t h_proto; /* data length (<= 1500) or type ID proto (>=1536) */
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++ ARP header +++++++++++++++ */
|
||||
PACK_ON
|
||||
struct ndpi_arphdr {
|
||||
u_int16_t ar_hrd;/* Format of hardware address. */
|
||||
u_int16_t ar_pro;/* Format of protocol address. */
|
||||
u_int8_t ar_hln;/* Length of hardware address. */
|
||||
u_int8_t ar_pln;/* Length of protocol address. */
|
||||
u_int16_t ar_op;/* ARP opcode (command). */
|
||||
u_char arp_sha[6];/* sender hardware address */
|
||||
u_int32_t arp_spa;/* sender protocol address */
|
||||
u_char arp_tha[6];/* target hardware address */
|
||||
u_int32_t arp_tpa;/* target protocol address */
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++ DHCP header +++++++++++++++ */
|
||||
PACK_ON
|
||||
struct ndpi_dhcphdr {
|
||||
u_int8_t msgType;
|
||||
u_int8_t htype;
|
||||
u_int8_t hlen;
|
||||
u_int8_t hops;
|
||||
u_int32_t xid;/* 4 */
|
||||
u_int16_t secs;/* 8 */
|
||||
u_int16_t flags;
|
||||
u_int32_t ciaddr;/* 12 */
|
||||
u_int32_t yiaddr;/* 16 */
|
||||
u_int32_t siaddr;/* 20 */
|
||||
u_int32_t giaddr;/* 24 */
|
||||
u_int8_t chaddr[16]; /* 28 */
|
||||
u_int8_t sname[64]; /* 44 */
|
||||
u_int8_t file[128]; /* 108 */
|
||||
u_int32_t magic; /* 236 */
|
||||
u_int8_t options[308];
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++ MDNS rsp header +++++++++++++++ */
|
||||
PACK_ON
|
||||
struct ndpi_mdns_rsp_entry {
|
||||
u_int16_t rsp_type, rsp_class;
|
||||
u_int32_t ttl;
|
||||
u_int16_t data_len;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++ LLC header (IEEE 802.2) ++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
@@ -207,27 +272,30 @@ struct ndpi_iphdr {
|
||||
/* +++++++++++++++++++++++ IPv6 header +++++++++++++++++++++++ */
|
||||
/* rfc3542 */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_in6_addr {
|
||||
union {
|
||||
u_int8_t u6_addr8[16];
|
||||
u_int16_t u6_addr16[8];
|
||||
u_int32_t u6_addr32[4];
|
||||
u_int64_t u6_addr64[2];
|
||||
} u6_addr; /* 128-bit IP6 address */
|
||||
};
|
||||
} PACK_OFF;
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_ip6_hdrctl {
|
||||
u_int32_t ip6_un1_flow;
|
||||
u_int16_t ip6_un1_plen;
|
||||
u_int8_t ip6_un1_nxt;
|
||||
u_int8_t ip6_un1_hlim;
|
||||
};
|
||||
} PACK_OFF;
|
||||
|
||||
/* PACK_ON */
|
||||
PACK_ON
|
||||
struct ndpi_ipv6hdr {
|
||||
struct ndpi_ip6_hdrctl ip6_hdr;
|
||||
struct ndpi_in6_addr ip6_src;
|
||||
struct ndpi_in6_addr ip6_dst;
|
||||
} /* PACK_OFF */;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++++++ TCP header +++++++++++++++++++++++ */
|
||||
|
||||
@@ -302,6 +370,29 @@ struct ndpi_icmphdr {
|
||||
} un;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++++++ ICMP6 header +++++++++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_icmp6hdr {
|
||||
uint8_t icmp6_type; /* type field */
|
||||
uint8_t icmp6_code; /* code field */
|
||||
uint16_t icmp6_cksum; /* checksum field */
|
||||
union {
|
||||
uint32_t icmp6_un_data32[1]; /* type-specific field */
|
||||
uint16_t icmp6_un_data16[2]; /* type-specific field */
|
||||
uint8_t icmp6_un_data8[4]; /* type-specific field */
|
||||
} icmp6_dataun;
|
||||
} PACK_OFF;
|
||||
|
||||
/* +++++++++++++++++++++++ VXLAN header +++++++++++++++++++++++ */
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_vxlanhdr {
|
||||
u_int16_t flags;
|
||||
u_int16_t groupPolicy;
|
||||
u_int32_t vni;
|
||||
} PACK_OFF;
|
||||
|
||||
/* ************************************************************ */
|
||||
/* ******************* ********************* ****************** */
|
||||
/* ************************************************************ */
|
||||
@@ -356,19 +447,26 @@ PACK_ON struct tinc_cache_entry {
|
||||
} PACK_OFF;
|
||||
|
||||
typedef enum {
|
||||
HTTP_METHOD_UNKNOWN = 0,
|
||||
HTTP_METHOD_OPTIONS,
|
||||
HTTP_METHOD_GET,
|
||||
HTTP_METHOD_HEAD,
|
||||
HTTP_METHOD_POST,
|
||||
HTTP_METHOD_PUT,
|
||||
HTTP_METHOD_DELETE,
|
||||
HTTP_METHOD_TRACE,
|
||||
HTTP_METHOD_CONNECT
|
||||
NDPI_HTTP_METHOD_UNKNOWN = 0,
|
||||
NDPI_HTTP_METHOD_OPTIONS,
|
||||
NDPI_HTTP_METHOD_GET,
|
||||
NDPI_HTTP_METHOD_HEAD,
|
||||
NDPI_HTTP_METHOD_PATCH,
|
||||
NDPI_HTTP_METHOD_POST,
|
||||
NDPI_HTTP_METHOD_PUT,
|
||||
NDPI_HTTP_METHOD_DELETE,
|
||||
NDPI_HTTP_METHOD_TRACE,
|
||||
NDPI_HTTP_METHOD_CONNECT
|
||||
} ndpi_http_method;
|
||||
|
||||
struct ndpi_lru_cache_entry {
|
||||
u_int32_t key; /* Store the whole key to avoid ambiguities */
|
||||
u_int32_t is_full:1, value:16, pad:15;
|
||||
};
|
||||
|
||||
struct ndpi_lru_cache {
|
||||
u_int32_t num_entries, *entries;
|
||||
u_int32_t num_entries;
|
||||
struct ndpi_lru_cache_entry *entries;
|
||||
};
|
||||
|
||||
struct ndpi_id_struct {
|
||||
@@ -479,14 +577,14 @@ struct ndpi_flow_tcp_struct {
|
||||
|
||||
/* NDPI_PROTOCOL_WHATSAPP */
|
||||
u_int8_t wa_matched_so_far;
|
||||
|
||||
|
||||
/* NDPI_PROTOCOL_TDS */
|
||||
u_int8_t tds_login_version;
|
||||
|
||||
/* NDPI_PROTOCOL_IRC */
|
||||
u_int8_t irc_stage;
|
||||
u_int8_t irc_port;
|
||||
|
||||
|
||||
/* NDPI_PROTOCOL_H323 */
|
||||
u_int8_t h323_valid_packets;
|
||||
|
||||
@@ -540,9 +638,20 @@ struct ndpi_flow_tcp_struct {
|
||||
/* NDPI_PROTOCOL_TELNET */
|
||||
u_int32_t telnet_stage:2; // 0 - 2
|
||||
|
||||
/* NDPI_PROTOCOL_SSL */
|
||||
u_int8_t ssl_seen_client_cert:1, ssl_seen_server_cert:1, ssl_stage:2; // 0 - 5
|
||||
|
||||
struct {
|
||||
struct {
|
||||
u_int8_t *buffer;
|
||||
u_int buffer_len, buffer_used;
|
||||
} message;
|
||||
|
||||
void* srv_cert_fingerprint_ctx; /* SHA-1 */
|
||||
|
||||
/* NDPI_PROTOCOL_TLS */
|
||||
u_int8_t hello_processed:1, certificate_processed:1, subprotocol_detected:1,
|
||||
fingerprint_set:1, _pad:4;
|
||||
u_int8_t sha1_certificate_fingerprint[20];
|
||||
} tls;
|
||||
|
||||
/* NDPI_PROTOCOL_POSTGRES */
|
||||
u_int32_t postgres_stage:3;
|
||||
|
||||
@@ -551,7 +660,7 @@ struct ndpi_flow_tcp_struct {
|
||||
u_int32_t seen_syn:1;
|
||||
u_int32_t seen_syn_ack:1;
|
||||
u_int32_t seen_ack:1;
|
||||
|
||||
|
||||
/* NDPI_PROTOCOL_ICECAST */
|
||||
u_int32_t icecast_stage:1;
|
||||
|
||||
@@ -658,6 +767,10 @@ struct ndpi_flow_udp_struct {
|
||||
|
||||
/* NDPI_PROTOCOL_MEMCACHED */
|
||||
u_int8_t memcached_matches;
|
||||
|
||||
/* NDPI_PROTOCOL_WIREGUARD */
|
||||
u_int8_t wireguard_stage;
|
||||
u_int32_t wireguard_peer_index[2];
|
||||
}
|
||||
#ifndef WIN32
|
||||
__attribute__ ((__packed__))
|
||||
@@ -724,10 +837,9 @@ struct ndpi_packet_struct {
|
||||
u_int8_t tcp_retransmission;
|
||||
u_int8_t l4_protocol;
|
||||
|
||||
u_int8_t ssl_certificate_detected:4, ssl_certificate_num_checks:4;
|
||||
u_int8_t tls_certificate_detected:4, tls_certificate_num_checks:4;
|
||||
u_int8_t packet_lines_parsed_complete:1,
|
||||
packet_direction:1,
|
||||
empty_line_position_set:1;
|
||||
packet_direction:1, empty_line_position_set:1, pad:5;
|
||||
};
|
||||
|
||||
struct ndpi_detection_module_struct;
|
||||
@@ -754,7 +866,8 @@ typedef enum {
|
||||
NDPI_PROTOCOL_ACCEPTABLE, /* Probably doesn't provide risks, but could be malicious (e.g., Dropbox) */
|
||||
NDPI_PROTOCOL_FUN, /* Pure fun protocol, which may be prohibited by the user policy (e.g., Netflix) */
|
||||
NDPI_PROTOCOL_UNSAFE, /* Probably provides risks, but could be a normal traffic. Unencrypted protocols with clear pass should be here (e.g., telnet) */
|
||||
NDPI_PROTOCOL_POTENTIALLY_DANGEROUS, /* Surely is dangerous (ex. Tor). Be prepared to troubles */
|
||||
NDPI_PROTOCOL_POTENTIALLY_DANGEROUS, /* Possibly dangerous (ex. Tor). */
|
||||
NDPI_PROTOCOL_DANGEROUS, /* Surely is dangerous (ex. smbv1). Be prepared to troubles */
|
||||
NDPI_PROTOCOL_TRACKER_ADS, /* Trackers, Advertisements... */
|
||||
NDPI_PROTOCOL_UNRATED /* No idea, not implemented or impossible to classify */
|
||||
} ndpi_protocol_breed_t;
|
||||
@@ -791,15 +904,12 @@ typedef enum {
|
||||
NDPI_PROTOCOL_CATEGORY_CUSTOM_4, /* User custom category 4 */
|
||||
NDPI_PROTOCOL_CATEGORY_CUSTOM_5, /* User custom category 5 */
|
||||
|
||||
/* Payload Content */
|
||||
NDPI_CONTENT_CATEGORY_AVI,
|
||||
NDPI_CONTENT_CATEGORY_FLASH,
|
||||
NDPI_CONTENT_CATEGORY_OGG,
|
||||
NDPI_CONTENT_CATEGORY_MPEG,
|
||||
NDPI_CONTENT_CATEGORY_QUICKTIME,
|
||||
NDPI_CONTENT_CATEGORY_REALMEDIA,
|
||||
NDPI_CONTENT_CATEGORY_WINDOWSMEDIA,
|
||||
NDPI_CONTENT_CATEGORY_WEBM,
|
||||
/* Further categories... */
|
||||
NDPI_PROTOCOL_CATEGORY_MUSIC,
|
||||
NDPI_PROTOCOL_CATEGORY_VIDEO,
|
||||
NDPI_PROTOCOL_CATEGORY_SHOPPING,
|
||||
NDPI_PROTOCOL_CATEGORY_PRODUCTIVITY,
|
||||
NDPI_PROTOCOL_CATEGORY_FILE_SHARING,
|
||||
|
||||
/* Some custom categories */
|
||||
CUSTOM_CATEGORY_MINING = 99,
|
||||
@@ -807,6 +917,13 @@ typedef enum {
|
||||
CUSTOM_CATEGORY_ADVERTISEMENT = 101,
|
||||
CUSTOM_CATEGORY_BANNED_SITE = 102,
|
||||
CUSTOM_CATEGORY_SITE_UNAVAILABLE = 103,
|
||||
CUSTOM_CATEGORY_ALLOWED_SITE = 104,
|
||||
/*
|
||||
The category below is used to track communications made by
|
||||
security applications (e.g. sophosxl.net, spamhaus.org)
|
||||
to track malware, spam etc.
|
||||
*/
|
||||
CUSTOM_CATEGORY_ANTIMALWARE = 105,
|
||||
|
||||
/*
|
||||
IMPORTANT
|
||||
@@ -817,7 +934,7 @@ typedef enum {
|
||||
|
||||
in ndpi_main.c
|
||||
*/
|
||||
|
||||
|
||||
NDPI_PROTOCOL_NUM_CATEGORIES /*
|
||||
NOTE: Keep this as last member
|
||||
Unused as value but useful to getting the number of elements
|
||||
@@ -826,13 +943,9 @@ typedef enum {
|
||||
} ndpi_protocol_category_t;
|
||||
|
||||
typedef enum {
|
||||
ndpi_pref_http_dont_dissect_response = 0,
|
||||
ndpi_pref_dns_dont_dissect_response,
|
||||
ndpi_pref_direction_detect_disable,
|
||||
ndpi_pref_disable_metadata_export,
|
||||
ndpi_pref_enable_category_substring_match
|
||||
ndpi_pref_direction_detect_disable = 0,
|
||||
} ndpi_detection_preference;
|
||||
|
||||
|
||||
/* ntop extensions */
|
||||
typedef struct ndpi_proto_defaults {
|
||||
char *protoName;
|
||||
@@ -890,6 +1003,15 @@ struct hs {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
|
||||
struct pcre_struct {
|
||||
pcre *compiled;
|
||||
pcre_extra *optimized;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct ndpi_detection_module_struct {
|
||||
NDPI_PROTOCOL_BITMASK detection_bitmask;
|
||||
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
|
||||
@@ -946,7 +1068,8 @@ struct ndpi_detection_module_struct {
|
||||
content_automa, /* Used for HTTP subprotocol_detection */
|
||||
subprotocol_automa, /* Used for HTTP subprotocol_detection */
|
||||
bigrams_automa, impossible_bigrams_automa; /* TOR */
|
||||
|
||||
/* IMPORTANT: please update ndpi_finalize_initalization() whenever you add a new automa */
|
||||
|
||||
struct {
|
||||
#ifdef HAVE_HYPERSCAN
|
||||
struct hs *hostnames;
|
||||
@@ -955,11 +1078,10 @@ struct ndpi_detection_module_struct {
|
||||
#else
|
||||
ndpi_automa hostnames, hostnames_shadow;
|
||||
#endif
|
||||
void *hostnames_hash;
|
||||
void *ipAddresses, *ipAddresses_shadow; /* Patricia */
|
||||
u_int8_t categories_loaded;
|
||||
} custom_categories;
|
||||
|
||||
|
||||
/* IP-based protocol detection */
|
||||
void *protocols_ptree;
|
||||
|
||||
@@ -985,10 +1107,6 @@ struct ndpi_detection_module_struct {
|
||||
u_int32_t zattoo_connection_timeout;
|
||||
u_int32_t jabber_stun_timeout;
|
||||
u_int32_t jabber_file_transfer_timeout;
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
#define NDPI_IP_STRING_SIZE 40
|
||||
char ip_string[NDPI_IP_STRING_SIZE];
|
||||
#endif
|
||||
u_int8_t ip_version_limit;
|
||||
/* NDPI_PROTOCOL_BITTORRENT */
|
||||
struct hash_ip4p_table *bt_ht;
|
||||
@@ -1006,19 +1124,25 @@ struct ndpi_detection_module_struct {
|
||||
/* NDPI_PROTOCOL_TINC */
|
||||
struct cache *tinc_cache;
|
||||
|
||||
/* NDPI_PROTOCOL_STUN and subprotocols */
|
||||
struct ndpi_lru_cache *stun_cache;
|
||||
|
||||
ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS];
|
||||
|
||||
u_int8_t http_dont_dissect_response:1, dns_dont_dissect_response:1,
|
||||
direction_detect_disable:1, /* disable internal detection of packet direction */
|
||||
disable_metadata_export:1, /* No metadata is exported */
|
||||
enable_category_substring_match:1 /* Default is perfect match */
|
||||
;
|
||||
|
||||
u_int8_t direction_detect_disable:1, /* disable internal detection of packet direction */
|
||||
_pad:7;
|
||||
|
||||
void *hyperscan; /* Intel Hyperscan */
|
||||
};
|
||||
|
||||
|
||||
#endif /* NDPI_LIB_COMPILATION */
|
||||
|
||||
typedef enum {
|
||||
ndpi_cipher_safe = NDPI_CIPHER_SAFE,
|
||||
ndpi_cipher_weak = NDPI_CIPHER_WEAK,
|
||||
ndpi_cipher_insecure = NDPI_CIPHER_INSECURE
|
||||
} ndpi_cipher_weakness;
|
||||
|
||||
struct ndpi_flow_struct {
|
||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE];
|
||||
#ifndef WIN32
|
||||
@@ -1027,8 +1151,9 @@ struct ndpi_flow_struct {
|
||||
u_int16_t protocol_stack_info;
|
||||
|
||||
/* init parameter, internal used to set up timestamp,... */
|
||||
u_int16_t guessed_protocol_id, guessed_host_protocol_id, guessed_category;
|
||||
u_int8_t protocol_id_already_guessed:1, host_already_guessed:1, init_finished:1, setup_packet_direction:1, packet_direction:1, check_extra_packets:1;
|
||||
u_int16_t guessed_protocol_id, guessed_host_protocol_id, guessed_category, guessed_header_category;
|
||||
u_int8_t l4_proto, protocol_id_already_guessed:1, host_already_guessed:1,
|
||||
init_finished:1, setup_packet_direction:1, packet_direction:1, check_extra_packets:1;
|
||||
|
||||
/*
|
||||
if ndpi_struct->direction_detect_disable == 1
|
||||
@@ -1039,7 +1164,7 @@ struct ndpi_flow_struct {
|
||||
u_int8_t max_extra_packets_to_check;
|
||||
u_int8_t num_extra_packets_checked;
|
||||
u_int8_t num_processed_pkts; /* <= WARNING it can wrap but we do expect people to giveup earlier */
|
||||
|
||||
|
||||
int (*extra_packets_func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow);
|
||||
|
||||
/*
|
||||
@@ -1051,13 +1176,16 @@ struct ndpi_flow_struct {
|
||||
struct ndpi_flow_udp_struct udp;
|
||||
} l4;
|
||||
|
||||
/* Place textual flow info here */
|
||||
char flow_extra_info[16];
|
||||
|
||||
/*
|
||||
Pointer to src or dst that identifies the
|
||||
server of this connection
|
||||
*/
|
||||
struct ndpi_id_struct *server_id;
|
||||
/* HTTP host or DNS query */
|
||||
u_char host_server_name[256];
|
||||
u_char host_server_name[240];
|
||||
|
||||
/*
|
||||
This structure below will not not stay inside the protos
|
||||
@@ -1068,17 +1196,28 @@ struct ndpi_flow_struct {
|
||||
*/
|
||||
struct {
|
||||
ndpi_http_method method;
|
||||
char *url, *content_type;
|
||||
char *url, *content_type, *user_agent;
|
||||
u_int8_t num_request_headers, num_response_headers;
|
||||
u_int8_t request_version; /* 0=1.0 and 1=1.1. Create an enum for this? */
|
||||
u_int16_t response_status_code; /* 200, 404, etc. */
|
||||
} http;
|
||||
|
||||
/*
|
||||
Put outside of the union to avoid issues in case the protocol
|
||||
is remapped to somethign pther than Kerberos due to a faulty
|
||||
dissector
|
||||
*/
|
||||
struct {
|
||||
char *pktbuf;
|
||||
u_int16_t pktbuf_maxlen, pktbuf_currlen;
|
||||
} kerberos_buf;
|
||||
|
||||
union {
|
||||
/* the only fields useful for nDPI and ntopng */
|
||||
struct {
|
||||
u_int8_t num_queries, num_answers, reply_code;
|
||||
u_int8_t num_queries, num_answers, reply_code, is_query;
|
||||
u_int16_t query_type, query_class, rsp_type;
|
||||
ndpi_ip_addr_t rsp_addr; /* The first address in a DNS response packet */
|
||||
} dns;
|
||||
|
||||
struct {
|
||||
@@ -1086,28 +1225,51 @@ struct ndpi_flow_struct {
|
||||
u_int8_t version;
|
||||
} ntp;
|
||||
|
||||
struct {
|
||||
char hostname[48], domain[48], username[48];
|
||||
} kerberos;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
char client_certificate[64], server_certificate[64];
|
||||
u_int16_t ssl_version, server_names_len;
|
||||
char client_requested_server_name[64], *server_names, server_organization[64],
|
||||
*alpn, *tls_supported_versions;
|
||||
u_int32_t notBefore, notAfter;
|
||||
char ja3_client[33], ja3_server[33];
|
||||
u_int16_t server_cipher;
|
||||
ndpi_cipher_weakness server_unsafe_cipher;
|
||||
} ssl;
|
||||
|
||||
|
||||
struct {
|
||||
u_int8_t num_udp_pkts, num_processed_pkts, num_binding_requests, is_skype;
|
||||
u_int8_t num_udp_pkts, num_processed_pkts, num_binding_requests;
|
||||
} stun;
|
||||
|
||||
/* We can have STUN over SSL thus they need to live together */
|
||||
} stun_ssl;
|
||||
/* We can have STUN over SSL/TLS thus they need to live together */
|
||||
} stun_ssl;
|
||||
|
||||
struct {
|
||||
char client_signature[48], server_signature[48];
|
||||
char hassh_client[33], hassh_server[33];
|
||||
} ssh;
|
||||
|
||||
struct {
|
||||
u_int8_t last_one_byte_pkt, last_byte;
|
||||
} imo;
|
||||
|
||||
struct {
|
||||
u_int8_t username_detected:1, username_found:1,
|
||||
password_detected:1, password_found:1,
|
||||
_pad:4;
|
||||
u_int8_t character_id;
|
||||
char username[32], password[32];
|
||||
} telnet;
|
||||
|
||||
struct {
|
||||
char answer[96];
|
||||
} mdns;
|
||||
|
||||
struct {
|
||||
char version[96];
|
||||
char version[32];
|
||||
} ubntac2;
|
||||
|
||||
struct {
|
||||
@@ -1117,6 +1279,11 @@ struct ndpi_flow_struct {
|
||||
u_char nat_ip[24];
|
||||
} http;
|
||||
|
||||
struct {
|
||||
u_int8_t auth_found:1, auth_failed:1, _pad:5;
|
||||
char username[16], password[16];
|
||||
} ftp_imap_pop_smtp;
|
||||
|
||||
struct {
|
||||
/* Bittorrent hash */
|
||||
u_char hash[20];
|
||||
@@ -1134,10 +1301,10 @@ struct ndpi_flow_struct {
|
||||
NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask;
|
||||
|
||||
ndpi_protocol_category_t category;
|
||||
|
||||
|
||||
/* NDPI_PROTOCOL_REDIS */
|
||||
u_int8_t redis_s2d_first_char, redis_d2s_first_char;
|
||||
|
||||
|
||||
u_int16_t packet_counter; // can be 0 - 65000
|
||||
u_int16_t packet_direction_counter[2];
|
||||
u_int16_t byte_counter[2];
|
||||
@@ -1152,8 +1319,7 @@ struct ndpi_flow_struct {
|
||||
|
||||
/* NDPI_PROTOCOL_HTTP */
|
||||
u_int8_t http_detected:1;
|
||||
u_int16_t http_upper_protocol, http_lower_protocol;
|
||||
|
||||
|
||||
/* NDPI_PROTOCOL_RTSP */
|
||||
u_int8_t rtsprdt_stage:2, rtsp_control_flow:1;
|
||||
|
||||
@@ -1168,7 +1334,7 @@ struct ndpi_flow_struct {
|
||||
|
||||
/* NDPI_PROTOCOL_THUNDER */
|
||||
u_int8_t thunder_stage:2; // 0 - 3
|
||||
|
||||
|
||||
/* NDPI_PROTOCOL_OSCAR */
|
||||
u_int8_t oscar_ssl_voice_stage:3, oscar_video_voice:1;
|
||||
|
||||
@@ -1228,16 +1394,111 @@ typedef struct {
|
||||
ndpi_protocol_breed_t protocol_breed;
|
||||
} ndpi_protocol_match;
|
||||
|
||||
typedef struct {
|
||||
char *string_to_match, *hyperscan_string_to_match;
|
||||
ndpi_protocol_category_t protocol_category;
|
||||
} ndpi_category_match;
|
||||
|
||||
typedef struct {
|
||||
u_int32_t network;
|
||||
u_int8_t cidr;
|
||||
u_int8_t value;
|
||||
} ndpi_network;
|
||||
|
||||
typedef u_int32_t ndpi_init_prefs;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ndpi_no_prefs = 0,
|
||||
ndpi_dont_load_tor_hosts,
|
||||
} ndpi_prefs;
|
||||
|
||||
typedef struct {
|
||||
int protocol_id;
|
||||
ndpi_protocol_category_t protocol_category;
|
||||
ndpi_protocol_breed_t protocol_breed;
|
||||
} ndpi_protocol_match_result;
|
||||
|
||||
typedef enum {
|
||||
ndpi_serialization_format_unknown = 0,
|
||||
ndpi_serialization_format_tlv,
|
||||
ndpi_serialization_format_json,
|
||||
ndpi_serialization_format_csv
|
||||
} ndpi_serialization_format;
|
||||
|
||||
/* Note: key supports string and uint32 (compressed to uint8/uint16) only,
|
||||
* this is also enforced by the API */
|
||||
typedef enum {
|
||||
ndpi_serialization_unknown = 0,
|
||||
ndpi_serialization_end_of_record,
|
||||
ndpi_serialization_uint8,
|
||||
ndpi_serialization_uint16,
|
||||
ndpi_serialization_uint32,
|
||||
ndpi_serialization_uint64,
|
||||
ndpi_serialization_int8,
|
||||
ndpi_serialization_int16,
|
||||
ndpi_serialization_int32,
|
||||
ndpi_serialization_int64,
|
||||
ndpi_serialization_float,
|
||||
ndpi_serialization_string
|
||||
} ndpi_serialization_type;
|
||||
|
||||
#define NDPI_SERIALIZER_DEFAULT_BUFFER_SIZE 8192
|
||||
#define NDPI_SERIALIZER_DEFAULT_BUFFER_INCR 1024
|
||||
|
||||
#define NDPI_SERIALIZER_STATUS_COMMA (1 << 0)
|
||||
#define NDPI_SERIALIZER_STATUS_ARRAY (1 << 1)
|
||||
#define NDPI_SERIALIZER_STATUS_EOR (1 << 2)
|
||||
#define NDPI_SERIALIZER_STATUS_SOB (1 << 3)
|
||||
#define NDPI_SERIALIZER_STATUS_NOT_EMPTY (1 << 4)
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_int32_t flags;
|
||||
u_int32_t size_used;
|
||||
} ndpi_private_serializer_status;
|
||||
|
||||
typedef struct {
|
||||
ndpi_private_serializer_status status;
|
||||
u_int32_t initial_buffer_size;
|
||||
u_int32_t buffer_size;
|
||||
ndpi_serialization_format fmt;
|
||||
u_int8_t *buffer;
|
||||
char csv_separator[2];
|
||||
u_int8_t has_snapshot;
|
||||
ndpi_private_serializer_status snapshot;
|
||||
} ndpi_private_serializer;
|
||||
|
||||
#define ndpi_private_deserializer ndpi_private_serializer
|
||||
|
||||
typedef struct { char c[sizeof(ndpi_private_serializer)]; } ndpi_serializer;
|
||||
|
||||
#define ndpi_deserializer ndpi_serializer
|
||||
|
||||
typedef struct {
|
||||
char *str;
|
||||
u_int16_t str_len;
|
||||
} ndpi_string;
|
||||
|
||||
/* **************************************** */
|
||||
|
||||
struct ndpi_analyze_struct {
|
||||
u_int32_t *values;
|
||||
u_int32_t min_val, max_val, sum_total, num_data_entries, next_value_insert_index;
|
||||
u_int16_t num_values_array_len /* lenght of the values array */;
|
||||
|
||||
struct {
|
||||
/* https://www.johndcook.com/blog/standard_deviation/ */
|
||||
float mu, q;
|
||||
} stddev;
|
||||
};
|
||||
|
||||
#define DEFAULT_SERIES_LEN 64
|
||||
#define MAX_SERIES_LEN 512
|
||||
#define MIN_SERIES_LEN 8
|
||||
|
||||
/* **************************************** */
|
||||
|
||||
typedef struct ndpi_ptree ndpi_ptree_t;
|
||||
|
||||
#endif /* __NDPI_TYPEDEFS_H__ */
|
||||
|
||||
@@ -75,6 +75,9 @@ typedef unsigned __int64 u_int64_t;
|
||||
|
||||
extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
|
||||
|
||||
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
||||
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
||||
#define localtime_r(a, b) localtime_s(b, a)
|
||||
#define strtok_r strtok_s
|
||||
#define timegm _mkgmtime
|
||||
|
||||
#endif /* __NDPI_WIN32_H__ */
|
||||
|
||||
+13
-9
@@ -14,10 +14,11 @@ prefix = @prefix@
|
||||
libdir = ${prefix}/lib
|
||||
includedir = ${prefix}/include/ndpi
|
||||
CC = @CC@
|
||||
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -O2 -g
|
||||
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -Wall @CFLAGS@ @CUSTOM_NDPI@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
RANLIB = ranlib
|
||||
|
||||
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o
|
||||
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c))
|
||||
HEADERS = $(wildcard ../include/*.h)
|
||||
NDPI_VERSION_MAJOR = @NDPI_MAJOR@
|
||||
NDPI_LIB_STATIC = libndpi.a
|
||||
@@ -42,15 +43,15 @@ ndpi_main.c: ndpi_content_match.c.inc
|
||||
|
||||
$(NDPI_LIB_STATIC): $(OBJECTS)
|
||||
ar rc $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
$(RANLIB) $@
|
||||
|
||||
$(NDPI_LIB_SHARED): $(OBJECTS)
|
||||
$(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS)
|
||||
ln -Ffs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)
|
||||
ln -Ffs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
|
||||
$(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS) $(LDFLAGS) @ADDITIONAL_LIBS@
|
||||
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)
|
||||
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
|
||||
|
||||
%.o: %.c $(HEADERS) Makefile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo $(NDPI_LIB_SHARED)
|
||||
@@ -58,10 +59,13 @@ clean:
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
|
||||
cppcheck:
|
||||
cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I ../include *.c protocols/*.c
|
||||
|
||||
install: $(NDPI_LIBS)
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
cp $(NDPI_LIBS) $(DESTDIR)$(libdir)/
|
||||
ln -Ffs $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED) $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED_BASE)
|
||||
ln -Ffs $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED) $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
|
||||
cp -P $(NDPI_LIB_SHARED_BASE) $(DESTDIR)$(libdir)/
|
||||
cp -P $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR) $(DESTDIR)$(libdir)/
|
||||
mkdir -p $(DESTDIR)$(includedir)
|
||||
cp ../include/*.h $(DESTDIR)$(includedir)
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* ndpi_analyze.c
|
||||
*
|
||||
* Copyright (C) 2019 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library.
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "ndpi_config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <float.h> /* FLT_EPSILON */
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_config.h"
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
void ndpi_init_data_analysis(struct ndpi_analyze_struct *ret, u_int16_t _max_series_len) {
|
||||
u_int32_t len;
|
||||
|
||||
memset(ret, 0, sizeof(struct ndpi_analyze_struct));
|
||||
|
||||
if(_max_series_len > MAX_SERIES_LEN) _max_series_len = MAX_SERIES_LEN;
|
||||
ret->num_values_array_len = _max_series_len;
|
||||
|
||||
if(ret->num_values_array_len > 0) {
|
||||
len = sizeof(u_int32_t)*ret->num_values_array_len;
|
||||
if((ret->values = ndpi_malloc(len)) == NULL) {
|
||||
ndpi_free(ret);
|
||||
ret = NULL;
|
||||
} else
|
||||
memset(ret->values, 0, len);
|
||||
} else
|
||||
ret->values = NULL;
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
struct ndpi_analyze_struct* ndpi_alloc_data_analysis(u_int16_t _max_series_len) {
|
||||
struct ndpi_analyze_struct *ret = ndpi_malloc(sizeof(struct ndpi_analyze_struct));
|
||||
|
||||
if(ret != NULL)
|
||||
ndpi_init_data_analysis(ret, _max_series_len);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
void ndpi_free_data_analysis(struct ndpi_analyze_struct *d) {
|
||||
if(d->values) ndpi_free(d->values);
|
||||
ndpi_free(d);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/*
|
||||
Add a new point to analyze
|
||||
*/
|
||||
void ndpi_data_add_value(struct ndpi_analyze_struct *s, const u_int32_t value) {
|
||||
float tmp_mu;
|
||||
|
||||
if(s->sum_total == 0)
|
||||
s->min_val = s->max_val = value;
|
||||
else {
|
||||
if(value < s->min_val) s->min_val = value;
|
||||
if(value > s->max_val) s->max_val = value;
|
||||
}
|
||||
|
||||
s->sum_total += value, s->num_data_entries++;
|
||||
|
||||
if(s->num_values_array_len) {
|
||||
s->values[s->next_value_insert_index] = value;
|
||||
|
||||
if(++s->next_value_insert_index == s->num_values_array_len)
|
||||
s->next_value_insert_index = 0;
|
||||
}
|
||||
|
||||
/* Update stddev */
|
||||
tmp_mu = s->stddev.mu;
|
||||
s->stddev.mu = ((s->stddev.mu * (s->num_data_entries - 1)) + value) / s->num_data_entries;
|
||||
s->stddev.q = s->stddev.q + (value - tmp_mu)*(value - s->stddev.mu);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/* Compute the average on all values */
|
||||
float ndpi_data_average(struct ndpi_analyze_struct *s) {
|
||||
return((s->num_data_entries == 0) ? 0 : ((float)s->sum_total / (float)s->num_data_entries));
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/* Return min/max on all values */
|
||||
u_int32_t ndpi_data_min(struct ndpi_analyze_struct *s) { return(s->min_val); }
|
||||
u_int32_t ndpi_data_max(struct ndpi_analyze_struct *s) { return(s->max_val); }
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/* Compute the variance on all values */
|
||||
float ndpi_data_variance(struct ndpi_analyze_struct *s) {
|
||||
return(s->num_data_entries ? (s->stddev.q / s->num_data_entries) : 0);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/* Compute the standard deviation on all values */
|
||||
float ndpi_data_stddev(struct ndpi_analyze_struct *s) {
|
||||
return(sqrt(ndpi_data_variance(s)));
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/* Compute the average only on the sliding window */
|
||||
float ndpi_data_window_average(struct ndpi_analyze_struct *s) {
|
||||
if(s->num_values_array_len) {
|
||||
float sum = 0.0;
|
||||
u_int16_t i, n = ndpi_min(s->num_data_entries, s->num_values_array_len);
|
||||
|
||||
for(i=0; i<n; i++)
|
||||
sum += s->values[i];
|
||||
|
||||
return((float)sum / (float)n);
|
||||
} else
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/*
|
||||
Compute entropy on the last sliding window values
|
||||
*/
|
||||
float ndpi_data_entropy(struct ndpi_analyze_struct *s) {
|
||||
if(s->num_values_array_len) {
|
||||
int i;
|
||||
float sum = 0.0, total = 0.0;
|
||||
|
||||
for(i=0; i<s->num_values_array_len; i++)
|
||||
total += s->values[i];
|
||||
|
||||
for (i=0; i<s->num_values_array_len; i++) {
|
||||
float tmp = (float)s->values[i] / (float)total;
|
||||
|
||||
if(tmp > FLT_EPSILON)
|
||||
sum -= tmp * logf(tmp);
|
||||
}
|
||||
|
||||
return(sum / logf(2.0));
|
||||
} else
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
void ndpi_data_print_window_values(struct ndpi_analyze_struct *s) {
|
||||
if(s->num_values_array_len) {
|
||||
u_int16_t i, n = ndpi_min(s->num_data_entries, s->num_values_array_len);
|
||||
|
||||
for(i=0; i<n; i++)
|
||||
printf("[%u: %u]", i, s->values[i]);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
/*
|
||||
Upload / download ration
|
||||
|
||||
-1 Download
|
||||
0 Mixed
|
||||
1 Upload
|
||||
*/
|
||||
float ndpi_data_ratio(u_int32_t sent, u_int32_t rcvd) {
|
||||
float s = (float)((int64_t)sent + (int64_t)rcvd);
|
||||
float d = (float)((int64_t)sent - (int64_t)rcvd);
|
||||
|
||||
return((s == 0) ? 0 : (d/s));
|
||||
}
|
||||
|
||||
const char* ndpi_data_ratio2str(float ratio) {
|
||||
if(ratio < -0.2) return("Download");
|
||||
else if(ratio > 0.2) return("Upload");
|
||||
else return("Mixed");
|
||||
}
|
||||
@@ -0,0 +1,693 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2016 Cisco Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
* Neither the name of the Cisco Systems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file ndpi_classify.c
|
||||
*
|
||||
* \brief contains the functionality for inline classification
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
// #include <sys/time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include "ndpi_main.h"
|
||||
#include "ndpi_classify.h"
|
||||
|
||||
/** finds the minimum value between to inputs */
|
||||
#ifndef min
|
||||
#define min(a,b) \
|
||||
({ __typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a < _b ? _a : _b; })
|
||||
#endif
|
||||
|
||||
|
||||
//bias (1) + w (207)
|
||||
//const float ndpi_parameters_splt[NUM_PARAMETERS_SPLT_LOGREG] = {
|
||||
float ndpi_parameters_splt[NUM_PARAMETERS_SPLT_LOGREG] = {
|
||||
-2.088057846500587456e+00, 7.763936238952200239e-05, 4.404309737393306595e-05, -9.467385027293546973e-02,
|
||||
4.348947142638090457e-01, -2.091409170053043390e-04, -5.788902107267982974e-04, 4.481443450852441001e-10,
|
||||
-3.136135459023654537e+00, -1.507730262127600751e+00, -1.204663669965535977e+00, -1.171839254318371104e+00,
|
||||
4.329302247232582057e-01, 8.310653628092458334e+00, 3.299246725156660176e+00, 0.000000000000000000e+00,
|
||||
1.847454931582027254e-02, -1.498024139966201096e+00, -7.660670007653060942e-01, -2.908130300830076731e+00,
|
||||
-1.252564844610269734e+00, -1.910955328742287573e+00, 9.471710980110392697e-01, 2.352302758516665371e+00,
|
||||
2.982269972214651954e+00, 4.280736383314343918e+00, 4.633629909719495288e+00, -2.198052637823726840e+00,
|
||||
-1.150759637168392580e+00, 3.420433363184381292e+00, 1.857878113059351077e-02, -1.559806674919653746e+00,
|
||||
4.197498183183401288e+00, 6.262186949633183453e+00, 1.100694844370524095e+01, 2.778688785515088000e+01,
|
||||
3.679948298336883195e+00, -2.432801394376875592e+00, 5.133442052706843617e-01, 2.181172654073517680e+00,
|
||||
-8.577551729671881731e-01, 7.013844214023315926e-01, 3.138233436228588857e+00, 7.319940508466630247e-01,
|
||||
0.000000000000000000e+00, 3.529209394581482861e+00, 1.464585117707144413e+01, 8.506550226820598359e-01,
|
||||
-9.060397326548508268e-01, 6.787474954688997641e+00, 8.125411068867387954e+00, 4.515740684104064151e+00,
|
||||
5.372135582950940069e+00, 9.210951196799497254e-01, 4.802177410869620466e+00, 2.945445016176073594e+01,
|
||||
1.575032253128311632e+00, -1.355276854364796946e-01, -3.322474764169629502e-01, 3.018397817188666732e+00,
|
||||
1.186503569922195744e+00, 0.000000000000000000e+00, 8.883242370198487503e-01, 7.248276146728496627e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, -4.831246718433664711e+00, 6.124136970173365002e-01,
|
||||
4.145693892559814686e-01, 2.683998941637626867e+00, 2.063906603639539039e+00, 2.989801217386735210e+00,
|
||||
2.262965767379551962e-01, 2.240332214649647380e+00, 5.984550782416063086e+00, 4.587011255338186544e+00,
|
||||
1.233118485315272039e+01, 1.115223490909697857e+00, -3.682686422016995476e+00, 6.096498453291562258e-01,
|
||||
1.119275528656461516e+00, 1.377886278915177731e-01, 3.828176805973048324e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 1.442927634029647344e+01, 0.000000000000000000e+00, 5.719118583309401593e-01,
|
||||
1.993632609731877392e-01, 3.047472271520709430e+00, 5.736784864911910198e+00, 6.677826247219391220e+00,
|
||||
6.307175478564531090e+00, 3.150295169417364249e+01, 3.738597740702392258e+00, 1.129754590514236234e+01,
|
||||
6.108506268573830056e+00, 1.605489516792866667e+00, 2.929631990348545489e+00, -2.832543082245212937e-02,
|
||||
1.358286530670594461e+00, 1.655932469853677924e+00, 6.701964773769768513e-01, 2.131182050917533211e+00,
|
||||
2.998351165769753468e+00, 7.772095996358327596e+00, 1.285014785269981141e+00, 4.407334784589962418e+00,
|
||||
1.719858214230612026e+00, -1.012765674651314063e+00, -5.749271123172469133e-01, -3.559614093795681278e+00,
|
||||
-3.073088477387719397e+00, -4.492469521371540431e+00, -3.753286990415885427e+00, -3.219255423324282273e+00,
|
||||
-2.806436518181075090e+00, -2.697305948568419875e+00, -7.879608430851776646e-01, 4.625507221739111330e+00,
|
||||
4.809280703883450414e+00, -3.435194026629848629e+00, -3.218943068168937049e+00, 3.335535704890596698e+00,
|
||||
2.071359212435486263e+00, 4.538992059175040339e+00, -2.770772323566738038e+01, 2.903047708571506735e+00,
|
||||
-4.436143805989154032e+00, -2.647991280011542381e-01, 1.737252348126810064e+00, -4.121989655995259128e+00,
|
||||
3.209709099445720581e-01, 1.012758514896711759e+01, 3.313255624721038295e+00, 4.631467619785444967e+00,
|
||||
7.668642402146534032e+00, 6.780938812710099128e+00, -3.256164342602652972e+00, 6.749565128319576779e-01,
|
||||
0.000000000000000000e+00, -4.407265954524525853e+00, 0.000000000000000000e+00, -3.666522115024547901e+01,
|
||||
-7.886029397826226273e+01, 0.000000000000000000e+00, 0.000000000000000000e+00, -2.261283814517791058e+01,
|
||||
-4.024317426178160240e+00, 3.213063737030031342e-01, 5.079805145796887800e+00, 1.326813226475260343e+00,
|
||||
1.233684078112145643e+00, 8.671852503871454232e+00, -2.041800256066371944e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -1.607347800380474823e+01, -4.430790279223246309e+00, 1.177552465851384511e+00,
|
||||
6.342921220500139512e+00, -2.466913734548706327e-02, 3.451642566010713065e-01, -6.012767168531006234e+00,
|
||||
7.328146570137336724e+00, 7.500088131707050465e+00, 0.000000000000000000e+00, -3.547913249211809017e+01,
|
||||
-3.130964814607208879e+00, 8.247326544297072237e-01, 3.757262485775580418e-01, -2.136528302027558723e+00,
|
||||
-2.631627236037529793e-01, -2.016718799388414141e+01, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -7.708602132869285528e-01, -2.602868328868111814e+00, 1.435184800833797958e+00,
|
||||
0.000000000000000000e+00, -2.080420864280113413e+00, 1.169498351211070819e+00, -1.798334115637199560e+01,
|
||||
-1.193885252696202670e+01, 0.000000000000000000e+00, 0.000000000000000000e+00, 4.304089297965300709e+00,
|
||||
-3.020893216686394656e+00, -1.234427481614708721e+00, 0.000000000000000000e+00, 1.853340741926325697e+00,
|
||||
-2.686000064995862147e+01, -1.672275139058893600e+01, -2.826268691607605987e+01, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -1.547397429377200817e+00, -4.018181657009961327e+00, -7.289186736637049968e+00,
|
||||
-7.458655219230571731e+00, -9.625538282761622710e+00, -1.103039457077456298e+01, -6.262675161142102809e+01,
|
||||
-9.265912629799268885e+00, -8.961543476816615339e+00, -9.622764435629340696e+00, -1.097978292092879826e+01,
|
||||
};
|
||||
|
||||
//bias (1) + w (207)
|
||||
//const float ndpi_parameters_bd[NUM_PARAMETERS_BD_LOGREG] = {
|
||||
float ndpi_parameters_bd[NUM_PARAMETERS_BD_LOGREG] = {
|
||||
-1.678134053325450292e+00, 1.048946534609769413e-04, 9.608725756967682636e-05, -7.515489355100658797e-02,
|
||||
2.089554874872663892e-01, -1.012058874142656513e-04, -2.917652723373885169e-04, 1.087540461196068741e-10,
|
||||
-2.594688448425090055e+00, -2.071803573048482061e+00, -1.399303273236228939e+00, -2.089300736641718004e+00,
|
||||
-8.842347826063630123e-01, 6.476433717022786141e+00, 3.114501282249810377e+00, -2.239127990932460399e+00,
|
||||
-4.667574389646080291e-01, -2.200651610813817438e+00, -1.674926704401964894e+00, -3.894420410398949706e+00,
|
||||
-1.232376502509682004e+00, -2.231027070413975189e+00, 7.691948448668822769e-01, 3.222335181407633531e+00,
|
||||
1.430983188964249919e+00, 2.144317250116257956e+00, 6.596745231472220361e+00, -2.464580889153460852e+00,
|
||||
-1.923337901965658681e+00, 2.910328594745831943e+00, -3.123244869063500073e-01, -1.683345539896562659e+00,
|
||||
3.785795988845424898e+00, 5.235473328290667361e+00, 8.512526402199654285e+00, 1.393475907195251473e+01,
|
||||
1.673386027437856916e+00, -2.910729265724139925e+00, 2.969886703676111184e-01, 1.700051266957717466e+00,
|
||||
-5.472121114836264733e-01, 1.716354591332415469e-01, 3.177884264837486317e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 1.924354871334499062e-01, 6.568439271753665487e+00, 2.102316342451608644e-01,
|
||||
-1.132124603237853355e+00, 7.329625148148498859e+00, 6.606460464951361189e+00, 2.844223241371105271e+00,
|
||||
3.078771172794853683e+00, 0.000000000000000000e+00, 2.656884613648917703e+00, 1.779697712165259205e+01,
|
||||
0.000000000000000000e+00, -3.457017935109325535e-01, 2.157595478838472414e-01, 3.829196175023549031e+00,
|
||||
0.000000000000000000e+00, 1.650776974765602867e-01, 1.357223085191380796e-02, 3.946357663253555081e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, -2.155616432815957495e+00, 8.213633570666911687e-01,
|
||||
1.125480801049912050e-01, 2.684005418659722420e+00, 5.769541257304295900e-01, 1.060883870466023948e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 3.413708974045502664e+00, 2.275281553961784553e+00,
|
||||
5.176725998383044924e+00, 1.019445219242678835e+00, -1.848344450190015698e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 1.491820649409327126e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 9.379741891282449728e+00, 0.000000000000000000e+00, 5.444605374840002510e-01,
|
||||
-9.654403640632221173e-02, 2.642171746731144744e+00, 4.626416118226488905e+00, 3.654642208477139498e+00,
|
||||
3.427412899258296619e+00, 1.490784083593987397e+01, 2.322393214516801141e+00, 6.511453713852694669e+00,
|
||||
6.949721651828602020e+00, 1.186838154505042375e+00, 2.072129970488261197e+00, 0.000000000000000000e+00,
|
||||
1.598928631178261561e+00, 5.926083912988970859e-01, -1.612886287403501873e-01, 9.452951868724716045e-01,
|
||||
2.145707914290207352e+00, 5.391610489831286657e+00, 8.454389313314318866e-01, 2.372736567215404602e+00,
|
||||
-3.130110237826235764e-01, -2.994989290166069740e+00, -2.571950567149417832e+00, -5.018016256298333921e+00,
|
||||
-4.851489154898488643e+00, -7.101788768628541249e+00, -5.227281714666618839e+00, -6.351346048086286444e+00,
|
||||
-4.558191218464671124e+00, -5.293990544168526213e+00, -2.920034449434862345e-01, 5.166915658100844411e+00,
|
||||
4.642130303354632836e+00, -5.246106907306949951e-01, -3.120281208300208498e+00, 1.544764033379846691e+00,
|
||||
0.000000000000000000e+00, 3.721469736246234561e+00, -1.083434721745241625e+01, 2.901590918368040395e+00,
|
||||
-3.602037909234679258e+00, 0.000000000000000000e+00, 2.736307835089097917e+00, -5.037400262764839987e+00,
|
||||
-1.163050013241316849e+00, 6.565863507998260573e+00, 1.872406036485896097e+00, 2.249439295570562880e+00,
|
||||
3.276076277814265136e+00, 5.747730113795930684e+00, -2.084335807954610154e+00, 1.812930768433161921e+00,
|
||||
0.000000000000000000e+00, -4.068875727535363751e+00, -4.509432609364653205e-02, -1.424182063303933710e+01,
|
||||
-1.743400430675688639e+01, 0.000000000000000000e+00, 0.000000000000000000e+00, -8.986019040369217947e+00,
|
||||
-2.005955598483518898e+00, 1.514163405869717538e+00, 4.060752357984299010e+00, 1.405971170124569403e+00,
|
||||
1.383171915541985708e+00, 4.654452090729912506e+00, -3.395023560174311950e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -8.562968788250293173e+00, -1.939561462845156514e+00, 2.627499899415196793e+00,
|
||||
4.949794698120698833e+00, 4.355655772643094448e-01, 0.000000000000000000e+00, -1.055190553626396577e+00,
|
||||
4.757318838337171840e+00, 3.966536148163406938e+00, 0.000000000000000000e+00, -1.190662117721104352e+01,
|
||||
-1.673945042186458121e+00, 0.000000000000000000e+00, -1.203943763219820356e-02, -1.411827841131889194e+00,
|
||||
-7.623501643009024109e-01, -6.774873775798392117e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, -1.755294779557688090e+00, 1.542887322103192238e+00,
|
||||
0.000000000000000000e+00, -8.228978371972577310e-01, 0.000000000000000000e+00, -5.379142925264499553e+00,
|
||||
-1.144060263986041326e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 4.731108583634047626e+00,
|
||||
-1.569393147397664556e+00, -3.449886418134247568e-01, 0.000000000000000000e+00, 1.658412661295906920e+00,
|
||||
-5.077151059809188460e+00, -7.326467579034271260e+00, -1.190177296658179840e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, -1.914781807241187739e+00, -5.438446604150855457e+00,
|
||||
-5.988893208768400811e+00, -7.886849112491050029e+00, -9.355574940159534947e+00, -1.682361325340106006e+01,
|
||||
-7.609538696398503888e+00, -7.363350786768400269e+00, -7.366039984795356155e+00, -7.051111570136543882e+00,
|
||||
2.337391373249395610e+00, -4.374845402801011574e+01, -3.610863365629191080e+00, 7.684297617701028571e+01,
|
||||
2.162851395732025139e+01, 1.066280518306870562e+01, 8.109257308306457901e+01, 5.149561395669890906e+00,
|
||||
0.000000000000000000e+00, 3.219993054481156136e+00, 0.000000000000000000e+00, 2.093519725422254396e+01,
|
||||
-5.225298528278367272e+00, 0.000000000000000000e+00, 2.159597932230871820e+00, -5.205637201784965384e+01,
|
||||
1.601979388461561982e+01, 6.945290207097973401e+00, 8.036724740759808583e-01, 4.712266457087280536e+00,
|
||||
2.146353485778652370e+01, 3.470089369007970248e+01, 9.468591086256607170e+00, 9.760488656497257054e-01,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 9.008837970422939323e-01,
|
||||
0.000000000000000000e+00, 1.462843531299845168e+01, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
-1.179406942091425847e+01, 0.000000000000000000e+00, 1.642473653464513816e+01, 1.387228776263151175e+01,
|
||||
0.000000000000000000e+00, 1.613129141280310108e+01, 0.000000000000000000e+00, -1.077318890268341045e+00,
|
||||
4.189407459072477802e-01, 0.000000000000000000e+00, -1.570052145651456899e+00, 0.000000000000000000e+00,
|
||||
1.120834605828141939e+01, 4.286417457736029490e+01, 0.000000000000000000e+00, 2.938378293327098945e+01,
|
||||
1.194087082487160956e+01, 0.000000000000000000e+00, -9.951431855637998813e-02, 3.844291513997798448e-01,
|
||||
2.362333099868798669e+01, -1.002532136112976957e+01, 2.427817537309562823e+01, 0.000000000000000000e+00,
|
||||
1.076329692188489773e+01, 1.760895870067486157e+00, 2.080295785135324849e+01, -4.335217053626006134e+01,
|
||||
-6.272369476984676062e-01, 5.165768790797590881e+00, -4.507215926635629311e-01, 0.000000000000000000e+00,
|
||||
-4.242472062530233679e+00, -4.931831554080153168e+00, -2.806203935735193777e+00, -2.670377941558885126e+01,
|
||||
0.000000000000000000e+00, -2.124688439238133242e+01, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
2.452415244698852970e+00, -1.173727222080745092e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
-1.458125295680756039e+01, -1.757703406512062827e+01, 0.000000000000000000e+00, 3.943626521423988951e+00,
|
||||
0.000000000000000000e+00, -4.006095410470026152e+00, 1.727171067402430538e+01, -3.412620901789366457e+01,
|
||||
0.000000000000000000e+00, 1.760073934312834254e+01, 3.266082201875645552e+01, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 1.514535424913179362e+01, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -3.100487758075622935e-01, 0.000000000000000000e+00, 2.387863228159451978e+01,
|
||||
1.237098847411416891e+01, 1.154430573879687560e-02, 7.976366278729441817e+00, 0.000000000000000000e+00,
|
||||
-6.296727640787388447e-01, 1.406230674131906255e+01, 1.430275589872723430e+01, -2.231764570537816184e+00,
|
||||
0.000000000000000000e+00, 5.003869692542436631e+00, 0.000000000000000000e+00, -5.482127427587509594e+00,
|
||||
-8.830547931126154992e+00, -5.376776036224484301e+01, -2.918517871695104304e+01, -1.009022417771788049e+01,
|
||||
-4.811775051355994037e+00, -1.188016976215758547e+01, -2.055483647266791536e+01, -2.482333959706277327e+01,
|
||||
-1.048392515070836950e+01, -3.837352144714887459e+01, 0.000000000000000000e+00, -9.298440675063780247e+00,
|
||||
0.000000000000000000e+00, 3.584086297861655890e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 1.184271790014085113e+00,
|
||||
1.594266439891793219e+01, 0.000000000000000000e+00, 8.473235161049382569e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 6.748879951595517568e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -1.057534737660506430e+01, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -3.179879192807419841e+01, 0.000000000000000000e+00, 5.000324879565139824e+00,
|
||||
0.000000000000000000e+00, 1.229183419446936654e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
4.127983063177185663e+00, 6.616705680943091750e+00, 5.848245769217652601e+00, -1.818944631334333550e+01,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
2.694838778746875274e+00, 0.000000000000000000e+00, 1.463145767737777625e+01, -4.924734438569850603e+00,
|
||||
0.000000000000000000e+00, 1.877377621310543088e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
1.971941442729244764e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 1.732809836566829187e+00, 2.700285877421266534e+01,
|
||||
2.915978562591383216e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, -6.999629705176019456e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 1.089611710258455268e+01,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
2.121018958070171934e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
-7.416250358067024706e+00, -1.263327458973565065e+01, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 2.241612733384156897e+01,
|
||||
0.000000000000000000e+00, 8.607688079645482659e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 1.750217629228628269e+01, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, -1.957769005108392690e+01, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -3.242393079195928784e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, 1.348338590741638932e+01, 0.000000000000000000e+00,
|
||||
-2.000312276678208392e-02, -7.776608146776987640e-01, 0.000000000000000000e+00, 0.000000000000000000e+00,
|
||||
0.000000000000000000e+00, -5.387825733845168941e+00, 0.000000000000000000e+00, 2.153516224136292934e+01,
|
||||
0.000000000000000000e+00, 0.000000000000000000e+00, -9.635140703414636576e+00, 2.603288107669730511e+00,
|
||||
};
|
||||
|
||||
/**
|
||||
* \fn void ndpi_merge_splt_arrays (const uint16_t *pkt_len, const struct timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times,
|
||||
uint32_t max_num_pkt_len, uint32_t max_merged_num_pkts)
|
||||
* \param pkt_len length of the packet
|
||||
* \param pkt_time time of the packet
|
||||
* \param pkt_len_twin length of the twin packet
|
||||
* \param pkt_time_twin time of the twin packet
|
||||
* \param start_time start time
|
||||
* \param start_time_twin start time of twin
|
||||
* \param s_idx s index in the merge
|
||||
* \param r_idx r index in the merge
|
||||
* \param merged_lens length of the merge
|
||||
* \param merged_times time of the merge
|
||||
* \param max_merged_num_pkts number of packets merged
|
||||
* \return none
|
||||
*/
|
||||
void
|
||||
ndpi_merge_splt_arrays (const uint16_t *pkt_len, const struct timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times)
|
||||
{
|
||||
int s,r;
|
||||
struct timeval ts_start = { 0, 0 }; /* initialize to avoid spurious warnings */
|
||||
struct timeval tmp, tmp_r;
|
||||
struct timeval start_m;
|
||||
|
||||
if(r_idx + s_idx == 0) {
|
||||
return ;
|
||||
} else if(r_idx == 0) {
|
||||
ts_start = pkt_time[0];
|
||||
tmp = pkt_time[0];
|
||||
ndpi_timer_sub(&tmp, &start_time, &start_m);
|
||||
} else if(s_idx == 0) {
|
||||
ts_start = pkt_time_twin[0];
|
||||
tmp = pkt_time_twin[0];
|
||||
ndpi_timer_sub(&tmp, &start_time_twin, &start_m);
|
||||
} else {
|
||||
if(ndpi_timer_lt(&start_time, &start_time_twin)) {
|
||||
ts_start = pkt_time[0];
|
||||
tmp = pkt_time[0];
|
||||
ndpi_timer_sub(&tmp, &start_time, &start_m);
|
||||
} else {
|
||||
// ts_start = pkt_time_twin[0];
|
||||
tmp = pkt_time_twin[0];
|
||||
ndpi_timer_sub(&tmp, &start_time_twin, &start_m);
|
||||
}
|
||||
}
|
||||
s = r = 0;
|
||||
while ((s < s_idx) || (r < r_idx)) {
|
||||
if(s >= s_idx) {
|
||||
merged_lens[s+r] = pkt_len_twin[r];
|
||||
tmp = pkt_time_twin[r];
|
||||
ndpi_timer_sub(&tmp, &ts_start, &tmp_r);
|
||||
merged_times[s+r] = ndpi_timeval_to_milliseconds(tmp_r);
|
||||
if(merged_times[s+r] == 0)
|
||||
merged_times[s+r] = ndpi_timeval_to_microseconds(tmp_r);
|
||||
ts_start = tmp;
|
||||
r++;
|
||||
} else if(r >= r_idx) {
|
||||
merged_lens[s+r] = pkt_len[s];
|
||||
tmp = pkt_time[s];
|
||||
ndpi_timer_sub(&tmp, &ts_start, &tmp_r);
|
||||
merged_times[s+r] = ndpi_timeval_to_milliseconds(tmp_r);
|
||||
if(merged_times[s+r] == 0)
|
||||
merged_times[s+r] = ndpi_timeval_to_microseconds(tmp_r);
|
||||
ts_start = tmp;
|
||||
s++;
|
||||
} else {
|
||||
if(ndpi_timer_lt(&pkt_time[s], &pkt_time_twin[r])) {
|
||||
merged_lens[s+r] = pkt_len[s];
|
||||
tmp = pkt_time[s];
|
||||
ndpi_timer_sub(&tmp, &ts_start, &tmp_r);
|
||||
merged_times[s+r] = ndpi_timeval_to_milliseconds(tmp_r);
|
||||
if(merged_times[s+r] == 0)
|
||||
merged_times[s+r] = ndpi_timeval_to_microseconds(tmp_r);
|
||||
ts_start = tmp;
|
||||
s++;
|
||||
} else {
|
||||
merged_lens[s+r] = pkt_len_twin[r];
|
||||
tmp = pkt_time_twin[r];
|
||||
ndpi_timer_sub(&tmp, &ts_start, &tmp_r);
|
||||
merged_times[s+r] = ndpi_timeval_to_milliseconds(tmp_r);
|
||||
if(merged_times[s+r] == 0)
|
||||
merged_times[s+r] = ndpi_timeval_to_microseconds(tmp_r);
|
||||
ts_start = tmp;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
}
|
||||
merged_times[0] = ndpi_timeval_to_milliseconds(start_m);
|
||||
if(merged_times[0] == 0)
|
||||
merged_times[0] = ndpi_timeval_to_microseconds(start_m);
|
||||
}
|
||||
|
||||
/* transform lens array to Markov chain */
|
||||
static void
|
||||
ndpi_get_mc_rep_lens (uint16_t *lens, float *length_mc, uint16_t num_packets)
|
||||
{
|
||||
float row_sum;
|
||||
int prev_packet_size = 0;
|
||||
int cur_packet_size = 0;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < MC_BINS_LEN*MC_BINS_LEN; i++) { // init to 0
|
||||
length_mc[i] = 0.0;
|
||||
}
|
||||
|
||||
if(num_packets == 0) {
|
||||
// nothing to do
|
||||
} else if(num_packets == 1) {
|
||||
cur_packet_size = (int)min(lens[0]/(float)MC_BIN_SIZE_LEN,(uint16_t)MC_BINS_LEN-1);
|
||||
length_mc[cur_packet_size + cur_packet_size*MC_BINS_LEN] = 1.0;
|
||||
} else {
|
||||
for (i = 1; i < num_packets; i++) {
|
||||
prev_packet_size = (int)min((uint16_t)(lens[i-1]/(float)MC_BIN_SIZE_LEN),(uint16_t)MC_BINS_LEN-1);
|
||||
cur_packet_size = (int)min((uint16_t)(lens[i]/(float)MC_BIN_SIZE_LEN),(uint16_t)MC_BINS_LEN-1);
|
||||
length_mc[prev_packet_size*MC_BINS_LEN + cur_packet_size] += 1.0;
|
||||
}
|
||||
// normalize rows of Markov chain
|
||||
for (i = 0; i < MC_BINS_LEN; i++) {
|
||||
// find sum
|
||||
row_sum = 0.0;
|
||||
for (j = 0; j < MC_BINS_LEN; j++) {
|
||||
row_sum += length_mc[i*MC_BINS_LEN+j];
|
||||
}
|
||||
if(row_sum != 0.0) {
|
||||
for (j = 0; j < MC_BINS_LEN; j++) {
|
||||
length_mc[i*MC_BINS_LEN+j] /= row_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* transform times array to Markov chain */
|
||||
void
|
||||
ndpi_get_mc_rep_times (uint16_t *times, float *time_mc, uint16_t num_packets)
|
||||
{
|
||||
float row_sum;
|
||||
int prev_packet_time = 0;
|
||||
int cur_packet_time = 0;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < MC_BINS_TIME*MC_BINS_TIME; i++) { // init to 0
|
||||
time_mc[i] = 0.0;
|
||||
}
|
||||
if(num_packets == 0) {
|
||||
// nothing to do
|
||||
} else if(num_packets == 1) {
|
||||
cur_packet_time = (int)min(times[0]/(float)MC_BIN_SIZE_TIME,(uint16_t)MC_BINS_TIME-1);
|
||||
time_mc[cur_packet_time + cur_packet_time*MC_BINS_TIME] = 1.0;
|
||||
} else {
|
||||
for (i = 1; i < num_packets; i++) {
|
||||
prev_packet_time = (int)min((uint16_t)(times[i-1]/(float)MC_BIN_SIZE_TIME),(uint16_t)MC_BINS_TIME-1);
|
||||
cur_packet_time = (int)min((uint16_t)(times[i]/(float)MC_BIN_SIZE_TIME),(uint16_t)MC_BINS_TIME-1);
|
||||
time_mc[prev_packet_time*MC_BINS_TIME + cur_packet_time] += 1.0;
|
||||
}
|
||||
// normalize rows of Markov chain
|
||||
for (i = 0; i < MC_BINS_TIME; i++) {
|
||||
// find sum
|
||||
row_sum = 0.0;
|
||||
for (j = 0; j < MC_BINS_TIME; j++) {
|
||||
row_sum += time_mc[i*MC_BINS_TIME+j];
|
||||
}
|
||||
if(row_sum != 0.0) {
|
||||
for (j = 0; j < MC_BINS_TIME; j++) {
|
||||
time_mc[i*MC_BINS_TIME+j] /= row_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn float classify (const unsigned short *pkt_len, const struct timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t)
|
||||
* \param pkt_len length of the packet
|
||||
* \param pkt_time time of the packet
|
||||
* \param pkt_len_twin length of the packet twin
|
||||
* \param pkt_time_twin time of the packet twin
|
||||
* \param start_time start time
|
||||
* \param start_time_twin start time of the twin
|
||||
* \param max_num_pkt_len maximum len of number of packets
|
||||
* \param sp
|
||||
* \param dp
|
||||
* \param op
|
||||
* \param ip
|
||||
* \param np_o
|
||||
* \param np_i
|
||||
* \param ob
|
||||
* \param ib
|
||||
* \param use_bd
|
||||
* \param *bd pointer to bd
|
||||
* \param *bd_t pointer to bd type
|
||||
* \return float score
|
||||
*/
|
||||
float
|
||||
ndpi_classify (const unsigned short *pkt_len, const struct timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t)
|
||||
{
|
||||
|
||||
float features[NUM_PARAMETERS_BD_LOGREG] = {1.0};
|
||||
float mc_lens[MC_BINS_LEN*MC_BINS_LEN];
|
||||
float mc_times[MC_BINS_TIME*MC_BINS_TIME];
|
||||
uint32_t i;
|
||||
float score = 0.0;
|
||||
|
||||
uint32_t op_n = min(np_o, max_num_pkt_len);
|
||||
uint32_t ip_n = min(np_i, max_num_pkt_len);
|
||||
uint16_t *merged_lens = NULL;
|
||||
uint16_t *merged_times = NULL;
|
||||
|
||||
for (i = 1; i < NUM_PARAMETERS_BD_LOGREG; i++) {
|
||||
features[i] = 0.0;
|
||||
}
|
||||
|
||||
merged_lens = ndpi_calloc(1, sizeof(uint16_t)*(op_n + ip_n));
|
||||
merged_times = ndpi_calloc(1, sizeof(uint16_t)*(op_n + ip_n));
|
||||
|
||||
if(!merged_lens || !merged_times) {
|
||||
ndpi_free(merged_lens);
|
||||
ndpi_free(merged_times);
|
||||
return(score);
|
||||
}
|
||||
|
||||
// fill out meta data
|
||||
features[1] = (float)dp; // destination port
|
||||
features[2] = (float)sp; // source port
|
||||
features[3] = (float)ip; // inbound packets
|
||||
features[4] = (float)op; // outbound packets
|
||||
features[5] = (float)ib; // inbound bytes
|
||||
features[6] = (float)ob; // outbound bytes
|
||||
features[7] = 0.0;// skipping 7 until we process the pkt_time arrays
|
||||
|
||||
// find the raw features
|
||||
ndpi_merge_splt_arrays(pkt_len, pkt_time, pkt_len_twin, pkt_time_twin, start_time, start_time_twin, op_n, ip_n,
|
||||
merged_lens, merged_times);
|
||||
|
||||
// find new duration
|
||||
for (i = 0; i < op_n+ip_n; i++) {
|
||||
features[7] += (float)merged_times[i];
|
||||
}
|
||||
|
||||
// get the Markov chain representation for the lengths
|
||||
ndpi_get_mc_rep_lens(merged_lens, mc_lens, op_n+ip_n);
|
||||
|
||||
// get the Markov chain representation for the times
|
||||
ndpi_get_mc_rep_times(merged_times, mc_times, op_n+ip_n);
|
||||
|
||||
// fill out lens/times in feature vector
|
||||
for (i = 0; i < MC_BINS_LEN*MC_BINS_LEN; i++) {
|
||||
features[i+8] = mc_lens[i]; // lengths
|
||||
}
|
||||
for (i = 0; i < MC_BINS_TIME*MC_BINS_TIME; i++) {
|
||||
features[i+8+MC_BINS_LEN*MC_BINS_LEN] = mc_times[i]; // times
|
||||
}
|
||||
|
||||
// fill out byte distribution features
|
||||
if(ob+ib > 100 && use_bd) {
|
||||
for (i = 0; i < NUM_BD_VALUES; i++) {
|
||||
if(pkt_len_twin != NULL) {
|
||||
features[i+8+MC_BINS_LEN*MC_BINS_LEN+MC_BINS_TIME*MC_BINS_TIME] = (bd[i]+bd_t[i])/((float)(ob+ib));
|
||||
} else {
|
||||
features[i+8+MC_BINS_LEN*MC_BINS_LEN+MC_BINS_TIME*MC_BINS_TIME] = bd[i]/((float)(ob));
|
||||
}
|
||||
}
|
||||
|
||||
score = ndpi_parameters_bd[0];
|
||||
for (i = 1; i < NUM_PARAMETERS_BD_LOGREG; i++) {
|
||||
score += features[i]*ndpi_parameters_bd[i];
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < NUM_PARAMETERS_SPLT_LOGREG; i++) {
|
||||
score += features[i]*ndpi_parameters_splt[i];
|
||||
}
|
||||
}
|
||||
|
||||
score = min(-score,500.0); // check b/c overflow
|
||||
|
||||
ndpi_free(merged_lens);
|
||||
ndpi_free(merged_times);
|
||||
|
||||
return 1.0/(1.0+exp(score));
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn void update_params (char *splt_params, char *bd_params)
|
||||
* \brief if a user supplies new parameter files, update parameters splt/bd
|
||||
* \param param_type type of new parameters to update
|
||||
* \param params file name with new parameters
|
||||
* \reutrn none
|
||||
*/
|
||||
void
|
||||
ndpi_update_params (classifier_type_codes_t param_type, const char *param_file)
|
||||
{
|
||||
float param;
|
||||
FILE *fp;
|
||||
int count = 0;
|
||||
|
||||
switch (param_type) {
|
||||
case (SPLT_PARAM_TYPE):
|
||||
count = 0;
|
||||
fp = fopen(param_file,"r");
|
||||
if(fp != NULL) {
|
||||
while (fscanf(fp, "%f", ¶m) != EOF) {
|
||||
ndpi_parameters_splt[count] = param;
|
||||
count++;
|
||||
if(count >= NUM_PARAMETERS_SPLT_LOGREG) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
break;
|
||||
|
||||
case (BD_PARAM_TYPE):
|
||||
count = 0;
|
||||
fp = fopen(param_file,"r");
|
||||
if(fp != NULL) {
|
||||
while (fscanf(fp, "%f", ¶m) != EOF) {
|
||||
ndpi_parameters_bd[count] = param;
|
||||
count++;
|
||||
if(count >= NUM_PARAMETERS_BD_LOGREG) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("error: unknown paramerter type (%d)", param_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* *********************************************************************
|
||||
* ---------------------------------------------------------------------
|
||||
* Time functions
|
||||
* For portability and static analysis, we define our own timer
|
||||
* comparison functions (rather than use non-standard
|
||||
* timercmp/timersub macros)
|
||||
* ---------------------------------------------------------------------
|
||||
* *********************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Compare two times to see if they are equal
|
||||
* \param a First time value
|
||||
* \param b Second time value
|
||||
* \return 1 if equal, 0 otherwise
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_timer_eq(const struct timeval *a,
|
||||
const struct timeval *b)
|
||||
{
|
||||
if(a->tv_sec == b->tv_sec && a->tv_usec == b->tv_usec) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
ndpi_timer_lt(const struct timeval *a,
|
||||
const struct timeval *b)
|
||||
{
|
||||
return (a->tv_sec == b->tv_sec) ?
|
||||
(a->tv_usec < b->tv_usec):(a->tv_sec < b->tv_sec);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Calculate the difference betwen two times (result = a - b)
|
||||
* \param a First time value
|
||||
* \param b Second time value
|
||||
* \param result The difference between the two time values
|
||||
* \return none
|
||||
*/
|
||||
void
|
||||
ndpi_timer_sub(const struct timeval *a,
|
||||
const struct timeval *b,
|
||||
struct timeval *result)
|
||||
{
|
||||
result->tv_sec = a->tv_sec - b->tv_sec;
|
||||
result->tv_usec = a->tv_usec - b->tv_usec;
|
||||
if(result->tv_usec < 0) {
|
||||
--result->tv_sec;
|
||||
result->tv_usec += 1000000;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Zeroize a timeval.
|
||||
* \param a Timeval to zero out
|
||||
* \return none
|
||||
*/
|
||||
void
|
||||
ndpi_timer_clear(struct timeval *a)
|
||||
{
|
||||
a->tv_sec = a->tv_usec = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Calculate the milliseconds representation of a timeval.
|
||||
* \param ts Timeval
|
||||
* \return unsigned int - Milliseconds
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_timeval_to_milliseconds(struct timeval ts)
|
||||
{
|
||||
unsigned int result = ts.tv_usec / 1000 + ts.tv_sec * 1000;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Calculate the microseconds representation of a timeval.
|
||||
* \param ts Timeval
|
||||
* \return unsigned int - Milliseconds
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_timeval_to_microseconds(struct timeval ts)
|
||||
{
|
||||
unsigned int result = ts.tv_usec + ts.tv_sec * 1000 * 1000;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len)
|
||||
{
|
||||
struct timeval tv;
|
||||
time_t nowtime;
|
||||
struct tm nowtm_r;
|
||||
char tmbuf[NDPI_TIMESTAMP_LEN];
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
nowtime = tv.tv_sec;
|
||||
localtime_r(&nowtime, &nowtm_r);
|
||||
strftime(tmbuf, NDPI_TIMESTAMP_LEN, "%H:%M:%S", &nowtm_r);
|
||||
snprintf(log_ts, log_ts_len, "%s.%06ld", tmbuf, (long)tv.tv_usec);
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
/*
|
||||
* ndpi_community_id.c
|
||||
*
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "ndpi_config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_config.h"
|
||||
|
||||
#include <time.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#include "ndpi_sha1.h"
|
||||
|
||||
#define NDPI_ICMP6_ECHO_REQUEST 128
|
||||
#define NDPI_ICMP6_ECHO_REPLY 129
|
||||
#define NDPI_MLD_LISTENER_QUERY 130
|
||||
#define NDPI_MLD_LISTENER_REPORT 131
|
||||
|
||||
#define NDPI_ROUTER_SOLICIT 133
|
||||
#define NDPI_ROUTER_ADVERT 134
|
||||
#define NDPI_NEIGHBOR_SOLICIT 135
|
||||
#define NDPI_NEIGHBOR_ADVERT 136
|
||||
|
||||
#define NDPI_ICMP_ECHOREPLY 0
|
||||
#define NDPI_ICMP_ECHO 8
|
||||
#define NDPI_ICMP_ROUTERADVERT 9
|
||||
#define NDPI_ICMP_ROUTERSOLICIT 10
|
||||
#define NDPI_ICMP_TIMESTAMP 13
|
||||
#define NDPI_ICMP_TIMESTAMPREPLY 14
|
||||
#define NDPI_ICMP_INFO_REQUEST 15
|
||||
#define NDPI_ICMP_INFO_REPLY 16
|
||||
#define NDPI_ICMP_MASKREQ 17
|
||||
#define NDPI_ICMP_MASKREPLY 18
|
||||
|
||||
#define NDPI_ICMP6_WRUREQUEST 139
|
||||
#define NDPI_ICMP6_WRUREPLY 140
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
static ssize_t ndpi_community_id_buf_copy(u_int8_t * const dst, const void * const src, ssize_t len) {
|
||||
if(src)
|
||||
memcpy(dst, src, len);
|
||||
else
|
||||
memset(dst, 0, len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
/*
|
||||
https://github.com/corelight/community-id-spec/blob/bda913f617389df07cdaa23606e11bbd318e265c/community-id.py#L56
|
||||
*/
|
||||
static u_int8_t ndpi_community_id_icmp_type_to_code_v4(u_int8_t icmp_type, u_int8_t icmp_code, int *is_one_way) {
|
||||
*is_one_way = 0;
|
||||
|
||||
switch(icmp_type) {
|
||||
case NDPI_ICMP_ECHO:
|
||||
return NDPI_ICMP_ECHOREPLY;
|
||||
case NDPI_ICMP_ECHOREPLY:
|
||||
return NDPI_ICMP_ECHO;
|
||||
case NDPI_ICMP_TIMESTAMP:
|
||||
return NDPI_ICMP_TIMESTAMPREPLY;
|
||||
case NDPI_ICMP_TIMESTAMPREPLY:
|
||||
return NDPI_ICMP_TIMESTAMP;
|
||||
case NDPI_ICMP_INFO_REQUEST:
|
||||
return NDPI_ICMP_INFO_REPLY;
|
||||
case NDPI_ICMP_INFO_REPLY:
|
||||
return NDPI_ICMP_INFO_REQUEST;
|
||||
case NDPI_ICMP_ROUTERSOLICIT:
|
||||
return NDPI_ICMP_ROUTERADVERT;
|
||||
case NDPI_ICMP_ROUTERADVERT:
|
||||
return NDPI_ICMP_ROUTERSOLICIT;
|
||||
case NDPI_ICMP_MASKREQ:
|
||||
return NDPI_ICMP_MASKREPLY;
|
||||
case NDPI_ICMP_MASKREPLY:
|
||||
return NDPI_ICMP_MASKREQ;
|
||||
default:
|
||||
*is_one_way = 1;
|
||||
return icmp_code;
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
/*
|
||||
https://github.com/corelight/community-id-spec/blob/bda913f617389df07cdaa23606e11bbd318e265c/community-id.py#L83
|
||||
*/
|
||||
static u_int8_t ndpi_community_id_icmp_type_to_code_v6(u_int8_t icmp_type, u_int8_t icmp_code, int *is_one_way) {
|
||||
*is_one_way = 0;
|
||||
|
||||
switch(icmp_type) {
|
||||
case NDPI_ICMP6_ECHO_REQUEST:
|
||||
return NDPI_ICMP6_ECHO_REPLY;
|
||||
case NDPI_ICMP6_ECHO_REPLY:
|
||||
return NDPI_ICMP6_ECHO_REQUEST;
|
||||
case NDPI_ROUTER_SOLICIT:
|
||||
return NDPI_ROUTER_ADVERT;
|
||||
case NDPI_ROUTER_ADVERT:
|
||||
return NDPI_ROUTER_SOLICIT;
|
||||
case NDPI_NEIGHBOR_SOLICIT:
|
||||
return NDPI_NEIGHBOR_ADVERT;
|
||||
case NDPI_NEIGHBOR_ADVERT:
|
||||
return NDPI_NEIGHBOR_SOLICIT;
|
||||
case NDPI_MLD_LISTENER_QUERY:
|
||||
return NDPI_MLD_LISTENER_REPORT;
|
||||
case NDPI_MLD_LISTENER_REPORT:
|
||||
return NDPI_MLD_LISTENER_QUERY;
|
||||
case NDPI_ICMP6_WRUREQUEST:
|
||||
return NDPI_ICMP6_WRUREPLY;
|
||||
case NDPI_ICMP6_WRUREPLY:
|
||||
return NDPI_ICMP6_WRUREQUEST;
|
||||
// Home Agent Address Discovery Request Message and reply
|
||||
case 144:
|
||||
return 145;
|
||||
case 145:
|
||||
return 144;
|
||||
default:
|
||||
*is_one_way = 1;
|
||||
return icmp_code;
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
/*
|
||||
https://github.com/corelight/community-id-spec/blob/bda913f617389df07cdaa23606e11bbd318e265c/community-id.py#L164
|
||||
*/
|
||||
static int ndpi_community_id_peer_v4_is_less_than(u_int32_t ip1, u_int32_t ip2, u_int16_t p1, u_int16_t p2) {
|
||||
int comp = memcmp(&ip1, &ip2, sizeof(u_int32_t));
|
||||
return comp < 0 || (comp == 0 && p1 < p2);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
static int ndpi_community_id_peer_v6_is_less_than(struct ndpi_in6_addr *ip1, struct ndpi_in6_addr *ip2, u_int16_t p1, u_int16_t p2) {
|
||||
int comp = memcmp(ip1, ip2, sizeof(struct ndpi_in6_addr));
|
||||
return comp < 0 || (comp == 0 && p1 < p2);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
static void ndpi_community_id_sha1_hash(const uint8_t *message, size_t len, u_char *hash /* 20-bytes */) {
|
||||
SHA1_CTX ctx;
|
||||
SHA1Init(&ctx);
|
||||
SHA1Update(&ctx, message, len);
|
||||
SHA1Final(hash, &ctx);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
/*
|
||||
https://github.com/corelight/community-id-spec/blob/bda913f617389df07cdaa23606e11bbd318e265c/community-id.py#L285
|
||||
*/
|
||||
static int ndpi_community_id_finalize_and_compute_hash(u_int8_t *comm_buf, u_int16_t off, u_int8_t l4_proto,
|
||||
u_int16_t src_port, u_int16_t dst_port, char *hash_buf, u_int8_t hash_buf_len) {
|
||||
u_int8_t pad = 0;
|
||||
uint32_t hash[5];
|
||||
char *community_id;
|
||||
|
||||
/* L4 proto */
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], &l4_proto, sizeof(l4_proto));
|
||||
|
||||
/* Pad */
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], &pad, sizeof(pad));
|
||||
|
||||
/* Source and destination ports */
|
||||
switch(l4_proto) {
|
||||
case IPPROTO_ICMP:
|
||||
case IPPROTO_ICMPV6:
|
||||
case IPPROTO_SCTP:
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], &src_port, sizeof(src_port));
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], &dst_port, sizeof(dst_port));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Compute SHA1 */
|
||||
ndpi_community_id_sha1_hash(comm_buf, off, (u_char*)hash);
|
||||
|
||||
/* Base64 encoding */
|
||||
community_id = ndpi_base64_encode((u_int8_t*)hash, sizeof(hash));
|
||||
|
||||
if (community_id == NULL)
|
||||
return -1;
|
||||
|
||||
#if 0 /* Debug Info */
|
||||
printf("Hex output: ");
|
||||
for(int i = 0; i < off; i++)
|
||||
printf("%.2x ", comm_buf[i]);
|
||||
printf("\n");
|
||||
|
||||
printf("Sha1 sum: ");
|
||||
for(int i = 0; i < 5; i++)
|
||||
printf("%.2x ", ntohl(hash[i]));
|
||||
printf("\n");
|
||||
|
||||
printf("Base64: %s\n", community_id);
|
||||
#endif
|
||||
|
||||
if (hash_buf_len < 2 || hash_buf_len-2 < strlen(community_id)+1) {
|
||||
ndpi_free(community_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Writing hash */
|
||||
hash_buf[0] = '1';
|
||||
hash_buf[1] = ':';
|
||||
strcpy(&hash_buf[2], community_id);
|
||||
ndpi_free(community_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
/*
|
||||
NOTE:
|
||||
- Leave fields empty/zero when information is missing (e.g. with ICMP ports are zero)
|
||||
- The hash_buf most be 30+1 bits or longer
|
||||
- Return code: 0 = OK, -1 otherwise
|
||||
*/
|
||||
|
||||
int ndpi_flowv4_flow_hash(u_int8_t l4_proto, u_int32_t src_ip, u_int32_t dst_ip,
|
||||
u_int16_t src_port, u_int16_t dst_port,
|
||||
u_int8_t icmp_type, u_int8_t icmp_code,
|
||||
u_char *hash_buf, u_int8_t hash_buf_len) {
|
||||
/*
|
||||
Input buffer (40 bytes)
|
||||
2 - Seed
|
||||
16 - IPv6 src
|
||||
16 - IPv6 dst
|
||||
1 - L4 proto
|
||||
1 - Pad
|
||||
2 - Port src
|
||||
2 - Port dst
|
||||
*/
|
||||
u_int8_t comm_buf[40] = { 0 };
|
||||
u_int16_t off = 0;
|
||||
u_int16_t seed = 0;
|
||||
u_int32_t *ip_a_ptr, *ip_b_ptr;
|
||||
u_int16_t port_a, port_b;
|
||||
int icmp_one_way = 0;
|
||||
|
||||
/* Adjust the ports according to the specs */
|
||||
switch(l4_proto) {
|
||||
case IPPROTO_ICMP:
|
||||
src_port = icmp_type;
|
||||
dst_port = ndpi_community_id_icmp_type_to_code_v4(icmp_type, icmp_code, &icmp_one_way);
|
||||
break;
|
||||
case IPPROTO_SCTP:
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
/* src/dst port ok */
|
||||
break;
|
||||
default:
|
||||
src_port = dst_port = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert tuple to NBO */
|
||||
src_ip = htonl(src_ip);
|
||||
dst_ip = htonl(dst_ip);
|
||||
src_port = htons(src_port);
|
||||
dst_port = htons(dst_port);
|
||||
|
||||
/*
|
||||
The community id hash doesn't have the definition of client and server, it just sorts IP addresses
|
||||
and ports to make sure the smaller ip address is the first. This performs this check and
|
||||
possibly swap client ip and port.
|
||||
*/
|
||||
if(icmp_one_way || ndpi_community_id_peer_v4_is_less_than(src_ip, dst_ip, src_port, dst_port)) {
|
||||
ip_a_ptr = &src_ip, ip_b_ptr = &dst_ip;
|
||||
port_a = src_port, port_b = dst_port;
|
||||
} else {
|
||||
/* swap flow peers */
|
||||
ip_a_ptr = &dst_ip, ip_b_ptr = &src_ip;
|
||||
port_a = dst_port, port_b = src_port;
|
||||
}
|
||||
|
||||
/* Seed */
|
||||
off = ndpi_community_id_buf_copy(&comm_buf[off], &seed, sizeof(seed));
|
||||
|
||||
/* Source and destination IPs */
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], ip_a_ptr, sizeof(src_ip));
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], ip_b_ptr, sizeof(dst_ip));
|
||||
|
||||
return ndpi_community_id_finalize_and_compute_hash(comm_buf, off,
|
||||
l4_proto, port_a, port_b, (char*)hash_buf, hash_buf_len);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
int ndpi_flowv6_flow_hash(u_int8_t l4_proto, struct ndpi_in6_addr *src_ip, struct ndpi_in6_addr *dst_ip,
|
||||
u_int16_t src_port, u_int16_t dst_port,
|
||||
u_int8_t icmp_type, u_int8_t icmp_code,
|
||||
u_char *hash_buf, u_int8_t hash_buf_len) {
|
||||
u_int8_t comm_buf[40] = { 0 };
|
||||
u_int16_t off = 0;
|
||||
u_int16_t seed = 0;
|
||||
struct ndpi_in6_addr *ip_a_ptr, *ip_b_ptr;
|
||||
u_int16_t port_a, port_b;
|
||||
int icmp_one_way = 0;
|
||||
|
||||
switch(l4_proto) {
|
||||
case IPPROTO_ICMPV6:
|
||||
src_port = icmp_type;
|
||||
dst_port = ndpi_community_id_icmp_type_to_code_v6(icmp_type, icmp_code, &icmp_one_way);
|
||||
break;
|
||||
case IPPROTO_SCTP:
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
/* src/dst port ok */
|
||||
break;
|
||||
default:
|
||||
src_port = dst_port = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert tuple to NBO */
|
||||
src_port = htons(src_port);
|
||||
dst_port = htons(dst_port);
|
||||
|
||||
if(icmp_one_way || ndpi_community_id_peer_v6_is_less_than(src_ip, dst_ip, src_port, dst_port)) {
|
||||
ip_a_ptr = src_ip, ip_b_ptr = dst_ip;
|
||||
port_a = src_port, port_b = dst_port;
|
||||
} else {
|
||||
ip_a_ptr = dst_ip, ip_b_ptr = src_ip;
|
||||
port_a = dst_port, port_b = src_port;
|
||||
}
|
||||
|
||||
/* Seed */
|
||||
off = ndpi_community_id_buf_copy(&comm_buf[off], &seed, sizeof(seed));
|
||||
|
||||
/* Source and destination IPs */
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], ip_a_ptr, sizeof(struct ndpi_in6_addr));
|
||||
off += ndpi_community_id_buf_copy(&comm_buf[off], ip_b_ptr, sizeof(struct ndpi_in6_addr));
|
||||
|
||||
return ndpi_community_id_finalize_and_compute_hash(comm_buf, off,
|
||||
l4_proto, port_a, port_b, (char*)hash_buf, hash_buf_len);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
+898
-175
File diff suppressed because it is too large
Load Diff
+2560
-2079
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
* afp.c
|
||||
*
|
||||
* Copyright (C) 2009-11 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* aimini.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -47,11 +47,12 @@ enum ajp_packet_type {
|
||||
AJP_BODY = 11
|
||||
};
|
||||
|
||||
PACK_ON
|
||||
struct ajp_header {
|
||||
uint16_t magic;
|
||||
uint16_t len;
|
||||
uint8_t code;
|
||||
};
|
||||
} PACK_OFF;
|
||||
|
||||
static void set_ajp_detected(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
@@ -70,18 +71,17 @@ static void set_ajp_detected(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
/*************************************************************************************************/
|
||||
|
||||
static void ndpi_check_ajp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ajp_header ajp_hdr;
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if (packet->payload_packet_len < 5 /* ajp_header size*/) {
|
||||
if (packet->payload_packet_len < sizeof(ajp_hdr)) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
ajp_hdr = *((struct ajp_header *) (packet->payload));
|
||||
memcpy(&ajp_hdr, packet->payload, sizeof(struct ajp_header));
|
||||
|
||||
ajp_hdr.magic = ntohs(ajp_hdr.magic);
|
||||
ajp_hdr.len = ntohs(ajp_hdr.len);
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* amazon_video.c
|
||||
*
|
||||
* Copyright (C) 2018-20 by ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ndpi_protocol_ids.h"
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMAZON_VIDEO
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
static void ndpi_check_amazon_video(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search Amazon Prime\n");
|
||||
|
||||
if(packet->payload_packet_len > 4) {
|
||||
if((packet->tcp != NULL) &&
|
||||
(packet->payload[0] == 0xFE &&
|
||||
packet->payload[1] == 0xED &&
|
||||
packet->payload[2] == 0xFA &&
|
||||
packet->payload[3] == 0xCE)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found Amazon Video on TCP\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
} else if((packet->udp != NULL) &&
|
||||
(packet->payload[0] == 0xDE &&
|
||||
packet->payload[1] == 0xAD &&
|
||||
packet->payload[2] == 0xBE &&
|
||||
packet->payload[3] == 0xEF)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found Amazon Video on UDP\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
void ndpi_search_amazon_video(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search amazon_video\n");
|
||||
|
||||
/* skip marked packets */
|
||||
if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_AMAZON_VIDEO)
|
||||
ndpi_check_amazon_video(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_amazon_video_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) {
|
||||
ndpi_set_bitmask_protocol_detection("AMAZON_VIDEO", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AMAZON_VIDEO,
|
||||
ndpi_search_amazon_video,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* amqp.c
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* applejuice.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* armagetron.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* flash.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ftp.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* manolito.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* popo.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* secondlife.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ayiya.c
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* battlefield.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* bgp.c
|
||||
*
|
||||
* Copyright (C) 2016-18 - ntop.org
|
||||
* Copyright (C) 2016-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* bittorrent.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -72,9 +72,7 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
|
||||
} else
|
||||
bt_hash = (const char*)&flow->packet.payload[28];
|
||||
|
||||
if(!ndpi_struct->disable_metadata_export) {
|
||||
if(bt_hash) memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
|
||||
}
|
||||
if(bt_hash) memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
|
||||
}
|
||||
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
|
||||
@@ -376,19 +374,32 @@ static void ndpi_int_search_bittorrent_tcp(struct ndpi_detection_module_struct *
|
||||
return;
|
||||
}
|
||||
|
||||
static u_int8_t is_port(u_int16_t a, u_int16_t b, u_int16_t what) {
|
||||
return(((what == a) || (what == b)) ? 1 : 0);
|
||||
}
|
||||
|
||||
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
char *bt_proto = NULL;
|
||||
|
||||
/* This is broadcast */
|
||||
if(packet->iph
|
||||
&& (((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF))
|
||||
|| (packet->udp
|
||||
&& ((ntohs(packet->udp->source) == 3544) /* teredo.c */
|
||||
|| (ntohs(packet->udp->dest) == 3544))))) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
if(packet->iph) {
|
||||
|
||||
if((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF))
|
||||
goto exclude_bt;
|
||||
|
||||
|
||||
if(packet->udp) {
|
||||
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
|
||||
if(is_port(sport, dport, 3544) /* teredo */
|
||||
|| is_port(sport, dport, 5246) || is_port(sport, dport, 5247)/* CAPWAP */) {
|
||||
exclude_bt:
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_BITTORRENT) {
|
||||
@@ -397,8 +408,8 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
if((packet->tcp != NULL)
|
||||
&& (packet->tcp_retransmission == 0 || packet->num_retried_bytes)) {
|
||||
ndpi_int_search_bittorrent_tcp(ndpi_struct, flow);
|
||||
}
|
||||
else if(packet->udp != NULL) {
|
||||
} else if(packet->udp != NULL) {
|
||||
/* UDP */
|
||||
char *bt_search = "BT-SEARCH * HTTP/1.1\r\n";
|
||||
|
||||
if((ntohs(packet->udp->source) < 1024)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* btlib.c
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
* Contributed by Vitaly Lavrov <vel21ripn@gmail.com>
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
@@ -39,59 +39,15 @@ typedef unsigned long long int u_int64_t;
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "btlib.h"
|
||||
|
||||
int bt_parse_debug = 0;
|
||||
|
||||
static char *printXb(char *s,const u_int8_t *b,int l) {
|
||||
int i;
|
||||
for(i=0; i < l; i++)
|
||||
snprintf(&s[i*2],41,"%02x",b[i]);
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print20b(char *s,const u_int8_t *b) {
|
||||
snprintf(s,41,"%08x%08x%08x%08x%08x",
|
||||
htonl(*(u_int32_t*)b),
|
||||
htonl(*(u_int32_t*)(b+4)),
|
||||
htonl(*(u_int32_t*)(b+8)),
|
||||
htonl(*(u_int32_t*)(b+12)),
|
||||
htonl(*(u_int32_t*)(b+16)));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_id_ip_p(char *s, const struct bt_nodes_data *b) {
|
||||
u_int8_t *p = (void*)b;
|
||||
print20b(s,b->id);
|
||||
snprintf(s+40,39," %d.%d.%d.%d:%u",
|
||||
p[20], p[21], p[22], p[23], htons(b->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_ip_p(char *s, const struct bt_ipv4p *b,int np) {
|
||||
const u_int8_t *p = (const void*)b;
|
||||
snprintf(s,39,!np ? "%d.%d.%d.%d:%u":"%d.%d.%d.%d",
|
||||
p[0], p[1], p[2], p[3], htons(b->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_ip6_p(char *s, const struct bt_ipv6p *b,int np) {
|
||||
u_int16_t *p = (void*)b;
|
||||
snprintf(s,79,!np ? "%x:%x:%x:%x:%x:%x:%x:%x.%u":"%x:%x:%x:%x:%x:%x:%x:%x",
|
||||
htons(p[0]), htons(p[1]), htons(p[2]), htons(p[3]),
|
||||
htons(p[4]), htons(p[5]), htons(p[6]), htons(p[7]),
|
||||
htons(b->port));
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *print_id_ip6_p(char *s,const struct bt_nodes6_data *b) {
|
||||
return print_ip6_p(s,(struct bt_ipv6p *)&b->ip,0);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void dump_bt_proto_struct(struct bt_parse_protocol *p) {
|
||||
char b20h[128];
|
||||
@@ -204,8 +160,7 @@ void cb_data(bt_parse_data_cb_t *cbd,int *ret) {
|
||||
if(cbd->t == 0) return;
|
||||
|
||||
if(cbd->t == 1) {
|
||||
|
||||
DEBUG_TRACE(printf("%s %lld\n",cbd->buf,cbd->v.i));
|
||||
DEBUG_TRACE(printf("%s %lld\n",cbd->buf, (long long)cbd->v.i));
|
||||
|
||||
if(STREQ(cbd->buf,"a.port")) {
|
||||
p->a.port = (u_int16_t)(cbd->v.i & 0xffff);
|
||||
@@ -234,7 +189,7 @@ void cb_data(bt_parse_data_cb_t *cbd,int *ret) {
|
||||
p->h_mint = 1;
|
||||
return;
|
||||
}
|
||||
DEBUG_TRACE(printf("UNKNOWN %s %lld\n",cbd->buf,cbd->v.i));
|
||||
DEBUG_TRACE(printf("UNKNOWN %s %lld\n",cbd->buf, (long long)cbd->v.i));
|
||||
return;
|
||||
}
|
||||
if(cbd->t != 2) {
|
||||
@@ -421,7 +376,7 @@ const u_int8_t *bt_decode(const u_int8_t *b, size_t *l, int *ret, bt_parse_data_
|
||||
int64_t d = 0;
|
||||
u_int8_t c;
|
||||
|
||||
if(*l == 0) return NULL;
|
||||
if(!l || *l == 0) return NULL;
|
||||
if(cbd->level > BDEC_MAXDEPT) goto bad_data;
|
||||
c = *b++; (*l)--;
|
||||
if(c == 'i') { // integer
|
||||
@@ -508,6 +463,7 @@ const u_int8_t *bt_decode(const u_int8_t *b, size_t *l, int *ret, bt_parse_data_
|
||||
cbd->level--;
|
||||
return b;
|
||||
}
|
||||
|
||||
bad_data:
|
||||
*ret=-1;
|
||||
return b;
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* capwap.c
|
||||
*
|
||||
* Copyright (C) 2019 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_protocol_ids.h"
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CAPWAP
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#define NDPI_CAPWAP_CONTROL_PORT 5246
|
||||
#define NDPI_CAPWAP_DATA_PORT 5247
|
||||
|
||||
|
||||
static void ndpi_int_capwap_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CAPWAP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
/* ************************************************** */
|
||||
|
||||
static void ndpi_search_setup_capwap(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t sport, dport;
|
||||
|
||||
if(!packet->iph) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
|
||||
if((dport == NDPI_CAPWAP_CONTROL_PORT)
|
||||
&& (packet->iph->daddr == 0xFFFFFFFF)
|
||||
&& (packet->payload_packet_len >= 16)
|
||||
&& (packet->payload[0] == 0x0)
|
||||
&& (packet->payload[8] == 6 /* Mac len */)
|
||||
)
|
||||
goto capwap_found;
|
||||
|
||||
if(((sport == NDPI_CAPWAP_CONTROL_PORT) || (dport == NDPI_CAPWAP_CONTROL_PORT))
|
||||
&& ((packet->payload[0] == 0x0) || (packet->payload[0] == 0x1))
|
||||
) {
|
||||
u_int16_t msg_len, offset, to_add;
|
||||
|
||||
if(packet->payload[0] == 0x0)
|
||||
offset = 13, to_add = 13;
|
||||
else
|
||||
offset = 15, to_add = 17;
|
||||
|
||||
msg_len = ntohs(*(u_int16_t*)&packet->payload[offset]);
|
||||
|
||||
if((msg_len+to_add) == packet->payload_packet_len)
|
||||
goto capwap_found;
|
||||
}
|
||||
|
||||
if(
|
||||
(((dport == NDPI_CAPWAP_DATA_PORT) && (packet->iph->daddr != 0xFFFFFFFF)) || (sport == NDPI_CAPWAP_DATA_PORT))
|
||||
&& (packet->payload_packet_len >= 16)
|
||||
&& (packet->payload[0] == 0x0)
|
||||
) {
|
||||
u_int8_t is_80211_data = (packet->payload[9] & 0x0C) >> 2;
|
||||
|
||||
|
||||
if((sport == NDPI_CAPWAP_DATA_PORT) && (is_80211_data == 2 /* IEEE 802.11 Data */))
|
||||
goto capwap_found;
|
||||
else if(dport == NDPI_CAPWAP_DATA_PORT) {
|
||||
u_int16_t msg_len = ntohs(*(u_int16_t*)&packet->payload[13]);
|
||||
|
||||
if((packet->payload[8] == 1 /* Mac len */)
|
||||
|| (packet->payload[8] == 6 /* Mac len */)
|
||||
|| (packet->payload[8] == 4 /* Wireless len */)
|
||||
|| ((msg_len+15) == packet->payload_packet_len))
|
||||
goto capwap_found;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
|
||||
capwap_found:
|
||||
ndpi_int_capwap_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
void ndpi_search_capwap(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if(packet->udp && (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN))
|
||||
ndpi_search_setup_capwap(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_capwap_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("CAPWAP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CAPWAP,
|
||||
ndpi_search_capwap,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* checkmk.c
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -48,7 +48,33 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCOVPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(((tsport == 443 || tdport == 443) ||
|
||||
(tsport == 80 || tdport == 80)) &&
|
||||
((packet->payload[0] == 0x17 &&
|
||||
packet->payload[1] == 0x03 &&
|
||||
packet->payload[2] == 0x03 &&
|
||||
packet->payload[3] == 0x00 &&
|
||||
packet->payload[4] == 0x3A)))
|
||||
{
|
||||
/* TLS signature of Cisco AnyConnect 0X170303003A */
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCO Anyconnect VPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
else if(((tsport == 8009 || tdport == 8009) ||
|
||||
(tsport == 8008 || tdport == 8008)) &&
|
||||
((packet->payload[0] == 0x17 &&
|
||||
packet->payload[1] == 0x03 &&
|
||||
packet->payload[2] == 0x03 &&
|
||||
packet->payload[3] == 0x00 &&
|
||||
packet->payload[4] == 0x69)))
|
||||
{
|
||||
/* TCP signature of Cisco AnyConnect 0X1703030069 */
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCO Anyconnect VPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
else if(
|
||||
(
|
||||
(usport == 10000 && udport == 10000)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* citrix.c
|
||||
*
|
||||
* Copyright (C) 2012-18 - ntop.org
|
||||
* Copyright (C) 2012-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -51,7 +51,7 @@ static void ndpi_check_citrix(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
return;
|
||||
} else if(payload_len > 4) {
|
||||
} else if(payload_len > 22) {
|
||||
char citrix_header[] = { 0x1a, 0x43, 0x47, 0x50, 0x2f, 0x30, 0x31 };
|
||||
|
||||
if((memcmp(packet->payload, citrix_header, sizeof(citrix_header)) == 0)
|
||||
|
||||
@@ -130,7 +130,7 @@ void ndpi_search_coap (struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(h->version == 1) {
|
||||
if(h->type == CON || h->type == NO_CON || h->type == ACK || h->type == RST ) {
|
||||
if(h->tkl < 8) {
|
||||
if((h->code >= 0 && h->code <= 5) || (h->code >= 65 && h->code <= 69) ||
|
||||
if((/* h->code >= 0 && */ h->code <= 5) || (h->code >= 65 && h->code <= 69) ||
|
||||
(h->code >= 128 && h->code <= 134) || (h->code >= 140 && h->code <= 143) ||
|
||||
(h->code >= 160 && h->code <= 165)) {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* collectd.c
|
||||
*
|
||||
* Copyright (C) 2014-18 - ntop.org
|
||||
* Copyright (C) 2014-20 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* crossfire.c
|
||||
*
|
||||
* Copyright (C) 2012-18 - ntop.org
|
||||
* Copyright (C) 2012-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -30,6 +30,11 @@ void ndpi_search_csgo(struct ndpi_detection_module_struct* ndpi_struct, struct n
|
||||
struct ndpi_packet_struct* packet = &flow->packet;
|
||||
|
||||
if (packet->udp != NULL) {
|
||||
if (packet->payload_packet_len < sizeof(uint32_t)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "Short csgo packet\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t w = htonl(get_u_int32_t(packet->payload, 0));
|
||||
NDPI_LOG_DBG2(ndpi_struct, "CSGO: word %08x\n", w);
|
||||
|
||||
|
||||
+24
-28
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* dhcp.c
|
||||
*
|
||||
* Copyright (C) 2016-18 - ntop.org
|
||||
* Copyright (C) 2016-20 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -100,40 +100,36 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
if(msg_type <= 8) foundValidMsgType = 1;
|
||||
} else if(id == 55 /* Parameter Request List / Fingerprint */) {
|
||||
if(!ndpi_struct->disable_metadata_export) {
|
||||
u_int idx, offset = 0;
|
||||
u_int idx, offset = 0;
|
||||
|
||||
for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) {
|
||||
int rc = snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
|
||||
sizeof(flow->protos.dhcp.fingerprint) - offset,
|
||||
"%s%u", (idx > 0) ? "," : "",
|
||||
(unsigned int)dhcp->options[i+2+idx] & 0xFF);
|
||||
|
||||
for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) {
|
||||
snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
|
||||
sizeof(flow->protos.dhcp.fingerprint) - offset,
|
||||
"%02X", dhcp->options[i+2+idx] & 0xFF);
|
||||
offset += 2;
|
||||
}
|
||||
|
||||
flow->protos.dhcp.fingerprint[sizeof(flow->protos.dhcp.fingerprint) - 1] = '\0';
|
||||
if(rc < 0) break; else offset += rc;
|
||||
}
|
||||
|
||||
flow->protos.dhcp.fingerprint[sizeof(flow->protos.dhcp.fingerprint) - 1] = '\0';
|
||||
} else if(id == 60 /* Class Identifier */) {
|
||||
if(!ndpi_struct->disable_metadata_export) {
|
||||
char *name = (char*)&dhcp->options[i+2];
|
||||
int j = 0;
|
||||
|
||||
j = ndpi_min(len, sizeof(flow->protos.dhcp.class_ident)-1);
|
||||
strncpy((char*)flow->protos.dhcp.class_ident, name, j);
|
||||
flow->protos.dhcp.class_ident[j] = '\0';
|
||||
}
|
||||
char *name = (char*)&dhcp->options[i+2];
|
||||
int j = 0;
|
||||
|
||||
j = ndpi_min(len, sizeof(flow->protos.dhcp.class_ident)-1);
|
||||
strncpy((char*)flow->protos.dhcp.class_ident, name, j);
|
||||
flow->protos.dhcp.class_ident[j] = '\0';
|
||||
} else if(id == 12 /* Host Name */) {
|
||||
if(!ndpi_struct->disable_metadata_export) {
|
||||
char *name = (char*)&dhcp->options[i+2];
|
||||
int j = 0;
|
||||
|
||||
char *name = (char*)&dhcp->options[i+2];
|
||||
int j = 0;
|
||||
|
||||
#ifdef DHCP_DEBUG
|
||||
NDPI_LOG_DBG2(ndpi_struct, "[DHCP] '%.*s'\n",name,len);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "[DHCP] '%.*s'\n",name,len);
|
||||
// while(j < len) { printf( "%c", name[j]); j++; }; printf("\n");
|
||||
#endif
|
||||
j = ndpi_min(len, sizeof(flow->host_server_name)-1);
|
||||
strncpy((char*)flow->host_server_name, name, j);
|
||||
flow->host_server_name[j] = '\0';
|
||||
}
|
||||
j = ndpi_min(len, sizeof(flow->host_server_name)-1);
|
||||
strncpy((char*)flow->host_server_name, name, j);
|
||||
flow->host_server_name[j] = '\0';
|
||||
}
|
||||
|
||||
i += len + 2;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* dhcpv6.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* directconnect.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -58,9 +58,9 @@ static u_int16_t parse_binf_message(struct ndpi_detection_module_struct
|
||||
u_int16_t ssl_port = 0;
|
||||
while (i < payload_len) {
|
||||
i = skip_unknown_headers(payload, payload_len, i);
|
||||
if ((i + 30) < payload_len) {
|
||||
if (memcmp(&payload[i], "DCTM", 4) == 0) {
|
||||
if (memcmp(&payload[i + 15], "ADCS", 4) == 0) {
|
||||
if((i + 30) < payload_len) {
|
||||
if(memcmp(&payload[i], "DCTM", 4) == 0) {
|
||||
if(memcmp(&payload[i + 15], "ADCS", 4) == 0) {
|
||||
ssl_port = ntohs_ndpi_bytestream_to_number(&payload[i + 25], 5, &bytes_read);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "DC ssl port parsed %d\n", ssl_port);
|
||||
}
|
||||
@@ -84,15 +84,15 @@ static void ndpi_int_directconnect_add_connection(struct ndpi_detection_module_s
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
if(src != NULL) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
if (connection_type == DIRECT_CONNECT_TYPE_PEER) {
|
||||
if (packet->tcp != NULL
|
||||
if(connection_type == DIRECT_CONNECT_TYPE_PEER) {
|
||||
if(packet->tcp != NULL
|
||||
&& flow->setup_packet_direction != packet->packet_direction && src->detected_directconnect_port == 0) {
|
||||
src->detected_directconnect_port = packet->tcp->source;
|
||||
NDPI_LOG_DBG2(ndpi_struct, "DC tcp PORT %u for src\n", ntohs(src->detected_directconnect_port));
|
||||
}
|
||||
if (packet->udp != NULL && src->detected_directconnect_udp_port == 0) {
|
||||
if(packet->udp != NULL && src->detected_directconnect_udp_port == 0) {
|
||||
src->detected_directconnect_udp_port = packet->udp->source;
|
||||
NDPI_LOG_DBG2(ndpi_struct, "DC udp PORT %u for src\n", ntohs(src->detected_directconnect_port));
|
||||
|
||||
@@ -100,10 +100,10 @@ static void ndpi_int_directconnect_add_connection(struct ndpi_detection_module_s
|
||||
}
|
||||
|
||||
}
|
||||
if (dst != NULL) {
|
||||
if(dst != NULL) {
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
if (connection_type == DIRECT_CONNECT_TYPE_PEER) {
|
||||
if (packet->tcp != NULL
|
||||
if(connection_type == DIRECT_CONNECT_TYPE_PEER) {
|
||||
if(packet->tcp != NULL
|
||||
&& flow->setup_packet_direction == packet->packet_direction && dst->detected_directconnect_port == 0) {
|
||||
/* DST PORT MARKING CAN LEAD TO PORT MISSDETECTIONS
|
||||
* seen at large customer http servers, where someone has send faked DC tcp packets
|
||||
@@ -121,35 +121,34 @@ static void ndpi_int_directconnect_add_connection(struct ndpi_detection_module_s
|
||||
}
|
||||
}
|
||||
|
||||
static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
if (flow->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
|
||||
if (packet->payload_packet_len >= 40 && memcmp(&packet->payload[0], "BINF", 4) == 0) {
|
||||
u_int16_t ssl_port = 0;
|
||||
ssl_port = parse_binf_message(ndpi_struct, &packet->payload[4], packet->payload_packet_len - 4);
|
||||
if (dst != NULL && ssl_port) {
|
||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
|
||||
if(packet->payload_packet_len >= 40 && memcmp(&packet->payload[0], "BINF", 4) == 0) {
|
||||
u_int16_t ssl_port = parse_binf_message(ndpi_struct,
|
||||
&packet->payload[4],
|
||||
packet->payload_packet_len - 4);
|
||||
if(dst != NULL && ssl_port)
|
||||
dst->detected_directconnect_ssl_port = ssl_port;
|
||||
}
|
||||
if (src != NULL && ssl_port) {
|
||||
|
||||
if(src != NULL && ssl_port)
|
||||
src->detected_directconnect_ssl_port = ssl_port;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ((packet->payload_packet_len >= 38 && packet->payload_packet_len <= 42)
|
||||
|
||||
if((packet->payload_packet_len >= 38 && packet->payload_packet_len <= 42)
|
||||
&& memcmp(&packet->payload[0], "DCTM", 4) == 0 && memcmp(&packet->payload[15], "ADCS", 4) == 0) {
|
||||
u_int16_t bytes_read = 0;
|
||||
if (dst != NULL) {
|
||||
if(dst != NULL) {
|
||||
dst->detected_directconnect_ssl_port =
|
||||
ntohs_ndpi_bytestream_to_number(&packet->payload[25], 5, &bytes_read);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "DC ssl port parsed %d\n", ntohs(dst->detected_directconnect_ssl_port));
|
||||
}
|
||||
if (src != NULL) {
|
||||
if(src != NULL) {
|
||||
src->detected_directconnect_ssl_port =
|
||||
ntohs_ndpi_bytestream_to_number(&packet->payload[25], 5, &bytes_read);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "DC ssl port parsed %d\n", ntohs(src->detected_directconnect_ssl_port));
|
||||
@@ -160,9 +159,9 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
return;
|
||||
|
||||
}
|
||||
if (src != NULL) {
|
||||
if (src->detected_directconnect_port == packet->tcp->source) {
|
||||
if ((u_int32_t)
|
||||
if(src != NULL) {
|
||||
if(src->detected_directconnect_port == packet->tcp->source) {
|
||||
if((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
@@ -175,8 +174,8 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (src->detected_directconnect_ssl_port == packet->tcp->dest) {
|
||||
if ((u_int32_t)
|
||||
if(src->detected_directconnect_ssl_port == packet->tcp->dest) {
|
||||
if((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
@@ -192,9 +191,9 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
|
||||
}
|
||||
|
||||
if (dst != NULL) {
|
||||
if (dst->detected_directconnect_port == packet->tcp->dest) {
|
||||
if ((u_int32_t)
|
||||
if(dst != NULL) {
|
||||
if(dst->detected_directconnect_port == packet->tcp->dest) {
|
||||
if((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
@@ -207,8 +206,8 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (dst->detected_directconnect_ssl_port == packet->tcp->dest) {
|
||||
if ((u_int32_t)
|
||||
if(dst->detected_directconnect_ssl_port == packet->tcp->dest) {
|
||||
if((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
@@ -224,17 +223,17 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
|
||||
}
|
||||
|
||||
if (flow->directconnect_stage == 0) {
|
||||
if(flow->directconnect_stage == 0) {
|
||||
|
||||
if (packet->payload_packet_len > 6) {
|
||||
if (packet->payload[0] == '$'
|
||||
if(packet->payload_packet_len > 6) {
|
||||
if(packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& (memcmp(&packet->payload[1], "Lock ", 5) == 0)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "maybe first dc connect to hub detected\n");
|
||||
flow->directconnect_stage = 1;
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len > 7
|
||||
if(packet->payload_packet_len > 7
|
||||
&& packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& (memcmp(&packet->payload[1], "MyNick ", 7) == 0)) {
|
||||
@@ -244,15 +243,15 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
}
|
||||
|
||||
}
|
||||
if (packet->payload_packet_len >= 11) {
|
||||
if(packet->payload_packet_len >= 11) {
|
||||
/* did not see this pattern in any trace */
|
||||
if (memcmp(&packet->payload[0], "HSUP ADBAS0", 11) == 0
|
||||
if(memcmp(&packet->payload[0], "HSUP ADBAS0", 11) == 0
|
||||
|| memcmp(&packet->payload[0], "HSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC HSUP ADBAS0 E\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_HUB);
|
||||
return;
|
||||
/* did not see this pattern in any trace */
|
||||
} else if (memcmp(&packet->payload[0], "CSUP ADBAS0", 11) == 0 ||
|
||||
} else if(memcmp(&packet->payload[0], "CSUP ADBAS0", 11) == 0 ||
|
||||
memcmp(&packet->payload[0], "CSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC CSUP ADBAS0 E\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_ADC_PEER);
|
||||
@@ -262,16 +261,16 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
|
||||
}
|
||||
|
||||
} else if (flow->directconnect_stage == 1) {
|
||||
if (packet->payload_packet_len >= 11) {
|
||||
} else if(flow->directconnect_stage == 1) {
|
||||
if(packet->payload_packet_len >= 11) {
|
||||
/* did not see this pattern in any trace */
|
||||
if (memcmp(&packet->payload[0], "HSUP ADBAS0", 11) == 0
|
||||
if(memcmp(&packet->payload[0], "HSUP ADBAS0", 11) == 0
|
||||
|| memcmp(&packet->payload[0], "HSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC HSUP ADBAS E in second packet\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_HUB);
|
||||
return;
|
||||
/* did not see this pattern in any trace */
|
||||
} else if (memcmp(&packet->payload[0], "CSUP ADBAS0", 11) == 0 ||
|
||||
} else if(memcmp(&packet->payload[0], "CSUP ADBAS0", 11) == 0 ||
|
||||
memcmp(&packet->payload[0], "CSUP ADBASE", 11) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC HSUP ADBAS0 E in second packet\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_ADC_PEER);
|
||||
@@ -280,8 +279,8 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
}
|
||||
}
|
||||
/* get client hello answer or server message */
|
||||
if (packet->payload_packet_len > 6) {
|
||||
if ((packet->payload[0] == '$' || packet->payload[0] == '<')
|
||||
if(packet->payload_packet_len > 6) {
|
||||
if((packet->payload[0] == '$' || packet->payload[0] == '<')
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|') {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC second\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_HUB);
|
||||
@@ -291,10 +290,10 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
}
|
||||
|
||||
}
|
||||
} else if (flow->directconnect_stage == 2) {
|
||||
} else if(flow->directconnect_stage == 2) {
|
||||
/* get client hello answer or server message */
|
||||
if (packet->payload_packet_len > 6) {
|
||||
if (packet->payload[0] == '$' && packet->payload[packet->payload_packet_len - 1] == '|') {
|
||||
if(packet->payload_packet_len > 6) {
|
||||
if(packet->payload[0] == '$' && packet->payload[packet->payload_packet_len - 1] == '|') {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC between peers\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_PEER);
|
||||
return;
|
||||
@@ -318,9 +317,8 @@ static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
int pos, count = 0;
|
||||
|
||||
|
||||
if (dst != NULL && dst->detected_directconnect_udp_port == packet->udp->dest) {
|
||||
if ((u_int32_t)
|
||||
if(dst != NULL && dst->detected_directconnect_udp_port == packet->udp->dest) {
|
||||
if((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
|
||||
@@ -335,21 +333,21 @@ static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 58) {
|
||||
if (src != NULL
|
||||
if(packet->payload_packet_len > 58) {
|
||||
if(src != NULL
|
||||
&& NDPI_COMPARE_PROTOCOL_TO_BITMASK(src->detected_protocol_bitmask, NDPI_PROTOCOL_DIRECTCONNECT)) {
|
||||
if (packet->payload[0] == '$'
|
||||
if(packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& memcmp(&packet->payload[1], "SR ", 3) == 0) {
|
||||
pos = packet->payload_packet_len - 2;
|
||||
if (packet->payload[pos] == ')') {
|
||||
if(packet->payload[pos] == ')') {
|
||||
while (pos > 0 && packet->payload[pos] != '(' && count < 21) {
|
||||
pos--;
|
||||
count++;
|
||||
}
|
||||
if (packet->payload[pos] == '(') {
|
||||
if(packet->payload[pos] == '(') {
|
||||
pos = pos - 44;
|
||||
if (pos > 2 && memcmp(&packet->payload[pos], "TTH:", 4) == 0) {
|
||||
if(pos > 2 && memcmp(&packet->payload[pos], "TTH:", 4) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC udp\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_PEER);
|
||||
return;
|
||||
@@ -357,25 +355,25 @@ static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
}
|
||||
}
|
||||
flow->directconnect_stage++;
|
||||
if (flow->directconnect_stage < 3)
|
||||
if(flow->directconnect_stage < 3)
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (dst != NULL
|
||||
if(dst != NULL
|
||||
&& NDPI_COMPARE_PROTOCOL_TO_BITMASK(dst->detected_protocol_bitmask, NDPI_PROTOCOL_DIRECTCONNECT)) {
|
||||
if (packet->payload[0] == '$'
|
||||
if(packet->payload[0] == '$'
|
||||
&& packet->payload[packet->payload_packet_len - 1] == '|'
|
||||
&& memcmp(&packet->payload[1], "SR ", 3) == 0) {
|
||||
pos = packet->payload_packet_len - 2;
|
||||
if (packet->payload[pos] == ')') {
|
||||
if(packet->payload[pos] == ')') {
|
||||
while (pos > 0 && packet->payload[pos] != '(' && count < 21) {
|
||||
pos--;
|
||||
count++;
|
||||
}
|
||||
if (packet->payload[pos] == '(') {
|
||||
if(packet->payload[pos] == '(') {
|
||||
pos = pos - 44;
|
||||
if (pos > 2 && memcmp(&packet->payload[pos], "TTH:", 4) == 0) {
|
||||
if(pos > 2 && memcmp(&packet->payload[pos], "TTH:", 4) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DC udp\n");
|
||||
ndpi_int_directconnect_add_connection(ndpi_struct, flow, DIRECT_CONNECT_TYPE_PEER);
|
||||
return;
|
||||
@@ -383,7 +381,7 @@ static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
}
|
||||
}
|
||||
flow->directconnect_stage++;
|
||||
if (flow->directconnect_stage < 3)
|
||||
if(flow->directconnect_stage < 3)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -405,14 +403,14 @@ void ndpi_search_directconnect(struct ndpi_detection_module_struct
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search DC\n");
|
||||
|
||||
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
|
||||
if (src != NULL && ((u_int32_t)
|
||||
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_DIRECTCONNECT) {
|
||||
if(src != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) <
|
||||
ndpi_struct->directconnect_connection_ip_tick_timeout)) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
|
||||
} else if (dst != NULL && ((u_int32_t)
|
||||
} else if(dst != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) <
|
||||
ndpi_struct->directconnect_connection_ip_tick_timeout)) {
|
||||
@@ -424,9 +422,9 @@ void ndpi_search_directconnect(struct ndpi_detection_module_struct
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->tcp != NULL) {
|
||||
if(packet->tcp != NULL) {
|
||||
ndpi_search_directconnect_tcp(ndpi_struct, flow);
|
||||
} else if (packet->udp != NULL) {
|
||||
} else if(packet->udp != NULL) {
|
||||
ndpi_search_directconnect_udp(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* directdownloadlink.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -56,7 +56,7 @@ u_int8_t search_ddl_domains(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t filename_start = 0;
|
||||
u_int8_t i = 1;
|
||||
u_int16_t i = 1;
|
||||
u_int16_t host_line_len_without_port;
|
||||
|
||||
if (packet->payload_packet_len < 100) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* dnp3.c
|
||||
* Extension for dnp3 recognition
|
||||
*
|
||||
* Created by Cesar HM
|
||||
*/
|
||||
|
||||
#include "ndpi_protocol_ids.h"
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DNP3
|
||||
|
||||
void ndpi_search_dnp3_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
NDPI_LOG_DBG(ndpi_struct, "search DNP3\n");
|
||||
|
||||
/* Check connection over TCP */
|
||||
|
||||
if(packet->tcp) {
|
||||
/* The payload of DNP3 is 10 bytes long.
|
||||
* Header bytes: 0x0564
|
||||
*/
|
||||
if ( packet->payload_packet_len >= 10 &&
|
||||
packet->payload[0] == 0x05 && packet->payload[1] == 0x64 ){
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DNP3\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DNP3, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void init_dnp3_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) {
|
||||
|
||||
ndpi_set_bitmask_protocol_detection("DNP3", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DNP3,
|
||||
ndpi_search_dnp3_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
+256
-141
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* dns.c
|
||||
*
|
||||
* Copyright (C) 2012-18 - ntop.org
|
||||
* Copyright (C) 2012-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -30,7 +30,9 @@
|
||||
|
||||
#define FLAGS_MASK 0x8000
|
||||
|
||||
/* #define DNS_DEBUG 1 */
|
||||
// #define DNS_DEBUG 1
|
||||
|
||||
static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
@@ -45,7 +47,9 @@ static u_int16_t get16(int *i, const u_int8_t *payload) {
|
||||
/* *********************************************** */
|
||||
|
||||
static u_int getNameLength(u_int i, const u_int8_t *payload, u_int payloadLen) {
|
||||
if(payload[i] == 0x00)
|
||||
if(i >= payloadLen)
|
||||
return(0);
|
||||
else if(payload[i] == 0x00)
|
||||
return(1);
|
||||
else if(payload[i] == 0xC0)
|
||||
return(2);
|
||||
@@ -59,11 +63,178 @@ static u_int getNameLength(u_int i, const u_int8_t *payload, u_int payloadLen) {
|
||||
return(off + getNameLength(i+off, payload, payloadLen));
|
||||
}
|
||||
}
|
||||
/*
|
||||
allowed chars for dns names A-Z 0-9 _ -
|
||||
Perl script for generation map:
|
||||
my @M;
|
||||
for(my $ch=0; $ch < 256; $ch++) {
|
||||
$M[$ch >> 5] |= 1 << ($ch & 0x1f) if chr($ch) =~ /[a-z0-9_-]/i;
|
||||
}
|
||||
print join(',', map { sprintf "0x%08x",$_ } @M),"\n";
|
||||
*/
|
||||
|
||||
static uint32_t dns_validchar[8] =
|
||||
{
|
||||
0x00000000,0x03ff2000,0x87fffffe,0x07fffffe,0,0,0,0
|
||||
};
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
int x, payload_offset;
|
||||
static int search_valid_dns(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
struct ndpi_dns_packet_header *dns_header,
|
||||
int payload_offset, u_int8_t *is_query) {
|
||||
int x = payload_offset;
|
||||
|
||||
memcpy(dns_header, (struct ndpi_dns_packet_header*)&flow->packet.payload[x],
|
||||
sizeof(struct ndpi_dns_packet_header));
|
||||
|
||||
dns_header->tr_id = ntohs(dns_header->tr_id);
|
||||
dns_header->flags = ntohs(dns_header->flags);
|
||||
dns_header->num_queries = ntohs(dns_header->num_queries);
|
||||
dns_header->num_answers = ntohs(dns_header->num_answers);
|
||||
dns_header->authority_rrs = ntohs(dns_header->authority_rrs);
|
||||
dns_header->additional_rrs = ntohs(dns_header->additional_rrs);
|
||||
|
||||
x += sizeof(struct ndpi_dns_packet_header);
|
||||
|
||||
/* 0x0000 QUERY */
|
||||
if((dns_header->flags & FLAGS_MASK) == 0x0000)
|
||||
*is_query = 1;
|
||||
/* 0x8000 RESPONSE */
|
||||
else if((dns_header->flags & FLAGS_MASK) == 0x8000)
|
||||
*is_query = 0;
|
||||
else
|
||||
return(1 /* invalid */);
|
||||
|
||||
if(*is_query) {
|
||||
/* DNS Request */
|
||||
if((dns_header->num_queries > 0) && (dns_header->num_queries <= NDPI_MAX_DNS_REQUESTS)
|
||||
&& (((dns_header->flags & 0x2800) == 0x2800 /* Dynamic DNS Update */)
|
||||
|| ((dns_header->num_answers == 0) && (dns_header->authority_rrs == 0)))) {
|
||||
/* This is a good query */
|
||||
while(x < flow->packet.payload_packet_len) {
|
||||
if(flow->packet.payload[x] == '\0') {
|
||||
x++;
|
||||
flow->protos.dns.query_type = get16(&x, flow->packet.payload);
|
||||
#ifdef DNS_DEBUG
|
||||
NDPI_LOG_DBG2(ndpi_struct, "query_type=%2d\n", flow->protos.dns.query_type);
|
||||
printf("[DNS] query_type=%d\n", flow->protos.dns.query_type);
|
||||
#endif
|
||||
break;
|
||||
} else
|
||||
x++;
|
||||
}
|
||||
} else
|
||||
return(1 /* invalid */);
|
||||
} else {
|
||||
/* DNS Reply */
|
||||
flow->protos.dns.reply_code = dns_header->flags & 0x0F;
|
||||
|
||||
if((dns_header->num_queries > 0) && (dns_header->num_queries <= NDPI_MAX_DNS_REQUESTS) /* Don't assume that num_queries must be zero */
|
||||
&& (((dns_header->num_answers > 0) && (dns_header->num_answers <= NDPI_MAX_DNS_REQUESTS))
|
||||
|| ((dns_header->authority_rrs > 0) && (dns_header->authority_rrs <= NDPI_MAX_DNS_REQUESTS))
|
||||
|| ((dns_header->additional_rrs > 0) && (dns_header->additional_rrs <= NDPI_MAX_DNS_REQUESTS)))
|
||||
) {
|
||||
/* This is a good reply: we dissect it both for request and response */
|
||||
|
||||
/* Leave the statement below commented necessary in case of call to ndpi_get_partial_detection() */
|
||||
x++;
|
||||
|
||||
if(flow->packet.payload[x] != '\0') {
|
||||
while((x < flow->packet.payload_packet_len)
|
||||
&& (flow->packet.payload[x] != '\0')) {
|
||||
x++;
|
||||
}
|
||||
|
||||
x++;
|
||||
}
|
||||
|
||||
x += 4;
|
||||
|
||||
if(dns_header->num_answers > 0) {
|
||||
u_int16_t rsp_type;
|
||||
u_int16_t num;
|
||||
|
||||
for(num = 0; num < dns_header->num_answers; num++) {
|
||||
u_int16_t data_len;
|
||||
|
||||
if((x+6) >= flow->packet.payload_packet_len) {
|
||||
break;
|
||||
}
|
||||
|
||||
if((data_len = getNameLength(x, flow->packet.payload, flow->packet.payload_packet_len)) == 0) {
|
||||
break;
|
||||
} else
|
||||
x += data_len;
|
||||
|
||||
if((x+2) >= flow->packet.payload_packet_len) {
|
||||
break;
|
||||
}
|
||||
rsp_type = get16(&x, flow->packet.payload);
|
||||
flow->protos.dns.rsp_type = rsp_type;
|
||||
|
||||
/* here x points to the response "class" field */
|
||||
if((x+12) <= flow->packet.payload_packet_len) {
|
||||
x += 6;
|
||||
data_len = get16(&x, flow->packet.payload);
|
||||
|
||||
if((x + data_len) <= flow->packet.payload_packet_len) {
|
||||
// printf("[rsp_type: %u][data_len: %u]\n", rsp_type, data_len);
|
||||
|
||||
if(rsp_type == 0x05 /* CNAME */) {
|
||||
x += data_len;
|
||||
continue; /* Skip CNAME */
|
||||
}
|
||||
|
||||
if((((rsp_type == 0x1) && (data_len == 4)) /* A */
|
||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||
|| ((rsp_type == 0x1c) && (data_len == 16)) /* AAAA */
|
||||
#endif
|
||||
)) {
|
||||
memcpy(&flow->protos.dns.rsp_addr, flow->packet.payload + x, data_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((flow->packet.detected_protocol_stack[0] == NDPI_PROTOCOL_DNS)
|
||||
|| (flow->packet.detected_protocol_stack[1] == NDPI_PROTOCOL_DNS)) {
|
||||
/* Request already set the protocol */
|
||||
// flow->extra_packets_func = NULL; /* Removed so the caller can keep dissecting DNS flows */
|
||||
} else {
|
||||
/* We missed the request */
|
||||
u_int16_t s_port = flow->packet.udp ? ntohs(flow->packet.udp->source) : ntohs(flow->packet.tcp->source);
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow,
|
||||
(s_port == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS,
|
||||
NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
} else
|
||||
return(1 /* invalid */);
|
||||
}
|
||||
|
||||
/* Valid */
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
static int search_dns_again(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
/* possibly dissect the DNS reply */
|
||||
ndpi_search_dns(ndpi_struct, flow);
|
||||
|
||||
/* Possibly more processing */
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
int payload_offset;
|
||||
u_int8_t is_query;
|
||||
u_int16_t s_port = 0, d_port = 0;
|
||||
|
||||
@@ -82,166 +253,110 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
return;
|
||||
}
|
||||
|
||||
x = payload_offset;
|
||||
|
||||
if((s_port == 53 || d_port == 53 || d_port == 5355)
|
||||
&& (flow->packet.payload_packet_len > sizeof(struct ndpi_dns_packet_header)+x)) {
|
||||
&& (flow->packet.payload_packet_len > sizeof(struct ndpi_dns_packet_header)+payload_offset)) {
|
||||
struct ndpi_dns_packet_header dns_header;
|
||||
int invalid = 0;
|
||||
int j = 0, max_len, off;
|
||||
int invalid = search_valid_dns(ndpi_struct, flow, &dns_header, payload_offset, &is_query);
|
||||
ndpi_protocol ret;
|
||||
|
||||
memcpy(&dns_header, (struct ndpi_dns_packet_header*) &flow->packet.payload[x], sizeof(struct ndpi_dns_packet_header));
|
||||
dns_header.tr_id = ntohs(dns_header.tr_id);
|
||||
dns_header.flags = ntohs(dns_header.flags);
|
||||
dns_header.num_queries = ntohs(dns_header.num_queries);
|
||||
dns_header.num_answers = ntohs(dns_header.num_answers);
|
||||
dns_header.authority_rrs = ntohs(dns_header.authority_rrs);
|
||||
dns_header.additional_rrs = ntohs(dns_header.additional_rrs);
|
||||
x += sizeof(struct ndpi_dns_packet_header);
|
||||
ret.master_protocol = NDPI_PROTOCOL_UNKNOWN;
|
||||
ret.app_protocol = (d_port == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS;
|
||||
|
||||
/* 0x0000 QUERY */
|
||||
if((dns_header.flags & FLAGS_MASK) == 0x0000)
|
||||
is_query = 1;
|
||||
/* 0x8000 RESPONSE */
|
||||
else if((dns_header.flags & FLAGS_MASK) == 0x8000)
|
||||
is_query = 0;
|
||||
else
|
||||
invalid = 1;
|
||||
if(invalid) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!invalid) {
|
||||
if(is_query) {
|
||||
/* DNS Request */
|
||||
if((dns_header.num_queries > 0) && (dns_header.num_queries <= NDPI_MAX_DNS_REQUESTS)
|
||||
&& (((dns_header.flags & 0x2800) == 0x2800 /* Dynamic DNS Update */)
|
||||
|| ((dns_header.num_answers == 0) && (dns_header.authority_rrs == 0)))) {
|
||||
/* This is a good query */
|
||||
/* extract host name server */
|
||||
max_len = sizeof(flow->host_server_name)-1;
|
||||
off = sizeof(struct ndpi_dns_packet_header) + payload_offset;
|
||||
|
||||
while(j < max_len && off < flow->packet.payload_packet_len && flow->packet.payload[off] != '\0') {
|
||||
uint8_t c, cl = flow->packet.payload[off++];
|
||||
|
||||
if(dns_header.num_queries > 0) {
|
||||
while(x < flow->packet.payload_packet_len) {
|
||||
if(flow->packet.payload[x] == '\0') {
|
||||
x++;
|
||||
flow->protos.dns.query_type = get16(&x, flow->packet.payload);
|
||||
#ifdef DNS_DEBUG
|
||||
NDPI_LOG_DBG2(ndpi_struct, "query_type=%2d\n", flow->protos.dns.query_type);
|
||||
#endif
|
||||
break;
|
||||
} else
|
||||
x++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
invalid = 1;
|
||||
} else {
|
||||
/* DNS Reply */
|
||||
|
||||
flow->protos.dns.reply_code = dns_header.flags & 0x0F;
|
||||
|
||||
if((dns_header.num_queries > 0) && (dns_header.num_queries <= NDPI_MAX_DNS_REQUESTS) /* Don't assume that num_queries must be zero */
|
||||
&& (((dns_header.num_answers > 0) && (dns_header.num_answers <= NDPI_MAX_DNS_REQUESTS))
|
||||
|| ((dns_header.authority_rrs > 0) && (dns_header.authority_rrs <= NDPI_MAX_DNS_REQUESTS))
|
||||
|| ((dns_header.additional_rrs > 0) && (dns_header.additional_rrs <= NDPI_MAX_DNS_REQUESTS)))
|
||||
) {
|
||||
/* This is a good reply */
|
||||
if(ndpi_struct->dns_dont_dissect_response == 0) {
|
||||
x++;
|
||||
|
||||
if(flow->packet.payload[x] != '\0') {
|
||||
while((x < flow->packet.payload_packet_len)
|
||||
&& (flow->packet.payload[x] != '\0')) {
|
||||
x++;
|
||||
}
|
||||
|
||||
x++;
|
||||
}
|
||||
|
||||
x += 4;
|
||||
|
||||
if(dns_header.num_answers > 0) {
|
||||
u_int16_t rsp_type;
|
||||
u_int16_t num;
|
||||
|
||||
for(num = 0; num < dns_header.num_answers; num++) {
|
||||
u_int16_t data_len;
|
||||
|
||||
if((x+6) >= flow->packet.payload_packet_len) {
|
||||
break;
|
||||
}
|
||||
|
||||
if((data_len = getNameLength(x, flow->packet.payload, flow->packet.payload_packet_len)) == 0) {
|
||||
break;
|
||||
} else
|
||||
x += data_len;
|
||||
|
||||
rsp_type = get16(&x, flow->packet.payload);
|
||||
flow->protos.dns.rsp_type = rsp_type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (cl & 0xc0) != 0 || // we not support compressed names in query
|
||||
off + cl >= flow->packet.payload_packet_len) {
|
||||
j = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(invalid) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
if(j && j < max_len) flow->host_server_name[j++] = '.';
|
||||
|
||||
while(j < max_len && cl != 0) {
|
||||
u_int32_t shift;
|
||||
|
||||
c = flow->packet.payload[off++];
|
||||
shift = ((u_int32_t) 1) << (c & 0x1f);
|
||||
flow->host_server_name[j++] = tolower((dns_validchar[c >> 5] & shift) ? c : '_');
|
||||
cl--;
|
||||
}
|
||||
}
|
||||
flow->host_server_name[j] = '\0';
|
||||
|
||||
/* extract host name server */
|
||||
int j = 0, max_len = sizeof(flow->host_server_name)-1, off = sizeof(struct ndpi_dns_packet_header) + 1 + payload_offset;
|
||||
while(off < flow->packet.payload_packet_len && flow->packet.payload[off] != '\0') {
|
||||
flow->host_server_name[j] = flow->packet.payload[off];
|
||||
if(j < max_len) {
|
||||
if(flow->host_server_name[j] < ' ')
|
||||
flow->host_server_name[j] = '.';
|
||||
j++;
|
||||
} else
|
||||
break;
|
||||
if(j > 0) {
|
||||
ndpi_protocol_match_result ret_match;
|
||||
|
||||
off++;
|
||||
}
|
||||
ret.app_protocol = ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char *)flow->host_server_name,
|
||||
strlen((const char*)flow->host_server_name),
|
||||
&ret_match,
|
||||
NDPI_PROTOCOL_DNS);
|
||||
|
||||
if(is_query && (ndpi_struct->dns_dont_dissect_response == 0)) {
|
||||
// dpi_set_detected_protocol(ndpi_struct, flow, (d_port == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS, NDPI_PROTOCOL_UNKNOWN);
|
||||
return; /* The response will set the verdict */
|
||||
}
|
||||
|
||||
flow->host_server_name[j] = '\0';
|
||||
if(ret_match.protocol_category != NDPI_PROTOCOL_CATEGORY_UNSPECIFIED)
|
||||
flow->category = ret_match.protocol_category;
|
||||
|
||||
flow->protos.dns.num_queries = (u_int8_t)dns_header.num_queries,
|
||||
flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs);
|
||||
if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN)
|
||||
ret.master_protocol = (d_port == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS;
|
||||
else
|
||||
ret.master_protocol = NDPI_PROTOCOL_DNS;
|
||||
}
|
||||
|
||||
if(j > 0) {
|
||||
ndpi_protocol_match_result ret_match;
|
||||
/* Report if this is a DNS query or reply */
|
||||
flow->protos.dns.is_query = is_query;
|
||||
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char *)flow->host_server_name,
|
||||
strlen((const char*)flow->host_server_name),
|
||||
&ret_match,
|
||||
NDPI_PROTOCOL_DNS);
|
||||
}
|
||||
if(is_query) {
|
||||
/* In this case we say that the protocol has been detected just to let apps carry on with their activities */
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, ret.app_protocol, ret.master_protocol);
|
||||
|
||||
/* This is necessary to inform the core to call this dissector again */
|
||||
flow->check_extra_packets = 1;
|
||||
|
||||
/* Don't use just 1 as in TCP DNS more packets could be returned (e.g. ACK). */
|
||||
flow->max_extra_packets_to_check = 5;
|
||||
flow->extra_packets_func = search_dns_again;
|
||||
return; /* The response will set the verdict */
|
||||
}
|
||||
|
||||
flow->protos.dns.num_queries = (u_int8_t)dns_header.num_queries,
|
||||
flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs);
|
||||
|
||||
#ifdef DNS_DEBUG
|
||||
NDPI_LOG_DBG2(ndpi_struct, "[num_queries=%d][num_answers=%d][reply_code=%u][rsp_type=%u][host_server_name=%s]\n",
|
||||
flow->protos.dns.num_queries, flow->protos.dns.num_answers,
|
||||
flow->protos.dns.reply_code, flow->protos.dns.rsp_type, flow->host_server_name
|
||||
);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "[num_queries=%d][num_answers=%d][reply_code=%u][rsp_type=%u][host_server_name=%s]\n",
|
||||
flow->protos.dns.num_queries, flow->protos.dns.num_answers,
|
||||
flow->protos.dns.reply_code, flow->protos.dns.rsp_type, flow->host_server_name
|
||||
);
|
||||
#endif
|
||||
|
||||
if(flow->packet.detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
/**
|
||||
Do not set the protocol with DNS if ndpi_match_host_subprotocol() has
|
||||
matched a subprotocol
|
||||
**/
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DNS\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, (d_port == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS, NDPI_PROTOCOL_UNKNOWN);
|
||||
} else {
|
||||
if(flow->packet.detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
/**
|
||||
Do not set the protocol with DNS if ndpi_match_host_subprotocol() has
|
||||
matched a subprotocol
|
||||
**/
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DNS\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, ret.app_protocol, ret.master_protocol);
|
||||
} else {
|
||||
if((flow->packet.detected_protocol_stack[0] == NDPI_PROTOCOL_DNS)
|
||||
|| (flow->packet.detected_protocol_stack[1] == NDPI_PROTOCOL_DNS))
|
||||
;
|
||||
else
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) {
|
||||
ndpi_set_bitmask_protocol_detection("DNS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DNS,
|
||||
ndpi_search_dns,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* dofus.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* drda.c
|
||||
*
|
||||
* Copyright (C) 2012-18 - ntop.org
|
||||
* Copyright (C) 2012-20 - ntop.org
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -30,11 +30,9 @@
|
||||
|
||||
#define DB_LSP_PORT 17500
|
||||
|
||||
|
||||
static void ndpi_int_dropbox_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int8_t due_to_correlation)
|
||||
{
|
||||
u_int8_t due_to_correlation) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
@@ -51,8 +49,7 @@ static void ndpi_check_dropbox(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(packet->udp->dest == dropbox_port) {
|
||||
if(packet->udp->source == dropbox_port) {
|
||||
if(payload_len > 10) {
|
||||
if(ndpi_strnstr((const char *)packet->payload, "\"host_int\"", payload_len) != NULL) {
|
||||
|
||||
if(ndpi_strnstr((const char *)packet->payload, "\"host_int\"", payload_len) != NULL) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found dropbox\n");
|
||||
ndpi_int_dropbox_add_connection(ndpi_struct, flow, 0);
|
||||
return;
|
||||
@@ -60,8 +57,7 @@ static void ndpi_check_dropbox(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
}
|
||||
} else {
|
||||
if(payload_len > 10) {
|
||||
if(ndpi_strnstr((const char *)packet->payload, "Bus17Cmd", payload_len) != NULL) {
|
||||
|
||||
if(ndpi_strnstr((const char *)packet->payload, "Bus17Cmd", payload_len) != NULL) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found dropbox\n");
|
||||
ndpi_int_dropbox_add_connection(ndpi_struct, flow, 0);
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* eaq.c
|
||||
*
|
||||
* Copyright (C) 2015-18 - ntop.org
|
||||
* Copyright (C) 2015-20 - ntop.org
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -41,7 +41,15 @@ static void ndpi_int_eaq_add_connection(struct ndpi_detection_module_struct *ndp
|
||||
|
||||
|
||||
void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
if (!flow) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
if (!packet) {
|
||||
return;
|
||||
}
|
||||
|
||||
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search eaq\n");
|
||||
|
||||
@@ -177,7 +177,6 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
/* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */
|
||||
flow->edonkey_stage = packet->packet_direction + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "EDONKEY stage %u: \n", flow->edonkey_stage);
|
||||
|
||||
@@ -187,7 +186,7 @@ static void ndpi_check_edonkey(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
}
|
||||
|
||||
/* This is a packet in another direction. Check if we find the proper response. */
|
||||
if((payload_len == 0) || (ndpi_edonkey_payload_check(packet->payload, payload_len))) {
|
||||
if(ndpi_edonkey_payload_check(packet->payload, payload_len)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found EDONKEY\n");
|
||||
ndpi_int_edonkey_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* fasttrack.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -37,47 +37,48 @@ static void ndpi_int_fasttrack_add_connection(struct ndpi_detection_module_struc
|
||||
|
||||
void ndpi_search_fasttrack_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search FASTTRACK\n");
|
||||
NDPI_LOG_DBG(ndpi_struct, "search FASTTRACK\n");
|
||||
|
||||
if ( (packet->payload != NULL)
|
||||
&& (packet->payload_packet_len > 6)
|
||||
&& (ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "detected 0d0a at the end of the packet\n");
|
||||
if ( (packet->payload != NULL)
|
||||
&& (packet->payload_packet_len > 6)
|
||||
&& (ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "detected 0d0a at the end of the packet\n");
|
||||
|
||||
if (memcmp(packet->payload, "GIVE ", 5) == 0 && packet->payload_packet_len >= 8) {
|
||||
u_int16_t i;
|
||||
for (i = 5; i < (packet->payload_packet_len - 2); i++) {
|
||||
// make shure that the argument to GIVE is numeric
|
||||
if (!(packet->payload[i] >= '0' && packet->payload[i] <= '9')) {
|
||||
goto exclude_fasttrack;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG_INFO(ndpi_struct, "found FASTTRACK\n");
|
||||
ndpi_int_fasttrack_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 50 && memcmp(packet->payload, "GET /", 5) == 0) {
|
||||
u_int8_t a = 0;
|
||||
NDPI_LOG_DBG2(ndpi_struct, "detected GET /. \n");
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
for (a = 0; a < packet->parsed_lines; a++) {
|
||||
if ((packet->line[a].len > 17 && memcmp(packet->line[a].ptr, "X-Kazaa-Username: ", 18) == 0)
|
||||
|| (packet->line[a].len > 23 && memcmp(packet->line[a].ptr, "User-Agent: PeerEnabler/", 24) == 0)) {
|
||||
NDPI_LOG_INFO(ndpi_struct,
|
||||
"found FASTTRACK X-Kazaa-Username: || User-Agent: PeerEnabler/\n");
|
||||
ndpi_int_fasttrack_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (memcmp(packet->payload, "GIVE ", 5) == 0 && packet->payload_packet_len >= 8) {
|
||||
u_int16_t i;
|
||||
for (i = 5; i < (packet->payload_packet_len - 2); i++) {
|
||||
// make shure that the argument to GIVE is numeric
|
||||
if (!(packet->payload[i] >= '0' && packet->payload[i] <= '9')) {
|
||||
goto exclude_fasttrack;
|
||||
}
|
||||
}
|
||||
|
||||
exclude_fasttrack:
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
NDPI_LOG_INFO(ndpi_struct, "found FASTTRACK\n");
|
||||
ndpi_int_fasttrack_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 50 && memcmp(packet->payload, "GET /", 5) == 0) {
|
||||
u_int16_t a = 0;
|
||||
NDPI_LOG_DBG2(ndpi_struct, "detected GET /. \n");
|
||||
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
for (a = 0; a < packet->parsed_lines; a++) {
|
||||
if ((packet->line[a].len > 17 && memcmp(packet->line[a].ptr, "X-Kazaa-Username: ", 18) == 0)
|
||||
|| (packet->line[a].len > 23 && memcmp(packet->line[a].ptr, "User-Agent: PeerEnabler/", 24) == 0)) {
|
||||
NDPI_LOG_INFO(ndpi_struct,
|
||||
"found FASTTRACK X-Kazaa-Username: || User-Agent: PeerEnabler/\n");
|
||||
ndpi_int_fasttrack_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exclude_fasttrack:
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* fiesta.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* fix.c
|
||||
*
|
||||
* Copyright (C) 2017-18 - ntop.org
|
||||
* Copyright (C) 2017-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* florensia.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
+223
-563
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ftp_data.c
|
||||
*
|
||||
* Copyright (C) 2016-18 - ntop.org
|
||||
* Copyright (C) 2016-20 - ntop.org
|
||||
*
|
||||
* The signature is based on the Libprotoident library.
|
||||
*
|
||||
@@ -49,11 +49,19 @@ static int ndpi_match_ftp_data_directory(struct ndpi_detection_module_struct *nd
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
|
||||
if((payload_len >= 4)
|
||||
&& ((packet->payload[0] == '-') || (packet->payload[0] == 'd'))
|
||||
&& ((packet->payload[1] == '-') || (packet->payload[1] == 'r'))
|
||||
&& ((packet->payload[2] == '-') || (packet->payload[2] == 'w'))
|
||||
&& ((packet->payload[3] == '-') || (packet->payload[3] == 'x'))) {
|
||||
if(payload_len > 10) {
|
||||
int i;
|
||||
|
||||
if(!((packet->payload[0] == '-') || (packet->payload[0] == 'd')))
|
||||
return(0);
|
||||
|
||||
for(i=0; i<9; i += 3)
|
||||
if(((packet->payload[1+i] == '-') || (packet->payload[1+i] == 'r'))
|
||||
&& ((packet->payload[2+i] == '-') || (packet->payload[2+i] == 'w'))
|
||||
&& ((packet->payload[3+i] == '-') || (packet->payload[3+i] == 'x'))) {
|
||||
;
|
||||
} else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -220,16 +228,24 @@ static int ndpi_match_file_header(struct ndpi_detection_module_struct *ndpi_stru
|
||||
static void ndpi_check_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
if((packet->payload_packet_len > 0)
|
||||
&& (ndpi_match_file_header(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_directory(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_port(ndpi_struct, flow)
|
||||
)
|
||||
) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found FTP_DATA request\n");
|
||||
ndpi_int_ftp_data_add_connection(ndpi_struct, flow);
|
||||
} else
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
/*
|
||||
Make sure we see the beginning of the connection as otherwise we might have
|
||||
false positive results
|
||||
*/
|
||||
if(flow->l4.tcp.seen_syn) {
|
||||
if((packet->payload_packet_len > 0)
|
||||
&& (ndpi_match_file_header(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_directory(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_port(ndpi_struct, flow)
|
||||
)
|
||||
) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found FTP_DATA request\n");
|
||||
ndpi_int_ftp_data_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
void ndpi_search_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* git.c
|
||||
*
|
||||
* Copyright (C) 2012-18 - ntop.org
|
||||
* Copyright (C) 2012-20 - ntop.org
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* gnutella.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
@@ -68,7 +68,6 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
u_int16_t c;
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search GNUTELLA\n");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* gtp.c
|
||||
*
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* guildwars.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* halflife2_and_mods.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-18 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library based on the OpenDPI and PACE technology by ipoque GmbH
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user