<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      URTracker 2.11版 license驗證原理剖析

      [摘要]注 :原創,轉載請注明出處。作 者:草惜草首 發: http://kokey.blogchina.com序言: 看了henryouly的文章以后深受啟發,決定對URTracker最新的版本來個剖析。在此,特別感謝henryouly!××××...
      注    :原創,轉載請注明出處。
      作 者:草惜草
      首 發: http://kokey.blogchina.com

      序言:

         看了henryouly的文章以后深受啟發,決定對URTracker最新的版本來個剖析。在此,特別感謝henryouly!

      ×××××××××××××××××××××××××××××××××××××××××××××
      URTracker事務跟蹤系統是一款功能強大而且易于使用的Web方式的協同工作軟件 。它用于幫助公司和團隊跟蹤工作中的問題,管理和記錄這些問題的處理過程。
      URTracker向您的團隊提供了一個全功能的,高度可定制的軟件工具用于報告和跟蹤問題、需求、缺陷(BUG)或者任務等事務。它擁有豐富的自定義字段、基于項目和角色的權限控制、簡化的工作流、友好的用戶界面,以及更多的其他特性。我們非常確信您將會喜歡上URTracker,因為我們相信她正是您所需要的。
       ××××××××××××××××××××××××××××××××××××××××××××
       工具介紹:
       
         要研究.NET當然離不開Reflector for .NET 。(Reflector is a class browser for .NET components. It supports assembly and namespace views, type and member search, XML documentation, call and callee graphs, IL, Visual Basic, Delphi and C# decompiler, dependency trees, base type and derived type hierarchies and resource viewers. )
         如果想把代碼保存下來,那就需要Reflector的插件Reflector.FileDisassembler了。(The Reflector.FileDisassembler is a little add-in for the new version of Lutz Roeder's .NET Reflector that you can use to dump the decompiler output to files of any Reflector supported language (C#, VB.NET, Delphi). This is extremely useful if you are searching for a specific line of code as you can use VS.NET's "Find in Files" or want to convert a class from one language to another.

        下載地址:Reflector for .NET   http://www.aisto.com/roeder/dotnet/
                            Reflector.FileDisassembler    http://www.denisbauer.com/NETTools/FileDisassembler.aspx
       
       正文:

      嚴重聲明:本文只作科研和學習用途。如果由本文產生的法律糾紛,一概與本人無關。

      好了,了解了Reflector咱們就可以動手研究URTracker了。

      當然首先用Reflector分析bin文件夾下的文件,一共有12個DLL文件,從他們的名稱你也可以猜出個八八九九,反正你不怕麻煩你就挨個用Reflector試好了...^_^
      最后找到了WebTracker.dll 可疑,因為在Reflector按F3,你可以搜索到很多關于license的東東。哈哈,探究之路開始了。
      首先看看Lealsoft.URTracker.BLL下有個ServerLicenseProvider類。

      public class ServerLicenseProvider : LicenseProvider
      {
            // Methods
            static ServerLicenseProvider();
            public ServerLicenseProvider();
            protected virtual ServerLicense CreateEmptyLicense(Type type);
            protected virtual ServerLicense CreateLicense(Type type, string key);
            public override License GetLicense(LicenseContext context, Type type, object instance, bool allowExceptions);
            protected virtual string GetLicenseData(Type type);
            protected virtual Stream GetLicenseDataStream(Type type);
            protected virtual bool ValidateLicense(ServerLicense license, out string errorMessage);
            protected virtual bool ValidateLicenseData(Type type, string licenseData);

            // Fields
            private static readonly ServerLicenseCollector LicenseCollector;

            // Nested Types
            private sealed class ServerLicenseCollector
            {
                  // Methods
                  public ServerLicenseCollector();
                  public void AddLicense(Type objectType, ServerLicense license);
                  public ServerLicense GetLicense(Type objectType);
                  public void RemoveLicense(Type objectType);

                  // Fields
                  private IDictionary _collectedLicenses;
            }
      }
       
      看到沒,有幾個CreateLicense,GetLicense,ValidateLicense ,ValidateLicenseData,GetLicenseDataStream這幾個方法。好,打開看看都是什么東東。

      protected virtual ServerLicense CreateLicense(Type type, string key)
      {
            char[] chArray1 = new char[1] { ':' } ;
            string[] textArray1 = key.Split(chArray1);
            return new URTrackerLicense(type, key, long.Parse(textArray1[1], CultureInfo.InvariantCulture), long.Parse(textArray1[2], CultureInfo.InvariantCulture), textArray1[3], long.Parse(textArray1[4], CultureInfo.InvariantCulture), long.Parse(textArray1[5], CultureInfo.InvariantCulture), textArray1[6]);
      }
       
      哇!就是新建license,URTrackerLicense后面有幾個參數,什么也看不出,感覺是要用":"split開一個字符串。來,打開URTrackerLicense構造函數看看。
      public URTrackerLicense(Type type, string key, long startTicks, long ticks, string username, long userIndex, long clientCount, string mac) : base(type, key)
      {
            this._foundMac = false;
            this._ticks = ticks;
            this._startTicks = startTicks;
            this._username = username;
            this._userIndex = userIndex;
            this._clientCount = clientCount;
            this._mac = mac;
            this._macArray = URTrackerLicense.GetMacArray();
            this._foundMac = this._macArray.IndexOf(this._mac) > -1;
      }
       
      哦,看到ticks,startTicks,username,userIndex,clientCount,mac
      難道這些就是所需參數"到期時間,使用開始時間,用戶名,用戶名索引,用戶數,本機網卡地址"
      有點意思了。呵呵。
      找到了 URTrackerLicense 類,你就會知道我們猜測的沒有錯了。
      public class URTrackerLicense : ServerLicense
      {
            // Methods
            public URTrackerLicense(Type type, string key, long startTicks, long ticks, string username, long userIndex, long clientCount, string mac);
            public static ArrayList GetMacArray();

            // Properties
            public long ClientCount { get; }
            public bool IsExpired { get; }
            public string Mac { get; }
            public long StartTicks { get; }
            public long Ticks { get; }
            public long UserIndex { get; }
            public string Username { get; }

            // Fields
            private long _clientCount;
            private bool _foundMac;
            private string _mac;
            private ArrayList _macArray;
            private long _startTicks;
            private long _ticks;
            private long _userIndex;
            private string _username;
      }
       
      繼續,剛才找了CreateLicense,現在開始找ValidateLicenseData。
      protected virtual bool ValidateLicenseData(Type type, string licenseData)
      {
            bool flag1 = false;
            char[] chArray1 = new char[1] { ':' } ;
            string[] textArray1 = licenseData.Split(chArray1);
            if (textArray1.Length == 7)
            {
                  return (string.Compare("URTracker1Licensed", textArray1[0], true, CultureInfo.InvariantCulture) == 0);
            }
            return flag1;
      }
       
      哈哈,就是說剛才分析那個數組中textArray1[0],必須是URTracker1Licensed!哈哈,這也進一步證實了我們要把注冊信息字符串用":"分開的設想。
      Come on!離成功越來越近了!接著分析ValidateLicense。
      protected virtual bool ValidateLicense(ServerLicense license, out string errorMessage)
      {
            errorMessage = null;
            URTrackerLicense license1 = (URTrackerLicense) license;
            if (license1.IsExpired)
            {
                  errorMessage = "The License has expired.";
                  return false;
            }
            return true;
      }
       
      哦,知道了!原來是判斷URTrackerLicense的屬性IsExpired的真假!好,咱們看看屬性IsExpired。
      public bool IsExpired
      {
            get
            {
                  if ((DateTime.Today.Ticks <= this._ticks) && (DateTime.Now.Ticks >= this._startTicks))
                  {
                        return !this._foundMac;
                  }
                  return true;
            }
      }
       
       知道了吧!就是判斷當前時間要在ticks和startTicks之間!然后再判斷Mac的值。
       現在查找Mac的相關類或者方法。找到了GetMacArray
       public static ArrayList GetMacArray()
      {
            ManagementClass class1 = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection collection1 = class1.GetInstances();
            ArrayList list1 = new ArrayList();
            using (ManagementObjectCollection.ManagementObjectEnumerator enumerator1 = collection1.GetEnumerator())
            {
                  while (enumerator1.MoveNext())
                  {
                        ManagementObject obj1 = enumerator1.get_Current();
                        if ((bool) obj1.get_Item("IPEnabled"))
                        {
                              list1.Add(obj1.get_Item("MacAddress").ToString().Replace(":", "").ToUpper());
                        }
                        obj1.Dispose();
                  }
            }
            return list1;
      }


      [1] [2]  下一頁




      日韩精品一区二区三区高清