Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- #
- #
- # THIS IS THE VERY LEAST YOU NEED TO POST AN EDIT REQUEST TO PASTEBIN
- # ORIGINAL (MORE COMPLEX): https://pastebin.com/N4YsJQiC
- # THIS SAME PASTE BUT WITH COMMENTS: https://pastebin.com/jFgnC7H7
- #
- #
- #
- $ptboundary = 'SOMERANDOMTEXTeiRmyvWHDqaCPQLxFCUpXvKyeabAd7cOEI0cjxr'
- $PASTE_ID = "YOUR PASTE'S ID GOES HERE"
- $MY_NEW_TEXT = "YOUR FINAL TEXT GOES HERE"
- $COOKIE_VALUE = "YOUR COOKIE GOES HERE"
- $session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
- $session.Cookies.Add((New-Object System.Net.Cookie(
- "pastebin-frontend",
- $COOKIE_VALUE,
- "/",
- "pastebin.com"
- )))
- $WR = Invoke-WebRequest `
- -Uri "https://pastebin.com/edit/$PASTE_ID" `
- -WebSession $session `
- $csrf = ($WR.RawContent -split '\r?\n' | Select-String '^.*input.*?name="_csrf' -Raw) -replace '^.*value *= *"(.*?)".*$', '$1'
- $STRING = @(
- "--$ptboundary"
- 'Content-Disposition: form-data; name="_csrf-frontend"'
- ''
- $csrf
- "--$ptboundary"
- 'Content-Disposition: form-data; name="PostForm[text]"'
- ''
- $MY_NEW_TEXT
- "--$ptboundary--"
- ) -join "`n"
- $BYTES = ([System.Text.Encoding]::UTF8.GetBytes($STRING))
- Invoke-WebRequest -Method Post -Uri "https://pastebin.com/edit/$PASTE_ID" `
- -WebSession $session `
- -ContentType "multipart/form-data; boundary=$ptboundary" `
- -Body $BYTES
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement