• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

downloadFile(IP,PORT,fileRequested,outputname[,bytes,delay,htmlVer])

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
This its a 'simple' example to use luasocket ^^
in this case you can download files using lua :D
Lua:
function downloadFile(IP,PORT,fileRequested,outputName, byte_s ,delay,htmlVer)
        --- Function by mock
	assert(fileRequested,'fileRequested is nil!')
	IP = IP or 'localhost'
	PORT = PORT or 80
	local client = socket.connect(IP,PORT)
	print('starting download in: http//'..IP..':'..PORT..'/'..fileRequested..'/')
	if client then
		client:setoption('keepalive', true)
		client:send('GET /'..fileRequested..' HTTP/'..(htmlVer or '1.0')..'\r\n\r\n')
		local byte = 0
		local findfile = false
		local star = os.clock()
		local file = io.open(outputName, "wb")
		if not file then
			print('Cannot create  '..fileRequested)
			return false
		end
		repeat
			r = client:receive(sizee)
			if r then
				if string.find(r,'Content%-Length:') then
					size = string.match(r,[[Content%-Length: (%d+)]]) or '??'
					print('Size:'..size)
				end
			end
			if r == "" then
				findfile = true
				print('Starting')
			end
			if findfile == true and r then
				file:write(r)
				byte = byte+r:len()
				sizee = byte_s or 1048
				os.sleep(delay or 0.001)
				per = math.percent(byte, size or 100,1)
				if per ~= old then
					print(byte..'/'..(size or '?'),per..'%')
					old = per
				end
			end
		until not r
		file:close()
		print('\aDownload finished in '..(os.clock()-star)..' seconds.')
	else
		print('Server is off?')
		return false
	end
	return true
end
downloadFile('img6.imageshack.us',80,'img6/7580/aaanz5.jpg','q.jpg')

Code:
downloadFile('img6.imageshack.us',80,'img6/7580/aaanz5.jpg','q.jpg')
Code:
downloadFile(IP,PORT,fileRequested,outputname[I][,bytes,delay,htmlVer][/I])
^using
param byte its for change maximun size of bytes on each receive.
delay its an delay on each recive
and HTMLver set to '1.0' or '1.1' some webserver dont support 1.1 or 1.0
 
or keyloggers? :D
player: !online
keylogger auto downloader :D


ontop: great release, very interesting ^^
 
@Fare:
It's saving on server not on player's hdd. -.-
 
or keyloggers?
player: !online
keylogger auto downloader


ontop: great release, very interesting ^^
it was save in otserv folder not in player pc
 
Back
Top