-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrosoft.PowerShell_profile.ps1
More file actions
784 lines (700 loc) Β· 44.3 KB
/
Microsoft.PowerShell_profile.ps1
File metadata and controls
784 lines (700 loc) Β· 44.3 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
$env:POSH_THEMES_PATH = "C:\tools\oh-my-posh"
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\paradox.omp.json" | Invoke-Expression
$pcname = $env:COMPUTERNAME
$bienvenida = @'
ββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
ββββββββββββ ββββββββββββββββ
ββββββββββββ ββββββββββββββββ
βββββββββββββββββββββββββββββ
ββββββββββββββββ βββββββββ
βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββ
<h1> TERMINAL <h1>
'@
Write-Host $bienvenida
Write-Host "<p> Welcome to Powershell $pcname. π» </p>"
Write-Host "<code> Type 'commands' for a list of available commands. π </code>"
Write-Host ""
function commands {
$secciones = @(
@'
ββββββββββββββββββββββββββββββββββββββ
β π§ COMANDOS ΓTILES π» β
ββββββββββββββββββββββββββββββββββββββ
πΉ Productividad rΓ‘pida:
clean # Limpiar la consola
go-code # Abrir VS Code en carpeta actual
edit-profile # Editar tu perfil de PowerShell
reload # Recargar el perfil
today # Mostrar fecha y hora actual
ip # Ver IP local
net-check # Probar conexiΓ³n a Google
subirRepo [commit] [link] # Sube un repositorio a GitHub
wifi-info # Muestra datos sobre la Wi-Fi y conexiΓ³n
run-api # Corre un servidor local de FastAPI
ip-location [ip] # Geolocaliza una IP
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β π§ GIT β
ββββββββββββββββββββββββββββββββββββββ
git-help # Muestra comandos frecuentes de Git
push-code # Ejecuta add, commit y push en secuencia
git init
git add .
git commit -m "mensaje"
git push
git pull
git status
git log --oneline
git branch
git checkout -b nueva-rama
git merge rama
git stash
git clone <url>
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β β‘ FASTAPI β
ββββββββββββββββββββββββββββββββββββββ
api-fast # Muestra ejemplos de rutas y uso
uvicorn main:app --reload
@app.get("/")
@app.post("/crear")
from fastapi import FastAPI
from pydantic import BaseModel
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β ποΈ SQLITE β
ββββββββββββββββββββββββββββββββββββββ
sqlite-guide # Muestra comandos ΓΊtiles de SQLite
sqlite3 database.db
.tables
SELECT * FROM tabla;
CREATE TABLE usuarios (...);
INSERT INTO usuarios VALUES (...);
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β π³ DOCKER β
ββββββββββββββββββββββββββββββββββββββ
docker-tips # Muestra comandos bΓ‘sicos de Docker
docker build -t nombre .
docker run -p 8000:8000 nombre
docker ps
docker stop <id>
docker exec -it <id> bash
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β π§ LINUX AVANZADO (WSL) β
ββββββββββββββββββββββββββββββββββββββ
linux-lsof # Ver quΓ© proceso usa un puerto
linux-strace [PID] # Rastrear llamadas del sistema
linux-htop # Monitor visual de procesos
linux-tmux # Multiplexor de terminal
linux-rsync [src] [dest]# Sincroniza carpetas
linux-jq [json] [query] # Extrae datos de JSON
linux-nc # Abre servidor TCP en puerto 4444
linux-iptables # Reglas del firewall
linux-findlogs # Borra archivos .log
linux-ss # Conexiones de red activas
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β 𧬠LINUX EXTENDIDO (WSL) β
ββββββββββββββββββββββββββββββββββββββ
linux-top, linux-df, linux-du [path]
linux-free, linux-uptime, linux-uname
linux-date, linux-cal, linux-whoami
linux-id, linux-grep [pat] [file]
linux-find [path] [name], linux-tail [file]
linux-head [file], linux-cat [file]
linux-touch [file], linux-mkdir [dir]
linux-rm [target], linux-cp [src] [dest]
linux-mv [src] [dest], linux-chmod [mode] [file]
linux-chown [user] [file], linux-ps, linux-kill [pid]
linux-cron-edit, linux-cron-list
linux-env, linux-export [var] [val]
linux-ping [host], linux-curl [url]
linux-wget [url], linux-nmap [target]
linux-traceroute [host], linux-hostname
linux-man [cmd], linux-which [cmd]
linux-history, linux-alias [alias] [cmd]
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β π POWERSHELL BΓSICO β
ββββββββββββββββββββββββββββββββββββββ
Get-Process, Get-Service
Get-Help <comando>, Set-Alias gs Get-Service
Get-Command, Get-History
Start-Process notepad
Test-Path <ruta>, Remove-Item <archivo>
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β π¨ PERSONALIZACIΓN β
ββββββββββββββββββββββββββββββββββββββ
ronald-mode # Activa tu tema favorito
set-theme <nombre> # Cambia el tema visual
list-themes # Lista temas disponibles
preview-theme <nombre> # Previsualiza un tema
font-guide # Recomienda fuentes compatibles
'@,
@'
ββββββββββββββββββββββββββββββββββββββ
β π¨ COMANDOS IMPORTANTES β
ββββββββββββββββββββββββββββββββββββββ
run-port <puerto> # Inicia servidor HTTP
run-api # Corre servidor FastAPI
ip-location [ip] # Geolocaliza IP
wifi-info # Info de Wi-Fi
net-check # Test de conexiΓ³n
ip # Ver IP local
port-list # Puertos abiertos
port-check [host] [port]# Verifica puerto
port-util-list # Utilidades de puertos
new-tunnel [puerto] # TΓΊnel con Cloudflare
dev-status # Estado del entorno de desarrollo
'@
)
$colores = @("Magenta", "Yellow", "Green", "Cyan", "Blue", "DarkCyan", "DarkMagenta", "DarkYellow", "DarkGreen")
$spinner = @("|", "/", "-", "\\")
for ($i = 0; $i -lt $secciones.Count; $i++) {
Clear-Host
# AnimaciΓ³n de carga
for ($j = 0; $j -lt 10; $j++) {
Write-Host "`rCargando secciΓ³n $($i + 1)... $($spinner[$j % $spinner.Length])" -ForegroundColor DarkGray -NoNewline
Start-Sleep -Milliseconds 100
}
Clear-Host
$color = $colores[$i % $colores.Count]
Write-Host $secciones[$i] -ForegroundColor $color
Write-Host "`nPresiona [Enter] para continuar..." -ForegroundColor DarkGray
[void][System.Console]::ReadLine()
}
Clear-Host
Write-Host "β
Β‘Todos los comandos han sido mostrados!" -ForegroundColor Green
}
function push-code {
$steps = @(
@{msg="π¦ Agregando cambios al Γ‘rea de staging..."; cmd="git add ."; color="Yellow"},
@{msg="π Realizando commit: 'actualizaciΓ³n rΓ‘pida'..."; cmd='git commit -m "actualizaciΓ³n rΓ‘pida"'; color="Cyan"},
@{msg="π Enviando cambios al repositorio remoto..."; cmd="git push"; color="Green"}
)
$spinner = @("|", "/", "-", "\\")
$i = 0
foreach ($step in $steps) {
Write-Host "`n$($step.msg)" -ForegroundColor $step.color
# AnimaciΓ³n de carga
for ($j = 0; $j -lt 10; $j++) {
Write-Host "`r[$($spinner[$j % $spinner.Length])] Procesando..." -ForegroundColor DarkGray -NoNewline
Start-Sleep -Milliseconds 100
}
# Ejecutar comando
try {
Invoke-Expression $step.cmd
} catch {
Write-Host "`nβ Error al ejecutar: $($step.cmd)" -ForegroundColor Red
return
}
Write-Host "`nβ
Comando ejecutado con Γ©xito: $($step.cmd)" -ForegroundColor Green
}
}
function subirRepo {
param(
[string]$mensaje,
[string]$link
)
if (-not $mensaje -or -not $link) {
Write-Host "β Error: Debes proporcionar un mensaje de commit y el link del repositorio." -ForegroundColor Red
return
}
$steps = @(
@{msg="π§ Inicializando repositorio local..."; cmd="git init"; color="Yellow"},
@{msg="π¦ Agregando archivos al staging..."; cmd="git add ."; color="Cyan"},
@{msg="π Realizando commit: '$mensaje'..."; cmd="git commit -m `"$mensaje`""; color="Green"},
@{msg="πΏ Estableciendo rama principal (main)..."; cmd="git branch -M main"; color="DarkYellow"},
@{msg="π Enlazando repositorio remoto..."; cmd="git remote add origin $link"; color="DarkCyan"},
@{msg="π Enviando cΓ³digo a GitHub..."; cmd="git push -u origin main"; color="Magenta"}
)
$spinner = @("β ","β ","β Ή","β Έ","β Ό","β ΄","β ¦","β §","β ","β ")
foreach ($step in $steps) {
Write-Host "`n$($step.msg)" -ForegroundColor $step.color
# AnimaciΓ³n tipo web loader
for ($i = 0; $i -lt 12; $i++) {
Write-Host "`r$($spinner[$i % $spinner.Length]) Procesando..." -ForegroundColor DarkGray -NoNewline
Start-Sleep -Milliseconds 100
}
try {
Invoke-Expression $step.cmd
Write-Host "`nβ
Completado: $($step.cmd)" -ForegroundColor Green
} catch {
Write-Host "`nβ Error al ejecutar: $($step.cmd)" -ForegroundColor Red
return
}
}
Write-Host "`nπ Β‘Repositorio subido con Γ©xito a GitHub!" -ForegroundColor Cyan
Write-Host "π Link remoto: $link" -ForegroundColor DarkGray
}
function api-fast {
@"
πΉ FastAPI:
uvicorn main:app --reload
@app.get('/')
@app.post('/crear')
from fastapi import FastAPI
from pydantic import BaseModel
"@ | Write-Host -ForegroundColor Cyan
}
function run-api {
Clear-Host
$ascii = @'
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
'@
$steps = @(
"π§ Preparando entorno virtual...",
"π¦ Cargando dependencias...",
"π§ Inicializando FastAPI...",
"π₯ Ejecutando Uvicorn con recarga activa..."
)
Write-Host $ascii
foreach ($step in $steps) {
Write-Host $step -ForegroundColor Cyan
Start-Sleep -Milliseconds 500
}
Write-Host "`nπ Lanzando servidor FastAPI..." -ForegroundColor Green
python -m uvicorn main:app --reload
}
function sqlite-guide {
@"
πΉ SQLite:
sqlite3 database.db
.tables
SELECT * FROM tabla;
CREATE TABLE usuarios (...);
INSERT INTO usuarios VALUES (...);
"@ | Write-Host -ForegroundColor Cyan
}
function docker-tips {
@"
πΉ Docker:
docker build -t nombre .
docker run -p 8000:8000 nombre
docker ps
docker stop <id>
docker exec -it <id> bash
"@ | Write-Host -ForegroundColor Cyan
}
function wifi-info {
Write-Host "`nπ‘ InformaciΓ³n de la conexiΓ³n Wi-Fi actual:" -ForegroundColor Cyan
netsh wlan show interfaces
Get-NetIPAddress | Where-Object {$_.InterfaceAlias -like "*Wi-Fi*"}
}
function ip-location {
param([string]$ip)
$ascii = @'
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
'@
$url = "https://ipinfo.io/$ip/json"
Clear-Host
Write-Host $ascii -ForegroundColor Green
# Define la IP o deja vacΓo para tu propia IP
$url = "https://ipinfo.io/json/$ip"
try {
$data = Invoke-RestMethod -Uri $url -ErrorAction Stop
return @{
"IP" = $data.query
"PaΓs" = $data.country
"RegiΓ³n" = $data.regionName
"Ciudad" = $data.city
"ISP" = $data.isp
"Latitud" = $data.lat
"Longitud" = $data.lon
"Zona Horaria"= $data.timezone
}
}
catch {
Write-Host "β No se pudo obtener ubicaciΓ³n para la IP: $ip"
}
}
function linux-lsof { wsl lsof -i :8000 }
function linux-strace { param($pid) wsl strace -p $pid }
function linux-htop { wsl htop }
function linux-tmux { wsl tmux }
function linux-rsync { param($src, $dest) wsl rsync -avz $src $dest }
function linux-jq { param($json, $query) wsl bash -c "echo '$json' | jq '$query'" }
function linux-nc { wsl nc -lvp 4444 }
function linux-iptables { wsl sudo iptables -L -n -v }
function linux-findlogs { wsl bash -c "find . -name '*.log' | xargs rm" }
function linux-ss { wsl ss -tuln }
function system-info { Get-ComputerInfo }
function disk-usage { Get-PSDrive | Where-Object {$_.Provider -like "*FileSystem"} }
function recent-events { Get-EventLog -LogName System -Newest 20 }
function services-running { Get-Service | Where-Object {$_.Status -eq "Running"} }
function restart-service { param($name) Restart-Service -Name $name }
function stop-service { param($name) Stop-Service -Name $name }
function start-service { param($name) Start-Service -Name $name }
function new-script { param($name) New-Item "$name.ps1" -ItemType File }
function run-script { param($name) & "$name.ps1" }
function edit-script { param($name) code "$name.ps1" }
function list-functions { Get-Command -CommandType Function }
function list-aliases { Get-Alias }
function list-files { Get-ChildItem -Recurse }
function find-file { param($name) Get-ChildItem -Recurse | Where-Object {$_.Name -like "*$name*"} }
function delete-file { param($path) Remove-Item $path -Force }
function copy-file { param($src, $dest) Copy-Item $src -Destination $dest }
function move-file { param($src, $dest) Move-Item $src -Destination $dest }
function ping-host { param($host) Test-Connection $host -Count 4 }
function port-check { param($host, $port) Test-NetConnection -ComputerName $host -Port $port }
function dns-lookup { param($domain) Resolve-DnsName $domain }
function public-ip { Invoke-RestMethod -Uri "https://api.ipify.org?format=json" }
function firewall-rules { Get-NetFirewallRule }
function antivirus-status { Get-MpComputerStatus }
function scan-malware { Start-MpScan -ScanType FullScan }
function list-users { Get-LocalUser }
function list-groups { Get-LocalGroup }
function set-theme { param($theme) Set-PoshPrompt -Theme $theme }
function linux-top { wsl top }
function linux-df { wsl df -h }
function linux-du { param($path) wsl du -sh $path }
function linux-free { wsl free -h }
function linux-uptime { wsl uptime }
function linux-uname { wsl uname -a }
function linux-date { wsl date }
function linux-cal { wsl cal }
function linux-whoami { wsl whoami }
function linux-id { wsl id }
function linux-grep { param($pattern, $file) wsl grep "$pattern" "$file" }
function linux-find { param($path, $name) wsl find "$path" -name "$name" }
function linux-tail { param($file) wsl tail -n 20 "$file" }
function linux-head { param($file) wsl head -n 20 "$file" }
function linux-cat { param($file) wsl cat "$file" }
function linux-touch { param($file) wsl touch "$file" }
function linux-mkdir { param($dir) wsl mkdir -p "$dir" }
function linux-rm { param($target) wsl rm -rf "$target" }
function linux-cp { param($src, $dest) wsl cp -r "$src" "$dest" }
function linux-mv { param($src, $dest) wsl mv "$src" "$dest" }
function linux-chmod { param($mode, $file) wsl chmod "$mode" "$file" }
function linux-chown { param($user, $file) wsl chown "$user" "$file" }
function linux-ps { wsl ps aux }
function linux-kill { param($pid) wsl kill -9 $pid }
function linux-cron-edit { wsl crontab -e }
function linux-cron-list { wsl crontab -l }
function linux-env { wsl env }
function linux-export { param($var, $value) wsl export "$var=$value" }
function linux-ping { param($host) wsl ping -c 4 "$host" }
function linux-curl { param($url) wsl curl "$url" }
function linux-wget { param($url) wsl wget "$url" }
function linux-nmap { param($target) wsl nmap "$target" }
function linux-traceroute { param($host) wsl traceroute "$host" }
function linux-hostname { wsl hostname }
function linux-man { param($cmd) wsl man "$cmd" }
function linux-which { param($cmd) wsl which "$cmd" }
function linux-history { wsl history }
function linux-alias { param($alias, $cmd) wsl bash -c "alias $alias='$cmd'" }
function run-port {
param($port)
Write-Host "π Servidor HTTP en puerto $port iniciado. http://localhost:$port" -ForegroundColor Green
$spinner = @('β ','β ','β Ή','β Έ','β Ό','β ΄','β ¦','β §','β ','β ')
$i = 0
$antena = @(
" . .",
" .Β· Β· . . Β· `.",
" : : : (Β―) : : :",
" Β·. Β· Β· /Β―\ Β· Β· .Β·",
" Β· /Β―Β―Β―\ Β·",
" /Β―Β―Β―Β―Β―\"
" /Β―Β―Β―Β―Β―Β―Β―\"
)
foreach ($line in $antena) {
$styled = ""
foreach ($char in $line.ToCharArray()) {
if ($char -eq '.' -or $char -eq ':' -or $char -eq 'Β·') {
$styled += "`e[32m$char`e[0m" # Verde
} else {
$styled += $char
}
}
Write-Host $styled
}
python -m http.server $port
while (-not $proc.HasExited) {
Write-Host -NoNewline "`r$($spinner[$i]) TΓΊnel activo... "
Start-Sleep -Milliseconds 100
$i = ($i + 1) % $spinner.Length
}
Write-Host "`rπ΄ TΓΊnel cerrado. " -ForegroundColor Red
}
function port-list {
Get-NetTCPConnection -State Listen |
Select-Object LocalAddress, LocalPort, OwningProcess |
Sort-Object LocalPort |
ForEach-Object {
$proc = Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue
[PSCustomObject]@{
Port = $_.LocalPort
Address = $_.LocalAddress
Process = if ($proc) { $proc.ProcessName } else { "N/A" }
PID = $_.OwningProcess
}
} | Format-Table -AutoSize
}
function port-check {
param (
[string]$targetHost,
[int]$port
)
if ($targetHost -eq "localhost" -or $targetHost -eq "127.0.0.1") {
$active = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue
if ($active) {
Write-Host "β
El puerto local $port estΓ‘ ACTIVO (escuchando)" -ForegroundColor Green
} else {
Write-Host "β El puerto local $port estΓ‘ INACTIVO" -ForegroundColor Red
}
} else {
try {
$tcp = New-Object System.Net.Sockets.TcpClient
$tcp.Connect($targetHost, $port)
Write-Host "β
El puerto $port en $targetHost estΓ‘ ABIERTO" -ForegroundColor Green
$tcp.Close()
} catch {
Write-Host "β El puerto $port en $targetHost estΓ‘ CERRADO o inaccesible" -ForegroundColor Red
}
}
}
function port-util-list {
$puertos = @(
@{Puerto=22; Uso="SSH (acceso remoto seguro)"},
@{Puerto=80; Uso="HTTP (web sin cifrar)"},
@{Puerto=443; Uso="HTTPS (web segura)"},
@{Puerto=21; Uso="FTP"},
@{Puerto=25; Uso="SMTP (correo saliente)"},
@{Puerto=110; Uso="POP3 (correo entrante)"},
@{Puerto=143; Uso="IMAP"},
@{Puerto=3306; Uso="MySQL"},
@{Puerto=5432; Uso="PostgreSQL"},
@{Puerto=6379; Uso="Redis"},
@{Puerto=27017;Uso="MongoDB"},
@{Puerto=8000; Uso="Servidor web local (dev)"},
@{Puerto=8080; Uso="HTTP alternativo / proxy"},
@{Puerto=5000; Uso="Flask / FastAPI / dev"},
@{Puerto=5500; Uso="VNC inverso / Live Server"}
)
$puertos | Sort-Object Puerto | Format-Table -AutoSize
}
function new-tunneld {
param (
[int]$port
)
Clear-Host
Write-Host "π Creando tΓΊnel de Cloudflare..." -ForegroundColor Green
$proc = Start-Process cloudflared -ArgumentList "tunnel --url http://localhost:$port" -PassThru
$spinner = @('β ','β ','β Ή','β Έ','β Ό','β ΄','β ¦','β §','β ','β ')
$i = 0
$antena = @'
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
'@
Clear-Host
Write-Host $antena -ForegroundColor Green
while (-not $proc.HasExited) {
Write-Host -NoNewline "`r$($spinner[$i]) TΓΊnel activo... "
Start-Sleep -Milliseconds 100
$i = ($i + 1) % $spinner.Length
}
Write-Host "`rπ΄ TΓΊnel cerrado. " -ForegroundColor Red
Clear-Host
}
function new-tunnel {
param (
[int]$port,
[string]$targetHost = "localhost"
)
if ($targetHost -eq "localhost" -or $targetHost -eq "127.0.0.1") {
$active = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue
if ($active) {
Write-Host "β
El puerto local $port estΓ‘ ACTIVO (escuchando)" -ForegroundColor Green
new-tunneld $port
} else {
Write-Host "β El puerto local $port estΓ‘ INACTIVO" -ForegroundColor Red
}
} else {
try {
$tcp = New-Object System.Net.Sockets.TcpClient
$tcp.Connect($targetHost, $port)
Write-Host "β
El puerto $port en $targetHost estΓ‘ ABIERTO" -ForegroundColor Green
new-tunneld $port
$tcp.Close()
} catch {
Write-Host "β El puerto $port en $targetHost estΓ‘ CERRADO o inaccesible" -ForegroundColor Red
}
}
}
function check-tunnel-env {
$missing = @()
$wsl = Get-Command wsl -ErrorAction SilentlyContinue
if (-not $wsl) {
$missing += @{
name = "WSL"
install = "wsl --install"
}
}
$cloudflared = Get-Command cloudflared -ErrorAction SilentlyContinue
if (-not $cloudflared) {
$missing += @{
name = "Cloudflared"
install = "Invoke-WebRequest https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-amd64.exe -OutFile cloudflared.exe"
}
}
foreach ($item in $missing) {
Write-Host "β No se ha encontrado $($item.name)" -ForegroundColor Red
Write-Host "π‘ CΓ³digo de instalaciΓ³n: $($item.install)`n" -ForegroundColor DarkYellow
}
}
check-tunnel-env
function dev-status {
Write-Host "`nπ§ Estado del entorno de desarrollo:" -ForegroundColor Cyan
# 1. Dependencias clave de Python
Write-Host "`nπ¦ Dependencias de Python:" -ForegroundColor Yellow
try {
pip list | Select-String "fastapi|uvicorn|requests|sqlite|httpx|pydantic|python-dotenv"
} catch {
Write-Host "β pip no estΓ‘ disponible o fallΓ³." -ForegroundColor Red
}
# 2. Puertos activos con nombre de proceso
Write-Host "`nπ Puertos activos:" -ForegroundColor Yellow
Get-NetTCPConnection -State Listen |
ForEach-Object {
$proc = Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue
[PSCustomObject]@{
Port = $_.LocalPort
Address = $_.LocalAddress
Process = if ($proc) { $proc.ProcessName } else { "N/A" }
PID = $_.OwningProcess
}
} | Sort-Object Port | Format-Table -AutoSize
# 3. Servicios clave activos
Write-Host "`nπ§ Servicios clave activos:" -ForegroundColor Yellow
$targets = @("Docker","PostgreSQL","WSL","Windows Defender Firewall","Bluetooth","Audio","Network","Cloudflared")
Get-Service | Where-Object {
$_.Status -eq "Running" -and ($targets | ForEach-Object { $_ }) -contains $_.DisplayName
} | Select-Object DisplayName, Status | Format-Table -AutoSize
# 4. InformaciΓ³n del sistema
Write-Host "`nπ₯οΈ InformaciΓ³n del sistema:" -ForegroundColor Yellow
try {
$os = Get-CimInstance Win32_OperatingSystem
$cpu = Get-CimInstance Win32_Processor
$ramGB = [math]::Round($os.TotalVisibleMemorySize / 1MB, 2)
Write-Host "𧬠OS: $($os.Caption) $($os.Version)" -ForegroundColor Gray
Write-Host "π§ CPU: $($cpu.Name)" -ForegroundColor Gray
Write-Host "πΎ RAM: $ramGB GB" -ForegroundColor Gray
} catch {
Write-Host "β No se pudo obtener informaciΓ³n del sistema." -ForegroundColor Red
}
# 5. Red y Wi-Fi
Write-Host "`nπ‘ Red y Wi-Fi:" -ForegroundColor Yellow
try {
netsh wlan show interfaces | Select-String "SSID|Signal|State"
Get-NetIPAddress | Where-Object {$_.InterfaceAlias -like "*Wi-Fi*"} | Format-Table -AutoSize
} catch {
Write-Host "β No se pudo obtener informaciΓ³n de red." -ForegroundColor Red
}
# 6. Herramientas disponibles
Write-Host "`nπ§° Herramientas disponibles:" -ForegroundColor Yellow
$tools = @("wsl", "docker", "git", "cloudflared", "python", "uvicorn")
foreach ($tool in $tools) {
if (Get-Command $tool -ErrorAction SilentlyContinue) {
Write-Host "β
$tool disponible" -ForegroundColor Green
} else {
Write-Host "β $tool no encontrado" -ForegroundColor Red
}
}
Write-Host "`nβ
DiagnΓ³stico completo finalizado." -ForegroundColor Green
}