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/lanattacks/tftp/tftp.rb
Views: 1904
1
# -*- coding: binary -*-
2
3
require 'rex/post/meterpreter/extensions/lanattacks/tlv'
4
5
module Rex
6
module Post
7
module Meterpreter
8
module Extensions
9
module Lanattacks
10
module Tftp
11
12
###
13
#
14
# TFTP Server functionality
15
#
16
###
17
class Tftp
18
19
def initialize(client)
20
@client = client
21
end
22
23
def start
24
client.send_request(Packet.create_request(COMMAND_ID_LANATTACKS_START_TFTP))
25
true
26
end
27
28
def reset
29
client.send_request(Packet.create_request(COMMAND_ID_LANATTACKS_RESET_TFTP))
30
true
31
end
32
33
def add_file(filename, data)
34
request = Packet.create_request(COMMAND_ID_LANATTACKS_ADD_TFTP_FILE)
35
request.add_tlv(TLV_TYPE_LANATTACKS_OPTION_NAME, filename)
36
request.add_tlv(TLV_TYPE_LANATTACKS_RAW, data, false, true) #compress it
37
client.send_request(request)
38
true
39
end
40
41
def stop
42
client.send_request(Packet.create_request(COMMAND_ID_LANATTACKS_STOP_TFTP))
43
true
44
end
45
46
attr_accessor :client
47
end
48
49
end; end; end; end; end; end
50
51