The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to Scan proclog files deeprajn95 Shell Programming and Scripting 3 05-12-2008 06:25 AM
Port Scan Attack Detector 2.1.2 (Default branch) iBot Software Releases - RSS News 0 04-04-2008 12:00 PM
Port Scan Attack Detector 2.1.1 (Default branch) iBot Software Releases - RSS News 0 01-26-2008 10:10 AM
Please let me know Regarding Port Scan myramkumar UNIX for Advanced & Expert Users 7 05-17-2007 11:11 AM
unix program that can port scan a c block of ips for proxies user UNIX for Dummies Questions & Answers 1 07-11-2005 02:01 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-30-2008
nrbhole nrbhole is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 18
port scan shell script

Hi,

Can any one please suggest me commands for making port scan shell script.
  #2 (permalink)  
Old 01-30-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
port scan is not usually a good thing , why do you need this ?
  #3 (permalink)  
Old 01-31-2008
nrbhole nrbhole is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 18
Hi,

I need this for monitoring the server ports. If any of the port seems to be down then send the alert using mail or message
  #4 (permalink)  
Old 01-31-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
I got this little script from Ghostdog74 from our forum, modified it a bit to suit my needs :
Code:
#!/usr/bin/python

import socket
import sys

if ( len(sys.argv) != 2 ):
    print "Usage: " + sys.argv[0] + " you must enter IP or FQDN as argument"
    sys.exit(1)

remote_host = sys.argv[1]

for remote_port in [21,22,23,80,139,139,389,443,445,3128,3306,3389]:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(20)
        try:
                sock.connect((remote_host, remote_port))
        except Exception,e:
                print "%d closed " % remote_port
        else:
                print "%d open" % remote_port
        sock.close()
- change the ports as you wish.
Implementing nmap for ports monitoring is also good idea.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0