Skip to content

Commit

Permalink
Updated - extract subdomains from TXT spf record
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiIgna committed Jul 2, 2020
1 parent 704e784 commit b42cbd9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@ const getAllRecords = async domain => {
records.filter(r => r.type === 'MX').forEach(extractNewSubdomains)

// -- In TXT spf record, if self referenced domain
records.filter(r => r.type === 'TXT' && r.value.includes('v=spf1')).forEach(record => {
records.filter(r => r.type === 'TXT' && r.value.includes('spf')).forEach(record => {
let parts = record.value.split(' ')

// get all parts that include subdomain + domain
parts = parts.filter(p => p.startsWith('include:') && p.endsWith(`.${domain}`))
parts = parts.filter(p => (p.startsWith('include:') || p.startsWith('redirect=')) && p.endsWith(`.${domain}`))

// strip unnecessary strings
parts = parts.map(p => p.replace('include:', '').replace(`.${domain}`, ''))
parts = parts.map(p => p.replace('include:', '').replace('redirect=', '').replace(`.${domain}`, ''))

txtToCheck.push(...parts)
})
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@layered/dns-records",
"version": "1.4.0",
"version": "1.4.1",
"description": "Discover publicly available DNS Records for a domain",
"keywords": [
"dns",
Expand Down

0 comments on commit b42cbd9

Please sign in to comment.