🌐 AI搜索 & 代理 主页
Skip to content

Commit a49a1a4

Browse files
committed
NEW : localHost-server | init
1 parent b30af14 commit a49a1a4

File tree

9 files changed

+1016
-0
lines changed

9 files changed

+1016
-0
lines changed

localHost-server/.gitignore

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# Video Resizer Tool - Git Ignore File
2+
# ===========================================================
3+
4+
# Python
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
*.so
9+
.Python
10+
build/
11+
develop-eggs/
12+
dist/
13+
downloads/
14+
eggs/
15+
.eggs/
16+
lib/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
wheels/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
MANIFEST
26+
27+
# PyInstaller
28+
*.manifest
29+
*.spec
30+
build/
31+
dist/
32+
33+
# Virtual Environment
34+
.venv/
35+
venv/
36+
ENV/
37+
env/
38+
.env
39+
40+
# IDE and Editors
41+
.vscode/
42+
.idea/
43+
*.swp
44+
*.swo
45+
*~
46+
.DS_Store
47+
Thumbs.db
48+
49+
# Logs and Debug
50+
*.log
51+
debug.log
52+
error.log
53+
54+
# Video Files (optional - uncomment if you don't want to track video files)
55+
# *.mp4
56+
# *.avi
57+
# *.mkv
58+
# *.mov
59+
# *.wmv
60+
# *.flv
61+
# *.webm
62+
63+
# Codec Files
64+
# openh264*.dll # Keep codec files tracked for distribution
65+
openh264*.bz2
66+
67+
# Output Files
68+
*_resized.*
69+
*_converted.*
70+
*_1080p_*
71+
*_720p_*
72+
*_480p_*
73+
74+
# Temporary Files
75+
temp/
76+
tmp/
77+
*.tmp
78+
*.temp
79+
80+
# OS generated files
81+
.DS_Store
82+
.DS_Store?
83+
._*
84+
.Spotlight-V100
85+
.Trashes
86+
ehthumbs.db
87+
Thumbs.db
88+
89+
# Windows
90+
desktop.ini
91+
92+
# macOS
93+
.AppleDouble
94+
.LSOverride
95+
96+
# Thumbnails
97+
._*
98+
99+
# Files that might appear in the root of a volume
100+
.DocumentRevisions-V100
101+
.fseventsd
102+
.Spotlight-V100
103+
.TemporaryItems
104+
.Trashes
105+
.VolumeIcon.icns
106+
.com.apple.timemachine.donotpresent
107+
108+
# Directories potentially created on remote AFP share
109+
.AppleDB
110+
.AppleDesktop
111+
Network Trash Folder
112+
Temporary Items
113+
.apdisk
114+
*.out
115+
*.err
116+
debug.log
117+
error.log
118+
119+
# Temporary Files
120+
*.tmp
121+
*.temp
122+
*.cache
123+
.cache/
124+
temp/
125+
tmp/
126+
127+
# Video Files
128+
# *.mp4
129+
# *.avi
130+
# *.mkv
131+
# *.mov
132+
# *.wmv
133+
# *.flv
134+
# *.webm
135+
# *.m4v
136+
# *.3gp
137+
138+
# Output Files (Processed videos)
139+
*_resized_*
140+
*_converted_*
141+
output/
142+
processed/
143+
144+
# Windows
145+
*.lnk
146+
desktop.ini
147+
$RECYCLE.BIN/
148+
149+
# macOS
150+
.DS_Store
151+
.AppleDouble
152+
.LSOverride
153+
Icon?
154+
._*
155+
.Spotlight-V100
156+
.Trashes
157+
158+
# Linux
159+
*~
160+
.fuse_hidden*
161+
.directory
162+
.Trash-*
163+
164+
# Project Specific
165+
# Configuration files with sensitive data
166+
config.ini
167+
settings.json
168+
.secrets
169+
credentials.txt
170+
171+
# Backup files
172+
*.bak
173+
*.backup
174+
*.old
175+
176+
# Archive files
177+
*.zip
178+
*.rar
179+
*.7z
180+
*.tar.gz
181+
182+
# Documentation builds
183+
docs/_build/
184+
site/
185+
186+
# Coverage reports
187+
htmlcov/
188+
.coverage
189+
.coverage.*
190+
coverage.xml
191+
*.cover
192+
.hypothesis/
193+
.pytest_cache/
194+
195+
# Jupyter Notebook
196+
.ipynb_checkpoints
197+
198+
# pyenv
199+
.python-version
200+
201+
# pipenv
202+
Pipfile.lock
203+
204+
# PEP 582
205+
__pypackages__/
206+
207+
# Celery
208+
celerybeat-schedule
209+
celerybeat.pid
210+
211+
# SageMath parsed files
212+
*.sage.py
213+
214+
# Environments
215+
.env
216+
.venv
217+
env/
218+
venv/
219+
ENV/
220+
env.bak/
221+
venv.bak/
222+
223+
# mypy
224+
.mypy_cache/
225+
.dmypy.json
226+
dmyprofile.json
227+
228+
# Pyre type checker
229+
.pyre/

