influence 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +7 -0
- data/bin/influence +1 -1
- data/db/migrations/001_create_messages.rb +21 -21
- data/influence.gem +2 -1
- data/lib/influence/dsl.rb +74 -0
- data/lib/influence/processor.rb +3 -5
- metadata +26 -31
data/.gitignore
ADDED
data/Gemfile
ADDED
data/bin/influence
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
Sequel.migration do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
|
1
|
+
# Sequel.migration do
|
2
|
+
# up do
|
3
|
+
# create_table(:messages) do
|
4
|
+
# primary_key :id
|
5
|
+
#
|
6
|
+
# Text :content
|
7
|
+
# String :influencer_ip
|
8
|
+
# DateTime :received_at
|
9
|
+
# DateTime :responded_at
|
10
|
+
# Integer :result_code existstatus
|
11
|
+
# Text :log
|
12
|
+
#
|
13
|
+
# DateTime :created_at
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# down do
|
18
|
+
# drop_table(:messages)
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
#
|
data/influence.gem
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
$DEBUG=true
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "influence"
|
4
|
-
s.version = "0.0.
|
4
|
+
s.version = "0.0.1"
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.authors = ["Jim Freeze"]
|
7
7
|
s.email = ["jimfreeze@gmail.com"]
|
8
|
+
s.homepage = "https://github.com/jfreeze/Influence"
|
8
9
|
s.summary = "Remote deployment server"
|
9
10
|
s.description = "Simple Client and Server app to setup and control remote machines. Uses TCP sockets for comm and Sqlite3 for logging. Currently for intranet use due to minimum security features."
|
10
11
|
s.rubyforge_project = s.name
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Influencer
|
2
|
+
class DSL
|
3
|
+
def initialize
|
4
|
+
@current_message
|
5
|
+
end
|
6
|
+
|
7
|
+
def message
|
8
|
+
@current_message = ??
|
9
|
+
@shell_command = ""
|
10
|
+
yield
|
11
|
+
convert_to_json
|
12
|
+
send
|
13
|
+
end
|
14
|
+
|
15
|
+
def shell_command(cmd)
|
16
|
+
@shell_command = cmd
|
17
|
+
end
|
18
|
+
|
19
|
+
def variables(vars)
|
20
|
+
@variables = vars
|
21
|
+
end
|
22
|
+
|
23
|
+
def response
|
24
|
+
@current_response
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def convert_to_json
|
30
|
+
process_message
|
31
|
+
@message = { :shell_command => @command }.to_json
|
32
|
+
end
|
33
|
+
|
34
|
+
def process_message
|
35
|
+
praocess_variables
|
36
|
+
@message = [@json_variables, @shell_command].join('; ')
|
37
|
+
end
|
38
|
+
|
39
|
+
def praocess_variables
|
40
|
+
vars = []
|
41
|
+
@variables.each do |name, val|
|
42
|
+
vars = "export #{name}='#{val}'"
|
43
|
+
end
|
44
|
+
@json_variables = vars.join('; ')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
module Influencer::DSL
|
50
|
+
message do
|
51
|
+
shell_command 'cat $SSHKEY >> /root/.ssh/authorized_k'
|
52
|
+
variables(:SSHKEY => 'ssh-dss AAAAB3NzaC1kc3MAAAEBAOWvk9TabSXZlyL8Um1PSrcuvttG9VV5RkJ8dUpuvP4X7kSqbZFw590IU+ZwJrV3SVy1BFW9sZgJK2qKwtQUBOMA6Ivckg3gWrwiX82f4jnnKBMlzJJ+ullla4+9WBP2rw7wP7bH+0fh2a6TUqOOOLM0BgRrOoHHiUT/gmJgWSfRWc/xfjIl2VMm+MmqF21mU+eka1efE9uMh2md0O2iVIYMP4ulbxK4IW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+
}
|
61
|
+
|
62
|
+
message do
|
63
|
+
shell_command 'cat /root/.ssh/id_dsa.pub'
|
64
|
+
end
|
65
|
+
`cat #{response.shell_command} >> /root/.ssh/known_hosts`
|
66
|
+
|
67
|
+
{ 'shell_command' : 'cat /root/.ssh/id_dsa.pub' }
|
68
|
+
# response
|
69
|
+
{ 'output' :
|
70
|
+
'result_code' :
|
71
|
+
'received_at' :
|
72
|
+
'responded_at' :
|
73
|
+
}
|
74
|
+
Text :log
|
data/lib/influence/processor.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
-
require 'message'
|
2
|
+
#require 'message'
|
3
3
|
|
4
4
|
module Influence
|
5
5
|
class Processor
|
@@ -14,13 +14,11 @@ module Influence
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
#
|
18
17
|
# run_command => command
|
19
18
|
# run_remote_command => url
|
20
|
-
|
21
|
-
#
|
19
|
+
|
22
20
|
def process
|
23
|
-
@message[:]
|
21
|
+
# @message[:x]
|
24
22
|
end
|
25
23
|
|
26
24
|
def respond
|
metadata
CHANGED
@@ -1,30 +1,29 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: influence
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Jim Freeze
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-09-11 00:00:00 -05:00
|
14
|
-
default_executable:
|
12
|
+
date: 2011-09-12 00:00:00.000000000Z
|
15
13
|
dependencies: []
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
description: Simple Client and Server app to setup and control remote machines. Uses
|
15
|
+
TCP sockets for comm and Sqlite3 for logging. Currently for intranet use due to
|
16
|
+
minimum security features.
|
17
|
+
email:
|
19
18
|
- jimfreeze@gmail.com
|
20
|
-
executables:
|
19
|
+
executables:
|
21
20
|
- influence
|
22
21
|
- influencer
|
23
22
|
extensions: []
|
24
|
-
|
25
23
|
extra_rdoc_files: []
|
26
|
-
|
27
|
-
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- Gemfile
|
28
27
|
- README.rdoc
|
29
28
|
- Rakefile
|
30
29
|
- bin/influence
|
@@ -32,37 +31,33 @@ files:
|
|
32
31
|
- db/migrations/001_create_messages.rb
|
33
32
|
- influence.gem
|
34
33
|
- lib/influence.rb
|
34
|
+
- lib/influence/dsl.rb
|
35
35
|
- lib/influence/processor.rb
|
36
36
|
- lib/influence/server.rb
|
37
37
|
- models/message.rb
|
38
38
|
- tmp/server.rb
|
39
|
-
|
40
|
-
homepage:
|
39
|
+
homepage: https://github.com/jfreeze/Influence
|
41
40
|
licenses: []
|
42
|
-
|
43
41
|
post_install_message:
|
44
42
|
rdoc_options: []
|
45
|
-
|
46
|
-
require_paths:
|
43
|
+
require_paths:
|
47
44
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
46
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
52
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
59
56
|
version: 1.3.6
|
60
57
|
requirements: []
|
61
|
-
|
62
58
|
rubyforge_project: influence
|
63
|
-
rubygems_version: 1.6
|
59
|
+
rubygems_version: 1.8.6
|
64
60
|
signing_key:
|
65
61
|
specification_version: 3
|
66
62
|
summary: Remote deployment server
|
67
63
|
test_files: []
|
68
|
-
|