mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-01 14:14:57 +02:00
render cms detection
This commit is contained in:
+19
-10
@@ -5,9 +5,12 @@ import random
|
||||
import requests
|
||||
import tldextract
|
||||
import logging
|
||||
import shutil
|
||||
|
||||
from threading import Thread
|
||||
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from lxml import html
|
||||
|
||||
@@ -665,20 +668,26 @@ def get_whois(ip_domain, save_db=False, fetch_from_db=True):
|
||||
def get_cms_details(url):
|
||||
# this function will fetch cms details using cms_detector
|
||||
response = {}
|
||||
cms_detector_command = 'python3 /usr/src/github/CMSeeK/cmseek.py -u {} --random-agent --batch'.format(url)
|
||||
cms_detector_command = 'python3 /usr/src/github/CMSeeK/cmseek.py -u {} --random-agent --batch --follow-redirect'.format(url)
|
||||
output_lines = os.popen(cms_detector_command).read().splitlines()
|
||||
result = [r for r in output_lines if "Result:" in r]
|
||||
|
||||
response['status'] = False
|
||||
response['message'] = 'Could not detect CMS!'
|
||||
|
||||
if result:
|
||||
result_path = re.search('32m(.*)0m', result[0])
|
||||
if result_path:
|
||||
cms_json_path = result_path.group(1)[:-2]
|
||||
cms_file_content = json.loads(open(cms_json_path, 'r').read())
|
||||
response = {}
|
||||
response = cms_file_content
|
||||
response['status'] = True
|
||||
domain_name = urlparse(url).netloc
|
||||
|
||||
cms_dir_path = '/usr/src/github/CMSeeK/Result/{}'.format(domain_name)
|
||||
cms_json_path = cms_dir_path + '/cms.json'
|
||||
|
||||
if os.path.isfile(cms_json_path):
|
||||
cms_file_content = json.loads(open(cms_json_path, 'r').read())
|
||||
response = {}
|
||||
response = cms_file_content
|
||||
response['status'] = True
|
||||
# remove cms dir path
|
||||
try:
|
||||
shutil.rmtree(cms_dir_path)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
return response
|
||||
|
||||
@@ -1476,9 +1476,8 @@ function get_domain_whois(domain_name, show_add_target_btn=false) {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(response => response.json()).then(function(response) {
|
||||
console.log(response);
|
||||
swal.close();
|
||||
if (response.status) {
|
||||
swal.close();
|
||||
display_whois_on_modal(response, show_add_target_btn=show_add_target_btn);
|
||||
} else {
|
||||
Swal.fire({
|
||||
|
||||
@@ -32,7 +32,7 @@ function cms_detector(){
|
||||
$('#modal-content').append(`
|
||||
<div class="mb-1">
|
||||
<label for="cms_detector_input_url" class="form-label">HTTP URL/Domain Name</label>
|
||||
<input class="form-control" type="text" id="cms_detector_input_url" required="" placeholder="https://yourdomain.com" value="https://bbanotes.com">
|
||||
<input class="form-control" type="text" id="cms_detector_input_url" required="" placeholder="https://yourdomain.com">
|
||||
</div>
|
||||
<small class="mb-3 float-end text-muted">(reNgine uses <a href="https://github.com/Tuhinshubhra/CMSeeK" target="_blank">CMSeeK</a> to detect CMS.)</span>
|
||||
<div class="mt-3 mb-3 text-center">
|
||||
@@ -59,9 +59,9 @@ $(document).on('click', '#detect_cms_submit_btn', function(){
|
||||
function cms_detector_api_call(url){
|
||||
var api_url = `/api/tools/cms_detector/?format=json&url=${url}`
|
||||
Swal.fire({
|
||||
title: `Detecting CMS details on ${url}...`
|
||||
title: `Detecting CMS`,
|
||||
text: `reNgine is detecting CMS on ${url} and this may take a while. Please wait...`
|
||||
});
|
||||
$('.modal').modal('hide');
|
||||
swal.showLoading();
|
||||
fetch(api_url, {
|
||||
method: 'GET',
|
||||
@@ -74,8 +74,125 @@ function cms_detector_api_call(url){
|
||||
console.log(response);
|
||||
if (response.status) {
|
||||
swal.close();
|
||||
console.log(response);
|
||||
// display_whois_on_modal(response, show_add_target_btn=show_add_target_btn);
|
||||
$('#modal_title').html('CMS Details for ' + url);
|
||||
$('#modal-content').empty();
|
||||
|
||||
content = `
|
||||
<div class="d-flex align-items-start mb-3">
|
||||
<img class="d-flex me-3 rounded-circle avatar-lg" src="${response.cms_url}/favicon.ico" alt="${response.cms_name}">
|
||||
<div class="w-100">
|
||||
<h4 class="mt-0 mb-1">${response.cms_name}</h4>
|
||||
<a href="${response.cms_url}" class="btn btn-xs btn-primary" target="_blank">Visit CMS</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 class="mb-3 mt-4 text-uppercase bg-light p-2"><i class="fe-info"></i> CMS Details</h5>
|
||||
<div class="">
|
||||
<h4 class="font-13 text-muted text-uppercase">CMS Name :</h4>
|
||||
<p class="mb-3">${response.cms_name}</p>
|
||||
|
||||
<h4 class="font-13 text-muted text-uppercase mb-1">CMS URL :</h4>
|
||||
<p class="mb-3"><a href="${response.cms_url}">${response.cms_url}</a></p>
|
||||
|
||||
<h4 class="font-13 text-muted text-uppercase mb-1">Detection Method :</h4>
|
||||
<p class="mb-3">${response.detection_param}</p>
|
||||
|
||||
<h4 class="font-13 text-muted text-uppercase mb-1">URL :</h4>
|
||||
<p class="mb-3">
|
||||
<small class="text-muted">(Includes redirected URL)</small><br>
|
||||
<a href="${response.url}" target="_blank">${response.url}</a>
|
||||
</p>`;
|
||||
|
||||
|
||||
if (response.wp_license) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Wordpress License :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.wp_license}" target="_blank">${response.wp_license}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.wp_readme_file) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Wordpress Readme file :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.wp_readme_file}" target="_blank">${response.wp_readme_file}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.wp_uploads_directory) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Wordpress Uploads Directory :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.wp_uploads_directory}" target="_blank">${response.wp_uploads_directory}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.wp_users) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Wordpress Users :</h4>
|
||||
<p class="mb-3">
|
||||
${response.wp_users}
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.wp_version) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Wordpress Version :</h4>
|
||||
<p class="mb-3">
|
||||
${response.wp_version}
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.joomla_version) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla Version :</h4>
|
||||
<p class="mb-3">
|
||||
${response.joomla_version}
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.joomla_debug_mode) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla Debug Mode :</h4>
|
||||
<p class="mb-3">
|
||||
${response.joomla_debug_mode}
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.joomla_readme_file) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla Readme File :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.joomla_readme_file}" target="_blank">${response.joomla_readme_file}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.joomla_backup_files) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla Backup Files :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.joomla_backup_files}" target="_blank">${response.joomla_backup_files}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.directory_listing) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla Directory Listing :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.directory_listing}" target="_blank">${response.directory_listing}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.joomla_config_files) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla Config Files :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.joomla_config_files}" target="_blank">${response.joomla_config_files}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
if (response.user_registration_url) {
|
||||
content += `<h4 class="font-13 text-muted text-uppercase mb-1">Joomla User Registration :</h4>
|
||||
<p class="mb-3">
|
||||
<a href="${response.user_registration_url}" target="_blank">${response.user_registration_url}</a>
|
||||
</p>`;
|
||||
}
|
||||
|
||||
|
||||
content += '</div>'
|
||||
|
||||
$('#modal-content').append(content);
|
||||
$('#modal_dialog').modal('show');
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Oops!',
|
||||
|
||||
Reference in New Issue
Block a user