Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/net/winrm/ctrl_c.rb
Views: 11780
# WSMV message to send a Ctrl+C signal to a remote shell1require 'winrm/wsmv/base'2module Net3module MsfWinRM4# A WinRM Ctrl+C signal message5class CtrlC < WinRM::WSMV::Base6def initialize(session_opts, opts)7raise 'opts[:shell_id] is required' unless opts[:shell_id]8raise 'opts[:command_id] is required' unless opts[:command_id]910super()1112@session_opts = session_opts13@shell_id = opts[:shell_id]14@command_id = opts[:command_id]15@shell_uri = opts[:shell_uri] || RESOURCE_URI_CMD16end1718protected1920def create_header(header)21header << Gyoku.xml(ctrl_c_header)22end2324def create_body(body)25body.tag!("#{NS_WIN_SHELL}:Signal", 'CommandId' => @command_id) do |cl|26cl << Gyoku.xml(ctrl_c_body)27end28end2930private3132def ctrl_c_header33merge_headers(shared_headers(@session_opts),34resource_uri_shell(@shell_uri),35action_signal,36selector_shell_id(@shell_id))37end3839def ctrl_c_body40{41"#{NS_WIN_SHELL}:Code" =>42'http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/ctrl_c'43}44end45end46end47end484950