Sha256: d12b4d184318a0643d1e913336e5d6ce7ec1a797308dacb343314c116d6d5ae5

Contents?: true

Size: 1.63 KB

Versions: 145

Compression:

Stored size: 1.63 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(
      #   screen_bin: 'optional - defaults to /usr/bin/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?

        if opts[:screen_bin].nil?
          screen_bin = '/usr/bin/screen'
        else
          screen_bin = opts[:screen_bin].to_s.strip.chomp.scrub
        end

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

        screen_params = "#{block_dev} 9600 8 N 1"
        screen_cmd = "#{screen_bin} #{screen_params}"
        system(screen_cmd)
      rescue StandardError => e
        raise e
      end

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

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

      # Display Usage for this Module

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

          #{self}.authors
        "
      end
    end
  end
end

Version data entries

145 entries across 145 versions & 1 rubygems

Version Path
pwn-0.4.502 lib/pwn/plugins/rfidler.rb
pwn-0.4.501 lib/pwn/plugins/rfidler.rb
pwn-0.4.500 lib/pwn/plugins/rfidler.rb
pwn-0.4.499 lib/pwn/plugins/rfidler.rb
pwn-0.4.498 lib/pwn/plugins/rfidler.rb
pwn-0.4.497 lib/pwn/plugins/rfidler.rb
pwn-0.4.496 lib/pwn/plugins/rfidler.rb
pwn-0.4.495 lib/pwn/plugins/rfidler.rb
pwn-0.4.494 lib/pwn/plugins/rfidler.rb
pwn-0.4.493 lib/pwn/plugins/rfidler.rb
pwn-0.4.492 lib/pwn/plugins/rfidler.rb
pwn-0.4.491 lib/pwn/plugins/rfidler.rb
pwn-0.4.490 lib/pwn/plugins/rfidler.rb
pwn-0.4.489 lib/pwn/plugins/rfidler.rb
pwn-0.4.488 lib/pwn/plugins/rfidler.rb
pwn-0.4.487 lib/pwn/plugins/rfidler.rb
pwn-0.4.486 lib/pwn/plugins/rfidler.rb
pwn-0.4.485 lib/pwn/plugins/rfidler.rb
pwn-0.4.484 lib/pwn/plugins/rfidler.rb
pwn-0.4.483 lib/pwn/plugins/rfidler.rb