Sha256: 3cae85fe743a411bcea88a0797f6d61c1a64afe563d182200f8173610c31f4c0

Contents?: true

Size: 626 Bytes

Versions: 4

Compression:

Stored size: 626 Bytes

Contents

# -*- coding: binary -*-

##
# ADB protocol support
##

require 'rex/proto/adb/message'

module Rex
module Proto
module ADB

class Client

  def initialize(sock, opts = {})
    @sock = sock
    @opts = opts
    @local_id_counter = 0x0a
  end

  def connect
    ADB::Message::Connect.new.send_recv(@sock)
  end

  def exec_cmd(cmd)
    local_id = @local_id_counter += 1
    response = ADB::Message::Open.new(local_id, "shell:"+cmd).send_recv(@sock)
    ADB::Message::Close.new(local_id, response.arg0).send_recv(@sock)
  end

  def read_message
    ADB::Message.read(@sock)
  end

end # Client

end # ADB
end # Proto
end # Rex

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rex-2.0.13 lib/rex/proto/adb/client.rb
rex-2.0.12 lib/rex/proto/adb/client.rb
rex-2.0.11 lib/rex/proto/adb/client.rb
rex-2.0.10 lib/rex/proto/adb/client.rb