block-proxy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.eslintignore +3 -0
  2. package/AD_BLOCK.md +38 -0
  3. package/Dockerfile +51 -0
  4. package/LICENSE +21 -0
  5. package/README.md +182 -0
  6. package/bin/start.js +45 -0
  7. package/cert/rootCA.crt +20 -0
  8. package/cert/rootCA.key +27 -0
  9. package/config.json +234 -0
  10. package/craco.config.js +52 -0
  11. package/hack-of-anyproxy/lib/requestHandler.js +1028 -0
  12. package/package.json +54 -0
  13. package/proxy/attacker.js +135 -0
  14. package/proxy/domain.js +26 -0
  15. package/proxy/fs.js +46 -0
  16. package/proxy/http.js +224 -0
  17. package/proxy/mitm/persistentStore.js +34 -0
  18. package/proxy/mitm/persistentStore.json +3 -0
  19. package/proxy/mitm/rule.js +116 -0
  20. package/proxy/mitm/uaFilter.js +47 -0
  21. package/proxy/mitm/ydcd/ydcd.js +34 -0
  22. package/proxy/mitm/youtube/youtube.response.js +39 -0
  23. package/proxy/monitor.js +283 -0
  24. package/proxy/proxy.js +1488 -0
  25. package/proxy/scan.js +120 -0
  26. package/proxy/start.js +7 -0
  27. package/proxy/wanip.js +76 -0
  28. package/public/favicon.ico +0 -0
  29. package/public/index.html +43 -0
  30. package/public/iphone-proxy-setting.jpg +0 -0
  31. package/public/logo192.png +0 -0
  32. package/public/logo512.png +0 -0
  33. package/public/manifest.json +25 -0
  34. package/public/proxy.jpg +0 -0
  35. package/public/robots.txt +3 -0
  36. package/server/express.js +232 -0
  37. package/server/start.js +24 -0
  38. package/server/util.js +166 -0
  39. package/socks5/server.js +321 -0
  40. package/socks5/start.js +7 -0
  41. package/socks5/test_tls_reuse.js +40 -0
  42. package/src/App.css +505 -0
  43. package/src/App.js +759 -0
  44. package/src/App.test.js +8 -0
  45. package/src/index.css +13 -0
  46. package/src/index.js +17 -0
  47. package/src/logo.svg +1 -0
  48. package/src/reportWebVitals.js +13 -0
  49. package/src/setupTests.js +5 -0
