powercord-community / suggestions

Repo where you can find and share plugin suggestions for Powercord
27 stars 4 forks source link

Real whois command #235

Open twnlink opened 3 years ago

twnlink commented 3 years ago

Description

The plugin would add a .whois (domain) command that allows you to get whois information for a domain.

More info

Someone else suggested a whois command that does something entirely different, this isn't the same suggestion. I also noticed that there are a lot of paid whois APIs or some that require an account, which isn't particularly optimal.


cyyynthia commented 3 years ago

The WHOIS protocol consists in just establishing a TCP connection and sending the domain/ip to identify. There's plenty of implementations out there with what servers to target to do requests.

Since in v3 we'll ditch the http lib for a more complete net lib with way more packed in, connecting to TCP servers will be possible, so this is feasible.

I'll tag it as both up for grabs and pending due to technical constrains for the time being.

0x41c commented 3 years ago

This would be a good module as long as it doesn't cripple because of restricted dependancies (which I see none) "node-xwhois" If this is approved I'll claim

cyyynthia commented 3 years ago

As I mentioned, the WHOIS request protocol is extremely simple and could be done with no dependencies. Since v3 will add a bundler the less dependencies you have, the better it'll be regarding compilation speeds.

Here is a very basic code, you need to adapt it to query the proper host (there are tons of lists available on already existing libs, or that you can lookup using your preferred search engine)

const net = require('net')
const sock = net.connect({ host: 'whois.nic.google', port: 43 })

let res = ''
sock.setEncoding('utf8')
sock.on('data', d => res += d)
sock.on('close', () => {
  console.log(res)
})

sock.write('powercord.dev\n')

Although this uses node's net library which won't be available in v3, we'll expose an alternative plugins developers will be able to use, so it'll just be a matter of migrating to this new lib once we get to v3.

SomeAspy commented 3 years ago

I was digging around plugins and found this, maybe it would assist in making? https://github.com/vvisars/ip-look-up