Use correct function to sanitize a filename. Close #3456

This commit is contained in:
nnposter 2026-08-27 02:05:53 +00:00
parent 4de0d186ff
commit 8b408ccb95
2 changed files with 4 additions and 1 deletions

View file

@ -4,6 +4,8 @@ o [NSE][GH#3447] IP options parsing by the packet library no longer crashes
on incomplete options. IP header data after EOOL are no longer parsed as
options. [nnposter]
o [NSE][GH#3456] Script http-config-backup was always failing. [h00die]
o [NSE][GH#3440] The rsync library was not correctly parsing server responses
for protocol version 32. [h00die]

View file

@ -4,6 +4,7 @@ local io = require "io"
local shortport = require "shortport"
local stdnse = require "stdnse"
local string = require "string"
local stringaux = require "stringaux"
local table = require "table"
local url = require "url"
@ -214,10 +215,10 @@ action = function (host, port)
if response.status == 200 and http.page_exists(response, result_404, known_404, url_path) then
-- check it if is valid before inserting
if cfg.check(response.body) then
local filename = stdnse.escape_filename((host.targetname or host.ip) .. url_path)
-- save the content
if save then
local filename = stringaux.filename_escape((host.targetname or host.ip) .. url_path)
local status, err = write_file(save .. filename, response.body);
if status then
stdnse.debug1("%s saved", filename);