-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
68 lines (52 loc) · 2.06 KB
/
index.js
File metadata and controls
68 lines (52 loc) · 2.06 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
#!/usr/bin/env node
import Wappalyzer from 'wappalyzer'
import dns from 'dns/promises'
import whois from 'whois-json'
import chalk from 'chalk'
import ora from 'ora'
import axios from 'axios'
const spinner = ora()
async function scanSite(url) {
try {
spinner.start(`Scanning ${url} ...`)
const wappalyzer = new Wappalyzer({ debug: false })
await wappalyzer.init()
const site = await wappalyzer.open(url)
const results = await site.analyze()
spinner.succeed(chalk.green(`Tech Identified for ${url}`))
// DNS + IP
spinner.start(`Fetching DNS & IP...`)
let dnsInfo = await dns.lookup(new URL(url).hostname)
spinner.succeed(`DNS & IP Retrieved`)
// SSL info
spinner.start(`Fetching SSL info...`)
const ssl = await axios.get(url, { timeout: 8000 })
spinner.succeed(`SSL check done`)
// WHOIS
spinner.start(`Fetching WHOIS info...`)
const whoisInfo = await whois(new URL(url).hostname)
spinner.succeed(`WHOIS Loaded`)
console.log(chalk.cyan(`\n=== Technology Stack ===`))
results.technologies.forEach(t =>
console.log(chalk.yellow(`- ${t.name} (${t.categories.map(c => c.name).join(", ")})`))
)
console.log(chalk.magenta(`\n=== Server Info ===`))
console.log(chalk.white(`IP: ${dnsInfo.address}`))
console.log(chalk.white(`Protocol: ${ssl.request.protocol}`))
console.log(chalk.white(`Server: ${ssl.headers.server || "Unknown"}`))
console.log(chalk.blue(`\n=== WHOIS Registrar ===`))
console.log(chalk.white(`Registrar: ${whoisInfo.registrar || "Unknown"}`))
console.log(chalk.white(`Country: ${whoisInfo.country || "Unknown"}`))
console.log(chalk.white(`Created: ${whoisInfo.creationDate || "Unknown"}`))
console.log(chalk.white(`Expires: ${whoisInfo.registrarRegistrationExpirationDate || "Unknown"}`))
console.log(chalk.green(`\nDone ✅\n`))
} catch (err) {
spinner.fail(chalk.red(`Error: ${err.message}`))
}
}
const input = process.argv[2]
if (!input) {
console.log(chalk.red("Usage: techsniff https://example.com"))
process.exit(1)
}
scanSite(input)