Start work on search page

This commit is contained in:
Astatin3
2024-04-21 10:31:38 -06:00
parent 5599f5f9a2
commit 191b7280f0
5 changed files with 140 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
mm = None
def init(moduleMaster):
pass
def main():
pass
+20
View File
@@ -0,0 +1,20 @@
{
"name": "search",
"creators": ["ASTATIN3"],
"version": "1.0",
"entrypoint": "modules/search/main.py",
"tabs": [
{
"name": "Search",
"defaultPage": "Search",
"pages": [
{
"type": "page",
"name": "Search",
"requiredPermGroup": "",
"location": "modules/search/search.html"
}
]
}
]
}
+111
View File
@@ -0,0 +1,111 @@
<style>
main #searchBar {
display: inline;
}
main button {
width: calc(50% - 6px);
display: inline;
}
tr button {
margin:0;
}
</style>
<main class="container">
<button id="tagBtn" onclick="tagList()">Tags</button>
<button id="searchBtn">Search</button>
<textarea
id="searchBar"
placeholder="Search..."></textarea>
</main>
<script>
const tagBtn = document.getElementById('tagBtn')
const searchBtn = document.getElementById('searchBtn')
tags = [
{
name: "str",
short_description: "Defines if a scan result contains text anywhere",
usage:`
str:"HTTP/1.1 200 OK" - Webpages
`
},
{
name: "port",
short_description: "Defines if a port is present in a scan",
usage:`
port:[port, port range, or port name]/[protocol](/[status])
port:80/tcp - Look for all open http ports
port:80/tcp/open - Look for all open http ports
port:80/tcp/filtered - Look for all filtered http ports
port:http/tcp - Look for all open http ports
port:80-90/tcp - Look for all open ports between 80 and 90
`
}
]
function tagDescription(tagIndex){
const tag = tags[tagIndex]
const elem = document.body
const bgcolor = 'var(--card-sectionning-background-color)'
const header = 'rgba(255,255,255,0.05)'
const textColor = 'text-white'
const title = `Tag ${tag.name} description`
utils.modal(elem, bgcolor, header, textColor, title,
`<p>${tag.short_description}<br><br>${tag.usage.replaceAll("\n", "<br>")}</p>`)
}
function addTag(tagIndex){
const tag = tags[tagIndex]
const elem = document.body
const bgcolor = 'var(--card-sectionning-background-color)'
const header = 'rgba(255,255,255,0.05)'
const textColor = 'text-white'
const title = `Add tag ${tag.name}`
utils.modal(elem, bgcolor, header, textColor, title,
`<p>Tag "${tag.name}" - ${tag.short_description}</p><br>
<input placeholder="${tag.name}:<data>"></input>`)
}
function tagList(){
const elem = document.body
const bgcolor = 'var(--card-sectionning-background-color)'
const header = 'rgba(255,255,255,0.05)'
const textColor = 'text-white'
const title = "Search Tags"
utils.modal(elem, bgcolor, header, textColor, title, `
<table role="grid">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
${(()=>{
str = ""
for(let i=0;i<tags.length;i++){
str += "<tr>"
str += `<td>${tags[i].name}</td>`
str += `<td><button onclick="tagDescription(${i})">Click</button></td>`
str += `<td><button onclick="addTag(${i})">Add</button></td>`
str += "</tr>"
}
return str
})()}
</tbody>
</table>`)
}
window.main = () => {}
</script>