javascript dns look up

S

steve

hi,
Has anyone come across a "hack" to do a dns look up via JS

I want to evaluate an email address against a server to see if it is valid ,
I'm 50 % of the way there but i need a way to look up the email servers MX
record.

I just wondered if there was a way to trigger a dns spew on port 53

Steve
 
M

Man-wai Chang

steve said:
hi,
Has anyone come across a "hack" to do a dns look up via JS

If you are using IE, you could use activex winsock control. If not, you
would need to submit the page back to the server to do it...

--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10) Linux 2.6.21.1
^ ^ 19:18:01 up 4:11 0 users load average: 1.00 1.00 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
 
S

shimmyshack

hi,
Has anyone come across a "hack" to do a dns look up via JS

I want to evaluate an email address against a server to see if it is valid ,
I'm 50 % of the way there but i need a way to look up the email servers MX
record.

I just wondered if there was a way to trigger a dns spew on port 53

Steve

imagine the best case scenario where you have a javascript which can
talk the right protocols and send and receive data from a DNS server,
will port 53 be open on the client. The best way is therefore to have
your webserver perform the check based on the value of somepost, and
send back the result via XHR or an iframe, however, I'm not sure that
MX records actually /have/ to exist (I read it along time ago)
although the A record does, and so provided there is at least an A
record you are ok. cacert.org uses pretty good email testing suite you
could purloin, by downloading their source code, which is open
(despite some copyright notices still hanging around) their script
tests the server with a connection attempt without actually sending
them mail. (dont forget to ban all those temporary domains - btw if
you have or find a maintained list of temporary email domians, could
you post a link here) :)
 
S

shimmyshack

imagine the best case scenario where you have a javascript which can
talk the right protocols and send and receive data from a DNS server,
will port 53 be open on the client.
i shoudl have said "can the client get to port 53 on an external
server" they might be forced to use a proxy on a LAN, or a socks
etc...

The best way is therefore to have
 
S

steve

i shoudl have said "can the client get to port 53 on an external
server" they might be forced to use a proxy on a LAN, or a socks
etc...

The best way is therefore to have

Hi Shimmy,

sorry I do not have any pointers to temp email domain list, I imagine it
changes every day

steve
..
 
S

steve

If you are using IE, you could use activex winsock control. If not, you
would need to submit the page back to the server to do it...

it has to be cross platform, if it was as easy as being able to use activex
I would be laughing.
Yes i can submit it back to the server, but I wanted the mental challenge.

steve
 
T

TC

Has anyone come across a "hack" to do a dns look up via JS
I want to evaluate an email address against a server to see if it is valid ,
I'm 50 % of the way there but i need a way to look up the email servers MX
record.

You may be wasting your time.

Many ISPs reject all outbound SMTP traffic, except to their own
outgoing mailserver. So you won't be able to establish an SMTP dialog
directly with the target user's mailserver.

Also, most mailservers no longer support the SMTP VRFY command - or
they seem to support it, but actually lie (eg. they say that *all*
addresses are valid). Your only remaining possibility is to check the
response to a dummy RCPT TO command - but I'm not sure that even this
is reliable now.

Try picking a relevant user's mailserver (not your ISP's outgoing
mailserver), and use Telnet to test the process manually. For example:

telnet mail.blah.com 25
HELO me
VRFY someuser
MAIL FROM me
RCPT TO someuser
(or somesuch)

If you cann't get it to work via Telnet, you won't be able to program
it - in Javascript or anything else.

HTH,
TC (MVP MSAccess)
http://tc2.atspace.com
 
S

shimmyshack

You may be wasting your time.

Many ISPs reject all outbound SMTP traffic, except to their own
outgoing mailserver. So you won't be able to establish an SMTP dialog
directly with the target user's mailserver.

Also, most mailservers no longer support the SMTP VRFY command - or
they seem to support it, but actually lie (eg. they say that *all*
addresses are valid). Your only remaining possibility is to check the
response to a dummy RCPT TO command - but I'm not sure that even this
is reliable now.

Try picking a relevant user's mailserver (not your ISP's outgoing
mailserver), and use Telnet to test the process manually. For example:

telnet mail.blah.com 25
HELO me
VRFY someuser
MAIL FROM me
RCPT TO someuser
(or somesuch)

If you cann't get it to work via Telnet, you won't be able to program
it - in Javascript or anything else.

HTH,
TC (MVP MSAccess)http://tc2.atspace.com

the smtp traffic would be server side of course, the results sent back
via javascript.
 
V

VK

it has to be cross platform, if it was as easy as being able to use activex
I would be laughing.
Yes i can submit it back to the server, but I wanted the mental challenge.

Javascript does not have socket capabilities, so out of Javascript
itself it is plain impossible.
Write a few-liners server-side script on Perl, invoke it using GET/
iframe, script implant, ajaxoid or remote service. If server-side
script gets HELLO from the remote daemon, let it send text/plain "var
emai_ok=true;" otherwise let it send back "var email_ok=false;"
Then just use the return value in your client-side script for check.
Obviously email_ok variable can be called any way you like. There is
no mental challenge in this trivia - simply take care of timeout
fallbacks - some SMTP servers are deadly slow.
 
T

TC

the smtp traffic would be server side of course, the results sent back via javascript

Understood. I assumed, probably incorrectly, that the code would run
on a client PC. But none-the-less, I still think he will not be able
to do what he wants (for other reasons stated above).

Cheers,
TC (MVP MSAccess)
http://tc2.atspace.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top