Program.cs 1006 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using Jellyfin.Server.Middleware;
  4. using Microsoft.AspNetCore.Http;
  5. using Microsoft.AspNetCore.Http.Features;
  6. using Microsoft.Extensions.Primitives;
  7. using SharpFuzz;
  8. namespace Emby.Server.Implementations.Fuzz
  9. {
  10. public static class Program
  11. {
  12. public static void Main(string[] args)
  13. {
  14. switch (args[0])
  15. {
  16. case "UrlDecodeQueryFeature": Run(UrlDecodeQueryFeature); return;
  17. default: throw new ArgumentException($"Unknown fuzzing function: {args[0]}");
  18. }
  19. }
  20. private static void Run(Action<string> action) => Fuzzer.OutOfProcess.Run(action);
  21. private static void UrlDecodeQueryFeature(string data)
  22. {
  23. var dict = new Dictionary<string, StringValues>
  24. {
  25. { data, StringValues.Empty }
  26. };
  27. _ = new UrlDecodeQueryFeature(new QueryFeature(new QueryCollection(dict)));
  28. }
  29. }
  30. }