From afd025c191df685ef1292d6a883e94d9d9773519 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 25 Feb 2015 19:58:33 +0000 Subject: [PATCH] Lua 5.2 allows null chars in patterns, so this hack is unnecessary --- scripts/smb-psexec.nse | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/scripts/smb-psexec.nse b/scripts/smb-psexec.nse index 03c7551c8..4114e4f1e 100644 --- a/scripts/smb-psexec.nse +++ b/scripts/smb-psexec.nse @@ -1348,22 +1348,7 @@ end local function do_replacements(mod, line) if(mod.replace) then for _, v in pairs(mod.replace) do - - -- It looks like Lua doesn't like replacing the null character, so have a sidecase for it - if(v[1] == string.char(0)) then - local newline = "" - for i = 1, #line, 1 do - local char = string.sub(line, i, i) - if(string.byte(char) == 0) then - newline = newline .. v[2] - else - newline = newline .. char - end - end - line = newline - else - line = string.gsub(line, v[1], v[2]) - end + line = string.gsub(line, v[1], v[2]) end end