Class: Msf::Payload::MalleableC2::Lexer

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/payload/malleable_c2.rb

Constant Summary collapse

BLOCK_KEYWORDS =
%w[
  client
  http-get
  http-post
  http-stager
  https-certificate
  id
  metadata
  output
  server
  stage
  transform-x64
  transform-x86
]
OTHER_KEYWORDS =
%w[
  add
  append
  base64
  base64url
  dns
  encode_hex
  header
  hostport
  mask
  netbios
  netbiosu
  parameter
  prepend
  print
  remove
  set
  string
  stringw
  strrep
  transform
  unset
  uri
  uri-append
  uri-query
  xor
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Lexer

Returns a new instance of Lexer.



99
100
101
102
# File 'lib/msf/core/payload/malleable_c2.rb', line 99

def initialize(file)
  @tokens = []
  tokenize(File.binread(file))
end

Instance Attribute Details

#tokensObject (readonly)

Returns the value of attribute tokens.



54
55
56
# File 'lib/msf/core/payload/malleable_c2.rb', line 54

def tokens
  @tokens
end

Instance Method Details

#is_block_keyword?(word) ⇒ Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/msf/core/payload/malleable_c2.rb', line 104

def is_block_keyword?(word)
  BLOCK_KEYWORDS.include?(word)
end