Guest User

Untitled

a guest
Jan 11th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. def Traffic(Protocol,VIP,Request):
  2. global pattern
  3. global output
  4. ssh = paramiko.SSHClient()
  5. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  6. ssh.connect('10.77.111.5', port=22, username= 'root', password='Lab4man1')
  7. if Protocol == "http":
  8. stdin, stdout, stderr = ssh.exec_command('shmultool -i %s -u index.html -l %s' %(VIP, Request))
  9. else:
  10. stdin, stdout, stderr = ssh.exec_command('shmultool -i %s -S -u index.html -l %s' %(VIP, Request))
  11. output = stdout.readlines()
  12. print 'n'.join(output)
  13. return output
  14.  
  15. def srch():
  16. print output
  17. string = output
  18. pattern = re.findall('200 OK', string)
  19. iterator = re.finditer(pattern, string)
  20. count = 0
  21. for match in iterator:
  22. count +=1
  23. print count
Add Comment
Please, Sign In to add comment