-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparked-namecheap.js
88 lines (65 loc) · 2.46 KB
/
parked-namecheap.js
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
83
84
85
86
87
import NameCheap from '@rqt/namecheap'
import bosom from 'bosom'
import request from 'request'
import fs from 'fs'
//var msg = require('./status.js');
//console.log(msg);
(async () => {
//import bosom from 'bosom'
const {user, key, ip} = await bosom('.namecheap.json')
console.log(user, key, ip);
const namecheap = new NameCheap({
user, key, sandbox: false, ip,
})
const list = await namecheap.domains.getList({
pageSize: 10,
page: 1,
sort: 'name',
desc: false,
})
console.log(list.domains, '\n')
let nameserver = {}
let dns = {}
const forLoop = async _ => {
console.log('Start')
for (let index = 0; index < list.domains.length; index++) {
// Get num of each fruit
const item = list.domains[index];
const domain = item.Name;
//console.log('domain:', domain);
// 5. Retrieve info about domain.
const info = await namecheap.domains.getInfo(domain)
if (info.DnsDetails.Nameserver.includes('dns1.registrar-servers.com')) {
nameserver[domain] = {};
nameserver[domain] = info.DnsDetails.Nameserver
const dnss = await namecheap.dns.getHosts(domain)
//console.log('dnss:', dnss, '\n')
dns[domain] = [];
let url = "http://" + domain
dns[domain].push(url);
const url1 = "https://" + domain
dns[domain].push(url1);
const url2 = "https://ap.www.namecheap.com/domains/marketplace/selldomain/" + domain
dns[domain].push(url2);
const url3 = "https://ap.www.namecheap.com/Domains/DomainControlPanel/"+ domain + "/domain"
dns[domain].push(url3);
request
.get(url)
.on('error', function (err) {
//console.error(err)
dns[domain].push(err.code);
dns[domain].push(err.address);
})
for (let ind = 0; ind < dnss.hosts.length; ind++) {
// const type = dnss.hosts[ind]["Type"];
const address = dnss.hosts[ind]["Address"];
dns[domain].push(address);
}
}
}
console.log('End')
}
await forLoop();
console.log(nameserver);
console.log(dns);
})()