| name | dit |
| description | Classify HTML pages, forms, and fields using machine learning. Use when the user needs to detect page types (login, error, captcha), identify form types (login, search, registration), or classify form fields (username, password, email) from HTML content or URLs. |
dit - HTML Page, Form & Field Classifier
dît (means "found" in Kurdish) classifies HTML pages, forms, and fields using machine learning (LogReg + CRF). Zero external ML dependencies.
It classifies pages (login, error, landing, blog, etc.), detects form types (login, search, registration, password recovery, contact, etc.), and classifies each field (username, password, email, search query, etc.).
Installation
go get github.com/happyhackingspace/dit
Or install the CLI:
go install github.com/happyhackingspace/dit/cmd/dit@latest
CLI Usage
dit run https://github.com/login
dit run login.html
dit run https://github.com/login --proba
dit data download
dit train model.json --data-folder data
dit evaluate --data-folder data
dit data upload
Library Usage (Go)
import "github.com/happyhackingspace/dit"
c, _ := dit.New()
page, _ := c.ExtractPageType(htmlString)
fmt.Println(page.Type)
fmt.Println(page.Forms)
results, _ := c.ExtractForms(htmlString)
for _, r := range results {
fmt.Println(r.Type)
fmt.Println(r.Fields)
}
pageProba, _ := c.ExtractPageTypeProba(htmlString, 0.05)
formProba, _ := c.ExtractFormsProba(htmlString, 0.05)
Page Types
login, registration, search, checkout, contact, password_reset, landing, product, blog, settings, soft_404, error, captcha, parked, coming_soon, admin, directory_listing, default_page, waf_block, other.
Form Types
login, search, registration, password/login recovery, contact/comment, join mailing list, order/add to cart, other.
Field Types
Authentication: username, password, password confirmation, email, email confirmation, username or email
Names: first name, last name, middle name, full name, organization name, gender
Address: country, city, state, address, postal code
Contact: phone, fax, url
Search: search query, search category
Content: comment text, comment title, about me text
Buttons: submit button, cancel button, reset button
Verification: captcha, honeypot, TOS confirmation, remember me checkbox, receive emails confirmation
Security: security question, security answer
Full list of 79 field type codes available in data/config.json.
References