@sapphire/phisherman 1.0.1 → 1.1.1-next.855aa68.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/dist/index.mjs +2 -0
- package/dist/lib/Phisherman.d.ts +15 -0
- package/dist/lib/Phisherman.d.ts.map +1 -1
- package/dist/lib/Phisherman.js +43 -4
- package/dist/lib/Phisherman.js.map +1 -1
- package/dist/lib/PhishermanTypes.d.ts +34 -0
- package/dist/lib/PhishermanTypes.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2,5 +2,7 @@ import mod from "./index.js";
|
|
|
2
2
|
|
|
3
3
|
export default mod;
|
|
4
4
|
export const checkDomain = mod.checkDomain;
|
|
5
|
+
export const getDomainInfo = mod.getDomainInfo;
|
|
6
|
+
export const reportCaughtPhish = mod.reportCaughtPhish;
|
|
5
7
|
export const reportDomain = mod.reportDomain;
|
|
6
8
|
export const setApiKey = mod.setApiKey;
|
package/dist/lib/Phisherman.d.ts
CHANGED
|
@@ -17,6 +17,21 @@ export declare function checkDomain(domain: string, apiKey?: string): Promise<{
|
|
|
17
17
|
* @since 1.0.0
|
|
18
18
|
*/
|
|
19
19
|
export declare function reportDomain(domain: string, apiKey?: string): Promise<PhishermanReportType>;
|
|
20
|
+
/**
|
|
21
|
+
* Returns information for a domain.
|
|
22
|
+
* @param domain The domain to get info about.
|
|
23
|
+
* @param apiKey optionally pass a Phiserman API key for making this request. This will default to {@link storedApiKey}, which can be configured through {@link setApiKey}.
|
|
24
|
+
* @since 1.1.0
|
|
25
|
+
*/
|
|
26
|
+
export declare function getDomainInfo(domain: string, apiKey?: string): Promise<import("./PhishermanTypes").PhishermanInfo>;
|
|
27
|
+
/**
|
|
28
|
+
* Report a caught phish back to phisherman to improve their analytics.
|
|
29
|
+
* @param domain The domain which was caught.
|
|
30
|
+
* @param apiKey @param apiKey optionally pass a Phiserman API key for making this request. This will default to {@link storedApiKey}, which can be configured through {@link setApiKey}.
|
|
31
|
+
* @param guildId The id of the guild in which the domain was caught.
|
|
32
|
+
* @since 1.1.0
|
|
33
|
+
*/
|
|
34
|
+
export declare function reportCaughtPhish(domain: string, apiKey?: string, guildId?: string | number): Promise<PhishermanReportType>;
|
|
20
35
|
/**
|
|
21
36
|
* Set the phisherman's API key.
|
|
22
37
|
* @param key The API key to access the phisherman API and cache within the code of the wrapper.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phisherman.d.ts","sourceRoot":"","sources":["../../src/lib/Phisherman.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Phisherman.d.ts","sourceRoot":"","sources":["../../src/lib/Phisherman.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,oBAAoB,EAAwB,MAAM,mBAAmB,CAAC;AASxG;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAqB;;;;GAiB9E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAqB,iCAgBzE;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAqB,uDAahF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAqB,EAAE,OAAO,GAAE,MAAM,GAAG,MAAW,iCAgB7G;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,iBAG1C"}
|
package/dist/lib/Phisherman.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setApiKey = exports.reportDomain = exports.checkDomain = void 0;
|
|
3
|
+
exports.setApiKey = exports.reportCaughtPhish = exports.getDomainInfo = exports.reportDomain = exports.checkDomain = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fetch_1 = require("@sapphire/fetch");
|
|
6
6
|
const node_os_1 = (0, tslib_1.__importDefault)(require("node:os"));
|
|
7
|
+
const agent = `Sapphire Phisherman/1.0.0 (node-fetch) ${node_os_1.default.platform()}/${node_os_1.default.release()} (https://github.com/sapphiredev/utilities/tree/main/packages/phisherman)`;
|
|
7
8
|
/**
|
|
8
9
|
* The cached apiKey which was created using {@link setApiKey}
|
|
9
10
|
*/
|
|
@@ -18,7 +19,7 @@ async function checkDomain(domain, apiKey = storedApiKey) {
|
|
|
18
19
|
const result = await (0, fetch_1.fetch)(`https://api.phisherman.gg/v2/domains/check/${domain}`, {
|
|
19
20
|
headers: {
|
|
20
21
|
'Content-Type': 'application/json',
|
|
21
|
-
'User-Agent':
|
|
22
|
+
'User-Agent': agent,
|
|
22
23
|
Authorization: `Bearer ${apiKey}`
|
|
23
24
|
}
|
|
24
25
|
}, "json" /* JSON */);
|
|
@@ -39,7 +40,7 @@ function reportDomain(domain, apiKey = storedApiKey) {
|
|
|
39
40
|
method: "PUT" /* Put */,
|
|
40
41
|
headers: {
|
|
41
42
|
'Content-Type': 'application/json',
|
|
42
|
-
'User-Agent':
|
|
43
|
+
'User-Agent': agent,
|
|
43
44
|
Authorization: `Bearer ${apiKey}`
|
|
44
45
|
},
|
|
45
46
|
body: JSON.stringify({
|
|
@@ -48,6 +49,44 @@ function reportDomain(domain, apiKey = storedApiKey) {
|
|
|
48
49
|
}, "json" /* JSON */);
|
|
49
50
|
}
|
|
50
51
|
exports.reportDomain = reportDomain;
|
|
52
|
+
/**
|
|
53
|
+
* Returns information for a domain.
|
|
54
|
+
* @param domain The domain to get info about.
|
|
55
|
+
* @param apiKey optionally pass a Phiserman API key for making this request. This will default to {@link storedApiKey}, which can be configured through {@link setApiKey}.
|
|
56
|
+
* @since 1.1.0
|
|
57
|
+
*/
|
|
58
|
+
async function getDomainInfo(domain, apiKey = storedApiKey) {
|
|
59
|
+
const result = await (0, fetch_1.fetch)(`https://api.phisherman.gg/v2/domains/info/${domain}`, {
|
|
60
|
+
headers: {
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
'User-Agent': ``,
|
|
63
|
+
Authorization: `Bearer ${apiKey}`
|
|
64
|
+
}
|
|
65
|
+
}, "json" /* JSON */);
|
|
66
|
+
return result[domain];
|
|
67
|
+
}
|
|
68
|
+
exports.getDomainInfo = getDomainInfo;
|
|
69
|
+
/**
|
|
70
|
+
* Report a caught phish back to phisherman to improve their analytics.
|
|
71
|
+
* @param domain The domain which was caught.
|
|
72
|
+
* @param apiKey @param apiKey optionally pass a Phiserman API key for making this request. This will default to {@link storedApiKey}, which can be configured through {@link setApiKey}.
|
|
73
|
+
* @param guildId The id of the guild in which the domain was caught.
|
|
74
|
+
* @since 1.1.0
|
|
75
|
+
*/
|
|
76
|
+
function reportCaughtPhish(domain, apiKey = storedApiKey, guildId = '') {
|
|
77
|
+
return (0, fetch_1.fetch)(`https://api.phisherman.gg/v2/phish/caught/${domain}`, {
|
|
78
|
+
method: "POST" /* Post */,
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Type': 'application/json',
|
|
81
|
+
'User-Agent': agent,
|
|
82
|
+
Authorization: `Bearer ${apiKey}`
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify({
|
|
85
|
+
guild: Number(guildId)
|
|
86
|
+
})
|
|
87
|
+
}, "json" /* JSON */);
|
|
88
|
+
}
|
|
89
|
+
exports.reportCaughtPhish = reportCaughtPhish;
|
|
51
90
|
/**
|
|
52
91
|
* Set the phisherman's API key.
|
|
53
92
|
* @param key The API key to access the phisherman API and cache within the code of the wrapper.
|
|
@@ -63,7 +102,7 @@ async function checkApiKey(apiKey) {
|
|
|
63
102
|
await (0, fetch_1.fetch)(`https://api.phisherman.gg/v2/domains/check/verified.test.phisherman.gg`, {
|
|
64
103
|
headers: {
|
|
65
104
|
'Content-Type': 'application/json',
|
|
66
|
-
'User-Agent':
|
|
105
|
+
'User-Agent': agent,
|
|
67
106
|
Authorization: `Bearer ${apiKey}`
|
|
68
107
|
}
|
|
69
108
|
}, "json" /* JSON */);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phisherman.js","sourceRoot":"","sources":["../../src/lib/Phisherman.ts"],"names":[],"mappings":";;;;AAAA,2CAAoF;AAEpF,mEAAyB;AAEzB;;GAEG;AACH,IAAI,YAAoB,CAAC;AAEzB;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,SAAiB,YAAY;IAC9E,MAAM,MAAM,GAAG,MAAM,IAAA,aAAK,EACzB,8CAA8C,MAAM,EAAE,EACtD;QACC,OAAO,EAAE;YACR,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"Phisherman.js","sourceRoot":"","sources":["../../src/lib/Phisherman.ts"],"names":[],"mappings":";;;;AAAA,2CAAoF;AAEpF,mEAAyB;AAEzB,MAAM,KAAK,GAAG,0CAA0C,iBAAE,CAAC,QAAQ,EAAE,IAAI,iBAAE,CAAC,OAAO,EAAE,2EAA2E,CAAC;AACjK;;GAEG;AACH,IAAI,YAAoB,CAAC;AAEzB;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,SAAiB,YAAY;IAC9E,MAAM,MAAM,GAAG,MAAM,IAAA,aAAK,EACzB,8CAA8C,MAAM,EAAE,EACtD;QACC,OAAO,EAAE;YACR,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,UAAU,MAAM,EAAE;SACjC;KACD,oBAED,CAAC;IAEF,OAAO;QACN,GAAG,MAAM;QACT,MAAM,EAAE,MAAM,CAAC,cAAc,KAAK,MAAM,IAAI,MAAM,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;KAC9F,CAAC;AACH,CAAC;AAjBD,kCAiB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pB,CAAC;AAHD,8BAGC;AAED,KAAK,UAAU,WAAW,CAAC,MAAc;IACxC,IAAI;QACH,MAAM,IAAA,aAAK,EACV,wEAAwE,EACxE;YACC,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;gBAClC,YAAY,EAAE,KAAK;gBACnB,aAAa,EAAE,UAAU,MAAM,EAAE;aACjC;SACD,oBAED,CAAC;KACF;IAAC,OAAO,KAAK,EAAE;QACf,MAAM,UAAU,GAAG,KAAmB,CAAC;QAEvC,IAAI,UAAU,CAAC,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC,OAAO,KAAK,wCAAwC,EAAE;YACxG,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SAClE;QAED,MAAM,KAAK,CAAC;KACZ;AACF,CAAC"}
|
|
@@ -12,4 +12,38 @@ export interface PhishermanReportType {
|
|
|
12
12
|
success: boolean;
|
|
13
13
|
message: string;
|
|
14
14
|
}
|
|
15
|
+
export interface PhishermanInfo {
|
|
16
|
+
status: string;
|
|
17
|
+
created: string;
|
|
18
|
+
lastChecked: string;
|
|
19
|
+
verifiedPhish: boolean;
|
|
20
|
+
classification: string;
|
|
21
|
+
firstSeen: string;
|
|
22
|
+
lastSeen: string;
|
|
23
|
+
targetedBrand: string;
|
|
24
|
+
phishCaught: number;
|
|
25
|
+
details: Details;
|
|
26
|
+
}
|
|
27
|
+
export interface PhishermanInfoType {
|
|
28
|
+
[key: string]: PhishermanInfo;
|
|
29
|
+
}
|
|
30
|
+
interface Details {
|
|
31
|
+
phishTankId: string;
|
|
32
|
+
urlScanId: string;
|
|
33
|
+
websiteScreenshot: string;
|
|
34
|
+
ip_address: string;
|
|
35
|
+
asn: Asn;
|
|
36
|
+
registry: string;
|
|
37
|
+
country: Country;
|
|
38
|
+
}
|
|
39
|
+
interface Asn {
|
|
40
|
+
asn: string;
|
|
41
|
+
asn_name: string;
|
|
42
|
+
route: string;
|
|
43
|
+
}
|
|
44
|
+
interface Country {
|
|
45
|
+
code: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
15
49
|
//# sourceMappingURL=PhishermanTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhishermanTypes.d.ts","sourceRoot":"","sources":["../../src/lib/PhishermanTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;CAChE;AAED,oBAAY,eAAe,GAAG,oBAAoB,GAAG;IACpD,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CAChB"}
|
|
1
|
+
{"version":3,"file":"PhishermanTypes.d.ts","sourceRoot":"","sources":["../../src/lib/PhishermanTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;CAChE;AAED,oBAAY,eAAe,GAAG,oBAAoB,GAAG;IACpD,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC;CAC9B;AAED,UAAU,OAAO;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,GAAG;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,UAAU,OAAO;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/phisherman",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1-next.855aa68.0",
|
|
4
4
|
"description": "Wrapper around phisherman to easily check and report domains",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prepublishOnly": "yarn build"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sapphire/fetch": "^2.0.
|
|
23
|
+
"@sapphire/fetch": "^2.0.5-next.855aa68.0"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "855aa684fce3d2e10c2dc02df2be6dad9f473db3"
|
|
57
57
|
}
|