-
Notifications
You must be signed in to change notification settings - Fork 648
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
Conversation
Thank you |
There was a problem hiding this 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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use local
variables.
Added unexpected DHCP plugin for detecting not allowed DHCP servers on the network.