write a Python script that will test the HTTP Service to see if it is "up and operational". Note that the HTTP service may be "down" for a period of time, so you should check the other components to see why the HTTP service is down. Devise a test plan and execute it!
turn in
test plan and code
WebCheck.py
#!/usr/bin/python
import hashlib
from sys import argv
from socket import *
def connScan(tgtHost):
try:
connSkt =
socket(AF_INET, SOCK_STREAM)
connSkt.connect((tgtHost, 80))
connSkt.send('GET
/\r\n')
results =
connSkt.recv(4096)
myHash =
hashlib.md5()
myHash.update(results)
print "URL:
" + tgtHost + ", Hash: " + myHash.hexdigest()
except:
print 'No
connection...'
finally:
connSkt.close()
def main():
# script, ip = argv
connScan('10.0.95.82')
if __name__ == "__main__":
main()
mysqlCheck.py
#!/usr/bin/python
import MySQLdb
dbconn = MySQLdb.connect(
'10.0.95.82', 'admin' , 'changeme', 'test')
dbcur = dbconn.cursor()
dbcur.execute('select * from test')
data = dbcur.fetchone()
print data
WebCheck2.py
#!/usr/bin/python3
import requests
import urllib.request
url = "http://10.0.95.82"
response = requests.get(url)
print(response.text)
ping -c 5 10.0.95.82
echo "------------------------ "
./mysqlCheck.py
echo "----------------------- "
./WebCheck.py
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 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 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
423 Experts Online