return passwords
-def crackpop(host, port, user, passwords):
+def crackpop(host, port, ssl, user, passwords):
+ if ssl:
+ pop3_connect = poplib.POP3_SSL
+ else:
+ pop3_connect = poplib.POP3
+
print "Testing %d passwords." % len(passwords)
for p in passwords:
# TODO maybe the same connection can be reused for more than one try,
# but some logic needs to be added to detect the maximum allowed
# authentication attempts or a disconnection from the server.
- pop3 = poplib.POP3(host, port)
+ pop3 = pop3_connect(host, port)
+
try:
pop3.user(user)
pop3.pass_(p)
dest='dry_run', action='store_const', const=True,
help='only print out the passwords, do not connect to the pop3 server')
+ parser.add_argument(
+ '-s', '--ssl',
+ dest='ssl', action='store_const', const=True,
+ help='use SSL to connect to the pop3 server')
+
+ parser.add_argument(
+ '-S', '--ssl-port', metavar="<ssl_port>",
+ dest='ssl_port', default=995,
+ help='the port the SSL pop3 server is listening on')
+
return parser
parser = option_parser()
args = parser.parse_args()
+ if args.ssl:
+ port = args.ssl_port
+ else:
+ port = args.port
+
passwords = generate_passwords(args.password_pattern, args.dry_run)
- crackpop(args.host, args.port, args.user, passwords)
+ crackpop(args.host, port, args.ssl, args.user, passwords)