Skip to content

Instantly share code, notes, and snippets.

View axelgenus's full-sized avatar

Alessandro Calorì axelgenus

  • ArchiC0DE
  • Italy
View GitHub Profile
@axelgenus
axelgenus / GetObjectSid.cs
Last active August 31, 2020 14:09
Get object SID SDDL string representation from binary value.
using System.Text;
namespace LdapSearch
{
public static class Extensions
{
public static string GetObjectSid(this byte[] objectSid)
{
var sid = new StringBuilder("S-");
@axelgenus
axelgenus / BinaryAttributeTest.cs
Created August 31, 2020 13:56
Demonstration of binary attribute values conversion issue with LdapForNet.
using NUnit.Framework;
namespace LdapForNet.Tests
{
public class Tests
{
[TestCase("objectSid", new byte[] { 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0xB0, 0x68, 0x77, 0x23, 0x28, 0xE5, 0x17, 0xDF, 0xDE, 0x78, 0x25, 0x94, 0x86, 0x13, 0x00, 0x00})]
public void BinaryAttributeTest(string attributeName, byte[] attributeValue)
{
// Prepare directory attribute.
package main
import (
r "github.com/dancannon/gorethink"
)
type Writer struct {
ID string `gorethink:"id,omitempty"`
Name string `gorethink:"name"`
}