OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
nmap
/
nselib
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2020 12:36:00 PM
rwxr-xr-x
📄
afp.lua
71.92 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ajp.lua
16.69 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
amqp.lua
10.5 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
anyconnect.lua
4.45 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
asn1.lua
14.57 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
base32.lua
7.33 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
base64.lua
5.67 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bin.lua
12.89 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bit.lua
2.43 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bitcoin.lua
16.99 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bits.lua
1.82 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bittorrent.lua
40.77 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
bjnp.lua
9.45 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
brute.lua
50.04 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
cassandra.lua
5.78 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
citrixxml.lua
16 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
coap.lua
76.24 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
comm.lua
10.75 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
creds.lua
18.22 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
cvs.lua
3.13 KB
04/16/2018 01:11:39 AM
rw-r--r--
📁
data
-
08/07/2020 12:36:00 PM
rwxr-xr-x
📄
datafiles.lua
11.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
datetime.lua
1.16 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dhcp.lua
29.17 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dhcp6.lua
19.87 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dns.lua
51.44 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dnsbl.lua
19.02 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
dnssd.lua
12.57 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
drda.lua
24.2 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
eap.lua
7.64 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
eigrp.lua
14.47 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
formulas.lua
5.35 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ftp.lua
9.03 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
geoip.lua
1.71 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
giop.lua
18.44 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
gps.lua
3.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
http.lua
105.81 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
httpspider.lua
36.15 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
iax2.lua
9.6 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ike.lua
15.02 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
imap.lua
9.59 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
informix.lua
39.76 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ipOps.lua
26.92 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ipmi.lua
10.02 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ipp.lua
12.54 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
irc.lua
757 bytes
04/16/2018 01:11:39 AM
rw-r--r--
📄
iscsi.lua
21.45 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
isns.lua
15.34 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
jdwp.lua
43.57 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
json.lua
11.65 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ldap.lua
31.86 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
lfs.luadoc
1.68 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
libssh2-utility.lua
4.39 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
libssh2.luadoc
4.75 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
listop.lua
4.66 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
lpeg-utility.lua
5.64 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
lpeg.luadoc
351 bytes
04/16/2018 01:11:39 AM
rw-r--r--
📄
ls.lua
10.96 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
match.lua
2.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
membase.lua
9.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mobileme.lua
8.46 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mongodb.lua
21.29 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mqtt.lua
28.95 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
msrpc.lua
179.93 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
msrpcperformance.lua
29.72 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
msrpctypes.lua
167.61 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mssql.lua
110.87 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
multicast.lua
6.1 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
mysql.lua
17.09 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
natpmp.lua
5.04 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ncp.lua
36 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ndmp.lua
11.58 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
netbios.lua
13.9 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
nmap.luadoc
40.34 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
nrpc.lua
4.42 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
nsedebug.lua
3.49 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
omp2.lua
4.77 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
openssl.luadoc
7.08 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ospf.lua
15.29 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
packet.lua
36.65 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pcre.luadoc
6.79 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pgsql.lua
20.61 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pop3.lua
5.7 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
pppoe.lua
29.95 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
proxy.lua
12.04 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rdp.lua
11.05 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
re.lua
8.22 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
redis.lua
3.59 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rmi.lua
47.89 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rpc.lua
106.22 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rpcap.lua
11.19 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rsync.lua
5.19 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
rtsp.lua
8.67 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sasl.lua
16.38 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
shortport.lua
8.01 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sip.lua
30.56 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
slaxml.lua
17.9 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smb.lua
175.85 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smb2.lua
16.32 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smbauth.lua
37.53 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
smtp.lua
19.81 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
snmp.lua
15.99 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
socks.lua
8.26 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
srvloc.lua
12.25 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ssh1.lua
8.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
ssh2.lua
11.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sslcert.lua
33.34 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
sslv2.lua
9.63 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
stdnse.lua
45.93 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
strbuf.lua
4.52 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
strict.lua
2.53 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
stun.lua
11.51 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tab.lua
3.35 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
target.lua
3.93 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tftp.lua
9.38 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tls.lua
56.16 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tn3270.lua
43.75 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
tns.lua
64.17 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
unicode.lua
14.32 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
unittest.lua
12.33 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
unpwdb.lua
10.08 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
upnp.lua
11.18 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
url.lua
12.09 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
versant.lua
8.6 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
vnc.lua
23.3 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
vulns.lua
76.29 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
vuzedht.lua
16.62 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
wsdd.lua
12.03 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
xdmcp.lua
11.9 KB
04/16/2018 01:11:39 AM
rw-r--r--
📄
xmpp.lua
15.88 KB
04/16/2018 01:11:39 AM
rw-r--r--
Editing: tftp.lua
Close
--- Library implementing a minimal TFTP server -- -- Currently only write-operations are supported so that script can trigger -- TFTP transfers and receive the files and return them as result. -- -- The library contains the following classes -- * <code>Packet</code> -- ** The <code>Packet</code> classes contain one class for each TFTP operation. -- * <code>File</code> -- ** The <code>File</code> class holds a received file including the name and contents -- * <code>ConnHandler</code> -- ** The <code>ConnHandler</code> class handles and processes incoming connections. -- -- The following code snippet starts the TFTP server and waits for the file incoming.txt -- to be uploaded for 10 seconds: -- <code> -- tftp.start() -- local status, f = tftp.waitFile("incoming.txt", 10) -- if ( status ) then return f:getContent() end -- </code> -- -- @author Patrik Karlsson <patrik@cqure.net> -- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html -- -- version 0.2 -- -- 2011-01-22 - re-wrote library to use coroutines instead of new_thread code. local bin = require "bin" local coroutine = require "coroutine" local nmap = require "nmap" local os = require "os" local stdnse = require "stdnse" local table = require "table" _ENV = stdnse.module("tftp", stdnse.seeall) threads, infiles, running = {}, {}, {} state = "STOPPED" srvthread = {} -- All opcodes supported by TFTP OpCode = { RRQ = 1, WRQ = 2, DATA = 3, ACK = 4, ERROR = 5, } --- A minimal packet implementation -- -- The current code only implements the ACK and ERROR packets -- As the server is write-only the other packet types are not needed Packet = { -- Implements the ACK packet ACK = { new = function( self, block ) local o = {} setmetatable(o, self) self.__index = self o.block = block return o end, __tostring = function( self ) return bin.pack(">SS", OpCode.ACK, self.block) end, }, -- Implements the error packet ERROR = { new = function( self, code, msg ) local o = {} setmetatable(o, self) self.__index = self o.msg = msg o.code = code return o end, __tostring = function( self ) return bin.pack(">SSz", OpCode.ERROR, self.code, self.msg) end, } } --- The File class holds files received by the TFTP server File = { --- Creates a new file object -- -- @param filename string containing the filename -- @param content string containing the file content -- @return o new class instance new = function(self, filename, content, sender) local o = {} setmetatable(o, self) self.__index = self o.name = filename o.content = content o.sender = sender return o end, getContent = function(self) return self.content end, setContent = function(self, content) self.content = content end, getName = function(self) return self.name end, setName = function(self, name) self.name = name end, setSender = function(self, sender) self.sender = sender end, getSender = function(self) return self.sender end, } -- The thread dispatcher is called by the start function once local function dispatcher() local last = os.time() local f_condvar = nmap.condvar(infiles) local s_condvar = nmap.condvar(state) while(true) do -- check if other scripts are active local counter = 0 for t in pairs(running) do counter = counter + 1 end if ( counter == 0 ) then state = "STOPPING" s_condvar "broadcast" end if #threads == 0 then break end for i, thread in ipairs(threads) do local status, res = coroutine.resume(thread) if ( not(res) ) then -- thread finished its task? table.remove(threads, i) break end end -- Make sure to process waitFile atleast every 2 seconds -- in case no files have arrived if ( os.time() - last >= 2 ) then last = os.time() f_condvar "broadcast" end end state = "STOPPED" s_condvar "broadcast" stdnse.debug1("Exiting _dispatcher") end -- Processes a new incoming file transfer -- Currently only uploads are supported -- -- @param host containing the hostname or ip of the initiating host -- @param port containing the port of the initiating host -- @param data string containing the initial data passed to the server local function processConnection( host, port, data ) local pos, op = bin.unpack(">S", data) local socket = nmap.new_socket("udp") socket:set_timeout(1000) local status, err = socket:connect(host, port) if ( not(status) ) then return status, err end socket:set_timeout(10) -- If we get anything else than a write request, abort the connection if ( OpCode.WRQ ~= op ) then stdnse.debug1("Unsupported opcode") socket:send( tostring(Packet.ERROR:new(0, "TFTP server has write-only support"))) end local pos, filename, enctype = bin.unpack("zz", data, pos) status, err = socket:send( tostring( Packet.ACK:new(0) ) ) local blocks = {} local lastread = os.time() while( true ) do local status, pdata = socket:receive() if ( not(status) ) then -- if we're here and haven't successfully read a packet for 5 seconds, abort if ( os.time() - lastread > 5 ) then coroutine.yield(false) else coroutine.yield(true) end else -- record last time we had a successful read lastread = os.time() pos, op = bin.unpack(">S", pdata) if ( OpCode.DATA ~= op ) then stdnse.debug1("Expected a data packet, terminating TFTP transfer") end local block, data pos, block, data = bin.unpack(">SA" .. #pdata - 4, pdata, pos ) blocks[block] = data -- First block was not 1 if ( #blocks == 0 ) then socket:send( tostring(Packet.ERROR:new(0, "Did not receive block 1"))) break end -- for every fifth block check that we've received the preceding four if ( ( #blocks % 5 ) == 0 ) then for b = #blocks - 4, #blocks do if ( not(blocks[b]) ) then socket:send( tostring(Packet.ERROR:new(0, "Did not receive block " .. b))) end end end -- Ack the data block status, err = socket:send( tostring(Packet.ACK:new(block)) ) if ( ( #blocks % 20 ) == 0 ) then -- yield every 5th iteration so other threads may work coroutine.yield(true) end -- If the data length was less than 512, this was our last block if ( #data < 512 ) then socket:close() break end end end local filecontent = {} -- Make sure we received all the blocks needed to proceed for i=1, #blocks do if ( not(blocks[i]) ) then return false, ("Block #%d was missing in transfer") end filecontent[#filecontent+1] = blocks[i] end stdnse.debug1("Finished receiving file \"%s\"", filename) -- Add anew file to the global infiles table table.insert( infiles, File:new(filename, table.concat(filecontent), host) ) local condvar = nmap.condvar(infiles) condvar "broadcast" end -- Waits for a connection from a client local function waitForConnection() local srvsock = nmap.new_socket("udp") local status = srvsock:bind(nil, 69) assert(status, "Failed to bind to TFTP server port") srvsock:set_timeout(0) while( state == "RUNNING" ) do local status, data = srvsock:receive() if ( not(status) ) then coroutine.yield(true) else local status, _, _, rhost, rport = srvsock:get_info() local x = coroutine.create( function() processConnection(rhost, rport, data) end ) table.insert( threads, x ) coroutine.yield(true) end end end --- Starts the TFTP server and creates a new thread handing over to the dispatcher function start() local disp = nil local mutex = nmap.mutex("srvsocket") -- register a running script running[coroutine.running()] = true mutex "lock" if ( state == "STOPPED" ) then srvthread = coroutine.running() table.insert( threads, coroutine.create( waitForConnection ) ) stdnse.new_thread( dispatcher ) state = "RUNNING" end mutex "done" end local function waitLast() -- The thread that started the server needs to wait here until the rest -- of the scripts finish running. We know we are done once the state -- shifts to STOPPED and we get a signal from the condvar in the -- dispatcher local s_condvar = nmap.condvar(state) while( srvthread == coroutine.running() and state ~= "STOPPED" ) do s_condvar "wait" end end --- Waits for a file with a specific filename for at least the number of -- seconds specified by the timeout parameter. -- -- If this function is called from the thread that's running the server it will -- wait until all the other threads have finished executing before returning. -- -- @param filename string containing the name of the file to receive -- @param timeout number containing the minimum number of seconds to wait -- for the file to be received -- @return status true on success false on failure -- @return File instance on success, nil on failure function waitFile( filename, timeout ) local condvar = nmap.condvar(infiles) local t = os.time() while(os.time() - t < timeout) do for _, f in ipairs(infiles) do if (f:getName() == filename) then running[coroutine.running()] = nil waitLast() return true, f end end condvar "wait" end -- de-register a running script running[coroutine.running()] = nil waitLast() return false end return _ENV;