Exemple #1
0
        public static byte[]? GetMachineID(IMachineInfoProvider machineInfoProvider)
        {
            if (!generationTable.TryGetValue(machineInfoProvider, out var generateTask))
            {
                DebugLog.WriteLine(nameof(HardwareUtils), "GetMachineID() called before Init()");
                return(null);
            }

            DebugLog.Assert(generateTask != null, nameof(HardwareUtils), "GetMachineID() found null task - should be impossible.");

            try
            {
                bool didComplete = generateTask.Wait(TimeSpan.FromSeconds(30));

                if (!didComplete)
                {
                    DebugLog.WriteLine(nameof(HardwareUtils), "Unable to generate machine_id in a timely fashion, logons may fail");
                    return(null);
                }
            }
            catch (AggregateException ex) when(ex.InnerException != null && generateTask.IsFaulted)
            {
                // Rethrow the original exception rather than a wrapped AggregateException.
                ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
            }

            MachineID machineId = generateTask.Result;

            using MemoryStream ms = new MemoryStream();
            machineId.WriteToStream(ms);
            return(ms.ToArray());
        }
Exemple #2
0
    private void OnTriggerStay(Collider other)
    {
        if (startShowing)
        {
            if (inInteractableBox)
            {
                MachineID machineNumber = other.GetComponent <MachineID>();

                if (machineNumber != null)
                {
                    HideAllPanels();
                    int machineID = machineNumber.GetMachineID();
                    DisplayPanel(machineID);
                }
            }

            if (!inInteractableBox)
            {
                HideAllPanels();
                noMachinesForPanelsSymbol.SetActive(true);
            }
        }
        else
        {
            Renderer boxRenderer = other.GetComponent <Renderer>();

            if (boxRenderer != null && other.gameObject.CompareTag("InteractableObject"))
            {
                boxRenderer.material = this.interactableActiveMaterial;
            }
        }
    }
Exemple #3
0
        public static byte[]? GetMachineID()
        {
            if (generateTask is null)
            {
                DebugLog.WriteLine(nameof(HardwareUtils), "GetMachineID() called before Init()");
                return(null);
            }

            bool didComplete = generateTask.Wait(TimeSpan.FromSeconds(30));

            if (!didComplete)
            {
                DebugLog.WriteLine(nameof(HardwareUtils), "Unable to generate machine_id in a timely fashion, logons may fail");
                return(null);
            }

            MachineID machineId = generateTask.Result;

            using (MemoryStream ms = new MemoryStream())
            {
                machineId.WriteToStream(ms);

                return(ms.ToArray());
            }
        }
