Module: Ronin::Support::Network::UDP::Mixin
- Included in:
- Mixin
- Defined in:
- lib/ronin/support/network/udp/mixin.rb
Overview
Provides helper methods for using the UDP protocol.
Instance Method Summary collapse
-
#udp_banner(host, port, **kwargs) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
-
#udp_connect(host, port, **kwargs) {|socket| ... } ⇒ UDPSocket?
Creates a new UDPSocket object connected to a given host and port.
-
#udp_connect_and_send(data, host, port, **kwargs) {|socket| ... } ⇒ UDPSocket
Creates a new UDPSocket object, connected to a given host and port.
-
#udp_open?(host, port, **kwargs) ⇒ Boolean?
Tests whether a remote UDP port is open.
-
#udp_recv(**kwargs) {|server, (client_host, client_port), mesg| ... } ⇒ nil
Creates a new UDPServer listening on a given host and port, accepts only one message from a client.
-
#udp_send(data, host, port, **kwargs) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
-
#udp_server(**kwargs, &block) ⇒ UDPServer
Creates a new UDPServer listening on a given host and port.
-
#udp_server_loop(**kwargs) {|server, (client_host, client_port), mesg| ... } ⇒ nil
Creates a new UDPServer listening on a given host and port, accepting messages from clients in a loop.
-
#udp_server_session(**kwargs) {|server| ... } ⇒ nil
Creates a new temporary UDPServer listening on a given host and port.
Instance Method Details
#udp_banner(host, port, **kwargs) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
227 228 229 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 227 def (host,port,**kwargs,&block) UDP.(host,port,**kwargs,&block) end |
#udp_connect(host, port, **kwargs) {|socket| ... } ⇒ UDPSocket?
Creates a new UDPSocket object connected to a given host and port.
112 113 114 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 112 def udp_connect(host,port,**kwargs,&block) UDP.connect(host,port,**kwargs,&block) end |
#udp_connect_and_send(data, host, port, **kwargs) {|socket| ... } ⇒ UDPSocket
Creates a new UDPSocket object, connected to a given host and port. The given data will then be written to the newly created UDPSocket.
151 152 153 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 151 def udp_connect_and_send(data,host,port,**kwargs,&block) UDP.connect_and_send(data,host,port,**kwargs,&block) end |
#udp_open?(host, port, **kwargs) ⇒ Boolean?
Tests whether a remote UDP port is open.
68 69 70 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 68 def udp_open?(host,port,**kwargs) UDP.open?(host,port,**kwargs) end |
#udp_recv(**kwargs) {|server, (client_host, client_port), mesg| ... } ⇒ nil
Creates a new UDPServer listening on a given host and port, accepts only one message from a client.
382 383 384 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 382 def udp_recv(**kwargs,&block) UDP.recv(**kwargs,&block) end |
#udp_send(data, host, port, **kwargs) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
191 192 193 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 191 def udp_send(data,host,port,**kwargs) UDP.send(data,host,port,**kwargs) end |
#udp_server(**kwargs, &block) ⇒ UDPServer
Creates a new UDPServer listening on a given host and port.
255 256 257 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 255 def udp_server(**kwargs,&block) UDP.server(**kwargs,&block) end |
#udp_server_loop(**kwargs) {|server, (client_host, client_port), mesg| ... } ⇒ nil
Creates a new UDPServer listening on a given host and port, accepting messages from clients in a loop.
336 337 338 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 336 def udp_server_loop(**kwargs,&block) UDP.server_loop(**kwargs,&block) end |
#udp_server_session(**kwargs) {|server| ... } ⇒ nil
Creates a new temporary UDPServer listening on a given host and port.
290 291 292 |
# File 'lib/ronin/support/network/udp/mixin.rb', line 290 def udp_server_session(**kwargs,&block) UDP.server_session(**kwargs,&block) end |