package/src/App.css ADDED
@@ -0,0 +1,505 @@
1
+ /* 服务器信息样式 */
2
+ .server-info {
3
+ /*padding: 10px 0;*/
4
+ }
5
+
6
+ .server-info p {
7
+ margin: 5px 0;
8
+ }
9
+
10
+ .ip-list {
11
+ list-style: none;
12
+ padding: 0;
13
+ margin: 10px 0;
14
+ }
15
+
16
+ .ip-item {
17
+ display: flex;
18
+ padding: 8px 0;
19
+ border-bottom: 1px solid #eee;
20
+ }
21
+
22
+ .ip-item:last-child {
23
+ border-bottom: none;
24
+ }
25
+
26
+ .interface-name {
27
+ font-weight: bold;
28
+ color: #555;
29
+ }
30
+
31
+ .ip-address {
32
+ flex: 1;
33
+ font-family: 'Courier New', monospace;
34
+ background-color: #f8f9fa;
35
+ padding: 2px 6px;
36
+ border-radius: 3px;
37
+ }
38
+
39
+ /* Toast 样式 */
40
+ .toast {
41
+ position: fixed;
42
+ top: 20px;
43
+ right: 20px;
44
+ padding: 16px 20px;
45
+ border-radius: 4px;
46
+ color: white;
47
+ font-weight: 500;
48
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
49
+ z-index: 1000;
50
+ display: flex;
51
+ align-items: center;
52
+ animation: toastSlideIn 0.3s ease-out;
53
+ min-width: 250px;
54
+ }
55
+
56
+ @keyframes toastSlideIn {
57
+ from {
58
+ transform: translateX(100%);
59
+ opacity: 0;
60
+ }
61
+ to {
62
+ transform: translateX(0);
63
+ opacity: 1;
64
+ }
65
+ }
66
+
67
+ .toast.success {
68
+ background-color: #28a745;
69
+ border-left: 4px solid #1e7e34;
70
+ }
71
+
72
+ .toast.error {
73
+ background-color: #dc3545;
74
+ border-left: 4px solid #bd2130;
75
+ }
76
+
77
+ .toast.info {
78
+ background-color: #17a2b8;
79
+ border-left: 4px solid #117a8b;
80
+ }
81
+
82
+ .toast-close {
83
+ background: none;
84
+ border: none;
85
+ color: white;
86
+ font-size: 20px;
87
+ font-weight: bold;
88
+ margin-left: 15px;
89
+ cursor: pointer;
90
+ padding: 0;
91
+ width: 20px;
92
+ height: 20px;
93
+ display: flex;
94
+ align-items: center;
95
+ justify-content: center;
96
+ }
97
+
98
+ .toast-close:hover {
99
+ opacity: 0.7;
100
+ }
101
+
102
+ /* 其他原有样式保持不变 */
103
+ .App {
104
+ text-align: center;
105
+ padding: 20px;
106
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
107
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
108
+ sans-serif;
109
+ background-color: #f5f5f5;
110
+ min-height: 100vh;
111
+ }
112
+
113
+ .config-container {
114
+ max-width: 1220px;
115
+ margin: 0 auto;
116
+ background: white;
117
+ border-radius: 8px;
118
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
119
+ padding: 30px;
120
+ text-align: left;
121
+ position: relative;
122
+ }
123
+
124
+ .config-container h1 {
125
+ text-align: center;
126
+ color: #333;
127
+ margin-top: 0;
128
+ }
129
+
130
+ .config-section {
131
+ margin-bottom: 30px;
132
+ padding: 20px;
133
+ border: 1px solid #eee;
134
+ border-radius: 5px;
135
+ background-color: #fafafa;
136
+ }
137
+
138
+ .config-section h2 {
139
+ margin-top: 0;
140
+ color: #555;
141
+ border-bottom: 1px solid #eee;
142
+ padding-bottom: 10px;
143
+ }
144
+
145
+ .host-input {
146
+ display: flex;
147
+ margin-bottom: 15px;
148
+ gap: 10px;
149
+ flex-direction: row;
150
+ }
151
+
152
+ .host-input input[type="text"] {
153
+ flex: 1;
154
+ padding: 10px;
155
+ border: 1px solid #ddd;
156
+ border-radius: 4px;
157
+ font-size: 14px;
158
+ }
159
+
160
+ .host-input button {
161
+ background-color: #007bff;
162
+ color: white;
163
+ border: none;
164
+ border-radius: 4px;
165
+ cursor: pointer;
166
+ font-size: 14px;
167
+ align-self: flex-start;
168
+ }
169
+
170
+ .host-input button:hover {
171
+ background-color: #0069d9;
172
+ }
173
+
174
+ .time-inputs {
175
+ display: flex;
176
+ gap: 10px;
177
+ align-items: center;
178
+ }
179
+
180
+ .time-inputs label {
181
+ flex-direction: column;
182
+ font-size: 14px;
183
+ }
184
+
185
+ hr.simple-line {
186
+ height:1px;
187
+ border-width:0px;
188
+ background-color:#e3e3e3
189
+ }
190
+
191
+ /* 时间控件样式 */
192
+ input[type="time"] {
193
+ padding: 4px;
194
+ border: 1px solid #ddd;
195
+ border-radius: 3px;
196
+ background-color: white;
197
+ }
198
+
199
+ input[type="time"]:focus {
200
+ outline: none;
201
+ border-color: #007bff;
202
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
203
+ }
204
+
205
+ .host-list {
206
+ list-style: none;
207
+ padding: 0;
208
+ margin: 0;
209
+ }
210
+
211
+ .host-item {
212
+ display: flex;
213
+ justify-content: space-between;
214
+ align-items: flex-start;
215
+ padding: 12px 0px;
216
+ border-bottom: 1px solid #eee;
217
+ }
218
+
219
+ .host-item:last-child {
220
+ border-bottom: none;
221
+ }
222
+
223
+ .host-info {
224
+ display: flex;
225
+ flex-grow: 1;
226
+ align-items:center;
227
+ font-size:15px;
228
+ }
229
+
230
+ span.host-text {
231
+ font-size: 14px;
232
+ flex-grow: 1;
233
+ align-self: center; /* 垂直居中 */
234
+ }
235
+
236
+ .time-controls {
237
+ display: flex;
238
+ gap: 8px;
239
+ align-items: center;
240
+ }
241
+
242
+ .time-controls label {
243
+ display: flex;
244
+ flex-direction: column;
245
+ font-size: 12px;
246
+ }
247
+
248
+ .remove-btn {
249
+ background-color: #dc3545;
250
+ color: white;
251
+ border: none;
252
+ padding: 5px 7px;
253
+ min-width: 23px;
254
+ cursor: pointer;
255
+ border-radius: 3px;
256
+ font-size: 12px;
257
+ height: fit-content;
258
+ align-self: center;
259
+ margin-left: 10px;
260
+ }
261
+
262
+ .remove-btn:hover {
263
+ background-color: #c82333;
264
+ }
265
+
266
+ .setting-row {
267
+ display: flex;
268
+ align-items: center;
269
+ margin-bottom: 15px;
270
+ gap: 15px;
271
+ }
272
+
273
+ .setting-row label {
274
+ /*width: 120px;*/
275
+ font-weight: bold;
276
+ color: #555;
277
+ }
278
+
279
+ .setting-row input {
280
+ flex: 1;
281
+ padding: 8px;
282
+ border: 1px solid #ddd;
283
+ border-radius: 4px;
284
+ }
285
+
286
+ .setting-row input[type="number"] {
287
+ padding: 8px;
288
+ border: 1px solid #ddd;
289
+ border-radius: 4px;
290
+ font-size: 14px;
291
+ }
292
+
293
+ .setting-row input[type="number"]:focus {
294
+ outline: none;
295
+ border-color: #007bff;
296
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
297
+ }
298
+
299
+ .actions {
300
+ display: flex;
301
+ justify-content: space-between;
302
+ }
303
+
304
+ .save-btn, .restart-btn {
305
+ flex: 1;
306
+ padding: 12px 20px;
307
+ border: none;
308
+ border-radius: 4px;
309
+ cursor: pointer;
310
+ font-size: 16px;
311
+ font-weight: bold;
312
+ }
313
+
314
+ .save-btn {
315
+ background-color: #28a745;
316
+ color: white;
317
+ }
318
+
319
+ .save-btn:hover:not(:disabled) {
320
+ background-color: #218838;
321
+ }
322
+
323
+ .restart-btn {
324
+ background-color: #ffc107;
325
+ color: #212529;
326
+ }
327
+
328
+ .restart-btn:hover:not(:disabled) {
329
+ background-color: #e0a800;
330
+ }
331
+
332
+ .save-btn:disabled, .restart-btn:disabled {
333
+ background-color: #6c757d;
334
+ cursor: not-allowed;
335
+ }
336
+
337
+ button {
338
+ padding: 8px 12px;
339
+ border: none;
340
+ border-radius: 3px;
341
+ cursor: pointer;
342
+ transition: background-color 0.2s;
343
+ }
344
+
345
+ button:hover {
346
+ opacity: 0.9;
347
+ }
348
+
349
+ button:disabled {
350
+ opacity: 0.6;
351
+ cursor: not-allowed;
352
+ }
353
+
354
+ /* Docker信息样式 */
355
+ .docker-info {
356
+ color: #007bff;
357
+ font-size: 0.9em;
358
+ }
359
+
360
+ .host-ip-info {
361
+ margin-top: 15px;
362
+ padding-top: 10px;
363
+ border-top: 1px solid #eee;
364
+ }
365
+
366
+ .host-ip-list {
367
+ list-style: none;
368
+ padding: 0;
369
+ margin: 10px 0;
370
+ }
371
+
372
+ .host-ip-item {
373
+ display: flex;
374
+ padding: 5px 0;
375
+ }
376
+
377
+ .method-name {
378
+ font-weight: bold;
379
+ width: 150px;
380
+ color: #555;
381
+ }
382
+
383
+ .host-ip-address {
384
+ flex: 1;
385
+ font-family: 'Courier New', monospace;
386
+ background-color: #e9ecef;
387
+ padding: 2px 6px;
388
+ border-radius: 3px;
389
+ }
390
+
391
+ /* 星期几控件样式 */
392
+ .weekday-controls {
393
+ display: flex;
394
+ /*flex-wrap: wrap;*/
395
+ align-items: center;
396
+ }
397
+
398
+ .weekday-btn {
399
+ width: 24px;
400
+ height: 24px;
401
+ padding: 0;
402
+ /*border: 1px solid #ddd;*/
403
+ background-color: #e5e5e5;
404
+ color: #515b63;
405
+ font-size: 12px;
406
+ border-radius: 0px;
407
+ cursor: pointer;
408
+ display: flex;
409
+ align-items: center;
410
+ justify-content: center;
411
+ }
412
+
413
+ .weekday-btn:hover {
414
+ background-color: #e9ecef;
415
+ border-color: #adb5bd;
416
+ }
417
+
418
+ .weekday-btn.active {
419
+ background-color: #007bff;
420
+ color: white;
421
+ }
422
+
423
+ .weekday-btn:focus {
424
+ outline: none;
425
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
426
+ }
427
+
428
+ /* MAC地址输入框样式 */
429
+ .mac-input {
430
+ display: flex;
431
+ align-items: center;
432
+ margin: 0 10px;
433
+ gap: 5px;
434
+ }
435
+
436
+ .mac-input label {
437
+ font-size: 12px;
438
+ color: #555;
439
+ }
440
+
441
+ .mac-input input[type="text"] {
442
+ width: 106px;
443
+ padding: 4px;
444
+ border: 1px solid #ddd;
445
+ border-radius: 3px;
446
+ font-size: 12px;
447
+ }
448
+
449
+ .mac-input input[type="text"]:focus {
450
+ outline: none;
451
+ border-color: #007bff;
452
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
453
+ }
454
+
455
+ .table-right-blank {
456
+ min-width:30px;
457
+ }
458
+
459
+ .title-mac-input {
460
+ font-size:15px;
461
+ text-align:center;
462
+ min-width:131px;
463
+ }
464
+ .title-time-controls {
465
+ font-size:15px;
466
+ text-align:center;
467
+ min-width:183px;
468
+ }
469
+ .title-weedkey-controls {
470
+ font-size:15px;
471
+ min-width:106px;
472
+ }
473
+
474
+ /* 响应式设计 */
475
+ @media (max-width: 500px) {
476
+ .config-container {
477
+ margin: 10px;
478
+ padding: 20px;
479
+ }
480
+
481
+ .time-controls {
482
+ flex-direction: column;
483
+ align-items: flex-start;
484
+ gap: 5px;
485
+ }
486
+
487
+ .host-item {
488
+ gap: 10px;
489
+ }
490
+
491
+ .remove-btn {
492
+ align-self: flex-start;
493
+ margin-left: 0;
494
+ margin-top: 10px;
495
+ }
496
+
497
+ .mac-input {
498
+ margin: 5px 0;
499
+ }
500
+
501
+ .mac-input input[type="text"] {
502
+ width: 100px;
503
+ }
504
+ }
505
+