pwnix-api-client 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -4
- data/Gemfile.lock +8 -10
- data/lib/pwnix-api-client/api_client.rb +10 -2
- data/lib/pwnix-api-client/shell_receiver_config.rb +17 -0
- data/lib/pwnix-api-client/system/network.rb +15 -6
- data/lib/pwnix-api-client/system/os.rb +8 -0
- data/lib/pwnix-api-client/version.rb +1 -1
- data/pwnix-api-client.gemspec +1 -2
- metadata +7 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,24 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pwnix-api-client (1.0)
|
5
|
+
httparty
|
6
|
+
json
|
7
|
+
|
1
8
|
GEM
|
2
9
|
remote: http://rubygems.org/
|
3
10
|
specs:
|
4
|
-
coderay (1.0.7)
|
5
11
|
httparty (0.9.0)
|
6
12
|
multi_json (~> 1.0)
|
7
13
|
multi_xml
|
8
14
|
json (1.7.5)
|
9
|
-
method_source (0.8)
|
10
15
|
multi_json (1.3.6)
|
11
16
|
multi_xml (0.5.1)
|
12
|
-
pry (0.9.10)
|
13
|
-
coderay (~> 1.0.5)
|
14
|
-
method_source (~> 0.8)
|
15
|
-
slop (~> 3.3.1)
|
16
|
-
slop (3.3.3)
|
17
17
|
|
18
18
|
PLATFORMS
|
19
19
|
ruby
|
20
20
|
|
21
21
|
DEPENDENCIES
|
22
|
-
|
23
|
-
json
|
24
|
-
pry
|
22
|
+
pwnix-api-client!
|
@@ -3,14 +3,18 @@ require 'httparty'
|
|
3
3
|
module Pwnix
|
4
4
|
module Api
|
5
5
|
module Client
|
6
|
-
|
7
|
-
|
6
|
+
if ENV['PWNIX_DEV']
|
7
|
+
BASE_URI = "http://localhost:9292/v1"
|
8
|
+
else
|
9
|
+
BASE_URI = "https://localhost:7967/v1"
|
10
|
+
end
|
8
11
|
end
|
9
12
|
end
|
10
13
|
end
|
11
14
|
|
12
15
|
require_relative 'system'
|
13
16
|
require_relative 'shell'
|
17
|
+
require_relative 'shell_receiver_config'
|
14
18
|
require_relative 'mode'
|
15
19
|
require_relative 'service'
|
16
20
|
|
@@ -42,11 +46,15 @@ module Pwnix
|
|
42
46
|
attr_accessor :base_uri
|
43
47
|
attr_accessor :system
|
44
48
|
attr_accessor :shells
|
49
|
+
attr_accessor :shell_receiver_config
|
45
50
|
attr_accessor :services
|
46
51
|
attr_accessor :modes
|
47
52
|
|
53
|
+
|
48
54
|
def initialize(config={})
|
49
55
|
|
56
|
+
@shell_receiver_config = ShellReceiverConfig.new
|
57
|
+
|
50
58
|
@shells = {
|
51
59
|
"dns" => Shell.new("dns"),
|
52
60
|
"gsm" => Shell.new("gsm"),
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Pwnix
|
2
|
+
module Api
|
3
|
+
module Client
|
4
|
+
class ShellReceiverConfig
|
5
|
+
include HTTParty
|
6
|
+
base_uri Pwnix::Api::Client::BASE_URI
|
7
|
+
debug_output
|
8
|
+
format :json
|
9
|
+
|
10
|
+
def generate
|
11
|
+
self.class.post("/shells/shell_receiver_config/generate", :body => {}).parsed_response['result']
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -11,12 +11,21 @@ module Pwnix
|
|
11
11
|
self.class.post("/system/network/status", :body => {}).parsed_response['result']
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
def set_static_ip(params)
|
15
|
+
# :interface
|
16
|
+
# :dns
|
17
|
+
# :netmask
|
18
|
+
# :
|
19
|
+
# :
|
20
|
+
self.class.post("/system/network/static_ip/enable", :body => {}).parsed_response['result']
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_dhcp
|
24
|
+
self.class.post("/system/network/dhcp/enable", :body => {}).parsed_response['result']
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_mac(mac=nil)
|
28
|
+
self.class.post("/system/network/mac/set", :body => { :mac => mac } ).parsed_response['result']
|
20
29
|
end
|
21
30
|
end
|
22
31
|
end
|
@@ -27,6 +27,14 @@ module Pwnix
|
|
27
27
|
self.class.post("/system/os/restart", :body => {}).parsed_response['result']
|
28
28
|
end
|
29
29
|
|
30
|
+
def hostname
|
31
|
+
self.class.post("/system/os/hostname", :body => {}).parsed_response['result']
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_hostname(hostname)
|
35
|
+
self.class.post("/system/os/hostname/set", :body => {}).parsed_response['result']
|
36
|
+
end
|
37
|
+
|
30
38
|
end
|
31
39
|
end
|
32
40
|
end
|
data/pwnix-api-client.gemspec
CHANGED
@@ -11,7 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{Pwnix API Client}
|
12
12
|
s.description = %q{ Remotely manage a Pwnix device. }
|
13
13
|
|
14
|
-
#s.rubyforge_project = "PwnixApiClient"
|
15
14
|
s.add_runtime_dependency "httparty"
|
16
15
|
s.add_runtime_dependency "json"
|
17
16
|
|
@@ -19,4 +18,4 @@ Gem::Specification.new do |s|
|
|
19
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
20
|
s.require_paths = ["lib"]
|
22
|
-
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwnix-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement: &
|
16
|
+
requirement: &8647220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *8647220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &8646800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *8646800
|
36
36
|
description: ! ' Remotely manage a Pwnix device. '
|
37
37
|
email:
|
38
38
|
- jcran@pwnieexpress.com
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/pwnix-api-client/mode.rb
|
53
53
|
- lib/pwnix-api-client/service.rb
|
54
54
|
- lib/pwnix-api-client/shell.rb
|
55
|
+
- lib/pwnix-api-client/shell_receiver_config.rb
|
55
56
|
- lib/pwnix-api-client/spec/pwnix-api-client-spec.rb
|
56
57
|
- lib/pwnix-api-client/system.rb
|
57
58
|
- lib/pwnix-api-client/system/hardware.rb
|