Example #1
0
        internal string GetRandomDomainName()
        {
            try
            {
            ECTime OldDate = new ECTime();
            OldDate.SetToNow();
            OldDate.AddMinutes( -(60 * 24 * 90)); // Go back 90 days.
            ulong OldDateIndex = OldDate.GetIndex();

            // A limited while( true ) that won't go forever.
            for( int Count = 0; Count < 10000; Count++ )
              {
              int Index = MForm.GetRandomNumber();
              Index = Index % DomainX509RecArrayLast;
              DomainX509Record Rec = DomainX509RecArray[Index];
              if( Rec.GetModifyTimeIndex() > OldDateIndex )
            continue; // Don't get a recently used one.

              // if( anything else )
            // continue;

              // return "127.0.0.1"; // For testing with local loopback.
              // return "promocodeclub.com"; // Good for testing X.509.
              return "secure.ballantinecommunications.net";
              // return "schneier.com"; //  Bruce Schneier, the cryptographer.
              // return "vantiv.com";

              // return Rec.DomainName;
              }

            return ""; // It shouldn't get here.

            }
            catch( Exception Except )
              {
              MForm.ShowStatus( "Exception in GetRandomDomainName():" );
              MForm.ShowStatus( Except.Message );
              return "";
              }
        }
Example #2
0
        internal bool ClearMidnightValues()
        {
            try
            {
            // The IP stuff is also kept in the server log.
            ECTime RecTime = new ECTime();
            ECTime OldTime = new ECTime();
            OldTime.SetToNow();
            OldTime.AddMinutes( -(60 * 24 * 30)); // 30 days.
            ulong OldIndex = OldTime.GetIndex();

            SortedDictionary<string, IPStatusRec> TempIPsDictionary = new SortedDictionary<string, IPStatusRec>();

            foreach( KeyValuePair<string, IPStatusRec> Kvp in IPsDictionary )
              {
              RecTime.SetFromIndex( Kvp.Value.TimeIndex );
              if( RecTime.GetIndex() < OldIndex )
            continue;

              // Keep totals on things like bad reg key count.
              IPStatusRec Rec = Kvp.Value;
              Rec.TimedOutCount = 0;
              Rec.GoodWebRequestCount = 0;
              // TotalGoodWebRequestCount
              // BadWebPageCount
              Rec.GetPublicKeyCount = 0;
              // Rec.TotalGetPublicKeyCount
              Rec.ConfirmBillingCount = 0;
              // Rec.TotalConfirmBillingCount

              TempIPsDictionary[Kvp.Key] = Rec;
              }

            IPsDictionary = TempIPsDictionary;
            return true;

            }
            catch( Exception Except )
              {
              MForm.ShowStatus( "Exception in ClearMidnightValues():" );
              MForm.ShowStatus( Except.Message );
              return false;
              }
        }