fix tool configurations

This commit is contained in:
Yogesh Ojha
2022-04-24 22:57:32 +05:30
parent ca75f6e4c5
commit 55cf1becc4
3 changed files with 524 additions and 490 deletions
+35 -10
View File
@@ -649,49 +649,71 @@ class GetFileContents(APIView):
req = self.request
name = req.query_params.get('name')
response = {}
response['status'] = False
response['message'] = 'Invalid Query Params'
if 'nuclei_config' in req.query_params:
path = "/root/.config/nuclei/config.yaml"
if not os.path.exists(path):
os.system('touch {}'.format(path))
response['message'] = 'File Created!'
f = open(path, "r")
return Response({'content': f.read()})
response['status'] = True
response['content'] = f.read()
return Response(response)
if 'subfinder_config' in req.query_params:
path = "/root/.config/subfinder/config.yaml"
if not os.path.exists(path):
os.system('touch {}'.format(path))
response['message'] = 'File Created!'
f = open(path, "r")
return Response({'content': f.read()})
response['status'] = True
response['content'] = f.read()
return Response(response)
if 'naabu_config' in req.query_params:
path = "/root/.config/naabu/config.yaml"
if not os.path.exists(path):
os.system('touch {}'.format(path))
response['message'] = 'File Created!'
f = open(path, "r")
return Response({'content': f.read()})
response['status'] = True
response['content'] = f.read()
return Response(response)
if 'theharvester_config' in req.query_params:
path = "/usr/src/github/theHarvester/api-keys.yaml"
if not os.path.exists(path):
os.system('touch {}'.format(path))
response['message'] = 'File Created!'
f = open(path, "r")
return Response({'content': f.read()})
response['status'] = True
response['content'] = f.read()
return Response(response)
if 'amass_config' in req.query_params:
path = "/root/.config/amass.ini"
if not os.path.exists(path):
os.system('touch {}'.format(path))
response['message'] = 'File Created!'
f = open(path, "r")
return Response({'content': f.read()})
response['status'] = True
response['content'] = f.read()
return Response(response)
if 'gf_pattern' in req.query_params:
basedir = '/root/.gf'
path = '/root/.gf/{}.json'.format(name)
if is_safe_path(basedir, path) and os.path.exists(path):
content = open(path, "r").read()
response['status'] = True
response['content'] = content
else:
content = "Invalid path!"
return Response({'content': content})
response['message'] = "Invalid path!"
response['status'] = False
return Response(response)
if 'nuclei_template' in req.query_params:
@@ -699,11 +721,14 @@ class GetFileContents(APIView):
path = '/root/nuclei-templates/{}'.format(name)
if is_safe_path(safe_dir, path) and os.path.exists(path):
content = open(path.format(name), "r").read()
response['status'] = True
response['content'] = content
else:
content = 'Invalid Path!'
return Response({'content': content})
response['message'] = 'Invalid Path!'
response['status'] = False
return Response(response)
return Response({'content': "ping-pong"})
return Response(response)
class ListTodoNotes(APIView):
File diff suppressed because it is too large Load Diff
@@ -1,16 +1,25 @@
function load_gf_template(pattern_name){
$('#modal-size').removeClass('modal-xl');
$('#modal-size').addClass('modal-lg');
$('.modal-title').html(`GF Pattern ` + htmlEncode(pattern_name));
$('#exampleModal').modal('show');
$('.modal-text').empty();
$('.modal-text').append(`<div class='outer-div' id="modal-loader"><span class="inner-div spinner-border text-primary align-self-center loader-sm"></span></div>`);
Swal.fire({
title: `Fetching GF template ${pattern_name}...`,
});
swal.showLoading();
$.getJSON(`/api/getFileContents?gf_pattern&name=${pattern_name}&format=json`, function(data) {
$('#modal-loader').empty();
console.log(data);
swal.close();
$('#modal_title').empty();
$('#modal-content').empty();
$("#modal-footer").empty();
$('#modal_title').html(`GF Pattern ` + htmlEncode(pattern_name));
$('#modal-content').append(`<pre>${htmlEncode(data['content'])}</pre>`);
$('#modal_dialog').modal('show');
}).fail(function(){
$('#modal-loader').empty();
$("#modal-content").append(`<p class='text-danger'>Error loading GF Pattern</p>`);
swal.fire("Error!", 'Error loading gf pattern!', "error", {
button: "Okay",
});
});
}