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

Abrir el formulario de contacto de una web y rellenarlo una vez de forma automática con SendKeys

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
#Función necesaria para hacer clic en una parte de la página
$MouseEventSig=@'
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
'@
$MouseEvent = Add-Type -memberDefinition $MouseEventSig -name "MouseEventWinApi" -passThru
 
#Abrir la web de contacto
Start-Process chrome "https://www.jesusninoc.com/contact2/"
 
#Pulsar en cualquier parte de la web para poner el foco dentro
Start-Sleep -Seconds 2
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(833,189)
$MouseEvent::mouse_event(0x00000002, 0, 0, 0, 0)
$MouseEvent::mouse_event(0x00000004, 0, 0, 0, 0)
 
#Ir tabulando y escribiendo en los campos del formulario
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
[System.Windows.Forms.SendKeys]::SendWait('Bob')
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
[System.Windows.Forms.SendKeys]::SendWait('Esponja')
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
[System.Windows.Forms.SendKeys]::SendWait('12345')
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
[System.Windows.Forms.SendKeys]::SendWait('[email protected]')
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
[System.Windows.Forms.SendKeys]::SendWait(' ')
 
#Una vez cumplimentados los campos pulsar ENTER
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")

CATEGORÍAS

PowerShell, Web

ETIQUETAS

Add-Type, Chrome, Drawing, HTTP, HTTPS, Jesús Niño Camazón, mouse_event, MouseEventWinApi, New-Object, SendWait, Start-Process, Start-Sleep, System.Drawing, System.Drawing.Point, System.Windows.Forms.Cursor, System.Windows.Forms.SendKeys, user32.dll, Windows

MÁS

  • ¿Cómo funciona un bot? ¿Cómo crear un bot muy simple en 2 minutos?
  • Automatizar el movimiento del ratón en el sistema operativo Windows con PowerShell
  • Explicación sobre el uso de funciones que están en DLL del sistema operativo (en PowerShell)
  • Práctica sobre virus
  • 11. Gestión del Directorio Activo (nivel intermedio)
  • Administración y aseguramiento de la información (Implantación de sistemas operativos)
643391626 643414148 650661375 695038274 617630682 609630793 639888191 626813701 600550687 646558091 685377684 685201990 613762407 655992203 656901767 667271096 673067880 610065673 609510504 694784973 634965264 629005629 639753183 698746350 698564237 644632157 605337632 697958124 654856439 686996816 613822593 691038287 610843785 682112911 664996408 647657910 638655474 635181338 632871226 631310503 614444991 656557110 615377583 600124913 698270964 613439726 611043759 617061998 653484246 671599566 663849749 617877932 657476757 684336710 656424638 679666294 614225299 673299223 642213614 602970831 685360695 631554797 680912537 650541735 694042558 650991201 613694109 687946492 679537629 671013860