SHARE
TWEET

Untitled

UY-Scuti Jun 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. import socket
  4. import sys
  5.    
  6. # Sends VRFY queries to SMTP to verify if a user exists
  7.  
  8. def smtp_verify(ip, user):
  9.     # Create a socket
  10.     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  11.     # Connect to the server
  12.     connect = s.connect((ip, 25))
  13.     # Receive the banner
  14.     banner = s.recv(1024)
  15.     print banner
  16.  
  17.     # VRFY a user
  18.     s.send('VRFY ' + user + '\r\n')
  19.     print "[*] Attempting to verify existance of user:", user
  20.     result = s.recv(1024)
  21.     print result
  22.  
  23.     # Close the socket
  24.     s.close()
  25.  
  26.  
  27. def main():
  28.     if len(sys.argv) != 3:
  29.         print "Usage: ./smtp_verify.py <IP address> <users file> \n"
  30.         sys.exit(0)
  31.  
  32.     ip = sys.argv[1]
  33.     user = sys.argv[2]
  34.     with open(user, 'r') as f:
  35.         for line in f:
  36.             user = line
  37.             smtp_verify(ip, user)
  38.  
  39. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top