Skip to content

Commit b50a72b

Browse files
authored
Add files via upload
0 parents  commit b50a72b

27 files changed

+8347
-0
lines changed

ExploitablePath.sln

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.26124.0
4+
MinimumVisualStudioVersion = 15.0.26124.0
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExploitablePath", "src\ExploitablePath.csproj", "{63C018A7-2E1D-441E-A722-26E59D0D336D}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|Any CPU = Release|Any CPU
13+
Release|x64 = Release|x64
14+
Release|x86 = Release|x86
15+
EndGlobalSection
16+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
17+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Debug|x64.ActiveCfg = Debug|Any CPU
20+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Debug|x64.Build.0 = Debug|Any CPU
21+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Debug|x86.ActiveCfg = Debug|Any CPU
22+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Debug|x86.Build.0 = Debug|Any CPU
23+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Release|x64.ActiveCfg = Release|Any CPU
26+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Release|x64.Build.0 = Release|Any CPU
27+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Release|x86.ActiveCfg = Release|Any CPU
28+
{63C018A7-2E1D-441E-A722-26E59D0D336D}.Release|x86.Build.0 = Release|Any CPU
29+
EndGlobalSection
30+
GlobalSection(SolutionProperties) = preSolution
31+
HideSolutionNode = FALSE
32+
EndGlobalSection
33+
GlobalSection(ExtensibilityGlobals) = postSolution
34+
SolutionGuid = {D0016E18-D79A-4D76-AE01-3B589F783591}
35+
EndGlobalSection
36+
EndGlobal
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
3+
&lt;Assembly Path="C:\Users\arielo\.nuget\packages\apachethrift\0.10.0\lib\net45\Thrift45.dll" /&gt;&#xD;
4+
&lt;Assembly Path="C:\Users\arielo\.nuget\packages\anglesharp\0.9.11\lib\netstandard1.0\AngleSharp.dll" /&gt;&#xD;
5+
&lt;Assembly Path="C:\Users\arielo\.nuget\packages\mimekit\0.21.0\lib\net40\MimeKit.dll" /&gt;&#xD;
6+
&lt;Assembly Path="C:\Users\arielo\.nuget\packages\opcfoundation.netstandard.opc.ua\1.3.350.4\lib\netstandard2.0\Opc.Ua.Core.dll" /&gt;&#xD;
7+
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

src/EmailMessage.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace ExploitablePath
6+
{
7+
public class EmailMessage
8+
{
9+
public string From { get; }
10+
11+
public string[] To { get; }
12+
13+
public string[] Cc { get; }
14+
15+
public string[] Bcc { get; }
16+
17+
public string[] ReplyTo { get; }
18+
19+
public string Subject { get; }
20+
21+
public string Body { get; }
22+
23+
public bool IsBodyHtml { get; }
24+
25+
public IList<EmailMessageAttachment> Attachments { get; }
26+
27+
public bool HasAttachments => Attachments != null && Attachments.Count > 0;
28+
29+
public EmailMessage(string from, string to, string subject, string body, bool isBodyHtml)
30+
: this(from, new[] { to }, null, null, null, subject, body, isBodyHtml, null)
31+
{
32+
}
33+
34+
public EmailMessage(string from, string[] to, string[] cc, string[] bcc, string[] replyTo, string subject, string body, bool isBodyHtml, IEnumerable<EmailMessageAttachment> attachments)
35+
{
36+
ArgumentIsNotNullOrEmpty(to, nameof(to));
37+
ArgumentIsNotNullOrEmpty(subject, nameof(subject));
38+
ArgumentIsNotNullOrEmpty(body, nameof(body));
39+
40+
From = from;
41+
To = to;
42+
Cc = cc;
43+
Bcc = bcc;
44+
ReplyTo = replyTo;
45+
Subject = subject;
46+
Body = body;
47+
IsBodyHtml = isBodyHtml;
48+
Attachments = attachments?.ToList();
49+
}
50+
51+
private static void ArgumentIsNotNullOrEmpty(string arg, string argName)
52+
{
53+
if (arg == null)
54+
{
55+
throw new ArgumentNullException(argName);
56+
}
57+
58+
if (arg.Length == 0)
59+
{
60+
throw new ArgumentException("Value cannot be empty.", argName);
61+
}
62+
}
63+
64+
private static void ArgumentIsNotNullOrEmpty(string[] arg, string argName)
65+
{
66+
if (arg == null)
67+
{
68+
throw new ArgumentNullException(argName);
69+
}
70+
71+
if (arg.Length == 0)
72+
{
73+
throw new ArgumentException("Value cannot be an empty array.", argName);
74+
}
75+
76+
if (arg.Any(x => x is not null && x.Length > 0) == false)
77+
{
78+
throw new ArgumentException("Value cannot be an array containing only null or empty elements.", argName);
79+
}
80+
}
81+
}
82+
}

