Module: Msf::Exploit::Remote::SMB::Server::Share::Command::Close

Included in:
Msf::Exploit::Remote::SMB::Server::Share
Defined in:
lib/msf/core/exploit/smb/server/share/command/close.rb

Instance Method Summary collapse

Instance Method Details

#send_close_res(c) ⇒ Integer

Builds and sends an SMB_COM_CLOSE response.

Parameters:

  • c (Socket)

    The client to answer.

Returns:

  • (Integer)

    The number of bytes returned to the client as response.


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/msf/core/exploit/smb/server/share/command/close.rb', line 23

def send_close_res(c)
  pkt = CONST::SMB_CLOSE_RES_PKT.make_struct
  smb_set_defaults(c, pkt)

  pkt['Payload']['SMB'].v['Command'] = CONST::SMB_COM_CLOSE
  pkt['Payload']['SMB'].v['Flags1'] = FLAGS
  pkt['Payload']['SMB'].v['Flags2'] = FLAGS2
  pkt['Payload']['SMB'].v['WordCount'] = CONST::SMB_CLOSE_RES_WORD_COUNT

  c.put(pkt.to_s)
end

#smb_cmd_close(c, buff) ⇒ Integer

Handles an SMB_COM_CLOSE command, used by the client to close an instance of an object associated with a valid FID.

Parameters:

  • c (Socket)

    The client sending the request.

  • buff (String)

    The data including the client request.

Returns:

  • (Integer)

    The number of bytes returned to the client as response.


15
16
17
# File 'lib/msf/core/exploit/smb/server/share/command/close.rb', line 15

def smb_cmd_close(c, buff)
  send_close_res(c)
end