forked from imvickykumar999/Expose-Nested-Folder-on-DarkWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
220 lines (191 loc) · 6.24 KB
/
Copy pathapp.py
File metadata and controls
220 lines (191 loc) · 6.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
from flask import Flask, render_template_string, send_from_directory, abort, request
import os
app = Flask(__name__)
BASE_DIR = os.path.abspath(os.getcwd())
HTML = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Premium File Browser</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', sans-serif;
}
body {
min-height: 100vh;
background: linear-gradient(135deg, #0f172a, #1e293b, #334155);
padding: 40px;
color: white;
}
.container {
max-width: 1100px;
margin: auto;
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(18px);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 24px;
padding: 35px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 15px;
margin-bottom: 25px;
}
h2 {
font-size: 30px;
font-weight: 700;
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
h2 a {
text-decoration: none;
color: #38bdf8;
transition: .25s;
}
h2 a:hover {
color: #facc15;
}
.path-separator {
color: #94a3b8;
}
.sort-btn {
padding: 12px 18px;
border: none;
border-radius: 14px;
background: #38bdf8;
color: #0f172a;
font-weight: bold;
cursor: pointer;
text-decoration: none;
transition: .3s;
}
.sort-btn:hover {
background: #facc15;
transform: translateY(-2px);
}
.grid {
display: grid;
gap: 14px;
}
.item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 18px 22px;
border-radius: 18px;
text-decoration: none;
color: white;
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.08);
transition: .3s;
}
.item:hover {
transform: translateY(-3px);
background: rgba(56, 189, 248, 0.15);
border-color: #38bdf8;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}
.left {
display: flex;
align-items: center;
gap: 14px;
font-size: 18px;
}
.icon {
font-size: 24px;
}
.badge {
font-size: 13px;
padding: 6px 10px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.1);
color: #cbd5e1;
}
.back {
display: inline-block;
margin-bottom: 18px;
color: white;
text-decoration: none;
padding: 12px 18px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.08);
}
.back:hover {
background: rgba(255, 255, 255, 0.14);
}
</style>
</head>
<body>
<div class="container">
<div class="toolbar">
<h2>
📂 <a href="/browse/">Home</a>
{% set parts = current_path.split('/') if current_path else [] %}
{% set ns = namespace(path='') %}
{% for part in parts %}
{% set ns.path = ns.path + '/' + part if ns.path else part %}
<span class="path-separator">/</span>
<a href="/browse/{{ ns.path }}">{{ part }}</a>
{% endfor %}
</h2>
<a class="sort-btn" href="?sort={{ 'desc' if sort=='asc' else 'asc' }}">Sort {{ '↓' if sort=='asc' else '↑'
}}</a>
</div>
{% if parent %}<a class="back" href="/browse/{{ parent }}">⬅ Back</a>{% endif %}
<div class="grid">
{% for item in items %}
<a class="item" href="{{ '/browse/' + item.path if item.is_dir else '/file/' + item.path }}" {% if not
item.is_dir %}target="_blank" {% endif %}>
<div class="left"><span class="icon">{{ '📁' if item.is_dir else item.icon }}</span><span>{{ item.name
}}</span></div>
<span class="badge">{{ 'Folder' if item.is_dir else item.ext }}</span>
</a>
{% endfor %}
</div>
</div>
</body>
</html>
"""
def get_icon(filename):
ext = filename.lower().split('.')[-1]
if ext in ['mp4','mkv','avi']: return '🎬', ext.upper()
if ext in ['html','htm']: return '🌐', ext.upper()
if ext in ['pdf']: return '📕', ext.upper()
return '📄', ext.upper()
@app.route('/')
def home():
return browse('')
@app.route('/browse/<path:subpath>')
@app.route('/browse/', defaults={'subpath': ''})
def browse(subpath):
full_path = os.path.join(BASE_DIR, subpath)
if not os.path.exists(full_path): abort(404)
sort_order = request.args.get('sort', 'asc')
names = os.listdir(full_path)
names = sorted(names, reverse=(sort_order=='desc'))
items=[]
for name in names:
item_path=os.path.join(full_path,name)
rel=os.path.relpath(item_path,BASE_DIR).replace('\\','/')
icon,ext=get_icon(name)
items.append({'name':name,'path':rel,'is_dir':os.path.isdir(item_path),'icon':icon,'ext':ext})
parent=os.path.dirname(subpath).replace('\\','/') if subpath else None
return render_template_string(HTML,items=items,current_path=subpath,parent=parent,sort=sort_order)
@app.route('/file/<path:filepath>')
def file(filepath):
full_path=os.path.join(BASE_DIR,filepath)
if not os.path.exists(full_path): abort(404)
return send_from_directory(os.path.dirname(full_path),os.path.basename(full_path))
if __name__=='__main__':
app.run(port=8000,debug=False)