简体   繁体   中英

Powershell - pwpush.com - submit button

I've been trying to use Powershell to push password to the website and retrieve links, but I've no clue how to make it to click the button.

PWPUSH

So far my code looks like:

    #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

Figured this out :) The code is there:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM