ssh_speak 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +25 -0
  3. data/README.md +41 -0
  4. data/bin/ssh-speak +52 -0
  5. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 15a6d3c2823a645b15685d63c4a5f1e3645c5ab7
4
+ data.tar.gz: 809745021d2723fd16d835dabb8461bacb51fa23
5
+ SHA512:
6
+ metadata.gz: 240cee293ed17952aa4e8784d69635cda8c17112cf2f875018ddddc3100065f3a770c367d643ca5f9957f1b08db5c01dd005d9f75d2d212d62fe5ee164ae79e0
7
+ data.tar.gz: 1d29ef25f461952b70d9aa6bd244addc213ae29417ba39cb9730b7c5afd2c6ef5e7eee21c453f0708fa3c63fd4d1f824aead4eeaa82a5ec7b2af5263016f5fe4
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2017, Sam
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # SSH Speak
2
+ Talk to a peer over SSH with espeak.
3
+
4
+ ## Installation
5
+ First you need espeak:
6
+
7
+ On Ubuntu/Debian or apt based distros:
8
+ ```shell
9
+ sudo apt-get install espeak
10
+ ```
11
+ On Archlinux based distros:
12
+ ```shell
13
+ sudo pacman -S espeak
14
+ ```
15
+ On Fedora or RPM based distros, e.g.
16
+ ```shell
17
+ dnf install espeak
18
+ ```
19
+
20
+ Then install the application
21
+ ```shell
22
+ gem install ssh_speak
23
+ ```
24
+
25
+ ## Usage
26
+ Basic usage:
27
+ ```shell
28
+ ssh-speak [user]@[host]:[port] [options]
29
+ ```
30
+
31
+ For example, speak to user `albert` on the server `68.179.53.103` on port `369`
32
+ ```shell
33
+ ssh-speak albert@68.179.53.103:369
34
+ ```
35
+ and it will propmpt you for alberts password
36
+
37
+ If you'd like the messages you send to be played back to you, simply add the `--playback` option, e.g.
38
+ ```shell
39
+ ssh-speak user@host:22 --playback
40
+ ```
41
+
data/bin/ssh-speak ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'net/ssh'
4
+ require 'readline'
5
+ require 'io/console'
6
+
7
+ abort 'Please supply ssh server argument in form of:
8
+ `user@host:port` (port is optional)' if ARGV.size.zero?
9
+
10
+ prompt = '(talk)> '
11
+
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
16
+ port = 22 if port.nil?
17
+ playback = ARGV.include? '--playback'
18
+
19
+ print 'Password: '
20
+ pass = STDIN.noecho(&:gets).chomp
21
+ print "\rAttempting to connect..."
22
+ begin
23
+ Net::SSH.start(
24
+ host, user,
25
+ :port => port,
26
+ :password => pass
27
+ ) { |ssh| ssh.exec! '' }
28
+ print "\rSuccessfully connected to host."
29
+ rescue Errno::ECONNREFUSED
30
+ print "\rCould not connect! Check username, hostname, port, etc."
31
+ end
32
+
33
+ puts "\r"
34
+ 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
+
43
+ Net::SSH.start host, user, :port => port, :password => pass do |ssh|
44
+ say = "espeak \"#{what}\""
45
+
46
+ %x{ #{say} >/dev/null 2>&1 & } if playback
47
+ ssh.exec! say
48
+ end
49
+ end
50
+
51
+ puts "\rTalker disconnected and exited."
52
+
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ssh_speak
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Demonstrandum
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Talk to your friend with espeak
14
+ email: knutsen@jetspace.co
15
+ executables:
16
+ - ssh-speak
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE
21
+ - README.md
22
+ - bin/ssh-speak
23
+ homepage: https://github.com/Demonstrandum/ssh_speak
24
+ licenses:
25
+ - BSD-2-Clause
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.0.0
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.6.13
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Talk to peers over SSH
47
+ test_files: []