CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
scanner script



Jul 27, 2001, 9:37 AM

Post #1 of 6 (976 views)
scanner script Can't Post

I need help,
I am trying to find a perl script that will port scan a specific host and display the output to a html file.
I want the script to run from a html "input" type page and the results to be displayed on another page.
I also want the script to scan only the users ip who is visiting my site.
I have found thousands of scanning scripts but none that can be made "web friendly".
Can someone help me with this or am I way over my head?

Thanks in advance.


Jul 27, 2001, 9:50 AM

Post #2 of 6 (973 views)
Re: scanner script [In reply to] Can't Post


Port Scanner: Do it yourself if you really have to and never ask for help. It's a simple 3-liner if you know what you're doing but I guess it *is* way over your head.


Ok, let's do something more mature and explain how to do a port scanner and maybe a one-line nuke to go with it.

use CGI 'remote_host'; 
use IO::Socket;
print "Content-type: text/htm\n\n<pre>";
IO::Socket::INET->new(PeerHost => remote_host(), PeerPort => $_)
&& print "Port $_ Open\n"
for 0..1024

So, what are we doing in the previous program? We are iterating over port values (0..1024), trying to open a socket with remote host we got from CGI's remote_host method. If opening the new socket succeeds, we print "Port n Open\n", otherwise, we do nothing and move on to the next port.

Now, I would like to clear something please, I'm not against helping people for I do that all the time and whenever I can. However, I don't think asking for a port scanner is a good idea. So, unless you're a sysadmin who would like to monitor a few machines for running services, you really should not need a port scanner. Using it to probe visitors' machines is probably a questionable behavior. If you were a sysadmin, the question you asked would've been different and I don't want to list all possible ways of asking about how to monitor machines or how to open a socket or how to connect.

Sorry all for being rude perhaps in the first post. If anybody has anything else to add, I'm here to listen.


(This post was edited by abstracts on Jul 27, 2001, 12:54 PM)


Jul 27, 2001, 10:17 AM

Post #3 of 6 (971 views)
Re: scanner script [In reply to] Can't Post

wow that was a mature answer ..... thank you for helping me see what kinda people reside here at this forum.

sorry for asking a question that I have no business asking. you pud

Enthusiast / Moderator

Jul 27, 2001, 10:42 AM

Post #4 of 6 (968 views)
Re: scanner script [In reply to] Can't Post


this is a beginners forum, as you will surely have noticed. This was a kindly asked question (I'm not so sure you noticed that). Someone has asked for help on a topic he's not very familiar with. All you do is tell him: If you're not familiar with it, forget it; If you were, you wouldn't have asked. Not everyone's a pro that has the kind of knowledge you obviously have and that is often a great contribution to this forum.
If the problem is really about to be solved with three lines of code, then why didn't you post it, explain it so it's understandable for the beginner what's going on, and additionally give a statement about the pro's and con's of using it. That would be more helpful than giving a beginner the wrong impression of this forum's attitude towards beginners.
Perhaps you should also have a look at this article.

-- Marcus



Jul 27, 2001, 11:09 AM

Post #5 of 6 (965 views)
Re: scanner script [In reply to] Can't Post

thank you very much for the reply, I'm sorry I acted out so bluntly to the first reponse but it was kinda shocking to have someone act out like that to a newbie. I subscribe to many forums and am not a newbie by any means to computers ... just to programming in perl.
I really want to figure out how to do this so any help would be greatly appreciated

(This post was edited by perldope on Jul 27, 2001, 10:12 AM)


Jul 27, 2001, 1:58 PM

Post #6 of 6 (956 views)
Re: scanner script [In reply to] Can't Post


Thanks Marcus for reminding me what this forum is all about. I got carried away probably. I apologize again for my misbehavior.



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives