일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Bash
- 솔라리스
- Kernel
- Disk
- Hack
- Python
- 칭찬교육
- cadre
- Performance
- 리눅스
- iptables
- goaccess
- ext3
- ext4
- pid
- rm
- PERL
- rm -rf
- DNS
- 쇼펜의상속자 #킨텍스메가쇼 #섬유향수탈취제
- 좌절교육
- windows
- 디스크
- CPU
- Cache
- Linux
- apachetop
- rsync
- http
- PORT
- Today
- Total
Ben's
port check python script 본문
#!/usr/bin/python
#
# 08/07/20 system team nhko
#
from httplib import HTTP
import urllib
import httplib
def error(msg) :
params = urllib.urlencode({'pass': 'xxxx', 'mesg': '10.10.10.2'':'+msg})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection("sms.nhko.com:80")
conn.request("POST", "/cgi-bin/sms.pl", params, headers)
print conn.getresponse().status
request = HTTP('nhko.co.kr',80)
request.putrequest('GET','/admin/asp_logintime_update.php3?' + urllib.quote('homepath=xxxxxxxxxx.com'))
request.putheader('Accept','*.*')
request.putheader('Accept-Language','ko')
request.putheader('Connection','Keep-Alive')
request.putheader('Host','www.nhko.co.kr')
request.putheader('User-Agent','nhko Request Checker')
request.endheaders()
errorCode, errorMessage, headers = request.getreply()
ERRCODE = str(errorCode)
ERRMSG = str(errorMessage)
if (ERRCODE == '200') and (ERRMSG == 'OK'):
print 'Success'
else:
print 'Fail'
error(" www.nhko.co.kr response fail - nhko alarm")
'리눅스 > python' 카테고리의 다른 글
performance of different scripting languages: shell v. perl v. python v. ruby (0) | 2013.01.22 |
---|