1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

merging in the --lua-exec feature for ncat.

This commit is contained in:
d33tah
2013-07-02 16:56:03 +00:00
parent 085d4ccfb2
commit b62709eb20
25 changed files with 1594 additions and 31 deletions

View File

@@ -0,0 +1,33 @@
--This is another --lua-exec demo. It displays a menu to a user, waits for her
--input and makes a decision according to what the user entered. All happens
--in an infinite loop.
while true do
print("Here's a menu for you: ")
print("1. Repeat the menu.")
print("0. Exit.")
io.write("Please enter your choice: ")
io.flush(io.stdout)
i = io.read()
--WARNING! Without this line, the script will go into an infinite loop
--that keeps consuming system resources when the connection gets broken.
--Ncat's subprocesses are NOT killed in this case!
if i == nil then
break
end
print("You wrote: ",i,".")
if i == "0" then
break
elseif i == "1" then
print("As you wish.")
else
print("No idea what you meant. Please try again.")
end
print() --print a newline
end