forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdns-scan.js
More file actions
82 lines (79 loc) · 2.42 KB
/
Copy pathdns-scan.js
File metadata and controls
82 lines (79 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { GraphQLBoolean, GraphQLList, GraphQLObjectType, GraphQLString } from 'graphql'
import { globalIdField } from 'graphql-relay'
import { GraphQLDateTime } from 'graphql-scalars'
import { nodeInterface } from '../../node'
import { dmarcType } from './dmarc'
import { spfType } from './spf'
import { dkimType } from './dkim'
import { mxRecordType } from './mx-record'
export const dnsScanType = new GraphQLObjectType({
name: 'DNSScan',
fields: () => ({
id: globalIdField('dns'),
domain: {
type: GraphQLString,
description: `The domain the scan was ran on.`,
resolve: async ({ domain }) => domain,
},
timestamp: {
type: GraphQLDateTime,
description: `The time when the scan was initiated.`,
resolve: ({ timestamp }) => new Date(timestamp),
},
baseDomain: {
type: GraphQLString,
description: `String of the base domain the scan was run on.`,
},
recordExists: {
type: GraphQLBoolean,
description: `Whether or not there are DNS records for the domain scanned.`,
},
resolveChain: {
type: new GraphQLList(new GraphQLList(GraphQLString)),
description: `The chain CNAME/IP addresses for the domain.`,
},
cnameRecord: {
type: GraphQLString,
description: `The CNAME for the domain (if it exists).`,
},
mxRecords: {
type: mxRecordType,
description: `The MX records for the domain (if they exist).`,
},
nsRecords: {
type: nsRecordType,
description: `The NS records for the domain.`,
},
dmarc: {
type: dmarcType,
description: `The DMARC scan results for the domain.`,
},
spf: {
type: spfType,
description: `The SPF scan results for the domain.`,
},
dkim: {
type: dkimType,
description: `The SKIM scan results for the domain.`,
},
}),
interfaces: [nodeInterface],
description: `Results of DKIM, DMARC, and SPF scans on the given domain.`,
})
export const nsRecordType = new GraphQLObjectType({
name: 'NSRecord',
fields: () => ({
hostnames: {
type: new GraphQLList(GraphQLString),
description: `Hostnames for the nameservers for the domain.`,
},
warnings: {
type: new GraphQLList(GraphQLString),
description: `Additional warning info about the NS record.`,
},
error: {
type: GraphQLString,
description: `Error message if the NS record could not be retrieved.`,
},
}),
})