Module: Msf::Payload::Mainframe

Defined in:
lib/msf/core/payload/mainframe.rb

Overview

This class is here to implement advanced features for mainframe based payloads. Mainframe payloads are expected to include this module if they want to support these features.

Instance Method Summary collapse

Instance Method Details

#compatible_encodersObject

Returns a list of compatible encoders based on mainframe architecture most will not work because of the different architecture an XOR-based encoder will be defined soon



18
19
20
21
# File 'lib/msf/core/payload/mainframe.rb', line 18

def compatible_encoders
  encoders2 = ['/generic\/none/', 'none']
  encoders2
end

#initialize(info = {}) ⇒ Object



9
10
11
# File 'lib/msf/core/payload/mainframe.rb', line 9

def initialize(info = {})
  super(info)
end

#jcl_jobcardObject

This method is here to implement advanced features for cmd:jcl based payloads. Common to all are the JCL Job Card, and its options which are defined here. It is optional for other mainframe payloads.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/msf/core/payload/mainframe.rb', line 28

def jcl_jobcard
  # format paramaters with basic constraints
  # see http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/
  #     com.ibm.zos.v2r1.ieab600/iea3b6_Parameter_field8.htm
  #
  jobname = format('%1.8s', datastore['JOBNAME']).strip.upcase
  actnum  = format('%1.60s', datastore['ACTNUM']).strip.upcase
  pgmname = format('%1.20s', datastore['PGMNAME']).strip
  jclass  = format('%1.1s', datastore['JCLASS']).strip.upcase
  notify  = format('%1.8s', datastore['NOTIFY']).strip.upcase
  notify  = if !notify.empty? && datastore['NTFYUSR']
              "//   NOTIFY=#{notify}, \n"
            else
              ""
            end
  msgclass = format('%1.1s', datastore['MSGCLASS']).strip.upcase
  msglevel = format('%5.5s', datastore['MSGLEVEL']).strip

  # build payload
  "//#{jobname} JOB "            \
  "(#{actnum}),\n"               \
  "//   '#{pgmname}',\n"         \
  "//   CLASS=#{jclass},\n"      \
  "#{notify}"                    \
  "//   MSGCLASS=#{msgclass},\n" \
  "//   MSGLEVEL=#{msglevel},\n" \
  "//   REGION=0M \n"
end