Powershell - pwpush.com - 提交按钮

问题描述 投票:0回答:1

我一直在尝试使用Powershell将密码推送到网站并检索链接,但我不知道如何使其单击按钮。

PWPUSH

到目前为止我的代码看起来像:

    #The idea is to use powershell to interact andgenerate passwords links

$IE = New-Object -ComObject "InternetExplorer.Application"

$RequestURI = "https://pwpush.com"
$Password = "password_payload";
$SubmitButton = "submit";

$IE.Visible = $true
$IE.Silent = $true
$IE.Navigate($RequestURI)
While ($IE.Busy) {
    Start-Sleep -Milliseconds 100
}

$Doc = $IE.Document
$Doc.getElementsByTagName("input") | ForEach-Object {
    if ($_.id -ne $null){
        if ($_.id.contains($SubmitButton)) {$SubmitButton = $_}
        if ($_.id.contains($Password)) {$Password = $_}
    }
}

$Password.value = "1234"
$SubmitButton.click()

Invoke-WebRequest https://pwpush.com/assets/application-cdd96c030d1ee817dae58ac877bd0213c8ea2859b1395e7bd83ceb37dadf5bb5.js
powershell button web click
1个回答
0
投票

弄清楚:)代码在那里:

https://github.com/kprocyszyn/tools/blob/master/push-pwpush.ps1

    <#
.SYNOPSIS
Pushes the password to pwpush.com and retrieves the link.
.DESCRIPTION
The idea behind the https://pwpush.com is to create links with password which will expire after specific time - therefore password are not left in clear text in email forever.
The Push-PWPush will generate the link with the password provided, or will generate random number as the password, if no password is provided.
.NOTES
Password requires Internet Explorer to work. Things which are going to be added:
- Custom link expriration
- More sophisticate random password
- Customised settings for random password
#>

[string]$Password = Read-Host "Type password or leave blank for random"

If (!$Password) {$Password = (Get-Random)}

Write-Host "Using password: $Password"

$IE = New-Object -ComObject "InternetExplorer.Application"

$RequestURI = "https://pwpush.com"


$IE.Visible = $false
$IE.Silent = $true
$IE.Navigate($RequestURI)

While ($IE.Busy) {Start-Sleep -Seconds 1}

$Payload = "password_payload";

$Doc = $IE.Document
$Doc.getElementsByTagName("input") | ForEach-Object {
    if ($_.id -ne $null){
        if ($_.id.contains($Payload)) {$Payload = $_}
    }
    if ($_.name -ne $null){
        if ($_.name.contains($commit)) {$SubmitButton = $_}
    }
}

$Payload.value = $Password
Start-sleep -Seconds 1
$SubmitButton.click()

While ($IE.Busy) {Start-Sleep -Seconds 1}

$URL = "url"

$Doc.getElementsByTagName("input") | ForEach-Object {
    if ($_.id -ne $null){
        if ($_.id.contains($URL)) {$URL = $_}
    }
}

$URL.value
© www.soinside.com 2019 - 2024. All rights reserved.