Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
0588db8
chore(deps): bump github.com/projectdiscovery/useragent
dependabot[bot] Aug 19, 2024
f92dd0e
lint
Mzack9999 Aug 19, 2024
7bc0a4c
Merge pull request #1881 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 19, 2024
d16e6d9
chore(deps): bump github.com/projectdiscovery/retryabledns
dependabot[bot] Aug 19, 2024
bb85d3d
chore(deps): bump github.com/projectdiscovery/goflags
dependabot[bot] Aug 19, 2024
752b705
Merge pull request #1879 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 19, 2024
955fe5c
chore(deps): bump github.com/projectdiscovery/gologger
dependabot[bot] Aug 19, 2024
00f171d
Merge pull request #1878 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 19, 2024
52b7d49
Merge pull request #1880 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 19, 2024
e5429d1
chore(deps): bump github.com/projectdiscovery/hmap from 0.0.54 to 0.0.55
dependabot[bot] Aug 19, 2024
fb579bd
Merge pull request #1882 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 19, 2024
eb2b540
Add `team-id` option (#1886)
RamanaReddy0M Aug 22, 2024
0c49f00
chore(deps): bump github.com/projectdiscovery/retryablehttp-go
dependabot[bot] Aug 26, 2024
adb2e42
Merge pull request #1893 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 26, 2024
0874f2d
chore(deps): bump github.com/projectdiscovery/rawhttp
dependabot[bot] Aug 26, 2024
5330266
chore(deps): bump github.com/projectdiscovery/fastdialer
dependabot[bot] Aug 26, 2024
7c39113
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] Aug 26, 2024
105453a
Merge pull request #1897 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 26, 2024
ae1d599
Merge pull request #1896 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 26, 2024
7b34fa7
Merge pull request #1894 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 26, 2024
b5f864a
chore(deps): bump github.com/projectdiscovery/useragent
dependabot[bot] Aug 26, 2024
0e61679
Add team-id in dashboard url (#1892)
RamanaReddy0M Aug 26, 2024
c861df0
use mapstructure tag
dogancanbakir Aug 26, 2024
c2e41c4
Merge pull request #1898 from projectdiscovery/use_mapstructure_tag
Mzack9999 Aug 26, 2024
9dd96ee
Merge pull request #1895 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Aug 26, 2024
e979dcd
chore(deps): bump github.com/projectdiscovery/dsl from 0.1.10 to 0.2.1
dependabot[bot] Sep 2, 2024
e8c0b88
chore(deps): bump github.com/projectdiscovery/retryabledns
dependabot[bot] Sep 2, 2024
b4b4f08
Merge pull request #1900 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 2, 2024
8ea4a16
Merge pull request #1902 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 2, 2024
427d95d
chore(deps): bump github.com/projectdiscovery/useragent
dependabot[bot] Sep 2, 2024
9e3cb57
chore(deps): bump github.com/projectdiscovery/hmap from 0.0.55 to 0.0.57
dependabot[bot] Sep 2, 2024
a955f48
Merge pull request #1903 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 2, 2024
6d914cc
Merge pull request #1901 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 2, 2024
3e680a4
chore(deps): bump github.com/projectdiscovery/fastdialer
dependabot[bot] Sep 2, 2024
80afe37
Merge pull request #1899 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 2, 2024
0d65af3
chore(deps): bump github.com/projectdiscovery/ratelimit
dependabot[bot] Sep 9, 2024
10320cc
chore(deps): bump github.com/projectdiscovery/freeport
dependabot[bot] Sep 9, 2024
9e69a12
chore(deps): bump github.com/projectdiscovery/gologger
dependabot[bot] Sep 9, 2024
c86c635
Merge pull request #1906 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 9, 2024
f3d1968
Merge pull request #1908 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 9, 2024
f563220
Merge pull request #1909 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 9, 2024
e051552
chore(deps): bump github.com/projectdiscovery/useragent
dependabot[bot] Sep 9, 2024
c5ffe7f
Merge pull request #1910 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 9, 2024
58f46ff
chore(deps): bump github.com/projectdiscovery/utils from 0.2.7 to 0.2.9
dependabot[bot] Sep 9, 2024
ec694a6
Merge pull request #1907 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 9, 2024
4e33c0c
feat: add idle screenshot option
Sep 15, 2024
b77e16f
chore(deps): bump github.com/projectdiscovery/retryablehttp-go
dependabot[bot] Sep 16, 2024
2208b3f
Merge pull request #1918 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 16, 2024
c741b21
chore(deps): bump github.com/projectdiscovery/fastdialer
dependabot[bot] Sep 16, 2024
0926e38
chore(deps): bump github.com/projectdiscovery/utils from 0.2.9 to 0.2.10
dependabot[bot] Sep 16, 2024
894aea4
Merge pull request #1920 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 16, 2024
0a0018b
Merge pull request #1919 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 16, 2024
56184e2
chore(deps): bump github.com/projectdiscovery/tlsx from 1.1.6 to 1.1.7
dependabot[bot] Sep 16, 2024
a697a75
Merge pull request #1922 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 16, 2024
2382355
chore(deps): bump github.com/projectdiscovery/rawhttp
dependabot[bot] Sep 16, 2024
230f59e
Merge pull request #1921 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 16, 2024
8e48bde
using duration var
Mzack9999 Sep 16, 2024
2455adc
Merge branch 'dev' into pr/1917
Mzack9999 Sep 16, 2024
d6082fd
Merge pull request #1917 from michael2to3/feat/wait-after-screenshot
Mzack9999 Sep 16, 2024
db72bb2
Adding trace (#1883)
Mzack9999 Sep 16, 2024
a5f8198
add auth cred file flag (#1912)
dogancanbakir Sep 16, 2024
0b2ee56
chore(deps): bump github.com/projectdiscovery/utils
dependabot[bot] Sep 23, 2024
283bf79
chore(deps): bump github.com/projectdiscovery/clistats
dependabot[bot] Sep 23, 2024
12fa4a0
Merge pull request #1925 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 23, 2024
e65b298
Merge pull request #1928 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 23, 2024
631ec2a
chore(deps): bump github.com/projectdiscovery/retryablehttp-go
dependabot[bot] Sep 23, 2024
86d4bb8
chore(deps): bump github.com/projectdiscovery/gologger
dependabot[bot] Sep 23, 2024
3bd1092
Merge pull request #1929 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 23, 2024
7e6000a
Merge pull request #1927 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 23, 2024
8a6cac9
chore(deps): bump github.com/projectdiscovery/rawhttp
dependabot[bot] Sep 23, 2024
c9e3829
Merge pull request #1926 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Sep 23, 2024
7bdd88b
chore(deps): bump github.com/projectdiscovery/dsl from 0.2.1 to 0.2.5
dependabot[bot] Sep 30, 2024
807503d
chore(deps): bump github.com/projectdiscovery/retryablehttp-go
dependabot[bot] Oct 7, 2024
ff83cea
Merge pull request #1940 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Oct 7, 2024
fa20ee9
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] Oct 7, 2024
b6a324f
chore(deps): bump github.com/projectdiscovery/rawhttp
dependabot[bot] Oct 7, 2024
2a50a8a
Merge pull request #1941 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Oct 7, 2024
42e064a
Merge pull request #1935 from projectdiscovery/dependabot/go_modules/…
dependabot[bot] Oct 7, 2024
7cfd714
Merge pull request #1937 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Oct 7, 2024
0c9bba7
introduce page type classifier (#1924)
dogancanbakir Oct 20, 2024
2f16a47
filter out near duplicate responses (#1951)
dogancanbakir Oct 20, 2024
b8f40c6
do not store failed reqs (#1954)
dogancanbakir Oct 20, 2024
5fac225
version update
ehsandeep Oct 20, 2024
719aa8b
readme update
ehsandeep Oct 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ This will display help for the tool. Here are all the switches it supports.


```console
Usage:
./httpx [flags]

Flags:
httpx is a fast and multi-purpose HTTP toolkit that allows running multiple probes using the retryablehttp library.

Usage:
./httpx [flags]

Expand Down Expand Up @@ -124,7 +130,8 @@ HEADLESS:
-ho, -headless-options string[] start headless chrome with additional options
-esb, -exclude-screenshot-bytes enable excluding screenshot bytes from json output
-ehb, -exclude-headless-body enable excluding headless header from json output
-st, -screenshot-timeout int set timeout for screenshot in seconds (default 10)
-st, -screenshot-timeout value set timeout for screenshot in seconds (default 10s)
-sid, -screenshot-idle value set idle time before taking screenshot in seconds (default 1s)

MATCHERS:
-mc, -match-code string match response with specified status code (-mc 200,302)
Expand All @@ -134,24 +141,25 @@ MATCHERS:
-mfc, -match-favicon string[] match response with specified favicon hash (-mfc 1494302000)
-ms, -match-string string[] match response with specified string (-ms admin)
-mr, -match-regex string[] match response with specified regex (-mr admin)
-mcdn, -match-cdn string[] match host with specified cdn provider (google, cloudfront, fastly)
-mcdn, -match-cdn string[] match host with specified cdn provider (cloudfront, fastly, google)
-mrt, -match-response-time string match response with specified response time in seconds (-mrt '< 1')
-mdc, -match-condition string match response with dsl expression condition

EXTRACTOR:
-er, -extract-regex string[] display response content with matched regex
-ep, -extract-preset string[] display response content matched by a pre-defined regex (ipv4,mail,url)
-ep, -extract-preset string[] display response content matched by a pre-defined regex (url,ipv4,mail)

FILTERS:
-fc, -filter-code string filter response with specified status code (-fc 403,401)
-fep, -filter-error-page filter response with ML based error page detection
-fd, -filter-duplicates filter out near-duplicate responses (only first response is retained)
-fl, -filter-length string filter response with specified content length (-fl 23,33)
-flc, -filter-line-count string filter response body with specified line count (-flc 423,532)
-fwc, -filter-word-count string filter response body with specified word count (-fwc 423,532)
-ffc, -filter-favicon string[] filter response with specified favicon hash (-ffc 1494302000)
-fs, -filter-string string[] filter response with specified string (-fs admin)
-fe, -filter-regex string[] filter response with specified regex (-fe admin)
-fcdn, -filter-cdn string[] filter host with specified cdn provider (google, cloudfront, fastly)
-fcdn, -filter-cdn string[] filter host with specified cdn provider (cloudfront, fastly, google)
-frt, -filter-response-time string filter response with specified response time in seconds (-frt '> 1')
-fdc, -filter-condition string filter response with dsl expression condition
-strip strips all tags in response. supported formats: html,xml (default html)
Expand Down Expand Up @@ -234,6 +242,7 @@ DEBUG:
-v, -verbose verbose mode
-si, -stats-interval int number of seconds to wait between showing a statistics update (default: 5)
-nc, -no-color disable colors in cli output
-tr, -trace trace

OPTIMIZATIONS:
-nf, -no-fallback display both probed protocol (HTTPS and HTTP)
Expand All @@ -248,7 +257,9 @@ OPTIMIZATIONS:

CLOUD:
-auth configure projectdiscovery cloud (pdcp) api key (default true)
-ac, -auth-config string configure projectdiscovery cloud (pdcp) api key credential file
-pd, -dashboard upload / view output in projectdiscovery cloud (pdcp) UI dashboard
-tid, -team-id string upload asset results to given team id (optional)
-aid, -asset-id string upload new assets to existing asset id (optional)
-aname, -asset-name string assets group name to set (optional)
-pdu, -dashboard-upload string upload httpx output file (jsonl) in projectdiscovery cloud (pdcp) UI dashboard
Expand Down
3 changes: 3 additions & 0 deletions cmd/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,8 @@ func setupOptionalAssetUpload(opts *runner.Options) *pdcp.UploadWriter {
// silently ignore
writer.SetAssetGroupName(opts.AssetName)
}
if opts.TeamID != "" {
writer.SetTeamID(opts.TeamID)
}
return writer
}
Binary file removed common/errorpageclassifier/clf.gob
Binary file not shown.
2 changes: 1 addition & 1 deletion common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func New(options *Options) (*HTTPX, error) {
var retryablehttpOptions = retryablehttp.DefaultOptionsSpraying
retryablehttpOptions.Timeout = httpx.Options.Timeout
retryablehttpOptions.RetryMax = httpx.Options.RetryMax

retryablehttpOptions.Trace = options.Trace
handleHSTS := func(req *http.Request) {
if req.Response.Header.Get("Strict-Transport-Security") == "" {
return
Expand Down
1 change: 1 addition & 0 deletions common/httpx/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Options struct {
NetworkPolicy *networkpolicy.NetworkPolicy
CDNCheckClient *cdncheck.Client
Protocol Proto
Trace bool
}

// DefaultOptions contains the default options
Expand Down
Binary file added common/pagetypeclassifier/clf.gob
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Now viewing: Image Gallery. Enjoy a visual tour of our activities.||nonerror
You're on our FAQ page. Get answers to common questions.||nonerror
Welcome to the Blog section. Engage with our thoughts and insights.||nonerror
This is the Discussion Forum. Join in, ask questions, or help others.||nonerror
You're on the Login page. Enter your credentials to access your account.||nonerror
You're on the Login page. Enter your credentials to access your account.||login
Welcome to the Sign-Up page. Join our community today.||nonerror
This is your User Dashboard. Manage your account and settings here.||nonerror
You've reached the Checkout page. Review your order and proceed to payment.||nonerror
Expand Down Expand Up @@ -198,4 +198,183 @@ You've successfully added the item to your cart!||nonerror
Success! Your password has been updated||nonerror
Welcome back! You have successfully logged in||nonerror
Great job! Your profile has been updated||nonerror
Your message was sent successfully. We'll get back to you shortly||nonerror
Your message was sent successfully. We'll get back to you shortly||nonerror
Welcome to the Login page. Please sign in to continue.||login
Please enter your username and password on the login page.||login
You have reached the login page. Access your account by logging in.||login
Login required. Please authenticate to access this page.||login
Welcome back! Please log in to your account.||login
Sign in to your account on this login page.||login
Secure Login: Enter your credentials to proceed.||login
This is the login page. Please enter your email and password.||login
Access denied. Please log in to continue.||login
You're on the login page. Forgot your password? Click here to reset.||login
User Login: Please provide your username and password.||login
Login to your account to access exclusive features.||login
Authentication required. Please log in.||login
Welcome back! Sign in to access your dashboard.||login
Please log in to proceed to the checkout page.||login
Member login: Enter your credentials below.||login
Staff login portal. Please enter your login details.||login
Customer login: Sign in to view your orders.||login
Partner login: Please authenticate to access partner resources.||login
Administrator login page. Enter your admin credentials.||login
Please log in to access your profile settings.||login
Login successful. Redirecting to your account dashboard.||login
Incorrect password. Please try again.||login
Session expired. Please log in again.||login
Welcome to the secure login page. Your privacy is important to us.||login
Access restricted. Please log in to view this content.||login
Please log in to access the members-only area.||login
Sign in with your social media account on the login page.||login
New user? Register here or log in if you already have an account.||login
Log in to participate in the forum discussions.||login
Access your account by logging in here.||login
Please log in to access your personalized dashboard.||login
Enter your login details to continue.||login
Login Page: Securely enter your credentials.||login
Welcome to the user login portal.||login
Sign in to manage your account settings.||login
This is the login screen. Please authenticate.||login
Returning user? Please log in.||login
Please log in to view your messages.||login
Log in to access premium content.||login
Authentication page: Enter your username and password.||login
Please enter your login information to proceed.||login
User authentication required. Please log in.||login
Log in now to unlock exclusive features.||login
Sign in to check your account balance.||login
Welcome back! Please enter your login credentials.||login
Member login area: Access restricted content by logging in.||login
Please sign in to continue to your profile.||login
Staff members, please log in to access internal resources.||login
Enter your email and password to log in.||login
Login required to view this page. Please sign in.||login
Access your profile by logging into your account.||login
Please provide your login credentials to access the system.||login
Log in to track your order status.||login
Welcome to the employee login page.||login
Secure area: Please log in to continue.||login
Please log in to update your preferences.||login
Sign in to access your learning materials.||login
Please authenticate to proceed to the next step.||login
Login Page: Your session has expired, please log in again.||login
Welcome back! Enter your credentials to sign in.||login
Client login: Access your project details here.||login
Agent login portal: Please sign in with your ID.||login
Enter your user ID and password to log in.||login
Log in to view your subscription details.||login
Login Page: Forgot your password? Click here to reset it.||login
Access restricted to authorized users only. Please log in.||login
Vendor login: Manage your listings by logging in.||login
Please log in to access your saved items.||login
Log in to participate in our online courses.||login
Sign in to view your appointment schedule.||login
Welcome to the admin login page.||login
Please enter your credentials to log in securely.||login
Log in to view your recent activities.||login
Authentication needed. Please sign in to proceed.||login
Member login: Keep me signed in checkbox available.||login
Log in with your email or username.||login
Access your account dashboard by logging in.||login
Sign in to post comments on articles.||login
Please log in to access your billing information.||login
Log in to access your personalized recommendations.||login
Please sign in to view your shopping cart.||login
Enter your credentials to log in and start shopping.||login
Welcome to the customer login page. Sign in to continue.||login
Authentication required. Please log in with your secure ID.||login
Log in to access exclusive member discounts.||login
Please log in to view and manage your wishlist.||login
Sign in to access your event tickets and details.||login
Faculty login: Please enter your staff ID and password.||login
Log in to access your investment portfolio.||login
Access your medical records by logging in securely.||login
Please sign in to continue to the payment gateway.||login
Login required to access your order history.||login
Welcome back! Log in to resume your session.||login
Please log in to submit your application.||login
Enter your username and password to log in to the portal.||login
Student login: Access your course materials by signing in.||login
Log in to customize your news feed preferences.||login
Please authenticate to access your secure messages.||login
Sign in to sync your data across devices.||login
Log in to join the live webinar.||login
Please log in to access your reservation details.||login
Welcome to the supplier login page.||login
Log in to access your support tickets.||login
Enter your credentials to log in and view analytics.||login
Please sign in to access developer resources.||login
Login required to view confidential documents.||login
Log in to participate in the survey.||login
Please authenticate to access the admin dashboard.||login
Sign in to view your loyalty points balance.||login
Log in to manage your email subscriptions.||login
Please log in to proceed with the enrollment process.||login
Access your download history by logging in.||login
Welcome back! Please log in to renew your membership.||login
Enter your employee ID to log in to the time tracking system.||login
Log in to update your security settings.||login
Please sign in to access your saved searches.||login
Authentication required for accessing project files.||login
Log in to collaborate with your team members.||login
Please enter your PIN and password to log in.||login
Sign in to access your fitness progress dashboard.||login
Log in to check your test results.||login
Please log in to schedule your appointments.||login
Welcome to the volunteer login page.||login
Log in to view your donation history.||login
Please authenticate to access the control panel.||login
Sign in to review and accept your job offer.||login
Log in to access premium tutorials and guides.||login
Please log in to manage your API keys.||login
Please log in with your email address and password.||login
Enter your username and password to access your account.||login
Sign in to your account using your email and password.||login
Welcome back! Please enter your login credentials.||login
Email address: [input field] Password: [input field]||login
Login to your account. Don't have one? Sign up now.||login
Username: [input field] Password: [input field] Remember me?||login
Forgot your password? Click here to reset it.||login
Please enter your email and password to continue.||login
Secure login portal. Enter credentials below.||login
Access your account by logging in below.||login
Remember me on this device.||login
Login required. Please sign in to proceed.||login
Forgot password? Reset it here.||login
Sign in with your email address and password.||login
Welcome! Please log in to your account.||login
User login: Enter your email and password.||login
Email: [input field] Password: [input field]||login
Please authenticate by entering your login details.||login
Sign in to your account or register for a new one.||login
Login page: Access restricted to authorized users only.||login
Need help logging in? Click here.||login
Enter your credentials to log in.||login
Keep me signed in.||login
Please sign in to access exclusive content.||login
Welcome back! Sign in to your dashboard.||login
Forgot your username or password? Retrieve them here.||login
Log in using your email or username.||login
Authentication required. Please log in.||login
Password recovery: Reset your password now.||login
Log in to manage your account settings.||login
Sign in to continue to checkout.||login
Enter your login information below.||login
Sign in to access your personalized dashboard.||login
Welcome to the member login page.||login
Already have an account? Log in here.||login
Enter email and password to sign in.||login
Sign in to your profile.||login
Member login: Access your account here.||login
Please log in to continue.||login
Enter your password to log in.||login
Sign in to view your messages.||login
Login to your profile to see updates.||login
Log in to your account to access features.||login
Please provide your username and password.||login
Log in to manage your subscriptions.||login
Sign in using your credentials.||login
Access denied. Please log in first.||login
Authentication portal. Enter login details.||login
Need an account? Sign up or log in if you already have one.||login
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package errorpageclassifier
package pagetypeclassifier

import (
_ "embed"
Expand All @@ -10,19 +10,19 @@ import (
//go:embed clf.gob
var classifierData []byte

type ErrorPageClassifier struct {
type PageTypeClassifier struct {
classifier *naive_bayes.NaiveBayesClassifier
}

func New() *ErrorPageClassifier {
func New() *PageTypeClassifier {
classifier, err := naive_bayes.NewClassifierFromFileData(classifierData)
if err != nil {
panic(err)
}
return &ErrorPageClassifier{classifier: classifier}
return &PageTypeClassifier{classifier: classifier}
}

func (n *ErrorPageClassifier) Classify(html string) string {
func (n *PageTypeClassifier) Classify(html string) string {
text := htmlToText(html)
if text == "" {
return "other"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package errorpageclassifier
package pagetypeclassifier

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestErrorPageClassifier(t *testing.T) {
t.Run("test creation of new ErrorPageClassifier", func(t *testing.T) {
func TestPageTypeClassifier(t *testing.T) {

t.Run("test creation of new PageTypeClassifier", func(t *testing.T) {
epc := New()
assert.NotNil(t, epc)
})
Expand Down
Loading
Loading