SMTP (tcp-25)
Post

SMTP (tcp-25)

VRFY USER ENUMERATION

With user and IP as input by the user:

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
32
33
34
35
#!/usr/bin/python

import socket
import sys

if len(sys.argv) != 3:
        print("Usage: vrfy.py <IP> <users_list>")
        sys.exit(0)

with open(sys.argv[2]) as topo_file:
    for line in topo_file:
        line=line.strip()
#        print(line)
# Create a Socket
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect to the Server
        connect = s.connect((sys.argv[1],25))

# Receive the banner
        banner = s.recv(1024)
        print(banner.decode())

# VRFY a user
        payload='VRFY ' + line + "\r\n"
#        print(payload)
        byt=payload.encode()
        print(byt.decode())
        s.send(byt)
        result = s.recv(1024)

        print(result.decode())

# Close the socket
        s.close()