Skip to content

Instantly share code, notes, and snippets.

View daniiiol's full-sized avatar

Daniel Scherrer daniiiol

View GitHub Profile
@daniiiol
daniiiol / hash256.ps1
Created December 2, 2023 12:18
Create a SHA256 string of a string with Powershell
$ClearString = "<yourString>"
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256')
$hash = $hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($ClearString))
$hashString = [System.BitConverter]::ToString($hash)
$hashString.Replace('-', '').ToLower()
@daniiiol
daniiiol / AES-ECB-Vulnerability-Program.cs
Last active November 11, 2023 14:05
PixelByPixel analysis of AES-ECB (Electronic Code Book Mode) Vulnerability
using System.Drawing;
using System.Drawing.Imaging;
using System.Security.Cryptography;
internal class Program
{
private static RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider();
private static void Main(string[] args)
{
for (int i = 0; i < 5; i++)
@daniiiol
daniiiol / AES-CBC-IV-Vulnerabilities-Program.cs
Last active November 11, 2023 14:04
PixelByPixel analysis of AES-CBC mode and different IV approaches
using System.Drawing;
using System.Drawing.Imaging;
using System.Security.Cryptography;
using System.Text;
internal class Program
{
private static RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider();
private static void Main(string[] args)
{
@daniiiol
daniiiol / octopusVarsInSitecoreConfigs.json
Last active December 7, 2016 19:38
Replace Octopus Variables in Sitecore Configs to environment specific values
{
"Id": "ActionTemplates-64",
"Name": "Replace Octopus Vars in Sitecore Configs",
"Description": "This Script searchs through all *.config files and replaces sc.variables and Sitecore settings with the value in Octopus of the same key.",
"ActionType": "Octopus.Script",
"Version": 16,
"Properties": {
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.RunOnServer": "false",
@daniiiol
daniiiol / agent.snippet
Last active October 21, 2016 08:24
Sitecore Visual Studio Snippets
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>
<!-- _locID_text="title" _locComment="" -->Agent</Title>
<Author>Daniel Scherrer</Author>
<Shortcut>sc_agent</Shortcut>
<Description>
<!-- _locID_text="description" _locComment="" -->Generates an Agent Entry</Description>
<SnippetTypes>
@daniiiol
daniiiol / Custom.ClonedItems.config
Created October 20, 2016 07:17
Access Rules for Cloned Items
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<accessRights defaultProvider="config">
<rights>
<add patch:after="*[@name='field:write']" name="field:writeClone" comment="Write right for fields." title="Field Write for Clones" modifiesData="false" />
<add patch:after="*[@name='item:write']" name="item:writeClone" comment="Write right for items." title="Write for Clones" modifiesData="false" />
</rights>
</accessRights>
@daniiiol
daniiiol / EventModel.cs
Last active September 26, 2016 08:06
Sitecore Client Tracker (SC 8.2)
using System.ComponentModel.DataAnnotations;
public class EventModel
{
/// <summary>
/// Name of the page event to be registered.
/// </summary>
[Required]
public string EventName { get; set; }
/// <summary>
@daniiiol
daniiiol / GlobalExceptionHandler.Config
Last active September 9, 2016 10:42
Catch the Sitecore MVC Exceptions before executing an application error - The Global Exception Tentacle to avoid Yellow Pages of Death
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<pipelines>
<mvc.exception>
<!--
The Global Exception Tentacle to avoid Yellow Pages of Death
If ShowExceptionsInPageEditor == true -> The system will throw an exception in the PageEditor
If ShowExceptionsInPreview == true -> The system will throw an exception in preview mode
If ShowExceptionsInDebugger == true -> The system will throw an exception in debbuger mode
-->
public static void RegisterTypes(IWindsorContainer container)
{
var rootPath = HostingEnvironment.MapPath("~/");
var basePath = PathInfo.Combine(PathInfo.Create(rootPath), PathInfo.Create(ConfigurationManager.AppSettings["NitroNet.BasePath"])).ToString();
new DefaultCastleWindsorModule(basePath).Configure(container);
}