udpfire 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/bin/udpfire +45 -0
  3. metadata +44 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDI1NWZkYzI0NjYxZThmOWNjOThkMDdhOTFiNDExNTA5OWU2MWJhYg==
5
+ data.tar.gz: !binary |-
6
+ MmMyM2QwYWE1NDI1NzMwMzY1NWM1MzU2MDUxNTk1ZDE3YTE5ZmYxMA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDM1MWIxNmUyZDAxNjEzYTZiZjY5ZGYwZTAxMTcwMTFjMzJiMjY2MGVkMGEx
10
+ MGIwNDIxMWIyYzRmNzg3NGU3MDAwYzkxMzgyYjlhNDM5NzQ2NTliYTQwMTM1
11
+ YzhiZDhlY2ViZTQwZjdkMzI0OGM1M2ZjNWM2NTFkMDZhNGMzM2E=
12
+ data.tar.gz: !binary |-
13
+ YTljYTIyZjMyYTg4Y2ZmMWEwMzQ2NTkyMzMzOWM4NWI0YTI0ODljZWQ3NmU4
14
+ YmZiMjA0NGI4YWM1M2I5NTFlNDhlMGM3ZjRiM2I2NDVkMmM0Mzk2ZGY4MzFl
15
+ YzY3YWYxNTIxYzZmZDYyYzcwM2FjYmMzYmI1MzIyYzQxOTZlOGM=
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Hello, this is a little ditty to send UDP packets quickly and easily from CLI.
4
+ #
5
+ # Whack the script in `/usr/local/bin` (or OS equivelant)
6
+ # and ensure that it has executable permissions. (`chmod +x *path-to-file*`)
7
+
8
+ # TODO: Add an install method. Nothing fancy, just for maximum ease of use.
9
+
10
+ def fire_udp(ip, port, message)
11
+ require 'socket'
12
+
13
+ client = UDPSocket.new
14
+ if (!message or !port or !ip)
15
+ args_error
16
+ exit
17
+ end
18
+ client.send message, 0, ip, port
19
+ end
20
+
21
+ # Display help message to STDOUT
22
+ def help
23
+ puts "udpfire: Fire a UDP packet towards a host/port."
24
+ puts "usage: udpfire <ipaddress> <port> <message>"
25
+ # puts "eg. udpfire 127.0.0.1 80 \"This is a message...\""
26
+ end
27
+
28
+ # Display ARGV quantity error. Then help.
29
+ def args_error
30
+ puts "Invalid amount of parameters.\r\n"
31
+ help
32
+ end
33
+
34
+ case ARGV.first
35
+ when nil, 'help', '--help', '-h', '-help', '?'
36
+ help
37
+ exit
38
+ else
39
+ unless ARGV.count == 3
40
+ args_error
41
+ exit
42
+ end
43
+
44
+ fire_udp ARGV[0], ARGV[1], ARGV[2]
45
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: udpfire
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jon Lambert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A quick command-line tool to fire a UDP packet at a host/port.
14
+ email: hello@jonlambert.net
15
+ executables:
16
+ - udpfire
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/udpfire
21
+ homepage: http://github.com/jonlambert/udpfire
22
+ licenses: []
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Fires a UDP packet at a host/port
44
+ test_files: []