SpecterOps / SpecterOps/SharpHound
Illegal Characters in Path
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.3k
- Forks
- 266
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 3
Description
I ran into an issue where I specified an output directory (it exists), but for some reason when sharphound ran, it gave an "Illegal Characters in Path" error and died. Rohan said to file a bug and thinks it relates to the following code:
`public string ResolveFileName(string filename, string extension, bool addTimestamp)
{
var finalFilename = filename;
if (!filename.EndsWith(extension))
finalFilename = $"{filename}.{extension}";
if (extension is "json" or "zip" && Flags.RandomizeFilenames)
finalFilename = $"{Path.GetRandomFileName()}";
if (addTimestamp) finalFilename = $"{CurrentLoopTime}_{finalFilename}";
if (OutputPrefix != null) finalFilename = $"{OutputPrefix}_{finalFilename}";
var finalPath = Path.Combine(OutputDirectory, finalFilename);
return finalPath;
}`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ResolveFileName method shown in the issue and reproduce the failure using an existing output directory. Trace how the filename, extension, timestamp, and OutputPrefix are combined before Path.Combine is called. Done means the same output-directory scenario completes without an Illegal Characters in Path error and preserves the intended output naming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100