All Projects → nager → Nager.publicsuffix

nager / Nager.publicsuffix

Licence: mit
.NET publicsuffix domain parser

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Nager.publicsuffix

Password Validator
Validates password according to flexible and intuitive specification
Stars: ✭ 224 (+234.33%)
Mutual labels:  validation-library, validate
Vee Validate
✅ Form Validation for Vue.js
Stars: ✭ 8,820 (+13064.18%)
Mutual labels:  validation-library, validate
FilterInputJs
Tiny and Powerful Library for limit an entry (text box,input) as number,string or more...
Stars: ✭ 37 (-44.78%)
Mutual labels:  validate, validation-library
Php Validate
Lightweight and feature-rich PHP validation and filtering library. Support scene grouping, pre-filtering, array checking, custom validators, custom messages. 轻量且功能丰富的PHP验证、过滤库。支持场景分组,前置过滤,数组检查,自定义验证器,自定义消息。
Stars: ✭ 225 (+235.82%)
Mutual labels:  validation-library, validate
reach-schema
Functional schema-driven JavaScript object validation library.
Stars: ✭ 34 (-49.25%)
Mutual labels:  validate, validation-library
vayder
Easy and concise validations for Express routes
Stars: ✭ 26 (-61.19%)
Mutual labels:  validate, validation-library
Tld.js
JavaScript API to work easily with complex domain names, subdomains and well-known TLDs.
Stars: ✭ 399 (+495.52%)
Mutual labels:  validation-library, subdomain
K8cscan
K8Cscan大型内网渗透自定义插件化扫描神器,包含信息收集、网络资产、漏洞扫描、密码爆破、漏洞利用,程序采用多线程批量扫描大型内网多个IP段C段主机,目前插件包含: C段旁注扫描、子域名扫描、Ftp密码爆破、Mysql密码爆破、Oracle密码爆破、MSSQL密码爆破、Windows/Linux系统密码爆破、存活主机扫描、端口扫描、Web信息探测、操作系统版本探测、Cisco思科设备扫描等,支持调用任意外部程序或脚本,支持Cobalt Strike联动
Stars: ✭ 693 (+934.33%)
Mutual labels:  subdomain
Fast Xml Parser
Validate XML, Parse XML to JS/JSON and vise versa, or parse XML to Nimn rapidly without C/C++ based libraries and no callback
Stars: ✭ 1,021 (+1423.88%)
Mutual labels:  validate
Subdomain3
A new generation of tool for discovering subdomains( ip , cdn and so on)
Stars: ✭ 605 (+802.99%)
Mutual labels:  subdomain
Domain hunter
A Burp Suite Extension that try to find all sub-domain, similar-domain and related-domain of an organization automatically! 基于流量自动收集整个企业或组织的子域名、相似域名、相关域名的burp插件
Stars: ✭ 594 (+786.57%)
Mutual labels:  subdomain
Creditcard
Creditcard number parsing, validation and information extraction
Stars: ✭ 52 (-22.39%)
Mutual labels:  validate
Ksubdomain
无状态子域名爆破工具
Stars: ✭ 976 (+1356.72%)
Mutual labels:  subdomain
Anubis
🔓Subdomain enumeration and information gathering tool
Stars: ✭ 722 (+977.61%)
Mutual labels:  subdomain
Jose
Universal "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK with no dependencies
Stars: ✭ 1,029 (+1435.82%)
Mutual labels:  validate
Subover
A Powerful Subdomain Takeover Tool
Stars: ✭ 607 (+805.97%)
Mutual labels:  subdomain
Fierce
A DNS reconnaissance tool for locating non-contiguous IP space.
Stars: ✭ 1,072 (+1500%)
Mutual labels:  subdomain
Teemo
A Domain Name & Email Address Collection Tool
Stars: ✭ 595 (+788.06%)
Mutual labels:  subdomain
Laravel Vue Validator
Simple package to display error in vue from laravel validation
Stars: ✭ 32 (-52.24%)
Mutual labels:  validation-library
Synologyddnscloudflaremultidomain
Synology DDNS Cloudflare service provider with multidomains and subdomains
Stars: ✭ 51 (-23.88%)
Mutual labels:  subdomain

Nager.PublicSuffix

The TLD proliferation makes it difficult to check whether domain names are valid. This project uses the rules of publicsuffix.org, a list of known public domain suffixes (TLD) to validate and split domains into three the parts (TLD, domain, subdomain). The validation rules are loaded directly from https://publicsuffix.org.

A domain name has 3 major parts:

Example TLD Domain Subdomain
blog.google.com com google blog
www.wikipedia.org org wikipedia www
mail.yandex.ru ru yandex mail
www.amazon.co.uk co.uk amazon www

nuget

The package is available on nuget

PM> install-package Nager.PublicSuffix

Online test tool

You can try the logic right here publicsuffix test tool

Benefits

  • High performance
  • FileTldRuleProvider or WebTldRuleProvider
  • CacheProvider
  • Async support

Examples

Analyze domain

Without a custom config the WebTldRuleProvider has a default cache live time of 1 day, then you must refresh the cache with execute BuildAsync;

var domainParser = new DomainParser(new WebTldRuleProvider());

var domainInfo = domainParser.Parse("sub.test.co.uk");
//domainInfo.Domain = "test";
//domainInfo.Hostname = "sub.test.co.uk";
//domainInfo.RegistrableDomain = "test.co.uk";
//domainInfo.SubDomain = "sub";
//domainInfo.TLD = "co.uk";

Check is a valid domain

Without a custom config the WebTldRuleProvider has a default cache live time of 1 day, then you must refresh the cache with execute BuildAsync;

var domainParser = new DomainParser(new WebTldRuleProvider());

var isValid = domainParser.IsValidDomain("sub.test.co.uk");

Change the default cache time

//cache data for 10 hours
var cacheProvider = new FileCacheProvider(cacheTimeToLive: new TimeSpan(10, 0, 0));
var webTldRuleProvider = new WebTldRuleProvider(cacheProvider: cacheProvider);

var domainParser = new DomainParser(webTldRuleProvider);
for (var i = 0; i < 100; i++)
{
    var isValid = webTldRuleProvider.CacheProvider.IsCacheValid();
    if (!isValid)
    {
        webTldRuleProvider.BuildAsync().GetAwaiter().GetResult(); //Reload data
    }
	
    var domainInfo = domainParser.Parse($"sub{i}.test.co.uk");
}

Use a local publicsuffix data file

var domainParser = new DomainParser(new FileTldRuleProvider("effective_tld_names.dat"));

var domainInfo = domainParser.Parse("sub.test.co.uk");
//domainInfo.Domain = "test";
//domainInfo.Hostname = "sub.test.co.uk";
//domainInfo.RegistrableDomain = "test.co.uk";
//domainInfo.SubDomain = "sub";
//domainInfo.TLD = "co.uk";
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].