src/EmailMessageAttachment.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.IO;
2+
3+
4+
namespace ExploitablePath
5+
{
6+
public class EmailMessageAttachment
7+
{
8+
public Stream Stream { get; }
9+
10+
public string FileName { get; }
11+
12+
public EmailMessageAttachment(Stream stream, string fileName)
13+
{
14+
Stream = stream;
15+
FileName = fileName;
16+
}
17+
}
18+
}

src/EmailService.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Net.Mail;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNet.Identity;
6+
using Umbraco.Core.Configuration;
7+
8+
namespace Umbraco.Core.Security
9+
{
10+
/// <summary>
11+
/// The <see cref="IIdentityMessageService"/> implementation for Umbraco
12+
/// </summary>
13+
public class EmailService : IIdentityMessageService
14+
{
15+
private readonly string _notificationEmailAddress;
16+
private readonly IEmailSender _defaultEmailSender;
17+
18+
public EmailService(string notificationEmailAddress, IEmailSender defaultEmailSender)
19+
{
20+
_notificationEmailAddress = notificationEmailAddress;
21+
_defaultEmailSender = defaultEmailSender;
22+
}
23+
24+
25+
public async Task SendAsync(IdentityMessage message)
26+
{
27+
var mailMessage = new MailMessage(
28+
_notificationEmailAddress,
29+
message.Destination,
30+
message.Subject,
31+
message.Body)
32+
{
33+
IsBodyHtml = message.Body.IsNullOrWhiteSpace() == false
34+
&& message.Body.Contains("<") && message.Body.Contains("</")
35+
};
36+
37+
try
38+
{
39+
//check if it's a custom message and if so use it's own defined mail sender
40+
var umbMsg = message as UmbracoEmailMessage;
41+
if (umbMsg != null)
42+
{
43+
await umbMsg.MailSender.SendAsync(mailMessage);
44+
}
45+
else
46+
{
47+
await _defaultEmailSender.SendAsync(mailMessage);
48+
}
49+
}
50+
finally
51+
{
52+
mailMessage.Dispose();
53+
}
54+
}
55+
}
56+
}

src/ExploitablePath.csproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<IsPackable>true</IsPackable>
5+
<PackageId>TinyJson</PackageId>
6+
<Title>TinyJson</Title>
7+
<PackageVersion>1.0.0</PackageVersion>
8+
<Authors>Alex Parker</Authors>
9+
<PackageLicenseUrl>https://raw.githubusercontent.com/zanders3/json/master/LICENSE</PackageLicenseUrl>
10+
<PackageProjectUrl>https://github.com/zanders3/json</PackageProjectUrl>
11+
<description>A really simple C# JSON parser.</description>
12+
<Copyright>Copyright 2017</Copyright>
13+
<PackageTags>Json;Serialisation</PackageTags>
14+
<RepositoryUrl>https://github.com/zanders3/json</RepositoryUrl>
15+
<LangVersion>latest</LangVersion>
16+
</PropertyGroup>
17+
<ItemGroup>
18+
<PackageReference Include="ApacheThrift" Version="0.10.0" />
19+
<PackageReference Include="DotNetCasClient" Version="1.0.0" />
20+
<PackageReference Include="HaemmerElectronics.SeppPenner.WindowsHello" Version="1.0.2" />
21+
<PackageReference Include="MimeKit" Version="0.21.0" />
22+
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="0.4.4" />
23+
<PackageReference Include="ServiceStack" Version="5.0.0" />
24+
</ItemGroup>
25+
<ItemGroup>
26+
<Compile Include="obj\EmailMessageAttachment.cs" />
27+
</ItemGroup>
28+
</Project>

