opennetadmin / ona

OpenNetAdmin IP Address Management (IPAM) system
opennetadmin.com
GNU General Public License v2.0
141 stars 35 forks source link

NMAP_SCAN_CRON throwing error #155

Closed mlfierro72 closed 4 years ago

mlfierro72 commented 4 years ago

I just configured the plugin and everything as far as I can see looks correct, and my subnets however when I run nmap_scan_cron -l, instead returning the list of subnets, I get:

select CONCAT(INET_NTOA(ip_addr),'/',32-log2((4294967296-ip_mask))) net from subnets where id in ( SELECT table_id_ref FROM custom_attributes WHERE table_name_ref = 'subnets' AND value = 'Y' AND custom_attribute_type_id = ( SELECT id FROM custom_attribute_types WHERE name LIKE 'nmap_scan' ) ) order by ip_addr'
3 ERROR => SQL query failed:

and when I run nmap_scan_cron -a, I get:

INFO => Running NMAP ping only scan on Input... Failed to resolve "Input". WARNING: No targets were specified, so 0 hosts scanned. INFO => Running NMAP ping only scan on array... Failed to resolve "array".

mattpascoe commented 4 years ago

hmm interesting.. I'll see if I can re-create the problem.. can you provide more information about your environment? Versions of OS, php, database etc.

If you have not, try setting the custom attribute 'nmap_scan' set to 'Y' on the subnets you wish to scan.

mlfierro72 commented 4 years ago

Ubuntu 18.04.4 LTS MySQL Ver 14.14 Distrib 5.7.29 PHP 7.2.24 Apache 2.4.29

I’ve got the custom attribute nmap_scan set to Y on all the subnets.

Thanks!

From: Matt Pascoe notifications@github.com Reply-To: opennetadmin/ona reply@reply.github.com Date: Monday, March 2, 2020 at 12:08 AM To: opennetadmin/ona ona@noreply.github.com Cc: mlfierro72 mlfierro@gmail.com, Author author@noreply.github.com Subject: Re: [opennetadmin/ona] NMAP_SCAN_CRON throwing error (#155)

hmm interesting.. I'll see if I can re-create the problem.. can you provide more information about your environment? Versions of OS, php, database etc.

If you have not, try setting the custom attribute 'nmap_scan' set to 'Y' on the subnets you wish to scan.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/opennetadmin/ona/issues/155?email_source=notifications&email_token=ALV4S56NHXURALQC3HDBUHTRFM5MXA5CNFSM4K7AZFG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENN5QPA#issuecomment-593221692, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALV4S52UUC6D7TLRVSZJF3DRFM5MXANCNFSM4K7AZFGQ.

mlfierro72 commented 4 years ago

[I've run this manually where $SQLFILE is /opt/ona/www/plugins/ona_nmap_scans/sql/nmap_subnets.sql

sudo ./dcm.pl -r ona_sql header=no sql=$SQLFILE Input array has 1 params, does not match query: '-- Lists all subnets with CIDR mask, use for nmap_ona_audit.php

-- LONG_DESC: -- This query returns all subnets from the database in -- network-ip/cidr notation. It will NOT return subnets that -- have the "nmap_scan" custom attribute set to "N".

-- The intent is that this list will be used as a seed for -- doing nmap scans of all subnets in the database. -- If you wish to find ONLY subnets that are flagged as "Y" -- then use the nmap_subnets_only_yes.sql file instead.

select CONCAT(INET_NTOA(ip_addr),'/',32-log2((4294967296-ip_mask))) net from subnets where id not in ( SELECT table_id_ref FROM custom_attributes WHERE table_name_ref = 'subnets' AND value = 'N' AND custom_attribute_type_id = ( SELECT id FROM custom_attribute_types WHERE name LIKE 'nmap_scan' ) ) order by ip_addr

'
3 ERROR => SQL query failed:](url)


From: Matt Pascoe notifications@github.com Sent: Monday, March 2, 2020 12:08 AM To: opennetadmin/ona ona@noreply.github.com Cc: mlfierro72 mlfierro@gmail.com; Author author@noreply.github.com Subject: Re: [opennetadmin/ona] NMAP_SCAN_CRON throwing error (#155)

hmm interesting.. I'll see if I can re-create the problem.. can you provide more information about your environment? Versions of OS, php, database etc.

If you have not, try setting the custom attribute 'nmap_scan' set to 'Y' on the subnets you wish to scan.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/opennetadmin/ona/issues/155?email_source=notifications&email_token=ALV4S56NHXURALQC3HDBUHTRFM5MXA5CNFSM4K7AZFG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENN5QPA#issuecomment-593221692, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALV4S52UUC6D7TLRVSZJF3DRFM5MXANCNFSM4K7AZFGQ.

mike-kll commented 4 years ago

I have the same problem is there a solution?

My Environment Debian 10.3 Apache 2.4.38 PHP 7.3

When I execute /opt/ona-master/bin/dcm.pl -r ona_sql sql=nmap_subnets_only_yes.sql

I get this error:

Input array has 1 params, does not match query: ..................... order by i.ip_addr'
3 ERROR => SQL query failed:

When i execute the sql statements in the mysql Shel is working.

Gankarloo commented 4 years ago

Try this https://github.com/opennetadmin/ona/pull/126

On Fri, Apr 3, 2020, 20:30 mike-kll notifications@github.com wrote:

I have the same problem is there a solution?

My Environment Debian 10.3 Apache 2.4.38 PHP 7.3

When I execute /opt/ona-master/bin/dcm.pl -r ona_sql sql=nmap_subnets_only_yes.sql

I get this error: Input array has 1 params, does not match query: '-- List all hosts, including other attributes -- LONG_DESC: -- This query will return a list of FQDN names for all hosts in the database. -- It includes the device type, IP, MAC, Subnet name, and location -- USAGE: -- No options available for this query, just run it

-- Your SQL statement would go below this line:

select concat(dns.name,".",z.name) fqdn, concat(m.name," ",models.name," (",roles.name,")") device_type, INET_NTOA(i.ip_addr) ip, i.mac_addr mac, s.name netname, l.reference location from interfaces i, dns, domains z, subnets s, manufacturers m, models, roles, device_types, hosts, devices left join locations l on (devices.location_id = l.id) where i.host_id = hosts.id and dns.domain_id = z.id and hosts.primary_dns_id = dns.id and s.id = i.subnet_id and devices.id = hosts.device_id and models.manufacturer_id = m.id and device_types.model_id = models.id and device_types.role_id = roles.id and devices.device_type_id = device_types.id order by i.ip_addr'

3 ERROR => SQL query failed:

When i execute the sql statements in the mysql Shel is working.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/opennetadmin/ona/issues/155#issuecomment-608594386, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6SLCBRKCRG6LSP5HT3JRTRKYTNZANCNFSM4K7AZFGQ .

mike-kll commented 4 years ago

Thats it, it works now.

Thanks a lot Gankarloo!!!

Gankarloo commented 4 years ago

Happy to be of assistance.

On Fri, Apr 3, 2020, 21:07 mike-kll notifications@github.com wrote:

Thats it, it works now.

Thanks a lot Gankarloo!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opennetadmin/ona/issues/155#issuecomment-608609945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6SLCDFZ7FEDCNZQ6XDQIDRKYXYDANCNFSM4K7AZFGQ .

mlfierro72 commented 4 years ago

Try this #126

This fixed it! Thank you!