Exemple #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AgentID;
         hashCode = (hashCode * 397) ^ (MachineID != null ? MachineID.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DeviceGuid != null ? DeviceGuid.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerID;
         hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ FolderID.GetHashCode();
         hashCode = (hashCode * 397) ^ (AgentName != null ? AgentName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SystemName != null ? SystemName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MachineName != null ? MachineName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DomainName != null ? DomainName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CurrentLoggedUsers != null ? CurrentLoggedUsers.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ComputerDescription != null ? ComputerDescription.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Monitored.GetHashCode();
         hashCode = (hashCode * 397) ^ LastPatchManagementReceived.GetHashCode();
         hashCode = (hashCode * 397) ^ (AgentVersion != null ? AgentVersion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Favorite.GetHashCode();
         hashCode = (hashCode * 397) ^ ThresholdID.GetHashCode();
         hashCode = (hashCode * 397) ^ MonitoredAgentID.GetHashCode();
         hashCode = (hashCode * 397) ^ Created.GetHashCode();
         hashCode = (hashCode * 397) ^ Modified.GetHashCode();
         hashCode = (hashCode * 397) ^ Online.GetHashCode();
         hashCode = (hashCode * 397) ^ (ReportedFromIP != null ? ReportedFromIP.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AppViewUrl != null ? AppViewUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Motherboard != null ? Motherboard.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Processor != null ? Processor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Memory.GetHashCode();
         hashCode = (hashCode * 397) ^ (Display != null ? Display.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Sound != null ? Sound.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProcessorCoresCount.GetHashCode();
         hashCode = (hashCode * 397) ^ (SystemDrive != null ? SystemDrive.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProcessorClock != null ? ProcessorClock.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Vendor != null ? Vendor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VendorSerialNumber != null ? VendorSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VendorBrandModel != null ? VendorBrandModel.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProductName != null ? ProductName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OS != null ? OS.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OSType != null ? OSType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OSVersion != null ? OSVersion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OSBuild != null ? OSBuild.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (WindowsSerialNumber != null ? WindowsSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Office != null ? Office.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OfficeSP != null ? OfficeSP.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OfficeOEM.GetHashCode();
         hashCode = (hashCode * 397) ^ (OfficeSerialNumber != null ? OfficeSerialNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OfficeFullVersion != null ? OfficeFullVersion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastLoginUser != null ? LastLoginUser.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HardwareDisks?.Sum(x => x.GetHashCode()) ?? 0);
         hashCode = (hashCode * 397) ^ (MacAddresses?.Sum(x => x.GetHashCode()) ?? 0);
         hashCode = (hashCode * 397) ^ (IpAddresses?.Sum(x => x.GetHashCode()) ?? 0);
         return(hashCode);
     }
 }
Exemple #5
0
        public static byte[] GetMachineID(string userId)
        {
            var machineId = new MachineID();

            machineId.SetBB3(GetHexString(Encoding.UTF8.GetBytes(userId + "Machine")));
            machineId.SetFF2(GetHexString(Encoding.UTF8.GetBytes(userId + "Mac")));
            machineId.Set3B3(GetHexString(Encoding.UTF8.GetBytes(userId + "Disk")));

            using (MemoryStream ms = new MemoryStream())
            {
                machineId.WriteToStream(ms);

                return(ms.ToArray());
            }
        }
Exemple #6
0
        public override void SetBasicPropertyValues()
        {
            base.SetBasicPropertyValues();

            //默认ModuleNumber由ID决定
            ModuleNumber = ID;
            ResourceProperty propertyValue;

            for (int i = 0; i < ListProperties.Count; i++)
            {
                propertyValue = ListProperties[i];
                switch (propertyValue.PropertyID)
                {
                case S1110Consts.PROPERTYID_HOSTADDRESS:
                    propertyValue.Value = HostAddress;
                    break;

                case S1110Consts.PROPERTYID_HOSTNAME:
                    propertyValue.Value = HostName;
                    break;

                case S1110Consts.PROPERTYID_HOSTPORT:
                    propertyValue.Value = HostPort.ToString();
                    break;

                case S1110Consts.PROPERTYID_CONTINENT:
                    propertyValue.Value = Continent;
                    break;

                case S1110Consts.PROPERTYID_COUNTRY:
                    propertyValue.Value = Country;
                    break;

                case S1110Consts.PROPERTYID_MODULENUMBER:
                    propertyValue.Value = ModuleNumber.ToString();
                    break;

                case S1110Consts.PROPERTYID_ENABLEDISABLE:
                    propertyValue.Value = IsEnabled ? "1" : "0";
                    break;

                case S1110Consts.PROPERTYID_MACHINE:
                    propertyValue.Value = MachineID.ToString();
                    break;
                }
            }
        }
Exemple #7
0
        static MachineID GenerateMachineID()
        {
            // the aug 25th 2015 CM update made well-formed machine MessageObjects required for logon
            // this was flipped off shortly after the update rolled out, likely due to linux steamclients running on distros without a way to build a machineid
            // so while a valid MO isn't currently (as of aug 25th) required, they could be in the future and we'll abide by The Valve Law now

            var machineId = new MachineID();

            MachineInfoProvider provider = MachineInfoProvider.GetProvider();

            machineId.SetBB3(GetHexString(provider.GetMachineGuid()));
            machineId.SetFF2(GetHexString(provider.GetMacAddress()));
            machineId.Set3B3(GetHexString(provider.GetDiskId()));

            // 333 is some sort of user supplied data and is currently unused

            return(machineId);
        }
Exemple #8
0
        static MachineID GenerateMachineID(object?state)
        {
            // the aug 25th 2015 CM update made well-formed machine MessageObjects required for logon
            // this was flipped off shortly after the update rolled out, likely due to linux steamclients running on distros without a way to build a machineid
            // so while a valid MO isn't currently (as of aug 25th) required, they could be in the future and we'll abide by The Valve Law now

            var provider = (IMachineInfoProvider)state !;

            var machineId = new MachineID();

            // Custom implementations can fail for any particular field, in which case we fall back to DefaultMachineInfoProvider.
            machineId.SetBB3(GetHexString(provider.GetMachineGuid() ?? DefaultMachineInfoProvider.Instance.GetMachineGuid()));
            machineId.SetFF2(GetHexString(provider.GetMacAddress() ?? DefaultMachineInfoProvider.Instance.GetMacAddress()));
            machineId.Set3B3(GetHexString(provider.GetDiskId() ?? DefaultMachineInfoProvider.Instance.GetDiskId()));

            // 333 is some sort of user supplied data and is currently unused

            return(machineId);
        }
Exemple #9
0
        public static byte[] GenerateMachineID()
        {
            // the aug 25th 2015 CM update made well-formed machine MessageObjects required for logon
            // this was flipped off shortly after the update rolled out, likely due to linux steamclients running on distros without a way to build a machineid
            // so while a valid MO isn't currently (as of aug 25th) required, they could be in the future and we'll abide by The Valve Law now

            var machineId = new MachineID();

            using (var ms = new MemoryStream())
            {
                // TODO: each field should ideally be a different set of identifying information, but we'll just temporarily use machineguids for all three
                machineId.BB3     = GetMachineGuid();
                machineId.FF2     = GetMachineGuid();
                machineId.ThreeB3 = GetMachineGuid();

                machineId.WriteToStream(ms);

                return(ms.ToArray());
            }
        }
Exemple #10
0
        public static string GenerateRandomMachineID()
        {
            var machineId = new MachineID();

            MachineInfoProvider provider = new RandomInfoProvider();



            machineId.SetBB3(GetHexString(provider.GetMachineGuid()));
            machineId.SetFF2(GetHexString(provider.GetMacAddress()));
            machineId.Set3B3(GetHexString(provider.GetDiskId()));

            // 333 is some sort of user supplied data and is currently unused

            byte[] buffer;
            using (MemoryStream ms = new MemoryStream())
            {
                machineId.WriteToStream(ms);

                buffer = ms.ToArray();
            }

            return(Convert.ToBase64String(buffer));
        }
Exemple #11
0
        static MachineID GenerateMachineID()
        {
            // the aug 25th 2015 CM update made well-formed machine MessageObjects required for logon
            // this was flipped off shortly after the update rolled out, likely due to linux steamclients running on distros without a way to build a machineid
            // so while a valid MO isn't currently (as of aug 25th) required, they could be in the future and we'll abide by The Valve Law now

            var machineId = new MachineID();

            MachineInfoProvider provider = MachineInfoProvider.GetProvider();

            machineId.SetBB3( GetHexString( provider.GetMachineGuid() ) );
            machineId.SetFF2( GetHexString( provider.GetMacAddress() ) );
            machineId.Set3B3( GetHexString( provider.GetDiskId() ) );

            // 333 is some sort of user supplied data and is currently unused

            return machineId;
        }
Exemple #12
0
 internal void SetLoginInformation(int nexonSN, string nexonID, string characterID, IPAddress localAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, int gameRoomClient, byte channelCode)
 {
     if (FeatureMatrix.IsEnable("NaverChanneling"))
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendFormat("{0};{1}", channelCode, nexonID);
         this.NexonID = stringBuilder.ToString();
     }
     else
     {
         this.NexonID = nexonID;
     }
     this.NexonSN        = nexonSN;
     this.CharacterID    = characterID;
     this.LocalAddress   = localAddress;
     this.RemoteAddress  = remoteAddress;
     this.CanTry         = canTry;
     this.IsTrial        = isTrial;
     this.MID            = machineID;
     this.GameRoomClient = gameRoomClient;
     this.SessionNo      = -1L;
     this.NexonID_forLog = nexonID;
     try
     {
         using (LogDBDataContext logDBDataContext = new LogDBDataContext())
         {
             long?num = new long?(-1L);
             logDBDataContext.AddLoginJournal(ref num);
             this.JournalID = num.Value;
         }
     }
     catch (Exception ex)
     {
         Log <CafeAuth> .Logger.Error(ex);
     }
 }
Exemple #13
0
 public override string ToString()
 {
     return(MachineID.ToString());
 }
Exemple #14
0
        public AsyncResultSync BeginLogin(string nexonID, string characterID, IPAddress loginAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, int gameRoomClient, object state)
        {
            if (!this.Valid)
            {
                return(null);
            }
            AsyncResultSync asyncResultSync = new AsyncResultSync(base.Thread);

            this.connection.BeginLogin(nexonID, characterID, loginAddress, remoteAddress, canTry, isTrial, machineID, (gameRoomClient == 0) ? null : new int[]
            {
                gameRoomClient
            }, new AsyncCallback(asyncResultSync.AsyncCallback), state);
            return(asyncResultSync);
        }
Exemple #15
0
        internal AsyncResultSync BeginLogin(string nexonID, string characterID, IPAddress localAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, int gameRoomClient, object state)
        {
            this.valid         = true;
            this.NexonID       = nexonID;
            this.CharacterID   = characterID;
            this.RemoteAddress = remoteAddress;
            this.CanTry        = canTry;
            CafeAuth cafeAuth;

            if (this.Service.NxIDToEntityDic.TryGetValue(this.NexonID, out cafeAuth))
            {
                cafeAuth.ForceClose();
            }
            this.Service.NxIDToEntityDic.Add(this.NexonID, this);
            return(this.Service.BeginLogin(nexonID, characterID, localAddress, remoteAddress, canTry, isTrial, machineID, gameRoomClient, state));
        }
Exemple #16
0
 public Login(string nexonID, string characterID, IPAddress localAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, ICollection <int> gameRoomClients)
 {
     this.NexonID         = nexonID;
     this.CharacterID     = characterID;
     this.LocalAddress    = localAddress;
     this.RemoteAddress   = remoteAddress;
     this.CanTry          = canTry;
     this.IsTrial         = isTrial;
     this.MachineID       = machineID;
     this.GameRoomClients = gameRoomClients;
 }
Exemple #17
0
 public Login(int nexonSN, string nexonID, string characterID, IPAddress localAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, int gameRoomClient, byte channelCode)
 {
     this.NexonSN        = nexonSN;
     this.NexonID        = nexonID;
     this.CharacterID    = characterID;
     this.LocalAddress   = localAddress;
     this.RemoteAddress  = remoteAddress;
     this.CanTry         = canTry;
     this.IsTrial        = this.IsTrial;
     this.MachineID      = machineID;
     this.GameRoomClient = gameRoomClient;
     this.ChannelCode    = channelCode;
 }
Exemple #18
0
        public bool VerifyLicence(out string message)
        {
            // 1- Try to load licence from licence file.
            LicUtils      utils = new LicUtils();
            PragmaLicense lic   = LoadLicence();

            message = String.Empty;


            // 2- No licence file.
            if (lic == null)
            {
                message = "No license found.\r\n";
                //message = _licFile;
                return(false);
            }

            // 2- Verify the licence.
            try
            {
                if (!utils.VerifyLicense(_licFile))
                {
                    message = "You are trying to use an invalid license.\r\nPlease visit www.PragmaSQL.com to purchase a valid license.";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                message = "Error:" + ex.Message;
                return(false);
            }

            MachineID current = MachineIdProvider.Retrieve(lic.MachineIdType);

            if (current.Key != lic.MachineKey.Key)
            {
                message = "You are trying to use a license which was not issued to you.\r\nPlease visit www.PragmaSQL.com to purchase a valid license.";
                return(false);
            }

            if (new ProductInfo().CurrentCodeName != lic.ProductCodeName)
            {
                message = "You are trying to use a license which was not issued for this version.\r\nPlease visit www.PragmaSQL.com to purchase a valid license.";
                return(false);
            }

            // 3- If licence is a demo licence check existance of the expire file
            if (lic.PurchaseType == PurchaseType.Demo)
            {
                try
                {
                    if (!File.Exists(_demoExpireFile))
                    {
                        message = "Demo expire date can not be determined!\r\nPlease visit www.PragmaSQL.com to purchase a license.";
                        return(false);
                    }

                    if (!ExpireDemoLicence(lic))
                    {
                        message = "Your demo period expired!\r\nPlease visit www.PragmaSQL.com to purchase a license.";
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                    return(false);
                }
            }

            return(true);
        }