src/Program.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Collections.Specialized;
3+
using System.IO;
4+
using DotNetCasClient.Utils;
5+
using Thrift.Protocol;
6+
using Opc.Ua;
7+
using ServiceStack.Formats;
8+
using ServiceStack.Host;
9+
using WindowsHello;
10+
11+
namespace ExploitablePath
12+
{
13+
public class Program
14+
{
15+
static TProtocol prot;
16+
17+
static void TestSkip()
18+
{
19+
TProtocolUtil.Skip(prot, TType.Stop);
20+
}
21+
22+
public Program()
23+
{
24+
var decoder = new BinaryDecoder(Stream.Null, ServiceMessageContext.GlobalContext);
25+
decoder.ReadExtensionObject("field");
26+
UrlUtil.ConstructValidateUrl("https://mockurl.com", true, false, new NameValueCollection());
27+
UrlUtilTest();
28+
HtmTest();
29+
}
30+
31+
static void TestReadExtensionObjectFunc()
32+
{
33+
var decoder = new BinaryDecoder(Stream.Null, ServiceMessageContext.GlobalContext);
34+
decoder.ReadExtensionObject("field");
35+
}
36+
37+
async void HtmTest()
38+
{
39+
var stack = new HtmlFormat();
40+
await stack.SerializeToStreamAsync(null, null, null);
41+
await stack.SerializeToStreamAsync(new BasicRequest(), new { }, Stream.Null);
42+
}
43+
44+
45+
void UrlUtilTest()
46+
{
47+
UrlUtil.ConstructServiceUrl(true);
48+
UrlUtil.ConstructValidateUrl("https://mockurl.com", true, false, new NameValueCollection());
49+
}
50+
51+
public static void Main()
52+
{
53+
TestReadExtensionObjectFunc();
54+
}
55+
56+
public void WindowsHelloTest()
57+
{
58+
var handle = new IntPtr();
59+
var data = new byte[] {0x32, 0x32};
60+
var provider = new WinHelloProvider("Hello", handle);
61+
var encryptedData = provider.Encrypt(data);
62+
var decryptedData = provider.PromptToDecrypt(encryptedData);
63+
}
64+
}
65+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
using System;
11+
using System.Reflection;
12+
13+
[assembly: System.Reflection.AssemblyCompanyAttribute("Alex Parker")]
14+
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
15+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright 2017")]
16+
[assembly: System.Reflection.AssemblyDescriptionAttribute("A really simple C# JSON parser.")]
17+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
18+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
19+
[assembly: System.Reflection.AssemblyProductAttribute("ExploitablePath")]
20+
[assembly: System.Reflection.AssemblyTitleAttribute("ExploitablePath")]
21+
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
22+
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/zanders3/json")]
23+
24+
// Generated by the MSBuild WriteCodeFragment class.
25+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
56a0b1797e2d40acc66c8501702d2a7c47c88774
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
is_global = true
2+
build_property.RootNamespace = ExploitablePath
3+
build_property.ProjectDir = C:\Projects\C#\Exploitable Path\MyNugetProject\ExploitablePath\src\

0 commit comments

Comments
 (0)