Class: Pwnix::Api::Client::ApiClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty, HTTPartyTime
Defined in:
lib/pwnix-api-client/api_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HTTPartyTime

#clear_errors, #errors, #has_errors?, included, #last_error, #safe_api_call

Constructor Details

#initialize(config = {}) ⇒ ApiClient

Returns a new instance of ApiClient.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/pwnix-api-client/api_client.rb', line 149

def initialize(config={})
  @shell_receiver_config = ShellReceiverConfig.new

  @shells = {
    "dns" => Shell.new("dns"),
    "gsm" => Shell.new("gsm"),
    "http" => Shell.new("http"),
    "icmp" => Shell.new("icmp"),
    "ssl" => Shell.new("ssl"),
    "tcp" => Shell.new("tcp"),
    "egress_buster" => Shell.new("egress_buster")
  }

  @modes = {
    "normal_mode" => Mode.new("normal_mode")
  }

  @node = Node.new

  @system = System.new
  
  @services = { 
    "evil_ap" => Service.new("evil_ap"), 
    "msfrpcd" => Service.new("msfrpcd"),
    "nac_bypass" => Service.new("nac_bypass"),
    "passive_recon" => Service.new("passive_recon"),
    "sshd" => Service.new("sshd"),
    "stealth" => Service.new("stealth"),
    "text_to_bash" => Service.new("text_to_bash")
  }
end

Instance Attribute Details

#base_uriObject

Returns the value of attribute base_uri.



137
138
139
# File 'lib/pwnix-api-client/api_client.rb', line 137

def base_uri
  @base_uri
end

#error_stringObject

Returns the value of attribute error_string.



144
145
146
# File 'lib/pwnix-api-client/api_client.rb', line 144

def error_string
  @error_string
end

#modesObject

Returns the value of attribute modes.



142
143
144
# File 'lib/pwnix-api-client/api_client.rb', line 142

def modes
  @modes
end

#nodeObject

Returns the value of attribute node.



143
144
145
# File 'lib/pwnix-api-client/api_client.rb', line 143

def node
  @node
end

#servicesObject

Returns the value of attribute services.



141
142
143
# File 'lib/pwnix-api-client/api_client.rb', line 141

def services
  @services
end

#shell_receiver_configObject

Returns the value of attribute shell_receiver_config.



140
141
142
# File 'lib/pwnix-api-client/api_client.rb', line 140

def shell_receiver_config
  @shell_receiver_config
end

#shellsObject

Returns the value of attribute shells.



139
140
141
# File 'lib/pwnix-api-client/api_client.rb', line 139

def shells
  @shells
end

#systemObject

Returns the value of attribute system.



138
139
140
# File 'lib/pwnix-api-client/api_client.rb', line 138

def system
  @system
end

Instance Method Details

#connected?Boolean

Returns:

  • (Boolean)


181
182
183
# File 'lib/pwnix-api-client/api_client.rb', line 181

def connected?
   safe_api_call("/node/connected") == "ok"
end