Module: Msf::Post::Hardware::RFTransceiver::RFTransceiver
- Defined in:
- lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
Instance Method Summary collapse
-
#enable_crc ⇒ Boolean
Enable packet CRC.
-
#enable_manchester ⇒ Boolean
Enable Manchester encoding.
-
#get_modulations ⇒ Array
Gets supported modulations.
-
#get_supported_indexes ⇒ Array
Returns a list of supported USB indexes by relay.
-
#is_rf? ⇒ Boolean
Checks to see if this module is a RF Transceiver module.
-
#max_power ⇒ Boolean
Sets the power to max.
-
#return_success(r) ⇒ Boolean
Validates success of a function call.
-
#rfrecv(timeout = -1,, blocksize = -1)) ⇒ String
Receive a packet.
-
#rfxmit(data, repeat = -1,, offset = -1)) ⇒ Boolean
Transmits a RF Packet.
-
#set_baud(baud, mhz = -1)) ⇒ Boolean
Sets the baud rate.
-
#set_channel(channel) ⇒ Boolean
Sets the channel.
-
#set_channel_bw(bandwidth, mhz = -1)) ⇒ Boolean
Sets the channel bandwidth.
-
#set_channel_spc(chanspc = -1,, chanspc_m = -1,, chanspc_e = -1,, mhz = -1)) ⇒ Boolean
Calculates the appropriate exponent and mantissa and updates the correct registers chanspc is in kHz.
-
#set_deviation(deviat, mhz = -1)) ⇒ Boolean
Sets the deviation.
-
#set_flen(len) ⇒ Boolean
Sets packet’s fixed length.
-
#set_freq(freq, mhz = -1)) ⇒ Boolean
Sets the frequency.
-
#set_index(idx) ⇒ Object
Sets the target USB index.
-
#set_lowball ⇒ Boolean
Sets lowball.
-
#set_mode(mode) ⇒ Boolean
Sets the mode TX, RX or Idle.
-
#set_modulation(mod) ⇒ Boolean
Sets the modulation.
-
#set_power(level) ⇒ Boolean
Set power level.
-
#set_preamble(bits) ⇒ Boolean
Sets the number of preamble bits.
-
#set_sync_mode(mode) ⇒ Boolean
Sets the sync mode.
-
#set_sync_word(word) ⇒ Boolean
Sets sync word.
-
#set_vlen(len) ⇒ Boolean
Sets packet’s variable length.
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
9 10 11 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 9 def index @index end |
Instance Method Details
#enable_crc ⇒ Boolean
Enable packet CRC
145 146 147 148 149 150 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 145 def enable_crc return false unless is_rf? self.index ||= 0 r = client.rftransceiver.enable_packet_crc(self.index) return_success(r) end |
#enable_manchester ⇒ Boolean
Enable Manchester encoding
155 156 157 158 159 160 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 155 def enable_manchester return false unless is_rf? self.index ||= 0 r = client.rftransceiver.enable_manchester(self.index) return_success(r) end |
#get_modulations ⇒ Array
Gets supported modulations
73 74 75 76 77 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 73 def get_modulations return [] unless is_rf? self.index ||= 0 return client.rftransceiver.get_supported_modulations(self.index) end |
#get_supported_indexes ⇒ Array
Returns a list of supported USB indexes by relay
30 31 32 33 34 35 36 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 30 def get_supported_indexes return [] unless is_rf? r = client.rftransceiver.supported_idx return r['indexes'] if r.has_key?('indexes') print_error("Invalid response from relay") return [] end |
#is_rf? ⇒ Boolean
Checks to see if this module is a RF Transceiver module
22 23 24 25 26 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 22 def is_rf? return true if client.rftransceiver print_error("Not an RFTransceiver module") return false end |
#max_power ⇒ Boolean
Sets the power to max. Ensure you set the frequency first before using this
274 275 276 277 278 279 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 274 def max_power return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_maxpower(self.index) return_success(r) end |
#return_success(r) ⇒ Boolean
Validates success of a function call
14 15 16 17 18 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 14 def return_success(r) return false unless r return false unless r.has_key?('success') return r['success'] end |
#rfrecv(timeout = -1,, blocksize = -1)) ⇒ String
Receive a packet
133 134 135 136 137 138 139 140 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 133 def rfrecv(timeout = -1, blocksize = -1) return '' unless is_rf? self.index ||= 0 opts = {} opts['timeout'] = timeout unless timeout == -1 opts['blocksize'] = blocksize unless blocksize == -1 client.rftransceiver.rfrecv(self.index, opts) end |
#rfxmit(data, repeat = -1,, offset = -1)) ⇒ Boolean
Transmits a RF Packet. All data is base64 encoded before transmission to relay
118 119 120 121 122 123 124 125 126 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 118 def rfxmit(data, repeat=-1, offset=-1) return false unless is_rf? self.index ||= 0 opts = {} opts['repeat'] = repeat unless repeat == -1 opts['offset'] = offset unless offset == -1 r = client.rftransceiver.rfxmit(self.index, data, opts) return_success(r) end |
#set_baud(baud, mhz = -1)) ⇒ Boolean
Sets the baud rate
215 216 217 218 219 220 221 222 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 215 def set_baud(baud, mhz=-1) return false unless is_rf? self.index ||= 0 opts = {} opts['mhz'] = mhz unless mhz == -1 r = client.rftransceiver.set_baud_rate(self.index, baud, opts) return_success(r) end |
#set_channel(channel) ⇒ Boolean
Sets the channel
166 167 168 169 170 171 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 166 def set_channel(channel) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_channel(self.index, channel) return_success(r) end |
#set_channel_bw(bandwidth, mhz = -1)) ⇒ Boolean
Sets the channel bandwidth
178 179 180 181 182 183 184 185 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 178 def set_channel_bw(bandwidth, mhz=-1) return false unless is_rf? self.index ||= 0 opts = {} opts['mhz'] = mhz unless mhz == -1 r = client.rftransceiver.set_channel_bandwidth(self.index, bandwidth, opts) return_success(r) end |
#set_channel_spc(chanspc = -1,, chanspc_m = -1,, chanspc_e = -1,, mhz = -1)) ⇒ Boolean
Calculates the appropriate exponent and mantissa and updates the correct registers chanspc is in kHz. if you prefer, you may set the chanspc_m and chanspc_e settings directly. only use one or the other:
* chanspc
* chanspc_m and chanspc_e
198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 198 def set_channel_spc(chanspc = -1, chanspc_m = -1, chanspc_e = -1, mhz=-1) return false unless is_rf? self.index ||= 0 opts = {} opts['chanspc'] = chanspc unless chanspc == -1 opts['chanspc_m'] = chanspc_m unless chanspc_m == -1 opts['chanspc_e'] = chanspc_e unless chanspc_e == -1 opts['mhz'] = mhz unless mhz == -1 r = client.rftransceiver.set_channel_spc(self.index, opts) return_success(r) end |
#set_deviation(deviat, mhz = -1)) ⇒ Boolean
Sets the deviation
229 230 231 232 233 234 235 236 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 229 def set_deviation(deviat, mhz=-1) return false unless is_rf? self.index ||= 0 opts = {} opts['mhz'] = mhz unless mhz == -1 r = client.rftransceiver.set_deviation(self.index, deviat, opts) return_success(r) end |
#set_flen(len) ⇒ Boolean
Sets packet’s fixed length
94 95 96 97 98 99 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 94 def set_flen(len) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.make_pkt_flen(self.index, len) return_success(r) end |
#set_freq(freq, mhz = -1)) ⇒ Boolean
Sets the frequency
50 51 52 53 54 55 56 57 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 50 def set_freq(freq, mhz=-1) return false unless is_rf? self.index ||= 0 opts = {} opts['mhz'] = mhz unless mhz == -1 r = client.rftransceiver.set_freq(self.index, freq, opts) return_success(r) end |
#set_index(idx) ⇒ Object
Sets the target USB index
41 42 43 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 41 def set_index(idx) self.index = idx end |
#set_lowball ⇒ Boolean
Sets lowball. Ensure you set the frequency first before using this
284 285 286 287 288 289 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 284 def set_lowball return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_lowball(self.index) return_success(r) end |
#set_mode(mode) ⇒ Boolean
Sets the mode TX, RX or Idle
63 64 65 66 67 68 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 63 def set_mode(mode) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_mode(self.index, mode) return_success(r) end |
#set_modulation(mod) ⇒ Boolean
Sets the modulation
83 84 85 86 87 88 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 83 def set_modulation(mod) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_modulation(self.index, mod) return_success(r) end |
#set_power(level) ⇒ Boolean
Set power level
295 296 297 298 299 300 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 295 def set_power(level) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_power(self.index, level) return_success(r) end |
#set_preamble(bits) ⇒ Boolean
Sets the number of preamble bits
264 265 266 267 268 269 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 264 def set_preamble(bits) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_number_preamble(self.index, bits) return_success(r) end |
#set_sync_mode(mode) ⇒ Boolean
Sets the sync mode
253 254 255 256 257 258 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 253 def set_sync_mode(mode) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_sync_mode(self.index, mode) return_success(r) end |
#set_sync_word(word) ⇒ Boolean
Sets sync word
242 243 244 245 246 247 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 242 def set_sync_word(word) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.set_sync_word(self.index, word) return_success(r) end |
#set_vlen(len) ⇒ Boolean
Sets packet’s variable length
105 106 107 108 109 110 |
# File 'lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb', line 105 def set_vlen(len) return false unless is_rf? self.index ||= 0 r = client.rftransceiver.make_pkt_vlen(self.index, len) return_success(r) end |