test-form.html•4.5 kB
<!DOCTYPE html>
<html>
<head>
<title>Test SpiderFoot Form Submission</title>
<script>
async function submitForm() {
const form = document.getElementById('scanForm');
const formData = new FormData(form);
// Log the form data being submitted
console.log('Form data to be submitted:');
for (let [key, value] of formData.entries()) {
console.log(`${key}: ${value}`);
}
try {
const response = await fetch('/startscan', {
method: 'POST',
body: formData,
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
},
credentials: 'include' // Include cookies for session
});
console.log('Response status:', response.status);
console.log('Response headers:');
response.headers.forEach((value, key) => {
console.log(` ${key}: ${value}`);
});
const text = await response.text();
console.log('Response text (first 500 chars):', text.substring(0, 500));
if (response.redirected) {
console.log('Redirected to:', response.url);
}
document.getElementById('result').textContent = `Status: ${response.status} - ${response.statusText}`;
} catch (error) {
console.error('Error submitting form:', error);
document.getElementById('result').textContent = `Error: ${error.message}`;
}
}
</script>
</head>
<body>
<h1>Test SpiderFoot Form Submission</h1>
<form id="scanForm" onsubmit="event.preventDefault(); submitForm();">
<div>
<label for="scanname">Scan Name:</label>
<input type="text" id="scanname" name="scanname" value="test-scan-123">
</div>
<div>
<label for="scantarget">Target:</label>
<input type="text" id="scantarget" name="scantarget" value="example.com">
</div>
<div>
<label for="type">Scan Type:</label>
<select id="type" name="type">
<option value="domain">Domain</option>
<option value="ip">IP Address</option>
<option value="asn">AS Number</option>
</select>
</div>
<div>
<label for="usecase">Use Case:</label>
<select id="usecase" name="usecase">
<option value="all">All</option>
<option value="passive">Passive</option>
<option value="investigate">Investigate</option>
</select>
</div>
<div>
<label>Modules (check to enable):</label><br>
<input type="checkbox" id="type_ACCOUNT_EXTERNAL_OWNED" name="type_ACCOUNT_EXTERNAL_OWNED" value="on">
<label for="type_ACCOUNT_EXTERNAL_OWNED">External Account</label><br>
<input type="checkbox" id="type_AFFILIATE_COMPANY_NAME" name="type_AFFILIATE_COMPANY_NAME" value="on" checked>
<label for="type_AFFILIATE_COMPANY_NAME">Affiliate Company</label><br>
<input type="checkbox" id="type_DNS_TEXT" name="type_DNS_TEXT" value="on" checked>
<label for="type_DNS_TEXT">DNS Text</label>
</div>
<div>
<button type="submit">Start Scan</button>
</div>
</form>
<div id="result"></div>
<script>
// Add hidden inputs that might be required
const form = document.getElementById('scanForm');
const modulelist = document.createElement('input');
modulelist.type = 'hidden';
modulelist.name = 'modulelist';
modulelist.value = 'sfp_dnsresolve,sfp_dnsbrute,sfp_dnszonexfer,sfp_dnscommoncrawl,sfp_dnsgrep,sfp_dnsresolveall,sfp_dnsresolver,sfp_dnssublist3r,sfp_dnszone,sfp_dnszone_p,sfp_dnszone_s,sfp_dnszone_t';
form.appendChild(modulelist);
const typelist = document.createElement('input');
typelist.type = 'hidden';
typelist.name = 'typelist';
typelist.value = 'DOMAIN_NAME,INTERNET_NAME,IP_ADDRESS,NETBLOCK_OWNER,NETBLOCKV6_OWNER';
form.appendChild(typelist);
</script>
</body>
</html>