is-antibot 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +57 -0
- package/package.json +93 -0
- package/src/index.js +31 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Kiko Beats <josefrancisco.verdu@gmail.com> (kikobeats.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# is-antibot
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<br>
|
|
5
|
+
<img src="https://i.imgur.com/Mh13XWB.gif" alt="is-antibot">
|
|
6
|
+
<br>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
[](https://coveralls.io/github/kikobeats/is-antibot)
|
|
11
|
+
[](https://www.npmjs.org/package/is-antibot)
|
|
12
|
+
|
|
13
|
+
**NOTE:** more badges availables in [shields.io](https://shields.io/)
|
|
14
|
+
|
|
15
|
+
> Detect Captcha responses
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ npm install is-antibot --save
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const isCaptcha = require('is-antibot')
|
|
27
|
+
|
|
28
|
+
isCaptcha('do something')
|
|
29
|
+
// => return something
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
### isCaptcha(input, [options])
|
|
35
|
+
|
|
36
|
+
#### input
|
|
37
|
+
|
|
38
|
+
*Required*<br>
|
|
39
|
+
Type: `string`
|
|
40
|
+
|
|
41
|
+
Lorem ipsum.
|
|
42
|
+
|
|
43
|
+
#### options
|
|
44
|
+
|
|
45
|
+
##### foo
|
|
46
|
+
|
|
47
|
+
Type: `boolean`<br>
|
|
48
|
+
Default: `false`
|
|
49
|
+
|
|
50
|
+
Lorem ipsum.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
**is-antibot** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/kikobeats/is-antibot/blob/master/LICENSE.md) License.<br>
|
|
55
|
+
Authored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/kikobeats/is-antibot/contributors).
|
|
56
|
+
|
|
57
|
+
> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/kikobeats) · Twitter [@kikobeats](https://twitter.com/kikobeats)
|
package/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "is-antibot",
|
|
3
|
+
"description": "Detect Captcha responses",
|
|
4
|
+
"homepage": "https://github.com/kikobeats/is-antibot",
|
|
5
|
+
"version": "0.0.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Kiko Beats",
|
|
8
|
+
"email": "josefrancisco.verdu@gmail.com",
|
|
9
|
+
"url": "https://kikobeats.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/kikobeats/is-antibot.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/kikobeats/is-antibot/issues"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"captcha",
|
|
20
|
+
"challenge",
|
|
21
|
+
"cloudflare"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@metascraper/helpers": "~5.49.15",
|
|
25
|
+
"cheerio": "~1.1.2",
|
|
26
|
+
"debug-logfmt": "~1.4.7"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"src"
|
|
30
|
+
],
|
|
31
|
+
"ava": {
|
|
32
|
+
"files": [
|
|
33
|
+
"test/**/*.js",
|
|
34
|
+
"!test/util.js"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@commitlint/cli": "latest",
|
|
39
|
+
"@commitlint/config-conventional": "latest",
|
|
40
|
+
"@ksmithut/prettier-standard": "latest",
|
|
41
|
+
"ava": "latest",
|
|
42
|
+
"c8": "latest",
|
|
43
|
+
"finepack": "latest",
|
|
44
|
+
"git-authors-cli": "latest",
|
|
45
|
+
"github-generate-release": "latest",
|
|
46
|
+
"nano-staged": "latest",
|
|
47
|
+
"simple-git-hooks": "latest",
|
|
48
|
+
"standard": "latest",
|
|
49
|
+
"standard-version": "latest"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">= 20"
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"commitlint": {
|
|
56
|
+
"extends": [
|
|
57
|
+
"@commitlint/config-conventional"
|
|
58
|
+
],
|
|
59
|
+
"rules": {
|
|
60
|
+
"body-max-line-length": [
|
|
61
|
+
0
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"exports": {
|
|
66
|
+
".": "./src/index.js"
|
|
67
|
+
},
|
|
68
|
+
"nano-staged": {
|
|
69
|
+
"*.js": [
|
|
70
|
+
"prettier-standard",
|
|
71
|
+
"standard --fix"
|
|
72
|
+
],
|
|
73
|
+
"package.json": [
|
|
74
|
+
"finepack"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"simple-git-hooks": {
|
|
78
|
+
"commit-msg": "npx commitlint --edit",
|
|
79
|
+
"pre-commit": "npx nano-staged"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"clean": "rm -rf node_modules",
|
|
83
|
+
"contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
|
|
84
|
+
"coverage": "c8 report --reporter=text-lcov > coverage/lcov.info",
|
|
85
|
+
"lint": "standard",
|
|
86
|
+
"postrelease": "npm run release:tags && npm run release:github && npm publish",
|
|
87
|
+
"pretest": "npm run lint",
|
|
88
|
+
"release": "standard-version -a",
|
|
89
|
+
"release:github": "github-generate-release",
|
|
90
|
+
"release:tags": "git push --follow-tags origin HEAD:master",
|
|
91
|
+
"test": "c8 ava"
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { parseUrl } = require('@metascraper/helpers')
|
|
4
|
+
const debug = require('debug-logfmt')('is-antibot')
|
|
5
|
+
|
|
6
|
+
module.exports = ({ url, $, html, headers = {} } = {}) => {
|
|
7
|
+
// https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/detect-response/
|
|
8
|
+
if (headers['cf-mitigated'] === 'challenge') {
|
|
9
|
+
debug({ provider: 'cloudflare' })
|
|
10
|
+
return true
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// https://github.com/glizzykingdreko/Vercel-Attack-Mode-Solver
|
|
14
|
+
if (headers['x-vercel-mitigated'] === 'challenge') {
|
|
15
|
+
debug({ provider: 'vercel' })
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { domainWithoutSuffix } = parseUrl(url)
|
|
20
|
+
|
|
21
|
+
if (domainWithoutSuffix === 'reddit') {
|
|
22
|
+
$ = $ || require('cheerio').load(html)
|
|
23
|
+
const condition = $('title').text().includes('Prove your humanity')
|
|
24
|
+
if (condition) {
|
|
25
|
+
debug({ provider: 'reddit' })
|
|
26
|
+
return true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return false
|
|
31
|
+
}
|