Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of sanitization for output files? #63

Closed
okazymyrov opened this issue Sep 24, 2020 · 6 comments · Fixed by #109
Closed

What is the purpose of sanitization for output files? #63

okazymyrov opened this issue Sep 24, 2020 · 6 comments · Fixed by #109

Comments

@okazymyrov
Copy link

In asktgt the output file is sanitized when a full path for ticket output is used (e.g., "C:\Folder 1\Folder2\ticket.kirbi"). The result is saved into the folder with rubeus.exe instead of provided output. What is the purpose of sanitization?

Ref:

outfile = Helpers.MakeValidFileName(outfile);

@leezp
Copy link

leezp commented Jan 28, 2021

output doesn't ;
i tried Rubeus.exe monitor /output:.\a.txt

@leezp
Copy link

leezp commented Jan 28, 2021

@HarmJ0y can you fix "outfile" parameter? doesn't work
image

@HarmJ0y
Copy link
Member

HarmJ0y commented Mar 11, 2021

The purpose of sanitization is to strip invalid characters from an output file name

// Great method from http://forcewake.me/today-i-learned-sanitize-file-name-in-csharp/
static public string MakeValidFileName(string name)
{
string invalidChars = new string(Path.GetInvalidFileNameChars());
string escapedInvalidChars = Regex.Escape(invalidChars);
string invalidRegex = string.Format(@"([{0}]*\.+$)|([{0}]+)", escapedInvalidChars);
return Regex.Replace(name, invalidRegex, "_");
}

@HarmJ0y
Copy link
Member

HarmJ0y commented Mar 11, 2021

@leezp The /outfile parameter is not valid for the monitor command. For future issues, please make sure to read either:

@leezp
Copy link

leezp commented Mar 12, 2021

@leezp The /outfile parameter is not valid for the monitor command. For future issues, please make sure to read either:

if you can add some enhancement and fix it?

@okazymyrov
Copy link
Author

Please note that the original issue was for asktgt, and not for monitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants