projects
/
crackpop.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9c0c330
)
Add support for SSL connections
author
Antonio Ospite <ospite@studenti.unina.it>
Tue, 2 Apr 2013 21:08:41 +0000
(23:08 +0200)
committer
Antonio Ospite <ospite@studenti.unina.it>
Tue, 2 Apr 2013 21:08:41 +0000
(23:08 +0200)
crackpop.py
patch
|
blob
|
history
diff --git
a/crackpop.py
b/crackpop.py
index
3c7d0f7
..
850b13f
100755
(executable)
--- a/
crackpop.py
+++ b/
crackpop.py
@@
-38,13
+38,19
@@
def generate_passwords(password_pattern, dry_run=False):
return passwords
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.
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)
try:
pop3.user(user)
pop3.pass_(p)
@@
-91,6
+97,16
@@
def option_parser():
dest='dry_run', action='store_const', const=True,
help='only print out the passwords, do not connect to the pop3 server')
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
return parser
@@
-98,5
+114,10
@@
if __name__ == "__main__":
parser = option_parser()
args = parser.parse_args()
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)
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)