+2008-12-12 Dean Brettle <dean@brettle.com>
+
+ * System.Web.dll.sources: deleted
+ System.Web.Configuration_2.0/CapabilitiesChecksum.cs
+
+ * Makefile (RESOURCE_FILES_2): deleted
+ System.Web.Configuration_2.0/RandomRoboBotKeywords.txt
+
2008-12-10 Marek Habersack <mhabersack@novell.com>
* Makefile (TEST_RESOURCE_FILES): added
resources/transparent.gif \
resources/webform.js \
resources/WebUIValidation_2.0.js \
- System.Web.Configuration_2.0/RandomRoboBotKeywords.txt \
System.Web.UI.WebControls/GridView.js \
System.Web.UI.WebControls/DetailsView.js \
System.Web.UI.WebControls/TreeView.js \
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
internal abstract class CapabilitiesBuild : ICapabilitiesProcess
{
- /// <summary>
- /// A list of all headers, that the Browser Detective Code will possibly access.
- /// </summary>
- System.Collections.ObjectModel.Collection<string> AllPossibleheaders;
/// <summary>
///
/// </summary>
/// <param name="initialCapabilities"></param>
/// <returns></returns>
public abstract System.Web.Configuration.CapabilitiesResult Process(System.Collections.Specialized.NameValueCollection header, System.Collections.IDictionary initialCapabilities);
- /// <summary>
- /// Creates a Checksum from the Header values used by the Browser Detection System.
- /// </summary>
- /// <param name="header">List of Header name/value pairs</param>
- /// <returns>checksum value to be used for caching/duplicate checks</returns>
- public virtual string HeaderChecksum(System.Collections.Specialized.NameValueCollection header)
- {
- if (AllPossibleheaders == null)
- {
- AllPossibleheaders = this.HeaderNames(new System.Collections.ObjectModel.Collection<string>());
- }
- System.IO.MemoryStream stream = new System.IO.MemoryStream();
- System.IO.StreamWriter writer = new System.IO.StreamWriter(stream, System.Text.Encoding.Default);
-
- for (int i = 0;i <= AllPossibleheaders.Count - 1;i++)
- {
- if (String.IsNullOrEmpty(header[AllPossibleheaders[i]]) == false)
- {
- writer.WriteLine(header[AllPossibleheaders[i]]);
- }
- }
- writer.Flush();
- byte[] array = stream.ToArray();
- writer.Close();
- return CapabilitiesChecksum.BuildChecksum(array);
- }
- /// <summary>
- /// Provides a Method to Load the Browser Detection class with a default Data file that is
- /// embeded in the dll.
- /// </summary>
- public abstract void LoadDefaultEmbeddedResource();
-
- public virtual string DataFileVersion
- {
- get
- {
- return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
- }
- }
}
}
#endif
+++ /dev/null
-#if NET_2_0
-/*
-Used to determine Browser Capabilities by the Browsers UserAgent String and related
-Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-using System;
-using System.Collections;
-using System.Text;
-
-namespace System.Web.Configuration
-{
- internal sealed class CapabilitiesChecksum
- {
- public CapabilitiesChecksum()
- {
- }
-
- public static string BuildChecksum(string raw)
- {
- byte[] array = System.Text.Encoding.Default.GetBytes(raw.ToCharArray());
- array = System.Security.Cryptography.MD5.Create().ComputeHash(array);
- string[] c = new string[array.Length];
- for (int i = 0;i <= array.Length - 1;i++)
- {
- c[i] = CapabilitiesChecksum.Hex(array[i]);
- }
- array = null;
- return string.Join("", c);
- }
-
- public static string BuildChecksum(byte[] array)
- {
- array = System.Security.Cryptography.MD5.Create().ComputeHash(array);
- string[] c = new string[array.Length];
- for (int i = 0;i <= array.Length - 1;i++)
- {
- c[i] = CapabilitiesChecksum.Hex(array[i]);
- }
- array = null;
- return string.Join("", c);
- }
-
- //
- // The original version of the code returned the hex half-octets reversed (e.g. if
- // b == 0xF2, 0x2F would be returned) for some reason. This version keeps this
- // convention.
- //
- static string Hex (byte b)
- {
- char[] list = new char[] {MapToHex ((byte)(b & 0x0F)), MapToHex ((byte)((b & 0xF0) >> 4))};
- return new String (list, 0, 2);
- }
-
- static char MapToHex (byte b)
- {
- if (b >= 0 && b <= 9)
- return (char)(b + 0x30);
-
- if (b >= 10 && b <= 16)
- return (char)(b + 0x37);
-
- throw new System.ArgumentException ("Unexpected error.");
- }
- }
-}
-#endif
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
internal class CapabilitiesResult : System.Web.HttpBrowserCapabilities
{
- static string[] RandomRoboBotKeywords;
-
/// <summary>
/// Initializes a new instance of the Result class.
/// </summary>
Capabilities ["browsers"] = new ArrayList ();
}
- static CapabilitiesResult () {
- //---------------------------------------------------------------
- //Copies out a list of keywords stored in an Embeded file, which
- //will be used to help determine if a browser is
- //IsRandomRoboBotUserAgent.
- //---------------------------------------------------------------
- Assembly asm = Assembly.GetExecutingAssembly();
- Stream CP = asm.GetManifestResourceStream("RandomRoboBotKeywords.txt");
- using (StreamReader Read = new StreamReader(CP, System.Text.Encoding.Default)) {
- RandomRoboBotKeywords = System.Text.RegularExpressions.Regex.Split(Read.ReadToEnd(), System.Environment.NewLine);
- }
- }
-
/// <summary>
///
/// </summary>
return item;
}
/// <summary>
- /// Gets the Operating System that the browser is running on.
- /// </summary>
- public string OS
- {
- get
- {
- return this["os"];
- }
- }
- /// <summary>
- /// Gets the browsers Build.
- /// </summary>
- public string BrowserBuild
- {
- get
- {
- return this["BrowserBuild"];
- }
- }
- /// <summary>
- /// Name of the Browser Rendering Engine, when known.
- /// </summary>
- public string BrowserRenderingEngine
- {
- get
- {
- return this["HtmlEngine"];
- }
- }
- /// <summary>
- /// Gets if the Browser was identified as a bot, as a mater of elimination of all other possible
- /// options currently availible.
- /// </summary>
- public bool IsRobot
- {
- get
- {
- if (string.Compare(this["IsMobileDevice"], "true", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return false;
- }
- else if (string.Compare(this["IsBot"], "true", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- else if (string.Compare(this["crawler"], "true", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- else if (string.Compare(this["Unknown"], "true", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- else if (string.Compare(this.Browser, "Unknown", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- else if (string.Compare(this.Browser, "IE", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- //too many fake IE's out there this should remove a few of the low
- //hanging fruit.
- if (string.IsNullOrEmpty(this.Platform) == true)
- {
- return true;
- }
- else if (string.Compare(this.Platform, "Unknown", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- else if (string.Compare(this[""], "....../1.0", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- //I hate Scrapters This one hit me today. Lets see how it like it now geting 403's
- return true;
- }
-
- }
- return false;
- }
- }
- public bool IsSyndicationReader
- {
- get
- {
- if (string.Compare(this["IsSyndicationReader"], "true", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- return false;
- }
- }
- public bool IsUnknown
- {
- get
- {
- if (string.Compare(this["Unknown"], "true", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
- {
- return true;
- }
- return false;
- }
- }
- /// <summary>
- /// Used to Identify Robobots that are using randomly generated Useragents
- /// that are nonsensical in nature/gibberish.
- /// </summary>
- /// <remarks>
- /// Current implementation is more of an elimination of common traits, which
- /// most Useragent/browser have. Which leave us with what can be assumed as
- /// randomized useragent names, which serve no purpose cept to drive stats
- /// programs nuts.
- /// </remarks>
- public bool IsRandomRobobotUserAgent
- {
- get
- {
- #region Check for Common Words in UserAgents
- //---------------------------------------------------------------
- //Quick Checks to see if the Bot has been identified by a name
- //from the headers provided.
- //---------------------------------------------------------------
- if (this.IsRobot == false)
- {
- //---------------------------------------------------------------
- //Since we can determine its not a Robot. We must have enough
- //details to prove its not a random useragent, and we move on.
- //---------------------------------------------------------------
- return false;
- }
- else if (this.IsSyndicationReader == true)
- {
- //---------------------------------------------------------------
- //Since we can determine its not a Rss/Atom Feed Reader. We must
- //have enough details to prove its not a random useragent, and we
- //move on.
- //---------------------------------------------------------------
- return false;
- }
- else if (string.Compare(this.Browser, "Unknown", true, System.Globalization.CultureInfo.CurrentCulture) != 0)
- {
- //---------------------------------------------------------------
- //Browser name was able to be determined then the Useragent had
- //enough details, thus not a random Useragent.
- //---------------------------------------------------------------
- return false;
- }
- else if (string.Compare(this.Platform, "Unknown", true, System.Globalization.CultureInfo.CurrentCulture) != 0)
- {
- //---------------------------------------------------------------
- //Assume if a platform was able to be determine then the Useragent
- //is more then likely not randomized name.
- //---------------------------------------------------------------
- return false;
- }
- else if (string.IsNullOrEmpty(this.UserAgent) == true)
- {
- //---------------------------------------------------------------
- //Null or empty. ^he Programer was just to lazy which to give it a
- //name, which is fine with me but doesn't not count as a Randomized
- //Browser Agent, since it doesn't have a Useragent at all to begin
- //with.
- //---------------------------------------------------------------
- return false;
- }
-
- //---------------------------------------------------------------
- //I assume ones under 8 charactors are not really randomly named
- //but the coder was just lazy or picked a short name.
- //---------------------------------------------------------------
- if (this.UserAgent.Length < 8)
- {
- return false;
- }
-
- //---------------------------------------------------------------
- //Up to this point I have not seen a randomly generated Agent string
- //with a period in it.
- //---------------------------------------------------------------
- if (this.UserAgent.IndexOf('.') > -1)
- {
- return false;
- }
- //---------------------------------------------------------------
- //Compare keywords often found in useragents to the current useragent
- //and if we find one we assume its not a randomized useragent.
- //---------------------------------------------------------------
- foreach (string keyword in RandomRoboBotKeywords)
- {
- if (keyword.Length <= this.UserAgent.Length)
- {
- if (this.UserAgent.IndexOf(keyword, StringComparison.CurrentCultureIgnoreCase) != -1)
- {
- return false;
- }
- }
- }
- #endregion
- //---------------------------------------------------------------
- //Since it made it though all the checks I assume that the useragent
- //doesn't match any known format that I can determine, and label it
- //a randomized Useragent/browser. AKA SPAM / Scraper / Pests Bots.
- //---------------------------------------------------------------
- return true;
- }
- }
- /// <summary>
/// Gets the keys returned from processing.
/// </summary>
public System.Collections.Specialized.StringCollection Keys
+2008-12-12 Owen Brady <Ocean@owenbrady.net>
+
+ * nBrowser/File.cs, nBrowser/Identification.cs, nBrowser/Node.cs, nBrowser/NodeTypes.cs,
+ nBrowser/Result.cs, nBrowser/Build.cs, nBrowser/Exception.cs, CapabilitiesBuild.cs,
+ CapabilitiesResult.cs: Updated Copyright information to include updated contact information.
+
+ * nBrowser/Build.cs: Removed LoadDefaultEmbeddedResource function, the embeded resource
+ it is referring too was never included in Mono. And was designed for a free standing
+ browser identification libary.
+
+ * nBrowser/Exception.cs: Removed Compile Attributes and related comments which were left
+ in from the original free standing browser libary.
+
+ * CapabilitiesBuild.cs: Removed Header Checksum related coding since it is not required
+ for the Mono implementation.
+
+ * CapabilitiesResult.cs: Updated Copyright information to include updated contact information.
+ Removed functions which were designed to make use of features of a embeded browser file which
+ is not present in Mono.
+
+ * CapabilitiesChecksum.cs, RandomRoboBotKeywords.txt: Deleted
2008-11-22 Gonzalo Paniagua Javier <gonzalo@novell.com>
+++ /dev/null
-/
-\
-_
-Agent
-Auto
-beta
-book
-bot
-Browse
-bug
-build
-check
-class
-client
-cold
-College
-compatible
-Contribute
-crawl
-Desktop
-discovery
-Download
-Eudora
-example
-explore
-favorg
-Fetch
-file
-finder
-flash
-form
-fox
-free
-Friend
-get
-google
-http
-IE
-Illinois
-Iltrovatore
-Internet
-java
-K-Meleon
-know
-Library
-link
-linux
-load
-locate
-locator
-Lycos
-lynx
-main
-manager
-MASTER
-microsoft
-mind
-Moozilla
-mozilla
-MSIE
-net
-Netscape
-nokia
-Norton
-null
-OpenBSD
-Opera
-play
-Plucker
-Post
-power
-Program
-project
-pure
-proxy
-QuickTime
-Redirector
-Scanner
-scooter
-scrape
-search
-server
-Service
-Site
-sight
-shout
-state
-Sleipnir
-slurp
-Snoopy
-spider
-SPY
-Surf
-source
-telnet
-teoma
-test
-THE
-tool
-tracker
-Tunnel
-Unix
-Update
-URL
-Verified
-Version
-Vista
-Web
-winamp
-Windows
-work
-Xenu
-XML
-Yahoo
-Zeus
-zip
-world
-light
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
{
return this.Browser().HeaderNames(list);
}
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override void LoadDefaultEmbeddedResource()
- {
- System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
- System.IO.Stream CP;
- CP = asm.GetManifestResourceStream("System.Web.Configuration.Resources.CodeProject.browser");
- System.Xml.XmlDocument Doc = new System.Xml.XmlDocument();
- Doc.Load(CP);
- CP.Close();
-
- this.AddBrowserFile(Doc, "System.Web.Configuration.Resources.CodeProject.browser");
- }
}
}
#endif
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
{
using System;
using System.Runtime.Serialization;
- [
- System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable"),
- System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")
- ]
internal class Exception : System.Exception
{
public Exception()
}
}
}
-/*
-Turns off the following Warning in FxCop
---------------------------------------------------------------------------------------------------------------------
-[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")]
-The System.Runtime.Serialization.ISerializable interface allows the type to customize its serialization, while
-the Serializable attribute enables the common language runtime to recognize the type as being serializable."
---------------------------------------------------------------------------------------------------------------------
-System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")
-Multiple constructors are required to correctly implement a custom exception. Missing constructors can make your
-exception unusable in certain scenarios. For example, the serialization constructor is required for handling
-exceptions in XML Web services.
---------------------------------------------------------------------------------------------------------------------
-*/
#endif
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
/*
Used to determine Browser Capabilities by the Browsers UserAgent String and related
Browser supplied Headers.
-Copyright (C) 2002-Present Owen Brady (Ocean at xvision.com)
+Copyright (C) 2002-Present Owen Brady (Ocean at owenbrady dot net)
+and Dean Brettle (dean at brettle dot com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
../Managed.Windows.Forms/System.Resources/ResXDataNode.cs
../Managed.Windows.Forms/System.Resources/ResXNullRef.cs
System.Web.Configuration_2.0/CapabilitiesBuild.cs
-System.Web.Configuration_2.0/CapabilitiesChecksum.cs
System.Web.Configuration_2.0/CapabilitiesResult.cs
System.Web.Configuration_2.0/ICapabilitiesProcess.cs
System.Web.Configuration_2.0/nBrowser/Result.cs