Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unexpected DHCP plugin #4562

Merged
merged 1 commit into from
Oct 10, 2020
Merged

Conversation

DanieleZulberti
Copy link
Contributor

Added unexpected DHCP plugin for detecting not allowed DHCP servers on the network.

@lucaderi lucaderi merged commit 6f9d442 into ntop:dev Oct 10, 2020
@lucaderi
Copy link
Member

Thank you

Copy link
Contributor

@simonemainardi simonemainardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, review suggested changes.

if flow.isServerUnicast() then
if(table.len(conf.items) > 0) then
ok = 0
server_ip = flow.getServerKey()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To obtain the server IP, use flow.getInfo() and then access key srv.ip of the returned table. This approach is safer than doing a replace string.

server_ip = server_ip:sub(1, -3)

for _, dns_ip in pairs(conf.items) do
if server_ip == dns_ip then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must break as soon as you find the match

function script.hooks.protocolDetected(now, conf)
if flow.isServerUnicast() then
if(table.len(conf.items) > 0) then
ok = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use local variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants