Skip to content

Commit

Permalink
Update SmsProviderWmi.cs
Browse files Browse the repository at this point in the history
Fix case matching issue
  • Loading branch information
Mayyhem authored Sep 16, 2024
1 parent 3949259 commit f2fc193
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/SmsProviderWmi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,14 +1037,18 @@ public static ManagementObject NewCollectionMember(ManagementScope wmiConnection
{
foreach (ManagementObject member in collectionMembers)
{
if ((!string.IsNullOrEmpty(deviceName) && (string)member.GetPropertyValue("Name") == deviceName) ||
(!string.IsNullOrEmpty(userName) && member.GetPropertyValue("Name").ToString().Contains(userName)) ||
if ((!string.IsNullOrEmpty(deviceName) && member.GetPropertyValue("Name").ToString().ToLower() == deviceName.ToLower()) ||
(!string.IsNullOrEmpty(userName) && member.GetPropertyValue("Name").ToString().ToLower().Contains(userName.ToLower())) ||
(!string.IsNullOrEmpty(resourceId) && (uint)member.GetPropertyValue("ResourceID") == Convert.ToUInt32(resourceId)))
{
Console.WriteLine($"[+] Successfully added {matchingResource["Name"]} ({matchingResource["ResourceID"]}) to {(!string.IsNullOrEmpty(collectionName) ? collectionName : collectionId)}");
memberAvailable = true;
collectionMember = collectionMembers.Cast<ManagementObject>().First();
}
else
{
Console.WriteLine($"[+] Member {member.GetPropertyValue("Name").ToString()} did not match the specified resource");
}
}
}
else
Expand Down

0 comments on commit f2fc193

Please sign in to comment.