localHost-server/README.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# LocalHost Server – Port Taramalı Yerel HTTP Sunucusu
2+
3+
Yerel (localhost / LAN) üzerinde seçilen dizini hızlıca HTTP üzerinden servis eden, bir port aralığını tarayıp ilk boş portu seçebilen, yalnızca Python standart kütüphanesi kullanan hafif araç.
4+
5+
> last_modify: 2025-08-13
6+
7+
8+
9+
<br><br>
10+
11+
12+
13+
## 🚀 Özellikler
14+
* Port tarama (varsayılan aralık: 8000–8100)
15+
* Doğrudan port seçimi (-p / --port)
16+
* Tek port veya aralık (-r 9000-9050 ya da -r 8080)
17+
* Yerel IP (LAN) tespiti (fallback 127.0.0.1)
18+
* Windows netstat entegrasyonu ile dolu port listesi
19+
* Harici bağımlılık yok (sadece standart lib)
20+
* Basit, okunabilir kod – kolay genişletme
21+
22+
23+
24+
<br><br>
25+
26+
27+
28+
## � Gereksinimler
29+
| Bileşen | Gereksinim |
30+
| ---------- | ----------------------- |
31+
| Python | 3.8+ |
32+
| OS | Windows / Linux / macOS |
33+
| Bağımlılık | Yok |
34+
35+
Not: netstat parçası Windows odaklıdır; Linux/macOS için `ss` veya `lsof` adaptasyonu ekleyebilirsiniz.
36+
37+
38+
<br><br>
39+
40+
41+
## 🔧 Kurulum
42+
Klonlayın veya dosyayı indirin, ardından:
43+
```bash
44+
python main.py
45+
```
46+
47+
Opsiyonel EXE (PyInstaller):
48+
```bash
49+
pip install pyinstaller
50+
pyinstaller --onefile --console main.py
51+
```
52+
53+
54+
<br><br>
55+
56+
57+
## 🎯 Kullanım
58+
```bash
59+
# Varsayılan aralıkta port ara
60+
python main.py
61+
62+
# Belirli port
63+
python main.py -p 8080
64+
65+
# Özel aralık
66+
python main.py -r 9000-9050
67+
68+
# Tek port dene (aralık gibi yazmadan)
69+
python main.py -r 8081
70+
```
71+
72+
Tarayıcı erişimi:
73+
```
74+
http://localhost:<port>
75+
http://<LAN_IP>:<port>
76+
```
77+
78+
<br><br>
79+
80+
81+
## 🧭 Argümanlar
82+
| Argüman | Açıklama | Örnek |
83+
| ------------ | -------------------- | ---------------------- |
84+
| -p / --port | Kesin port | -p 8005 |
85+
| -r / --range | Aralık veya tek port | -r 8100-8200 / -r 8101 |
86+
87+
Öncelik: `--port` verilirse aralık yok sayılır.
88+
89+
90+
<br><br>
91+
92+
93+
## 🧪 Örnek Çıktı
94+
```
95+
============================== Scanning Ports ==============================
96+
Aralık: 8000-8100
97+
Checking ports : 8000 - 8100
98+
...
99+
Seçilen boş port: 8001
100+
============================== Starting HTTP Server ==============================
101+
İstenen port: 8001
102+
Çalışma dizini : D:\\localHost-server
103+
Erişim adresleri:
104+
http://localhost:8001 | http://192.168.1.34:8001
105+
(Ctrl+C ile durdur)
106+
```
107+
108+
109+
<br><br>
110+
111+
112+
## 🛡️ Güvenlik Notları
113+
* Kimlik doğrulama yok; aynı ağdaki herkes dosyaları görebilir.
114+
* Hassas dizinlerde çalıştırmayın (örn. bütün C:\ kökü).
115+
* İnternete port yönlendirmesi (NAT) yapmayın.
116+
117+
118+
119+
<br><br>
120+
121+
122+
## ⚙️ İç Yapı
123+
| İşlev | Amaç |
124+
| ------------------- | --------------------------------------- |
125+
| find_available_port | Aralıkta bind denemesi ile ilk boş port |
126+
| is_port_in_use | bind başarısız ise port dolu varsayımı |
127+
| get_local_ip | Routing tablosu + hostname fallback |
128+
| run_server | socketserver.TCPServer ile servis |
129+
130+
131+
<br><br>
132+
133+
134+
## ❗ Yaygın Sorunlar
135+
| Belirti | Neden | Çözüm |
136+
| ------------------- | ------------------------------ | ------------------------------------------- |
137+
| getaddrinfo failed | Hatalı host tuple | Host boş string olsun: ("", port) |
138+
| Port dolu gözüküyor | Firewall / başka servis / izin | Farklı aralık, yönetici mod veya izin ayarı |
139+
| LAN IP 127.0.0.1 | Yönlendirme yok | Aynı makine için sorun değil |
140+
141+
142+
<br><br>
143+
144+
145+
## 🔍 Genişletme Fikirleri
146+
* IPv6 / ThreadingTCPServer
147+
* Çoklu sürücü map (C, D) -> özel handler
148+
* Basit Basic-Auth ekleme
149+
* Renkli terminal (colorama) desteği
150+
151+
152+
153+
154+
<br><br>
155+
156+
157+
158+
159+
### Proje Bağlantıları
160+
- [MEFAMEX | Python Code Snippets ](https://github.com/Mefamex/python-code-snippets)
161+
- [Mefamex.com/projects](https://mefamex.com/projects/)
162+
163+
164+
<br><br><hr>

localHost-server/icon.ico

161 KB
Binary file not shown.

0 commit comments

Comments
 (0)