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

Allow control of device discovery and other template options #133

Merged
merged 5 commits into from
Mar 17, 2015
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions lib/nexpose/scan_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,56 @@ def host_threads=(threads)
host_threads.text = threads.to_s
end

# Enable/disable IP stack fingerprinting
# @param [Boolean] enable or disable IP stack fingerprinting
def enable_ip_stack_fingerprinting(enable)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change this to the same foo=(blah) style used by the others, for consistency's sake.

ns = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name="java/NetworkScanners"]')

Choose a reason for hiding this comment

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

Line is too long. [96/80]

Copy link
Contributor

Choose a reason for hiding this comment

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

I think another branch has this changed to 120 max width since this could get annoying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is annoying. I'll fix the other legitimate feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed max line width on master, so next time hound runs it shouldn't bark at these. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've merged master to hopefully muzzle Hound.

Copy link
Contributor

Choose a reason for hiding this comment

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

Meanwhile Travis is taking forever to start builds for some reason, which is kind of annoying.

param = REXML::XPath.first(ns, './param[@name="ipFingerprintEnabled"]')
if param
param.text = (enable ? 1 : 0)
else
param = REXML::Element.new('param')
param.add_attribute('name', 'ipFingerprintEnabled')
param.text = (enable ? 1 : 0)
ns.add_element(param)
end
end

# Enable/diisable ICMP device discovery
# @param [Boolean] enable or disable ICMP device discovery
def enable_icmp_discovery=(enable)
icmp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/icmpHostCheck')
icmp.attributes['enabled'] = (enable ? 1 : 0)
end

# Add custom TCP ports to scan for device discovery
# @param [Array] ports to scan for device discovery
def tcp_discovery_ports=(ports)
tcp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/TCPHostCheck')
REXML::XPath.first(tcp, './portList').text = ports.join(',')
end

# Enable/disable TCP device discovery
# @param [Boolean] enable or disable TCP device discovery
def enable_tcp_discovery=(enable)
tcp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/TCPHostCheck')
tcp.attributes['enabled'] = (enable ? 1 : 0)
end

# Add custom UDP ports to scan for UDP device discovery
# @param [Array] posts to scan for UDP device discovery
def udp_discovery_ports=(ports)
udp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/UDPHostCheck')
REXML::XPath.first(udp, './portList').text = ports.join(',')
end

# Enable/diisable UDP device discovery
# @param [Boolean] enable or disable UDP device discovery
def enable_udp_discovery=(enable)
udp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/UDPHostCheck')
udp.attributes['enabled'] = (enable ? 1 : 0)
end

# Add custom TCP ports to scan for services
# @param [Array] ports to scan
def tcp_service_ports=(ports)
Expand Down