Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / April 2007



Tip: Looking for answers? Try searching our database.

javascript dns look up

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
steve - 28 Apr 2007 09:45 GMT
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
Man-wai Chang - 28 Apr 2007 12:18 GMT
> 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...

Signature

 .~.   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

steve - 28 Apr 2007 22:38 GMT
>> 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...

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
VK - 29 Apr 2007 20:37 GMT
> >> Has anyone come across a "hack" to do a dns look up via JS
>
[quoted text clipped - 4 lines]
> 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.
shimmyshack - 28 Apr 2007 17:22 GMT
> hi,
> Has anyone come across a "hack" to do a dns look up via JS
[quoted text clipped - 6 lines]
>
> 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) :)
shimmyshack - 28 Apr 2007 17:54 GMT
> > hi,
> > Has anyone come across a "hack" to do a dns look up via JS
[quoted text clipped - 10 lines]
> 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
> 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
[quoted text clipped - 7 lines]
> you have or find a maintained list of temporary email domians, could
> you post a link here) :)
steve - 28 Apr 2007 22:37 GMT
>>> hi,
>>> Has anyone come across a "hack" to do a dns look up via JS
[quoted text clipped - 28 lines]
>> you have or find a maintained list of temporary email domians, could
>> you post a link here) :)

Hi  Shimmy,

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

steve
.
TC - 29 Apr 2007 16:48 GMT
> 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
shimmyshack - 29 Apr 2007 17:19 GMT
> > 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 ,
[quoted text clipped - 28 lines]
> HTH,
> TC (MVP MSAccess)http://tc2.atspace.com

the smtp traffic would be server side of course, the results sent back
via javascript.
TC - 30 Apr 2007 09:45 GMT
> > > 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 ,
[quoted text clipped - 30 lines]
>
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.