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/rex/post/meterpreter/extensions/unhook/unhook.rb
Views: 1904
1
# -*- coding: binary -*-
2
3
require 'rex/post/meterpreter/extensions/unhook/tlv'
4
require 'rex/post/meterpreter/extensions/unhook/command_ids'
5
6
module Rex
7
module Post
8
module Meterpreter
9
module Extensions
10
module Unhook
11
12
###
13
#
14
# This meterpreter extension can be used to unhook PSP products
15
#
16
###
17
#
18
class Unhook < Extension
19
UNHOOK_ERROR_SUCCESS = 0
20
21
def self.extension_id
22
EXTENSION_ID_UNHOOK
23
end
24
25
def initialize(client)
26
super(client, 'unhook')
27
28
client.register_extension_aliases(
29
[
30
{
31
'name' => 'unhook',
32
'ext' => self
33
},
34
])
35
end
36
37
def unhook_pe
38
request = Packet.create_request(COMMAND_ID_UNHOOK_PE)
39
response = client.send_request(request)
40
response_code = response.get_tlv_value(TLV_TYPE_UNHOOK_ERROR_CODE)
41
42
raise Exception, 'Did not get ERROR_SUCCESS back!' if response_code != UNHOOK_ERROR_SUCCESS
43
return 0, response_code, nil
44
end
45
46
end
47
end; end; end; end; end
48
49