flitrx commited on
Commit
f9cd923
·
verified ·
1 Parent(s): 4c32a6f

i get the following error: "Error generating dorks: Invalid API response format" - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +357 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Dirker
3
- emoji: 🐠
4
- colorFrom: blue
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: dirker
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,357 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>DorkGen - Linux Terminal</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Ubuntu:wght@300;400;500&display=swap');
11
+
12
+ :root {
13
+ --primary: #4ade80;
14
+ --secondary: #60a5fa;
15
+ --accent: #f472b6;
16
+ --background: #1e293b;
17
+ --panel: #334155;
18
+ --text: #e2e8f0;
19
+ --terminal: #0f172a;
20
+ }
21
+
22
+ body {
23
+ font-family: 'Ubuntu', sans-serif;
24
+ background-color: var(--background);
25
+ color: var(--text);
26
+ height: 100vh;
27
+ overflow: hidden;
28
+ margin: 0;
29
+ padding: 0;
30
+ background-image: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1064&q=80');
31
+ background-size: cover;
32
+ background-position: center;
33
+ background-attachment: fixed;
34
+ }
35
+
36
+ .terminal-font {
37
+ font-family: 'Fira Code', monospace;
38
+ }
39
+
40
+ .window {
41
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
42
+ border-radius: 8px;
43
+ overflow: hidden;
44
+ }
45
+
46
+ .terminal-header {
47
+ background: linear-gradient(to right, #334155, #475569);
48
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
49
+ }
50
+
51
+ .terminal-body {
52
+ background-color: var(--terminal);
53
+ background-image: radial-gradient(rgba(74, 222, 128, 0.1) 1px, transparent 1px);
54
+ background-size: 20px 20px;
55
+ }
56
+
57
+ .prompt {
58
+ color: var(--primary);
59
+ }
60
+
61
+ .command {
62
+ color: var(--secondary);
63
+ }
64
+
65
+ .response {
66
+ color: var(--text);
67
+ }
68
+
69
+ .cursor {
70
+ display: inline-block;
71
+ width: 10px;
72
+ height: 20px;
73
+ background-color: var(--primary);
74
+ animation: blink 1s infinite;
75
+ }
76
+
77
+ @keyframes blink {
78
+ 0%, 100% { opacity: 1; }
79
+ 50% { opacity: 0; }
80
+ }
81
+
82
+ .search-result {
83
+ border-left: 3px solid var(--secondary);
84
+ }
85
+
86
+ .dork-item {
87
+ transition: all 0.2s ease;
88
+ }
89
+
90
+ .dork-item:hover {
91
+ background-color: rgba(30, 41, 59, 0.5);
92
+ transform: translateX(5px);
93
+ }
94
+
95
+ .desktop-icon {
96
+ transition: all 0.2s ease;
97
+ }
98
+
99
+ .desktop-icon:hover {
100
+ transform: scale(1.05);
101
+ background-color: rgba(255, 255, 255, 0.1);
102
+ }
103
+
104
+ .taskbar-item {
105
+ transition: all 0.2s ease;
106
+ border-bottom: 2px solid transparent;
107
+ }
108
+
109
+ .taskbar-item:hover {
110
+ border-bottom-color: var(--primary);
111
+ }
112
+
113
+ .glow {
114
+ text-shadow: 0 0 5px rgba(74, 222, 128, 0.5);
115
+ }
116
+
117
+ .glow-secondary {
118
+ text-shadow: 0 0 5px rgba(96, 165, 250, 0.5);
119
+ }
120
+
121
+ .glow-accent {
122
+ text-shadow: 0 0 5px rgba(244, 114, 182, 0.5);
123
+ }
124
+
125
+ /* Scrollbar styling */
126
+ ::-webkit-scrollbar {
127
+ width: 8px;
128
+ }
129
+
130
+ ::-webkit-scrollbar-track {
131
+ background: rgba(30, 41, 59, 0.5);
132
+ }
133
+
134
+ ::-webkit-scrollbar-thumb {
135
+ background: var(--secondary);
136
+ border-radius: 4px;
137
+ }
138
+
139
+ ::-webkit-scrollbar-thumb:hover {
140
+ background: var(--primary);
141
+ }
142
+ </style>
143
+ </head>
144
+ <body class="relative">
145
+ <!-- Desktop Icons -->
146
+ <div class="absolute top-0 left-0 p-4 w-full h-full pointer-events-none">
147
+ <div class="flex flex-col space-y-4 w-24">
148
+ <div class="desktop-icon flex flex-col items-center p-2 rounded pointer-events-auto cursor-pointer">
149
+ <i class="fas fa-folder text-3xl text-yellow-400 mb-1"></i>
150
+ <span class="text-xs text-center">Documents</span>
151
+ </div>
152
+ <div class="desktop-icon flex flex-col items-center p-2 rounded pointer-events-auto cursor-pointer">
153
+ <i class="fas fa-terminal text-3xl text-green-400 mb-1"></i>
154
+ <span class="text-xs text-center">Terminal</span>
155
+ </div>
156
+ <div class="desktop-icon flex flex-col items-center p-2 rounded pointer-events-auto cursor-pointer">
157
+ <i class="fas fa-globe text-3xl text-blue-400 mb-1"></i>
158
+ <span class="text-xs text-center">Browser</span>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- Main Terminal Window -->
164
+ <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-full max-w-4xl h-5/6 flex flex-col z-10">
165
+ <div class="window flex-1 flex flex-col">
166
+ <!-- Terminal Header -->
167
+ <div class="terminal-header flex items-center justify-between px-4 py-2">
168
+ <div class="flex items-center space-x-2">
169
+ <div class="w-3 h-3 rounded-full bg-red-500"></div>
170
+ <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
171
+ <div class="w-3 h-3 rounded-full bg-green-500"></div>
172
+ </div>
173
+ <div class="text-sm font-medium">dorkgen@linux: ~/terminal</div>
174
+ <div class="w-12"></div> <!-- Spacer for alignment -->
175
+ </div>
176
+
177
+ <!-- Terminal Body -->
178
+ <div class="terminal-body flex-1 overflow-hidden flex flex-col">
179
+ <!-- Terminal Content -->
180
+ <div id="terminal-content" class="flex-1 overflow-y-auto p-4 space-y-4">
181
+ <div class="response">
182
+ <p class="glow">Welcome to <span class="font-bold text-green-400">DorkGen Terminal</span></p>
183
+ <p>This tool converts your plain English queries into effective Google dorks.</p>
184
+ <p>Type your query and specify how many dorks you'd like to generate.</p>
185
+ <p class="mt-4 text-sm text-gray-400">Example: "find exposed admin panels" (5 dorks)</p>
186
+ </div>
187
+
188
+ <div class="flex items-start">
189
+ <span class="prompt mr-2">user@dorkgen:~$</span>
190
+ <div id="initial-prompt" class="flex-1">
191
+ <span class="command">ready</span>
192
+ </div>
193
+ </div>
194
+
195
+ <div class="response">
196
+ <p>System ready. Enter your query:</p>
197
+ </div>
198
+ </div>
199
+
200
+ <!-- Input Area -->
201
+ <div class="border-t border-gray-700 p-4 bg-gray-800">
202
+ <form id="query-form" class="w-full">
203
+ <div class="flex items-center">
204
+ <span class="prompt mr-2">user@dorkgen:~$</span>
205
+ <input
206
+ type="text"
207
+ id="user-query"
208
+ autocomplete="off"
209
+ class="flex-1 bg-transparent border-none outline-none text-white terminal-font"
210
+ placeholder="Type your query and number of dorks (e.g. 'find exposed admin panels 5')"
211
+ >
212
+ <button type="submit" class="ml-2 px-3 py-1 bg-green-600 hover:bg-green-700 rounded text-sm hidden">Submit</button>
213
+ </div>
214
+ </form>
215
+ <!-- API Configuration and Script -->
216
+ <script>
217
+ const apiConfig = {
218
+ api_key: "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",
219
+ base_url: "https://openrouter.ai/api/v1",
220
+ model: "cognitivecomputations/dolphin-mistral-24b-venice-edition:free"
221
+ };
222
+
223
+ const systemPrompt = `You are an expert in cybersecurity and Google dorking.
224
+ The user will provide a plain English query and a number (e.g., "find exposed admin panels 5").
225
+ Generate exactly that number of effective Google dorks that would help find the requested information.
226
+ Format each dork on a new line with no additional explanations.
227
+ The dorks should be specific and effective for finding the requested information.`;
228
+
229
+ document.getElementById('query-form').addEventListener('submit', async function(e) {
230
+ e.preventDefault();
231
+ const input = document.getElementById('user-query').value.trim();
232
+ const terminalContent = document.getElementById('terminal-content');
233
+
234
+ // Extract query and number of dorks
235
+ const parts = input.split(/\s+/);
236
+ const numDorks = parseInt(parts.pop());
237
+ const query = parts.join(' ');
238
+
239
+ if (!query || isNaN(numDorks) || numDorks < 1) {
240
+ terminalContent.innerHTML += `
241
+ <div class="response text-red-400">
242
+ <p>Invalid input. Please use format: "query" number (e.g. "find exposed admin panels 5")</p>
243
+ </div>
244
+ `;
245
+ return;
246
+ }
247
+
248
+ // Show user input in terminal
249
+ terminalContent.innerHTML += `
250
+ <div class="flex items-start">
251
+ <span class="prompt mr-2">user@dorkgen:~$</span>
252
+ <div class="flex-1">
253
+ <span class="command">${input}</span>
254
+ </div>
255
+ </div>
256
+ <div class="response">
257
+ <p>Generating ${numDorks} dorks for "${query}"...</p>
258
+ </div>
259
+ `;
260
+
261
+ try {
262
+ const response = await fetch(`${apiConfig.base_url}/chat/completions`, {
263
+ method: 'POST',
264
+ headers: {
265
+ 'Authorization': `Bearer ${apiConfig.api_key}`,
266
+ 'Content-Type': 'application/json'
267
+ },
268
+ body: JSON.stringify({
269
+ model: apiConfig.model,
270
+ messages: [
271
+ { role: "system", content: systemPrompt },
272
+ { role: "user", content: `${query} ${numDorks}` }
273
+ ]
274
+ })
275
+ });
276
+
277
+ const data = await response.json();
278
+
279
+ // Check for API errors first
280
+ if (data.error) {
281
+ throw new Error(data.error.message || 'API Error');
282
+ }
283
+
284
+ // Check response structure
285
+ if (!data.choices || !data.choices[0] || !data.choices[0].message || !data.choices[0].message.content) {
286
+ console.error('Invalid API response:', data);
287
+ throw new Error('Invalid API response format. Please check the console for details.');
288
+ }
289
+
290
+ // Process dorks
291
+ const dorks = data.choices[0].message.content.split('\n')
292
+ .map(d => d.trim())
293
+ .filter(d => d.length > 0);
294
+
295
+ // Display dorks
296
+ let dorksHTML = `
297
+ <div class="response">
298
+ <p class="font-bold mb-2">Generated Dorks:</p>
299
+ `;
300
+
301
+ dorks.forEach(dork => {
302
+ dorksHTML += `
303
+ <div class="dork-item p-2 mb-1 bg-gray-800 rounded">
304
+ <code>${dork}</code>
305
+ <div class="mt-1 flex space-x-2">
306
+ <a href="https://www.google.com/search?q=${encodeURIComponent(dork)}"
307
+ target="_blank"
308
+ class="text-xs px-2 py-1 bg-blue-600 hover:bg-blue-700 rounded">
309
+ Search Google
310
+ </a>
311
+ <a href="https://duckduckgo.com/?q=${encodeURIComponent(dork)}"
312
+ target="_blank"
313
+ class="text-xs px-2 py-1 bg-yellow-600 hover:bg-yellow-700 rounded">
314
+ Search DuckDuckGo
315
+ </a>
316
+ <a href="https://www.bing.com/search?q=${encodeURIComponent(dork)}"
317
+ target="_blank"
318
+ class="text-xs px-2 py-1 bg-green-600 hover:bg-green-700 rounded">
319
+ Search Bing
320
+ </a>
321
+ </div>
322
+ </div>
323
+ `;
324
+ });
325
+
326
+ dorksHTML += `</div>`;
327
+ terminalContent.innerHTML += dorksHTML;
328
+
329
+ } catch (error) {
330
+ terminalContent.innerHTML += `
331
+ <div class="response bg-red-900/50 p-3 rounded border border-red-700">
332
+ <p class="font-bold text-red-300">Error generating dorks:</p>
333
+ <p class="text-red-200">${error.message}</p>
334
+ <p class="text-xs text-red-300 mt-2">Please try again or check your API configuration.</p>
335
+ <details class="mt-2 text-xs">
336
+ <summary class="cursor-pointer text-red-300">Technical Details</summary>
337
+ <pre class="mt-1 p-2 bg-black/50 rounded overflow-auto">${JSON.stringify({
338
+ error: error.message,
339
+ response: data || 'No response data'
340
+ }, null, 2)}</pre>
341
+ </details>
342
+ </div>
343
+ `;
344
+ }
345
+
346
+ // Scroll to bottom and clear input
347
+ terminalContent.scrollTop = terminalContent.scrollHeight;
348
+ document.getElementById('user-query').value = '';
349
+ });
350
+
351
+ // Focus input on page load
352
+ document.addEventListener('DOMContentLoaded', () => {
353
+ document.getElementById('user-query').focus();
354
+ });
355
+ </script>
356
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=flitrx/dirker" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
357
+ </html>