code: def run_command(self, scan_id, host, cmd):
          
  
          ssh = paramiko.SSHClient()
          ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  
          options = self.get_scan_options(scan_id)
  
          port = int(options['port'])
          timeout = int(options['ssh_timeout'])
  
          # For backward compatibility, consider the legacy mode to get
          # credentials as scan_option.
          # First and second modes should be removed in future releases.
          # On the third case it receives the credentials as a subelement of
          # the <target>.
          credentials = self.get_scan_credentials(scan_id, host)
          if ('username_password' in options and
                  ':' in options['username_password']):
              username, password = options['username_password'].split(':', 1)
          elif 'username' in options and options['username']:
              username = options['username']
              password = options['password']
          elif credentials:
              cred_params = credentials.get('ssh')
              username = cred_params.get('username', '')
              password = cred_params.get('password', '')
          else:
              self.add_scan_error(scan_id, host=host,
                                  value='Erroneous username_password value')
              raise ValueError('Erroneous username_password value')
  
          try:
              ssh.connect(hostname=host, username=username, password=password,
                          timeout=timeout, port=port)
          except (paramiko.ssh_exception.AuthenticationException,
                  socket.error) as err:
              # Errors: No route to host, connection timeout, authentication
              # failure etc,.
              self.add_scan_error(scan_id, host=host, value=str(err))
              return None
  
          _, stdout, _ = ssh.exec_command(cmd)
          result = stdout.readlines()
          ssh.close()
  
          return result
docs: Run a single command via SSH and return the content of stdout or
          None in case of an Error. A scan error is issued in the latter
          case.
  
          For logging into 'host', the scan options 'port', 'username',
          'password' and 'ssh_timeout' are used.