Method: Nessus::Client::Scan#scan_new

Defined in:
lib/nessus/client/scan.rb

#scan_new(target, policy_id, scan_name, seq = nil, description = nil) ⇒ Hash

POST /scan/new

Parameters:

  • target (String)

    a string that contains the scan target(s)

  • policy_id (Fixnum)

    a numeric ID that references the policy to use

  • scan_name (String)

    the name to assign to this scan

  • seq (Fixnum) (defaults to: nil)

    a unique identifier for the specific request

Returns:

  • (Hash)

    the newly created scan object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/nessus/client/scan.rb', line 13

def scan_new(target, policy_id, scan_name, seq = nil, description = nil)
  payload = {
    :custom_targets => target,
    :policy_id => policy_id,
    :name => scan_name
  }
  payload[:seq] = seq if seq
  payload[:description] = description if description
  response = post '/scan/new', payload

  if response['error']
    raise Nessus::UnknownError, response['error']
  end

  response['reply']['contents'] # ['scan']
end