Sha256: 67784c9c19a285bd436e48eb35328bc1b8be2ffbc0cef5b578bdf0491a473d2c

Contents?: true

Size: 1.36 KB

Versions: 85

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module PWN
  module Plugins
    # This plugin is used for interacting with an RFIDler using the
    # the screen command as a terminal emulator.
    module RFIDler
      # Supported Method Parameters::
      # PWN::Plugins::RFIDler.connect_via_screen(
      #   block_dev: 'optional - serial block device path (defaults to /dev/ttyUSB0)'
      # )

      public_class_method def self.connect_via_screen(opts = {})
        block_dev = opts[:block_dev].to_s if File.exist?(
          opts[:block_dev].to_s
        )

        block_dev = '/dev/ttyUSB0' if opts[:block_dev].nil?
        screen_bin = '/usr/bin/screen'

        raise "ERROR: #{screen_bin} not found." unless File.exist?(screen_bin)

        system(
          screen_bin,
          block_dev,
          '9600',
          '8',
          'N',
          '1'
        )
      rescue StandardError => e
        raise e
      end

      # Author(s):: 0day Inc. <support@0dayinc.com>

      public_class_method def self.authors
        "AUTHOR(S):
          0day Inc. <support@0dayinc.com>
        "
      end

      # Display Usage for this Module

      public_class_method def self.help
        puts "USAGE:
          #{self}.connect_via_screen(
            block_dev: 'optional serial block device path (defaults to /dev/ttyUSB0)'
          )

          #{self}.authors
        "
      end
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
pwn-0.5.235 lib/pwn/plugins/rfidler.rb
pwn-0.5.234 lib/pwn/plugins/rfidler.rb
pwn-0.5.233 lib/pwn/plugins/rfidler.rb
pwn-0.5.232 lib/pwn/plugins/rfidler.rb
pwn-0.5.231 lib/pwn/plugins/rfidler.rb
pwn-0.5.230 lib/pwn/plugins/rfidler.rb
pwn-0.5.229 lib/pwn/plugins/rfidler.rb
pwn-0.5.228 lib/pwn/plugins/rfidler.rb
pwn-0.5.227 lib/pwn/plugins/rfidler.rb
pwn-0.5.226 lib/pwn/plugins/rfidler.rb
pwn-0.5.225 lib/pwn/plugins/rfidler.rb
pwn-0.5.224 lib/pwn/plugins/rfidler.rb
pwn-0.5.223 lib/pwn/plugins/rfidler.rb
pwn-0.5.222 lib/pwn/plugins/rfidler.rb
pwn-0.5.221 lib/pwn/plugins/rfidler.rb
pwn-0.5.220 lib/pwn/plugins/rfidler.rb
pwn-0.5.219 lib/pwn/plugins/rfidler.rb
pwn-0.5.217 lib/pwn/plugins/rfidler.rb
pwn-0.5.216 lib/pwn/plugins/rfidler.rb
pwn-0.5.215 lib/pwn/plugins/rfidler.rb