CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/base/sessions/custom.rb
Views: 1904
1
# -*- coding: binary -*-
2
3
module Msf
4
module Sessions
5
6
###
7
#
8
# This class provides the ability to receive a custom stage callback
9
#
10
###
11
class Custom
12
13
#
14
# This interface supports basic interaction.
15
#
16
include Msf::Session
17
include Msf::Session::Basic
18
19
attr_accessor :arch
20
attr_accessor :platform
21
22
#
23
# Returns the type of session.
24
#
25
def self.type
26
"custom"
27
end
28
29
def initialize(rstream, opts = {})
30
super
31
self.platform ||= ""
32
self.arch ||= ""
33
datastore = opts[:datastore]
34
end
35
36
def self.create_session(rstream, opts = {})
37
Msf::Sessions::Custom.new(rstream, opts)
38
end
39
40
def process_autoruns(datastore)
41
cleanup
42
end
43
44
def cleanup
45
print_good("Custom stage sent; session has been closed")
46
if rstream
47
# this is also a best-effort
48
rstream.close rescue nil
49
rstream = nil
50
end
51
end
52
53
#
54
# Returns the session description.
55
#
56
def desc
57
"Custom"
58
end
59
60
def self.can_cleanup_files
61
false
62
end
63
64
#
65
# Calls the class method
66
#
67
def type
68
self.class.type
69
end
70
end
71
end
72
end
73
74