Commit graph

70 commits

Author SHA1 Message Date
Alfredo Cardigliano
f2060f2488 Copyright update (C) 2022-01-03 09:35:09 +01:00
Francesco Amodeo
de27966413
Implemented countries host check (#5713)
* Added check and alert implementation

* Fixed size of estimation and some typo

* Added HLL counters and DES structure
Co-authored-by: Paolo Junior Mollica <p.mollica@studenti.unipi.it>

* fixes according comments of PR

* decreased memory footprint

* resolved conflicts

* fixed HostCheckID

* Removed wrongly committed file

Co-authored-by: paolo-junior-mollica <paolo.junior.mollica@gmail.com>
Co-authored-by: Matteo Biscosi <49585191+MatteoBiscosi@users.noreply.github.com>
2021-08-25 15:50:07 +02:00
Gaetano Barresi
f650a3700a
Domain Names host check (#5723)
* Adding/modifying .cpp for Domain Names host check

* Adding/modifying .h/.lua for Domain Names host check

* minor synstax fix

* dns_contacts

Co-authored-by: Stefano Russo <55586218+D0kken@users.noreply.github.com>
Co-authored-by: Stefano Russo <s.russo41@studenti.unipi.it>
2021-08-25 11:22:41 +02:00
Luca
112c931226 Observation point code cleanup (WIP) 2021-07-01 23:26:15 +02:00
Luca Deri
846d24c5e9 Initial VLANid rework 2021-06-15 23:01:59 +02:00
Luca
a4047c5a1c Implements flow callbacks and alerts in C++
Scaffolding code of the host scripts

Scaffolding code for host alerts

Adds host_callbacks/ for .cpp files

Implements all classes for host callbacks

Removes pro/enterprise host callbacks

Adds typedefs with callback deltas

Compilation fix

Creates instances of host callbacks in loader

Link fix

Removes redundant/non-necessary host alerts

Merges Scan and Flood callbacks together

Removes outdated API files

Refactors alert keys into entity|id

Refactors all flow alert_{...} into flow_alert_{...}

Refactors C++ flow alert_{...} into flow_alert_{...}

Reworks alert ids to include an entity type

Cleanup and merge alertTypeRaw with getAlertType

Minor fix

Refactors alert definitions and keys into sub directories

Implement host alert callback execution and trigger/release logic

Update callbacks API

Adds base CallbacksLoader for {Host,Flow}CallbacksLoader

Implements load of host user scripts with periodicities

Implements runtime reload of host callbacks

Add logic for periodic callbacks

Add 'expired' flag to host alerts

Implements execution of host callbacks and SYN flood checks

Adds triggerAlertAsync calls to SYNFlood

Implements JSON host alert generation info

Handle callback getPeriod. Optimize callback lookup.

Implements host recipients in C++

Add callback status

Define destructor

Iterator fixes

Cleanup host Lua calls (now performed in C++)

Changes to show new host alerts in SQLite

Adds release/engage action on alert JSON

Move AlertableEntity to OtherAlertableEntity, inheriting from a new AlertableEntity. Add HostAlertableEntity.

Implements SYN Flood Attacker with params

Uses parametrized thresholds to trigger syn flood alerts

Implements build alert of both attacker and victim

Implement HostAlertableEntity

Implements SYN scan attacker/victim alerts

Implements flow flood attacker/victim alerts

Removes a debug flag

Add virtual allocStatus

Add HostAlert disableAutoRelease()

Add Ãexplicit releaseAlert()

Implements SYNFloodHostCallbackStatus

Implements SYNScanHostCallbackStatus

Implements FlowFloodHostCallbackStatus

Change trigger API to handle cli/src score

Implements {DNS,SMTP,NTP}ServerContactsAlert

Reworks ServerContacts host alerts

Implement exclusion bitmaps for host alerts

Implements {SMTP,DNS,NTP}ServerContactsAlert

Adds host_info to the generated alert JSON

Minor cleanup

Optimize access to callback status

Move RepliesRequestsRatio to pro

Rework triggerAlert on host to avoid multiple call and unneeded status data

Compilation fix

Reworked host alerts API (wip)

Cleanup unused host callbacks

Compilation fixes

Finishes backend implementation of host alerts exclusions

Rework host callbacks executor

Implements disable of host alerts

Port SYNFlood to the new api

Cleanup

Reduce duplicated code

Comments

Port ServerContacts to the new api

Clenaup

Adds parsing of configuration for host callbacks

Port SYNScanAlert to the new API

Port FlowFlood to the new API

Cleanup unused HostAlert getName

Reworks DNSRequestsErrorsRatioAlert

Adds JSON for DNSTrafficAlert

Adds FlowsAlert

Adds P2PTrafficAlert

Add RepliesRequestsRatioAlert

Adds ScoreAlert

Adds ThroughputAlert

Adds TrafficAlert

Fixes for scan/flood alerts

DNS ratio alert support

Add HTTP stats getters

Implements deltas for many host callbacks

Host score inc

Adds missing Alert params to host alerts

Release all host alerts on idle

Refactors score classes

Implements class Score to contain scores for hosts, flows, etc

Adds scores to VLANs, Networks, ASes and Countries

Host callbacks can trigger a single alert now

FlowFlood, SYNFloo, SYNScan now inherit from FlowHits

Move severity and score to constructor

Add else branch to hits callbacks

Alert definition update for flows_flood, syn_flood, syn_scan

Update field name

Engaged alert init

Adds score incs/decs for AS, VLAN, country, os and network

Restore network scripts

Restored other alert definitions for floods

Handle decreasing alert score

Removes include

Rename flows_flood to flow_flood for consistency

Restored alert_tcp_syn_flood_victim alert_tcp_syn_scan_victim definitions

Fixes for non-host engaged/release alerts

Cleanup LuaEngineFlow and LuaEngineHost classes

Fixes old calls to host lua during shutdown

Removes AlertCheckLuaEngine instance

Fixes purging of flows

Fixes alerts release upon shutdown causing wrong uses

Removes a debug flag

Fix getNumEngagedAlerts

Cleanup unnecessary host callbacks

Removes array of callback statuses inside host

Bitmap fixes

Refactors Bitmap into Bitmap128

Implements 16-bits bitmaps for host alerts

Adds class HostCallbacksStatus

Moves callback status p2p and DNS inside HostCallbacksStatus

Removes unused callbacks in typedefs

Minor cleanup

Adds trigger/release for DNS/p2p alerts

Reworks UI of hosts user scripts

Rename HostCallbackType to HostCallbackID, getType to getID, others
2021-04-03 09:53:15 +02:00
Matteo Biscosi
dbfdec34fe Implements Local Host behaviour analysis and it's alert
Alert in case the host has an unexpected behaviour
2021-02-25 12:04:05 +01:00
Simone Mainardi
bdf3069227 Fixes for interface/host.lua [attempt to index a function value] 2021-02-03 15:06:07 +01:00
Matteo Biscosi
eba1aaa359 Implements #4984 core Internet resources misuse script 2021-02-03 12:41:18 +01:00
Matteo Biscosi
fe01117324 Implements #4006 alerts when host contacts an unusual number of peers
Partial implementation, the rest is under the Pro Repository
2021-02-02 13:31:21 +01:00
Luca Deri
0b4e2757c1 Added host contact counters for core servers 2021-01-28 23:42:03 +01:00
Matteo Biscosi
43fa8cf6e9 Implements OperatingSystem Hash
Implements #1599
2021-01-21 11:14:52 +01:00
Luca Deri
a1178a0791 Updated (C) 2021-01-02 12:08:23 +01:00
Luca Deri
2884cc9794 Reworked Doh/DoT handling 2020-11-11 18:55:12 +01:00
Luca Deri
7758e0dea1 Reworked DoH code 2020-11-11 16:19:39 +01:00
Matteo Biscosi
5a8fd8efd7
Fixes #2115 and added shell script user guide (#4702)
* Added shell endpoint user guide

* Fixes #2115 std::new exceptions not always handled

* Removed a nothrow due to the insert of a try-catch statement

* Trying to implement #4421

Co-authored-by: matteo <biscosi@ntop.org>
2020-11-11 12:28:18 +01:00
Simone Mainardi
fa96c5e2f5 Code cleanup 2020-10-01 14:20:07 +02:00
Luca Deri
80dfd37e04 Reworked baheviour analysis code 2020-09-28 12:55:37 +02:00
Simone Mainardi
1baa7d6cc4 Avoids double 5-sec HT-walks to update stats 2020-07-27 14:22:59 +02:00
Luca Deri
dd062dcc09 Behaviour analysis is not disabled by default 2020-07-22 09:39:47 +02:00
Luca Deri
84bd93f903 Implemented periodicity stats 2020-07-20 22:44:23 +02:00
Luca Deri
35876b871e Added --pcap-file-purge-flows for forcing purge on pcap files (debug only)
Local host BA improvements
2020-07-15 17:20:57 +02:00
Luca Deri
f2c3ee137c Host stats cleanup 2020-07-13 23:56:46 +02:00
Luca Deri
32f38e6d8b Port cardinality implementation 2020-06-12 11:07:44 +02:00
Luca Deri
9445dcb6b8 Introduced cardinality count 2020-06-12 08:11:05 +02:00
emanuele-f
ec51278c20 Cleanup of HostStats 2020-05-20 17:05:30 +02:00
Simone Mainardi
43284e22f8 Fixes crash and removes unused PortContactStats
Class was not used and didn't handle concurrent accesses to strings,
yielding crashes such as

Thread 14 "stats_update.lu" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb3fff700 (LWP 25268)]
0x00005555556b9183 in IpAddress::intoa (this=0x28c, buf=0x7fffb3ffe030 "", bufLen=64, bitmask=255 '\377') at src/IpAddress.cpp:352
352     src/IpAddress.cpp: No such file or directory.
(gdb)
(gdb) bt
    at src/GenericHash.cpp:222
    #9  0x00005555556c0413 in NetworkInterface::walker (this=0x555556159e70, begin_slot=0x7fffb3ffe454, walk_all=true, wtype=walker_flows, walker=0x5555556c6b79 <host_flow_update_stats(GenericHashEntry*, void*, bool*)>,
        user_data=0x7fffb3ffe458) at src/NetworkInterface.cpp:795
	#10 0x00005555556c6f7c in NetworkInterface::periodicStatsUpdate (this=0x555556159e70, vm=0x7fffac0a5578) at src/NetworkInterface.cpp:2589
	#11 0x0000555555671d62 in ntop_periodic_stats_update (vm=0x7fffac0a5578) at src/LuaEngine.cpp:6304
	#12 0x000055555576c2f6 in luaD_precall ()
	#13 0x0000555555777acd in luaV_execute ()
	#14 0x000055555576c5cf in luaD_call ()
	#15 0x000055555576c621 in luaD_callnoyield ()
	#16 0x000055555576ba42 in luaD_rawrunprotected ()
	#17 0x000055555576c91b in luaD_pcall ()
	#18 0x0000555555769cd4 in lua_pcallk ()
	#19 0x0000555555681e8a in LuaEngine::run_loaded_script (this=0x7fffac01fe10) at src/LuaEngine.cpp:12188
	#20 0x000055555563eca2 in ThreadedActivity::runScript (this=0x555562aee4e0, now=1585309410, script_path=0x7fff88002620 "/usr/share/ntopng/scripts/callbacks/interface/stats_update.lua", iface=0x555556159e70, deadline=1585309420)
	    at src/ThreadedActivity.cpp:418
	    #21 0x00005555556ba04d in ThreadPool::run (this=0x5555624525a0) at src/ThreadPool.cpp:103
	    #22 0x00005555556b9c79 in doRun (ptr=0x5555624525a0) at src/ThreadPool.cpp:31
	    #23 0x00007ffff65aa6db in start_thread (arg=0x7fffb3fff700) at pthread_create.c:463
	    #24 0x00007ffff3ea388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
