ssh_speak 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +25 -7
  3. data/bin/ssh-speak +22 -16
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3a5cfdd8a57eca284e037885a58e2588f347315e
4
- data.tar.gz: f6f2a2a94e4cf57f3fc32947e119bcdea18f05f1
2
+ SHA256:
3
+ metadata.gz: '048d9021fef3cba4d6ce69d90ee1eaa266d966aa9c5405f66a21c853ebf16759'
4
+ data.tar.gz: c9f92484d3d02eac7f052822a15ee12d2b518bbed4c5093d14f2d91e51119fea
5
5
  SHA512:
6
- metadata.gz: 9efe8fdf1b2bb7a9af6225d762f490e01cf2bd937bb71970395ec80de58eb73b1eaaff6a8e11c20ff524d9bb89672c1e3e55704a32e12b97b5a9749dbbc9f4f0
7
- data.tar.gz: 1d39e57888318b6c80c07523d88dca90f4a3b20e183eb915015a9ed0acd69b5ed26c539c951bae8eaa4c52b1d78453d1be56048d1f4f766f84f36fcbbc09f63f
6
+ metadata.gz: fd08e038a98f7733527c3320234d2caab5cb665311fc2a52f035ae82c586d448c398d12f2a3499a5e79630211e03527ea485872678de95336c1a9714cd7790fb
7
+ data.tar.gz: 1eabcedad321a5df0e914819e3759e3412af8a786a039fe030fe972a4f5035a0849d3ed5c3cc90bb73ea72b23a1ebc01a025523e1ba9557cf7381bea1327f8f9
data/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
  Talk to a peer over SSH with espeak.
3
3
 
4
4
  ## Installation
5
- First you need espeak:
6
5
 
6
+ ### Installing espeak
7
7
  On Ubuntu/Debian or apt based distros:
8
8
  ```shell
9
9
  sudo apt-get install espeak
10
10
  ```
11
- On Archlinux based distros:
11
+ On Arch based distros:
12
12
  ```shell
13
13
  sudo pacman -S espeak
14
14
  ```
@@ -17,25 +17,43 @@ On Fedora or RPM based distros, e.g.
17
17
  dnf install espeak
18
18
  ```
19
19
 
20
+ ### Installing the Gem
21
+
20
22
  Then install the application
21
23
  ```shell
22
- gem install ssh_speak
24
+ gem install ssh_speak --no-ri --no-rdoc
23
25
  ```
26
+ make sure you have the install directory in your `$PATH`, gem will warn you if you don't.
24
27
 
25
28
  ## Usage
26
29
  Basic usage:
27
30
  ```shell
28
- ssh-speak [user]@[host]:[port] [options]
31
+ ssh-speak [user]@[host]:[port] [options] [[-o] [espeak-options]]
29
32
  ```
33
+ - `[user]` is the user you want to speak to.
34
+ - `[host]` is the name of the machine you want to connect to
35
+ - `[port]` is optional, it will default to `22`. Important if the user you're connecting to's sshd does not run on port `22`.
36
+ - `[options]` include:
37
+ - `--playback` which will make the program say back to you what you wrote.
38
+ - `--wait` will make the console hang until espeak has finished talking on the other computer
39
+ - `-o [options]` this argument must always be last, every subsequent argument (option) after `-o` will be passed in to `espeak`, so you could say things like `-v finnish` to get a finnish voice; all such espeak options must come after `-o`
30
40
 
31
41
  For example, speak to user `albert` on the server `68.179.53.103` on port `369`
32
42
  ```shell
33
43
  ssh-speak albert@68.179.53.103:369
34
44
  ```
35
- and it will propmpt you for alberts password
45
+ and it will prompt you for Albert's password
36
46
 
37
- If you'd like the messages you send to be played back to you, simply add the `--playback` option, e.g.
47
+ If you'd like the messages you send to be played back to you, and you want to wait until it finishes speaking simply add the `--playback` and `--wait` options, e.g.
38
48
  ```shell
