nunojob:~ dscape/08$ echo The Black Sheep

Posts tagged ‘Encrypt’

RSA Encrypt & Decrypt in ruby

Well I finished the encrypt with RSA on ruby some hours ago and felt like sharing :)

Case you feel like doing something back for me just download the latest release of my beta twitter client and send me some comments to my email. It’s pretty hard to test something when my environment is completely contaminated !

require 'openssl'
require 'Base64'

class Rudolph
  class Crypt
    def initialize data_path
      @data_path = data_path
      @private   = get_key 'id_rsa'
      @public    = get_key 'id_rsa.pub'
    end

    def encrypt_string message
      Base64::encode64(@public.public_encrypt(message)).rstrip
    end

    def decrypt_string message
      @private.private_decrypt Base64::decode64(message)
    end

    def self.generate_keys data_path
      rsa_path = File.join(data_path, 'rsa')
      privkey  = File.join(rsa_path, 'id_rsa')
      pubkey   = File.join(rsa_path, 'id_rsa.pub')
      unless File.exists?(privkey) || File.exists?(pubkey)
        keypair  = OpenSSL::PKey::RSA.generate(1024)
        Dir.mkdir(rsa_path) unless File.exist?(rsa_path)
        File.open(privkey, 'w') { |f| f.write keypair.to_pem } unless File.exists? privkey
        File.open(pubkey, 'w') { |f| f.write keypair.public_key.to_pem } unless File.exists? pubkey
      end
    end

    private
    def get_key filename
      OpenSSL::PKey::RSA.new File.read(File.join(@data_path, 'rsa', filename))
    end
  end
end

Can you bypass rapidshare waiting time?

Before presenting the solution I would like to state that I feel very strongly against piracy. Sites like rapidshare, megaupload are the perfect scheme to make profit from illegal downloads without having to take the fall. (You can learn more about how this website works reading it’s wikipage)

If they could (they probably can) they would (ok, they probably will) sue me for saying this, but everyone knows this is the truth. I know that have the right to only offer a free service to a user whenever they wish to. It’s the way they do it that intrigued me. Can I fool “one of the biggest and fastest web hosters world wide”. Well it appears I can.

They check information from your computer (specifically your network interface MAC Address) to know what is the computer trying to access a file. I didn’t gave myself the work of checking if they let any tracking cookies in the system, I just assumed they do (and worked around it).

Before just giving the solution I found, let me just express my opinion on privacy. In my opinion no one has the right to know what computer is mine, what data is in my hard drive or what things I like to do. You should protect yourself to prevent companies from knowing stuff like who you are, what websites you visit, what is your computer, what data you have stored in your computer, what is your email (so they can flood it the way they want), etc. It’s not like I’m a hacker or that I have the most important things of the planet of my laptop, that’s certainly not the case. But all these information are about myself and for myself only. No company should be making money selling this information so a third party can benefit from it, by flooding my email or having data (like my address or phone number) where they can annoy me. They shouldn’t even know about it in the first place. So protect your information from unwanted use, check out why you should encrypt your hard drive, try to be spyware free and most of all be aware that not all is good about the internet.

For starters, how do I avoid a website from knowing it’s me. Simple:

  1. Clear your private data (how to)
  2. Close Firefox
  3. Download MAC Address Changer (here)
  4. Install the program and run it
  5. In the program select the network connection you use to access the internet from the list
  6. Hit the Change MAC button
  7. Hit Random MAC Address
  8. Hit Change now
  9. Disconnect your modem from power for 10/15 seconds (unplug the cord).
  10. Plug the cord back in.
  11. Open Firefox and go to the web page you wish to access.

Don’t forget, when your done go to MAC address changer and put your original MAC address on.

And I remind you I take no responsibility on what you do with the contents of this post, I did it so as a learning experience and I guess anyone can draw the same conclusions I did. I’m not responsible for your actions, do what you please but at your own expenses.

[EDIT: For Mac OS X Leopard users]