2020-03-27 13:36:51 +01:00
Luca Deri
e55854aaff Initial work on host bins 2020-01-27 11:55:00 +01:00
Luca Deri
57e6a93065 Improved scheduling algorithm to guarantee minimum service time when number of entries allow
Updated (C)
2020-01-06 23:36:36 +01:00
Simone Mainardi
a65b6efc7c Implements icmp hosts stats for view interfaces 2019-12-13 13:06:26 +01:00
Simone Mainardi
4a9ac03cb4 Implements dns hosts stats for view interfaces 2019-12-13 09:58:09 +01:00
Simone Mainardi
4bac6dfd85 DNS queries pie chart fix 2019-12-05 17:14:02 +01:00
Simone Mainardi
e80dc962f4 Optimizes host.getFullInfo with smaller functions in periodic scripts 2019-10-21 16:21:03 +02:00
Simone Mainardi
b81592e49f nEdge compilation fixes 2019-09-30 20:04:42 +02:00
emanuele-f
c3fa094e99 Improve MUD prefs handling
Also implement a non-inline reloadPrefs Host method to avoid slowing down packet capture
2019-09-10 11:10:33 +02:00
Simone Mainardi
e1bdb8887c Performs local hosts serialization in set_hash_entry_state_idle 2019-08-12 14:40:54 +02:00
Emanuele Faranda
c829c4c3c3
Unify os (#2755)
* Unify OS information.

Now OS information is only stored into the Host. The lua uses numeric IDs to handle OS.

* Fix network discovery OS

* Show OS detail into the host details page
2019-08-08 12:09:51 +00:00
Luca Deri
e0563d28bc Improved host port stats 2019-07-22 15:49:39 +02:00
Luca Deri
3b3af9bb9f Implemented local hosts services hashes 2019-07-15 23:36:45 +02:00
Luca Deri
6a547616e2 Implemented local hosts ports stats 2019-07-15 18:55:11 +02:00
emanuele-f
e74f6ee3b7 Fix host timeseries first point problem.
An additional point is now stored on the ts database to address the issue.

Fixes #2184
2019-05-28 17:17:21 +02:00
emanuele-f
8fcce457c9 Implement countries serialization
Countries now show the cumulative traffic since ntopng restart as this is consistent with the other views
2019-05-27 13:07:30 +02:00
Emanuele Faranda
c09199690f
Unify serialization to redis and implement VLAN/AS serialization (#2610) 2019-05-27 08:11:20 +00:00
Salvatore Costantino
76dded229a Added ICMP ECHO time series (#2518)
* Added ICMP ECHO time series

* added icmp echo time series
2019-04-08 16:10:30 +02:00
Salvatore Costantino
3bb830d23e Fix active contacts time series (#2506)
* Fix active contacts time series

* Fix active contacts time series
2019-04-04 09:33:09 +02:00
SalvatoreCostantino
27fcedf9ff Added TCP time series 2019-04-02 16:22:39 +02:00
Salvatore Costantino
c8a95d9476 Added dns time series (#2487) 2019-03-28 19:14:51 +01:00
emanuele-f
347bc2062e Simplify host serialization keys by using the isDhcpHost info 2019-02-26 18:45:29 +01:00
emanuele-f
4d1c777940 Improve device deserialization logic 2019-02-25 15:41:58 +01:00
emanuele-f
905700d4e2 Reuse get_mac_based_tskey to avoid format differences 2019-02-22 16:28:31 +01:00