39
- ssh-speak user@host:22 --playback
49
+ ssh-speak user@host:22 --playback --wait
40
50
  ```
41
51
 
52
+ As an example for the `-o` option, say you want to sound like a drunk Finnish person. Make sure you have slowed speech (`-s 50`, measured in words-per-minute, default is 175); you're loud (`-a 200` amplitude, default is 100); you're rather low pitch (`-p 20`, pitch, default is 50); and of course, you're Finnish (`-v finnish`, voice, default is `english`):
53
+ ```shell
54
+ ssh-speak $(whoami)@localhost --wait -o -s 50 -a 200 -p 20 -v finnish
55
+ ```
56
+ and try it out (make sure you have `sshd` running for yourself here, at port 22):
57
+ ```shell
58
+ (talk)> perkele
59
+ ```
@@ -5,16 +5,15 @@ require 'readline'
5
5
  require 'io/console'
6
6
 
7
7
  abort 'Please supply ssh server argument in form of:
8
- `user@host:port` (port is optional)' if ARGV.size.zero?
8
+ `user@host:port` (port is optional, default 22)' if ARGV.size.zero?
9
9
 
10
10
  prompt = '(talk)> '
11
11
 
12
12
  user, _ = ARGV[0].split '@'
13
- location = ARGV[0].split ':'
14
- _, host = location[0].split '@'
15
- port = location[-1].to_i if location.size > 1
13
+ server = ARGV[0].split ':'
14
+ _, host = server[0].split '@'
15
+ port = server[-1].to_i if server.size > 1
16
16
  port = 22 if port.nil?
17
- playback = ARGV.include? '--playback'
18
17
 
19
18
  print 'Password: '
20
19
  pass = STDIN.noecho(&:gets).chomp
@@ -28,25 +27,32 @@ begin
28
27
  print "\rSuccessfully connected to host."
29
28
  rescue Errno::ECONNREFUSED
30
29
  print "\rCould not connect! Check username, hostname, port, etc."
30
+ server = ARGV[0].split ':'
31
+ exit 1
31
32
  end
32
33
 
34
+ playback = ARGV.include? '--playback'
35
+ wait = ARGV.include? '--wait'
36
+ options = ARGV.index('-o') ? ARGV[(ARGV.index('-o') + 1)..-1].join(' ') : ''
37
+
33
38
  puts "\r"
34
39
  what = String.new
35
- until what == "\0"
36
- trap 'SIGINT' do
37
- puts "\nUse EOF character to exit (Ctrl+D)"
38
- print prompt
39
- end
40
- what = Readline.readline prompt, true
41
- break if what.nil? || what.downcase.strip == 'exit'
42
40
 
43
- Net::SSH.start host, user, :port => port, :password => pass do |ssh|
44
- say = "espeak \"#{what}\""
41
+ Net::SSH.start host, user, :port => port, :password => pass do |ssh|
42
+ until what == "\0"
43
+ trap 'SIGINT' do
44
+ puts "\nUse EOF character to exit (Ctrl+D)"
45
+ print prompt
46
+ end
47
+
48
+ what = Readline.readline prompt, true
49
+ break if what.nil? || what.downcase.strip == 'exit'
45
50
 
51
+ say = "espeak #{options} \"#{what}\""
46
52
  %x{ #{say} >/dev/null 2>&1 & } if playback
47
- ssh.exec! say
53
+ ssh.exec! wait ? say : "sh -c 'nohup #{say} > /dev/null 2>&1 &'"
48
54
  end
49
55
  end
50
56
 
51
- puts "\rTalker disconnected and exited."
57
+ puts "\rSSH Speaker disconnected and exited."
52
58
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh_speak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demonstrandum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.6.13
63
+ rubygems_version: 2.7.4
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: Talk to peers over SSH