the original code was just
while (MAC.ToLower().StartsWith("000b82"))
{
string s = x98c0d0f014f8bfe2 + "&gnkey=0b82";
}
What this does is takes and verifies the MAC address then creates a a hashkey.
I need it to be able to take new MAC addresses beginning with c074ad
and do "&gnkey=c074"
if c074ad
is used or do &gnkey=0b82
if 000b82
is used.
What am I missing? c074ad is
new MAC. https://github.com/SH4ZB0T/Grandstream-Provisioning-Tool/tree/master/GrandstreamProvisioningTool/dll/Grandstream
// Token: 0x06000006 RID: 6 RVA: 0x00002178 File Offset: 0x00000378
public static byte[] Encode(string inputStream, string MAC, bool encryption)
{
if (MAC.Length != 12)
{
throw new Exception("Mac Address must be exactly 12 characters long.");
}
if ((!MAC.ToLower().StartsWith("000b82")) || (!MAC.ToLower().StartsWith("c074ad")));
{
throw new Exception("Unrecognized Device");
}
TextEncoder.xdb0ee97a9934cea1(inputStream);
string x98c0d0f014f8bfe = TextEncoder.x037d2dea37c72401();
return TextEncoder.x875a866de1bf2e29(MAC, x98c0d0f014f8bfe, encryption);
}
// Token: 0x06000007 RID: 7 RVA: 0x000021E0 File Offset: 0x000003E0
private static byte[] x875a866de1bf2e29(string x61f6b464f047216f, string x98c0d0f014f8bfe2, bool xa2cf66bde80e30c9)
{
-> if ("000b82") {string s1 = x98c0d0f014f8bfe2 + "&gnkey=0b82"};
-> if ("c074ad") {string s2 = x98c0d0f014f8bfe2 + "&gnkey=c074"};
int num;
if (((uint)num & 0U) != 0U)
The ||
in the second conditional should be &&
, or there should only be one negation (!
), with both of the condition in parentheses.
So either
if ( !(MAC.ToLower().StartsWith("000b82") || MAC.ToLower().StartsWith("c074ad")))
or
if ( !MAC.ToLower().StartsWith("000b82")) && !MAC.ToLower().StartsWith("c074ad"))
As it is, the condition is always true, no matter what the MAC is.
User contributions licensed under CC BY-SA 3.0