Skip to content

Instantly share code, notes, and snippets.

@ed-cooper
Last active September 10, 2017 19:40
Show Gist options
  • Save ed-cooper/597635e133310305713ae1a8edcba858 to your computer and use it in GitHub Desktop.
Save ed-cooper/597635e133310305713ae1a8edcba858 to your computer and use it in GitHub Desktop.
Scratch Animated Thumbnail Hacker
#Scratch Animated Thumbnail Hacker, by @novice27b ( https://scratch.mit.edu/users/novice27b/ )
require "socket"
require "openssl"
file = File.binread('FILE PATH TO ANIMATED GIF GOES HERE - MUST BE UNDER 1MB')
id = 'PROJECT ID GOES HERE (THE END PART OF YOUR PROJECT URL)'
sessid = 'SCRATCH SESSION ID GOES HERE - CHECK YOUR BROWSER COOKIES TO GET THIS VALUE'
socket = TCPSocket.open("scratch.mit.edu", 443)
ssl = OpenSSL::SSL::SSLSocket.new(socket)
ssl.connect()
message = "\
POST /internalapi/project/thumbnail/#{id}/set/ HTTP/1.1\r\n\
Host: scratch.mit.edu\r\n\
Cookie: scratchcsrftoken=; scratchsessionsid=#{sessid}\r\n\
Content-Length: #{file.bytesize}\r\n\r\n"
ssl.write(message)
ssl.write(file)
while ( (c = ssl.getc) != "}" )
print c
end
puts
@CosmicWebServices
Copy link

👍

@bob1171
Copy link

bob1171 commented Sep 10, 2017

🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment