Sha256: 1a0bef438156702ead5e5a6a14a87637676837923f1c7b0258746e0d6f574f75

Contents?: true

Size: 1.49 KB

Versions: 69

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'pwn'
require 'optparse'

opts = {}
OptionParser.new do |options|
  options.banner = "USAGE:
    #{File.basename($PROGRAM_NAME)} [opts]
  "

  options.on('-vNUM', '--voicemail_num=num', '<Required - Number to Voicemail Service>') do |num|
    opts[:voicemail_num] = num
  end
  options.on('-pPIN', '--voicemail_pin=PIN', '<Optional - Voicemail Pin (Prompts if Ommitted>') do |pin|
    opts[:voicemail_pin] = pin
  end
end.parse!

if opts.empty?
  puts `#{File.basename($PROGRAM_NAME)} --help`
  exit 1
end

voicemail_num = opts[:voicemail_num].to_s.scrub.strip.chomp.delete('-').delete('.').to_i

if opts[:voicemail_pin].nil?
  voicemail_pin = PWN::Plugins::AuthenticationHelper.mask_password.to_s.scrub
else
  voicemail_pin = opts[:voicemail_pin].to_s.scrub
end

serial_obj = PWN::Plugins::Serial.connect

PWN::Plugins::Serial.request(
  serial_obj: serial_obj,
  payload: "ATDT#{voicemail_num};\r\n"
)

# TODO: Loop until data received indicates call picked up instead of sleep
sleep 13

voicemail_pin.each_char do |pin_char|
  PWN::Plugins::Serial.request(
    serial_obj: serial_obj,
    payload: "AT+VTS=#{pin_char}\r\n"
  )
end

PWN::Plugins::Serial.request(
  serial_obj: serial_obj,
  payload: "AT+VTS=#\r\n"
)

PWN::Plugins::Serial.request(
  serial_obj: serial_obj,
  payload: "AT+CHUP;\r\n"
)

session_data = PWN::Plugins::Serial.dump_session_data
puts '~' * 200
puts session_data
puts '~' * 200

PWN::Plugins::Serial.disconnect(serial_obj: serial_obj)

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
pwn-0.5.236 bin/pwn_serial_check_voicemail
pwn-0.5.235 bin/pwn_serial_check_voicemail
pwn-0.5.234 bin/pwn_serial_check_voicemail
pwn-0.5.233 bin/pwn_serial_check_voicemail
pwn-0.5.232 bin/pwn_serial_check_voicemail
pwn-0.5.231 bin/pwn_serial_check_voicemail
pwn-0.5.230 bin/pwn_serial_check_voicemail
pwn-0.5.229 bin/pwn_serial_check_voicemail
pwn-0.5.228 bin/pwn_serial_check_voicemail
pwn-0.5.227 bin/pwn_serial_check_voicemail
pwn-0.5.226 bin/pwn_serial_check_voicemail
pwn-0.5.225 bin/pwn_serial_check_voicemail
pwn-0.5.224 bin/pwn_serial_check_voicemail
pwn-0.5.223 bin/pwn_serial_check_voicemail
pwn-0.5.222 bin/pwn_serial_check_voicemail
pwn-0.5.221 bin/pwn_serial_check_voicemail
pwn-0.5.220 bin/pwn_serial_check_voicemail
pwn-0.5.219 bin/pwn_serial_check_voicemail
pwn-0.5.217 bin/pwn_serial_check_voicemail
pwn-0.5.216 bin/pwn_serial_check_voicemail