Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Traffic(Protocol,VIP,Request):
- global pattern
- global output
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect('10.77.111.5', port=22, username= 'root', password='Lab4man1')
- if Protocol == "http":
- stdin, stdout, stderr = ssh.exec_command('shmultool -i %s -u index.html -l %s' %(VIP, Request))
- else:
- stdin, stdout, stderr = ssh.exec_command('shmultool -i %s -S -u index.html -l %s' %(VIP, Request))
- output = stdout.readlines()
- print 'n'.join(output)
- return output
- def srch():
- print output
- string = output
- pattern = re.findall('200 OK', string)
- iterator = re.finditer(pattern, string)
- count = 0
- for match in iterator:
- count +=1
- print count
Add Comment
Please, Sign In to add comment