⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strbuf.lua

📁 Overview是Linux,FreeBSD,UNIX,Windows下的网络扫描和嗅探工 具包,其基本功能有三个,一是探测一组主机是否在线 其次是扫描 主机端口,嗅探所提供的网络服务 还可以推断主机
💻 LUA
字号:
-- license = "See nmaps COPYING for license"module("strbuf" ,package.seeall)-- String buffer functions. Concatenation is not efficient in -- lua as strings are immutable. If a large amount of '..' -- operations are needed a string buffer should be used instead--[[	local buf = strbuf.new()	-- from here buf may be used like a string for concatenation operations	-- (the lefthand-operand has to be a strbuf, the righthand-operand may be 	-- a string or a strbuf)	-- alternativly you can assign a value (which will become the first string	-- inside the buffer) with new	local buf2 = strbuf.new('hello')	buf = buf .. 'string'	buf = buf .. 'data'	print(buf)                   -- default seperator is a new line	print(strbuf.dump(buf))      -- no seperator	print(strbuf.dump(buf, ' ')) -- seperated by spaces	strbuf.clear(buf)--]]dump = table.concat concatbuf =function(sbuf, s)	if sbuf == s then		error("refusing to concat the same buffer (recursion)!")	end	if getmetatable(sbuf) ~= mt then		error("left-hand operand of the concat operation has to be a strbuf!")	end	if type(s)=="string" then		table.insert(sbuf, s)	elseif getmetatable(s) == mt then		for _,v in ipairs(s) do			table.insert(sbuf, v)		end	else 		error("right-hand operand of concat has to be either string or strbuf!")	end	return sbufendlocal eqbuf = function(sbuf1, sbuf2)	if getmetatable(sbuf1) ~= mt then		error("equal function expects a value of type strbuf as left-hand operand")	end	if getmetatable(sbuf1) ~= getmetatable(sbuf2) then		return false	end	if #sbuf1 ~= #sbuf2 then		return false	end		for i=1, #sbuf1 do		if sbuf1[i] ~= sbuf2[i] then			return false		end	end	return trueendclear = function(sbuf)	for i, v in pairs(sbuf) do		sbuf[i] = nil    	endendmt = { __concat = concatbuf, __tostring = function(s) return dump(s, '\n') end ,  __eq=eqbuf}new = function(val)	local tmp ={}	setmetatable(tmp, mt)	if val ~=nil then		table.insert(tmp, val)	end	return tmpend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -