synack 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/bin/synack +14 -11
- data/lib/synack/server.rb +1 -1
- data/synack.gemspec +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -13,11 +13,11 @@ To start synack:
|
|
13
13
|
|
14
14
|
To send a message to your local Notification Center:
|
15
15
|
|
16
|
-
synack
|
16
|
+
synack "Watson, come here, I need you."
|
17
17
|
|
18
18
|
You can send messages to remote machines by specifying a host and port in the client:
|
19
19
|
|
20
|
-
synack -h my_remote_machine -
|
20
|
+
synack -h my_remote_machine -p 1013 "I'm here, what did you want?"
|
21
21
|
|
22
22
|
You can even use UNIX pipes to send messages (first line of input only, for now):
|
23
23
|
|
data/README.rdoc
CHANGED
@@ -12,11 +12,11 @@ To start synack:
|
|
12
12
|
|
13
13
|
To send a message to your local Notification Center:
|
14
14
|
|
15
|
-
synack
|
15
|
+
synack "Watson, come here, I need you."
|
16
16
|
|
17
17
|
You can send messages to remote machines by specifying a host and port in the client:
|
18
18
|
|
19
|
-
synack -h my_remote_machine -p 11113
|
19
|
+
synack -h my_remote_machine -p 11113 "I'm here, what did you want?"
|
20
20
|
|
21
21
|
You can even use UNIX pipes to send messages (first line of input only, for now):
|
22
22
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/bin/synack
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby -wKU
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'optparse'
|
4
4
|
require 'synack'
|
5
5
|
|
6
|
-
|
7
|
-
["--message", "-m", Getopt::REQUIRED],
|
8
|
-
["--server", "-s", Getopt::OPTIONAL],
|
9
|
-
["--host", "-h", Getopt::OPTIONAL],
|
10
|
-
["--port", "-p", Getopt::OPTIONAL]
|
11
|
-
)
|
6
|
+
config = {}
|
12
7
|
|
13
|
-
|
14
|
-
|
8
|
+
options = OptionParser.new do |opt|
|
9
|
+
opt.on('-s') { config[:server] = true }
|
10
|
+
opt.on('-h HOST') { |host| config[:host] = host }
|
11
|
+
opt.on('-p PORT') { |port| config[:port] = port }
|
12
|
+
end
|
13
|
+
|
14
|
+
options.parse!
|
15
|
+
|
16
|
+
@host = config[:host] || 'localhost'
|
17
|
+
@port = config[:port] || 11113
|
15
18
|
|
16
|
-
if
|
19
|
+
if config[:server]
|
17
20
|
Synack::Server.start(
|
18
21
|
host: @host,
|
19
22
|
port: @port
|
@@ -25,7 +28,7 @@ else
|
|
25
28
|
port: @port
|
26
29
|
)
|
27
30
|
|
28
|
-
_input =
|
31
|
+
_input = ARGV[0] ? ARGV[0] : STDIN.read
|
29
32
|
client.say _input
|
30
33
|
rescue DRb::DRbConnError => e
|
31
34
|
puts "Some kind of connection error occurred: #{e}"
|
data/lib/synack/server.rb
CHANGED
@@ -31,7 +31,7 @@ module Synack
|
|
31
31
|
# Instance methods =============================================================================
|
32
32
|
|
33
33
|
def sanitize(message)
|
34
|
-
message.
|
34
|
+
message && message.gsub(/[^0-9A-z\.\-\'\, ]/, '_')
|
35
35
|
end
|
36
36
|
|
37
37
|
def say(message)
|
data/synack.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
segments:
|
169
169
|
- 0
|
170
|
-
hash:
|
170
|
+
hash: -2608069044233777158
|
171
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
172
|
none: false
|
173
173
|
requirements:
|