Skip to content

Instantly share code, notes, and snippets.

@galehrizky
Last active July 4, 2020 04:18
Show Gist options
  • Save galehrizky/de8d5135af4671d18d3e1b0f2bf82ef9 to your computer and use it in GitHub Desktop.
Save galehrizky/de8d5135af4671d18d3e1b0f2bf82ef9 to your computer and use it in GitHub Desktop.
Detect CMS & Framework
# ======================================================
# Change the author name don't make you become a coder
# contact : galehrizky123@xaisyndicate.id
# requirement : python3
# use : python3 detect_cms.py
# @2020 galehdotid | fb.com/hax0rtersakiti
# =======================================================
import requests,time,os,sys,re
from termcolor import colored
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from concurrent.futures import ThreadPoolExecutor
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
class warna():
"""docstring for warna"""
def red(self,str):
return colored(str, "red")
def blue(self,str):
return colored(str, "blue")
def green(self,str):
return colored(str, "green")
class _cms():
"""This Class For check the initial"""
def __init__(self):
self.rs = requests.session()
self.hd = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0'}
self.clr = warna()
def _wordpress(self, url):
try:
wp_1 = self._curl(url)
wp_2 = self._curl(url+'/license.txt')
wp_3 = self._curl(url+'/xmlrpc.php?rsd')
if wp_2.status_code == 200:
if 'WordPress' in str(wp_2.text.encode('utf-8')):
self.save(url, "Wordpress.txt")
print(self.clr.green("[+] [Wordpress CMS] => {}".format(url)))
elif wp_3.status_code == 200:
if 'WordPress' in str(wp_3.text.encode('utf-8')):
self.save(url, "Wordpress.txt")
print(self.clr.green("[+] [Wordpress CMS] => {}".format(url)))
elif wp_1.status_code == 200:
if '/wp-content/' in str(wp_1.text.encode('utf-8')):
self.save(url, "Wordpress.txt")
print(self.clr.green("[+] [Wordpress CMS] => {}".format(url)))
else:
print(self.clr.red("[-] [NOT WORDPRESS] => {}".format(url)))
except Exception as e:
pass
def prestashop(self, url):
try:
prestashop = self._curl(url)
clr = self.clr
if prestashop.status_code == 200:
if 'content="PrestaShop"' in str(prestashop.text.encode('utf-8')):
self.save(url, "Prestashop.txt")
print(self.clr.green("[+] [Prestashop CMS] => {}".format(url)))
else:
print(self.clr.red("[-] [NOT PRESTASHOP] {}".format(url)))
except Exception as e:
pass
def magento(self,url):
try:
magento = self._curl(url + '/user/login')
magento2 = self._curl(url)
if magento.status_code == 200:
if 'magento' in str(magento2.text.encode('utf-8')) or 'Magento' in str(magento2.text.encode('utf-8')):
self.save(url, "Magento.txt")
print(self.clr.green("[+] [Magento CMS] => {}".format(url)))
else:
print(self.clr.red("[-] [NOT MAGENTO] {}".format(url)))
except Exception as e:
pass
def opencart(self,url):
try:
opencart = self._curl(url)
if 'catalog/view/' in str(opencart.text.encode('utf-8')):
self.save(url, "Opencart.txt")
print(self.clr.green("[+] [Opencart CMS] => {}".format(url)))
else:
print(self.clr.red("[+] [NOT Opencart] => {}".format(url)))
except Exception as e:
pass
def _laravel(self,url):
try:
laravel = self._curl(url).headers
if 'laravel_session' in str(laravel):
print(self.clr.green("[+] [Laravel Framework] => {}".format(url)))
self.save(url, "Laravel.txt")
elif '=ey' in str(laravel['set-cookie']):
print(self.clr.green("[+] [Laravel Framework] => {}".format(url)))
self.save(url, "Laravel.txt")
else:
print(self.clr.red("[-] [NOT LARAVEL] {} ".format(url)))
except Exception as e:
pass
def _codeigniter(self,url):
try:
codeigniter = self._curl(url).headers
if 'ci_session' in str(codeigniter):
print(self.clr.green("[+] [Codeigniter Framework] => {}".format(url)))
self.save(url, "Codeigniter.txt")
else:
print(self.clr.red("[-] [NOT CODEIGNITER] {} ".format(url)))
except Exception as e:
pass
def _curl(self,url):
rc = self.rs
try:
url = rc.get(url,headers=self.hd, verify=False, allow_redirects=False)
return url
except Exception as e:
pass
def _execute(self,url):
rq = self._curl(url)
if rq is not None:
if rq.status_code == 200:
self._wordpress(url)
self.prestashop(url)
self.magento(url)
self.opencart(url)
self._laravel(url)
self._codeigniter(url)
else:
print(self.clr.red("[+] DEAD SITES {}".format(url)))
else:
print(self.clr.red("[+] SITES SOMETHING WRONG {}".format(url)))
def save(self, sites, names):
s = open(names, "a+")
s.write(sites+"\n")
return s
cms = _cms()
def main():
try:
lisnya = input("Your name list -> ")
trit = int(input("Put Your Thread Number -> "))
# os.system('cls' if os.name == 'nt' else 'clear')
try:
with ThreadPoolExecutor(max_workers=trit) as executor:
with open(lisnya, 'r') as url:
for x in url:
if not re.match('(?:http|ftp|https)://', x):
aw = 'http://{}'.format(x)
executor.submit(cms._execute,aw.rstrip())
except IOError as e:
print("[-] YOUR LIST NOT FOUND !")
sys.exit()
pass
except Exception as e:
pass
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt as e:
print("[!] Exit Program....")
sys.exit()
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment