Old 26th May 2006, 09:50   #1
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
connect to SMTP port on remote name/ip, return 1 or 0

I've read and searched the forums, and online, I can't seem to find a simple enough win32 command line port scanning tool, that I could nsexec and get the output to see if port 25 is open on the remote mailserver (I need to verify a user entered SMTP mailserver ip/name)

I've tried the following function to no avail, it just returns -1

http://forums.winamp.com/showthread....highlight=smtp

any help would be useful, thanks
shaunb is offline   Reply With Quote
Old 26th May 2006, 10:29   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
This might help you:
http://faq.siteground.com/faq/email_port25.htm

-Stu
Afrow UK is offline   Reply With Quote
Old 26th May 2006, 10:33   #3
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
hm, I was just playing about with windows telnet just now hehe, I guess I could exec to stack and then check the result, but hmm, each mailserver responds with a slightly different welcome string.

pinging it wouldnt suffice as it might be firewalled or whatever. blarg
shaunb is offline   Reply With Quote
Old 28th May 2006, 12:25   #4
OldGrumpy
Member
 
Join Date: Feb 2006
Location: Germany
Posts: 53
You don't have to check for the server reply, just for "connect failed" from telnet...
OldGrumpy is offline   Reply With Quote
Old 28th May 2006, 17:10   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Good idea lol

-Stu
Afrow UK is offline   Reply With Quote
Old 28th May 2006, 19:56   #6
nandhp
Junior Member
 
Join Date: Feb 2004
Location: Mars
Posts: 20
Telnet is a Win32 GUI application in 95/98/ME/NT so this approach won't work on those versions. If you need something more reliable, you might want to look for a better solution.
nandhp is offline   Reply With Quote
Old 29th May 2006, 20:35   #7
OldGrumpy
Member
 
Join Date: Feb 2006
Location: Germany
Posts: 53
nandhp, I wasn't exactly serious, I was just pointing out a slightly faulty logical chain Of course it would be better to just write a plugin that uses the winsock interface ot connect to a specified server and port
OldGrumpy is offline   Reply With Quote
Old 30th May 2006, 08:03   #8
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
hmm, not really time to write my own plugin, if I had to write anything it'd be a custom console application that did the socket task. hmm
shaunb is offline   Reply With Quote
Old 30th May 2006, 09:15   #9
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
Looks like I've come up with a workable solution

using portqry.exe (version 2, available from MS's site)

firstly I nsexec a batch file that wraps the portquery.exe and provides one parameter %1 , to pass in the $CFMAILSERVER (I require to verify a coldfusion server default mailserver), anyway , using the errorlevel function of dos I can then check the exit code of portqry, and output either success or failed to my 'results file' on c:\, which I then use NSIS to read, chop a couple of bytes off the end, and use to check if the mail server verified ok!

my code is attached as its too long

edit: actually I can't find where to attach it so if anyone wants the code just send me a private message! doh!

I hope it'll help anyone else trying to do the same task.

The end results work quite well

(for reference)
http://www.petri.co.il/quickly_find_...open_ports.htm
shaunb is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump