Skip to content

Instantly share code, notes, and snippets.

@ShilGen
Last active June 16, 2023 07:19
Show Gist options
  • Save ShilGen/dcb0d53907a1dd77a7d08d8997d5ede6 to your computer and use it in GitHub Desktop.
Save ShilGen/dcb0d53907a1dd77a7d08d8997d5ede6 to your computer and use it in GitHub Desktop.
using ObjStudioClasses;
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Threading.Tasks;
public class Script
{
private static byte[] CalcPasswordHash(string password)
{
using (var stream = new MemoryStream())
{
using (var writer = new StreamWriter(stream))
{
writer.Write(password);
}
using (var md5 = System.Security.Cryptography.MD5.Create())
{
return md5.ComputeHash(stream.ToArray());
}
}
}
public static object Execute()
{
var user = InnerUser.GetInstances().Single(x => x.AttributeLogin == "Administrator");
user.AttributeAuthenticationRules.AttributeExternalPasswordHash = CalcPasswordHash("1234");
user.AttributeUserStatus=UserStatusItem.Instances.Active;
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment