Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ import subprocess
|
|
3 |
import os
|
4 |
|
5 |
def run_katana(url):
|
6 |
-
# Set a custom configuration directory within /
|
7 |
-
katana_config_dir = "/
|
8 |
os.makedirs(katana_config_dir, exist_ok=True)
|
9 |
|
10 |
# Ensure the config file exists, or create a dummy one if needed
|
@@ -13,7 +13,7 @@ def run_katana(url):
|
|
13 |
with open(config_file_path, 'w') as f:
|
14 |
f.write("# Dummy configuration\n")
|
15 |
|
16 |
-
output_file = "/
|
17 |
command = f"katana -config {config_file_path} -u {url} > {output_file}"
|
18 |
try:
|
19 |
subprocess.run(command, shell=True, check=True)
|
@@ -21,8 +21,8 @@ def run_katana(url):
|
|
21 |
except subprocess.CalledProcessError as e:
|
22 |
return f"Error running katana: {e}"
|
23 |
|
24 |
-
# Ensure the /
|
25 |
-
os.makedirs("/
|
26 |
|
27 |
# Gradio interface
|
28 |
interface = gr.Interface(
|
@@ -31,7 +31,7 @@ interface = gr.Interface(
|
|
31 |
outputs="file",
|
32 |
title="Katana URL Crawler",
|
33 |
description="Enter a URL to crawl with Katana.",
|
34 |
-
flagging_dir="/
|
35 |
)
|
36 |
|
37 |
interface.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
3 |
import os
|
4 |
|
5 |
def run_katana(url):
|
6 |
+
# Set a custom configuration directory within /tmp
|
7 |
+
katana_config_dir = "/tmp/katana"
|
8 |
os.makedirs(katana_config_dir, exist_ok=True)
|
9 |
|
10 |
# Ensure the config file exists, or create a dummy one if needed
|
|
|
13 |
with open(config_file_path, 'w') as f:
|
14 |
f.write("# Dummy configuration\n")
|
15 |
|
16 |
+
output_file = "/tmp/urls.txt" # Use /tmp for writable directory
|
17 |
command = f"katana -config {config_file_path} -u {url} > {output_file}"
|
18 |
try:
|
19 |
subprocess.run(command, shell=True, check=True)
|
|
|
21 |
except subprocess.CalledProcessError as e:
|
22 |
return f"Error running katana: {e}"
|
23 |
|
24 |
+
# Ensure the /tmp/flagged directory exists
|
25 |
+
os.makedirs("/tmp/flagged", exist_ok=True)
|
26 |
|
27 |
# Gradio interface
|
28 |
interface = gr.Interface(
|
|
|
31 |
outputs="file",
|
32 |
title="Katana URL Crawler",
|
33 |
description="Enter a URL to crawl with Katana.",
|
34 |
+
flagging_dir="/tmp/flagged" # Specify a writable directory for flagging
|
35 |
)
|
36 |
|
37 |
interface.launch(server_name="0.0.0.0", server_port=7860)
|