added krawl homepage to templates
This commit is contained in:
@@ -6,7 +6,7 @@ server:
|
|||||||
timezone: null # e.g., "America/New_York" or null for system default
|
timezone: null # e.g., "America/New_York" or null for system default
|
||||||
|
|
||||||
# manually set the server header, if null a random one will be used.
|
# manually set the server header, if null a random one will be used.
|
||||||
server_header: "Apache/2.2.22 (Ubuntu)"
|
server_header: null
|
||||||
|
|
||||||
links:
|
links:
|
||||||
min_length: 5
|
min_length: 5
|
||||||
|
|||||||
105
src/handler.py
105
src/handler.py
@@ -140,108 +140,25 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
random.seed(seed)
|
random.seed(seed)
|
||||||
num_pages = random.randint(*self.config.links_per_page_range)
|
num_pages = random.randint(*self.config.links_per_page_range)
|
||||||
|
|
||||||
html = f"""<!DOCTYPE html>
|
# Build the content HTML
|
||||||
<html>
|
content = ""
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Krawl</title>
|
|
||||||
<style>
|
|
||||||
body {{
|
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
background-color: #0d1117;
|
|
||||||
color: #c9d1d9;
|
|
||||||
margin: 0;
|
|
||||||
padding: 40px 20px;
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}}
|
|
||||||
.container {{
|
|
||||||
max-width: 1200px;
|
|
||||||
width: 100%;
|
|
||||||
}}
|
|
||||||
h1 {{
|
|
||||||
color: #f85149;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 48px;
|
|
||||||
margin: 60px 0 30px;
|
|
||||||
}}
|
|
||||||
.counter {{
|
|
||||||
color: #f85149;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 56px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 60px;
|
|
||||||
}}
|
|
||||||
.links-container {{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20px;
|
|
||||||
align-items: center;
|
|
||||||
}}
|
|
||||||
.link-box {{
|
|
||||||
background: #161b22;
|
|
||||||
border: 1px solid #30363d;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 15px 30px;
|
|
||||||
min-width: 300px;
|
|
||||||
text-align: center;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}}
|
|
||||||
.link-box:hover {{
|
|
||||||
background: #1c2128;
|
|
||||||
border-color: #58a6ff;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(88, 166, 255, 0.2);
|
|
||||||
}}
|
|
||||||
a {{
|
|
||||||
color: #58a6ff;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 700;
|
|
||||||
}}
|
|
||||||
a:hover {{
|
|
||||||
color: #79c0ff;
|
|
||||||
}}
|
|
||||||
.canary-token {{
|
|
||||||
background: #1c1917;
|
|
||||||
border: 2px solid #f85149;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 30px 50px;
|
|
||||||
margin: 40px auto;
|
|
||||||
max-width: 800px;
|
|
||||||
overflow-x: auto;
|
|
||||||
}}
|
|
||||||
.canary-token a {{
|
|
||||||
color: #f85149;
|
|
||||||
font-size: 18px;
|
|
||||||
white-space: nowrap;
|
|
||||||
}}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<h1>Krawl me! 🕸</h1>
|
|
||||||
<div class="counter">{Handler.counter}</div>
|
|
||||||
|
|
||||||
<div class="links-container">
|
# Add canary token if needed
|
||||||
"""
|
|
||||||
|
|
||||||
if Handler.counter <= 0 and self.config.canary_token_url:
|
if Handler.counter <= 0 and self.config.canary_token_url:
|
||||||
html += f"""
|
content += f"""
|
||||||
<div class="link-box canary-token">
|
<div class="link-box canary-token">
|
||||||
<a href="{self.config.canary_token_url}">{self.config.canary_token_url}</a>
|
<a href="{self.config.canary_token_url}">{self.config.canary_token_url}</a>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Add links
|
||||||
if self.webpages is None:
|
if self.webpages is None:
|
||||||
for _ in range(num_pages):
|
for _ in range(num_pages):
|
||||||
address = ''.join([
|
address = ''.join([
|
||||||
random.choice(self.config.char_space)
|
random.choice(self.config.char_space)
|
||||||
for _ in range(random.randint(*self.config.links_length_range))
|
for _ in range(random.randint(*self.config.links_length_range))
|
||||||
])
|
])
|
||||||
html += f"""
|
content += f"""
|
||||||
<div class="link-box">
|
<div class="link-box">
|
||||||
<a href="{address}">{address}</a>
|
<a href="{address}">{address}</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -249,18 +166,14 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
else:
|
else:
|
||||||
for _ in range(num_pages):
|
for _ in range(num_pages):
|
||||||
address = random.choice(self.webpages)
|
address = random.choice(self.webpages)
|
||||||
html += f"""
|
content += f"""
|
||||||
<div class="link-box">
|
<div class="link-box">
|
||||||
<a href="{address}">{address}</a>
|
<a href="{address}">{address}</a>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
html += """
|
# Return the complete page using the template
|
||||||
</div>
|
return html_templates.main_page(Handler.counter, content)
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>"""
|
|
||||||
return html
|
|
||||||
|
|
||||||
def do_HEAD(self):
|
def do_HEAD(self):
|
||||||
"""Sends header information"""
|
"""Sends header information"""
|
||||||
|
|||||||
91
src/templates/html/main_page.html
Normal file
91
src/templates/html/main_page.html
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Krawl</title>
|
||||||
|
<style>
|
||||||
|
body {{
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
background-color: #0d1117;
|
||||||
|
color: #c9d1d9;
|
||||||
|
margin: 0;
|
||||||
|
padding: 40px 20px;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}}
|
||||||
|
.container {{
|
||||||
|
max-width: 1200px;
|
||||||
|
width: 100%;
|
||||||
|
}}
|
||||||
|
h1 {{
|
||||||
|
color: #f85149;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 48px;
|
||||||
|
margin: 60px 0 30px;
|
||||||
|
}}
|
||||||
|
.counter {{
|
||||||
|
color: #f85149;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 56px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 60px;
|
||||||
|
}}
|
||||||
|
.links-container {{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
align-items: center;
|
||||||
|
}}
|
||||||
|
.link-box {{
|
||||||
|
background: #161b22;
|
||||||
|
border: 1px solid #30363d;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 15px 30px;
|
||||||
|
min-width: 300px;
|
||||||
|
text-align: center;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}}
|
||||||
|
.link-box:hover {{
|
||||||
|
background: #1c2128;
|
||||||
|
border-color: #58a6ff;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(88, 166, 255, 0.2);
|
||||||
|
}}
|
||||||
|
a {{
|
||||||
|
color: #58a6ff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
}}
|
||||||
|
a:hover {{
|
||||||
|
color: #79c0ff;
|
||||||
|
}}
|
||||||
|
.canary-token {{
|
||||||
|
background: #1c1917;
|
||||||
|
border: 2px solid #f85149;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 30px 50px;
|
||||||
|
margin: 40px auto;
|
||||||
|
max-width: 800px;
|
||||||
|
overflow-x: auto;
|
||||||
|
}}
|
||||||
|
.canary-token a {{
|
||||||
|
color: #f85149;
|
||||||
|
font-size: 18px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>Krawl me! 🕸</h1>
|
||||||
|
<div class="counter">{counter}</div>
|
||||||
|
|
||||||
|
<div class="links-container">
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -60,3 +60,8 @@ def product_search() -> str:
|
|||||||
def input_form() -> str:
|
def input_form() -> str:
|
||||||
"""Generate input form page for XSS honeypot"""
|
"""Generate input form page for XSS honeypot"""
|
||||||
return load_template("input_form")
|
return load_template("input_form")
|
||||||
|
|
||||||
|
|
||||||
|
def main_page(counter: int, content: str) -> str:
|
||||||
|
"""Generate main Krawl page with links and canary token"""
|
||||||
|
return load_template("main_page", counter=counter, content=content)
|
||||||
|
|||||||
Reference in New Issue
Block a user