Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 2.02 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class RelayController < ApplicationController
  2.   require 'socksify'
  3.   require 'uri'
  4.   require 'net/http'
  5.  
  6.   def expiry
  7.    username = params[:username]
  8.    password = params[:password]
  9.    @return = valid_expiry_date(username.to_s, password.to_s)
  10.   end
  11.  
  12.   def anti_hack
  13.     username = params[:username]
  14.     password = params[:password]
  15.     @return = valid_expiry_date(username.to_s, password.to_s)
  16.   end
  17.  
  18.   def change_password
  19.     username = params[:username]
  20.     password = params[:password]
  21.     newpassword = params[:newpassword]
  22.     @return = valid_expiry_date(username.to_s, password.to_s, newpassword.to_s)
  23.   end
  24.  
  25.  
  26.   private
  27.  
  28.   def change_password(username, password, newpassword)
  29.      TCPSocket::socks_server = "127.0.0.1"
  30.      TCPSocket::socks_port = 9050
  31.       reply = Net::HTTP.get URI.parse("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=setaccountdetails_v1&type=prem&login=" + username + "&password=" + password + "&newpassword=" + newpassword)
  32.       if reply == "OK"
  33.         return "done"
  34.       else
  35.         return "false"
  36.       end
  37.   end
  38.  
  39.   def rsantihack_disable(username, password)
  40.      TCPSocket::socks_server = "127.0.0.1"
  41.      TCPSocket::socks_port = 9050
  42.      reply = Net::HTTP.get URI.parse("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login=" + username + "&password=" + password)
  43.      account = reply[169..171]
  44.      if account == 0
  45.        return true
  46.      else
  47.        return false
  48.      end
  49.    end
  50.  
  51.   def valid_expiry_date(username, password)
  52.     random = Digest::SHA1.hexdigest([Time.now, rand].join)
  53.     random = random[10..20]
  54.     TCPSocket::socks_server = "127.0.0.1"
  55.     TCPSocket::socks_port = 9050
  56.     reply = Net::HTTP.get URI.parse("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login=" + username + "&password=" + password)
  57.    
  58.     account = Time.at(reply[105..115].to_i)
  59.       if (Time.now + 2419200) <= account
  60.         return true      
  61.       else
  62.         return false
  63.       end
  64.   end
  65. end