Advertisement
Guest User

Rapidshare Account Checker v0.2

a guest
Oct 19th, 2010
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.72 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import os, sys,urllib.request
  3.  
  4. def main():
  5.     if len(sys.argv) == 1:
  6.        Clear_CLI()
  7.        About()
  8.        Prompted_Exec()
  9.     else:
  10.        Clear_CLI()
  11.        About()
  12.        List_Exec(sys.argv[1])
  13.  
  14. def About():#Information about the script and Author.
  15.     print('#----------------------------------------------------------------------#')
  16.     print('# Script Name : Rapidshare Account Checker v0.2                        #')
  17.     print('# Author      : Kreshnik Hasanaj                                       #')
  18.     print('# Special Thx : Kim Bruning                                            #')
  19.     print('# Mail        : kresha7@hotmail.com                                    #')
  20.     print('# WebPage     : http://selftaughtgeek.wordpress.com                    #')
  21.     print('# Purpose     : rsc.py rchecklist.txt | or simply exec script          #')
  22.     print('# Usage       : At your own risk                                       #')
  23.     print('# List Format : username:password and new line                         #')
  24.     print('# Requirements: Python 3.1                                             #')
  25.     print('#----------------------------------------------------------------------#\n')
  26.  
  27. def Clear_CLI():#Checking what platform we're running on to perform CLI cleaning.
  28.     if sys.platform == ('win32' or 'win64'): os.system('cls')
  29.     elif sys.platform == ('linux' or 'linux2'): os.system('clear')
  30.  
  31. def Prompted_Exec():#Prompt User for Input to get Account Informations.
  32.     Username = input("Please enter your Username:")
  33.     Password = input("Please enter your Password:")
  34.     print('--------------------------------------')
  35.  
  36.     try:
  37.        if len(Username) != 0 and len(Password) != 0:
  38.  
  39.           ResOut = HTTP_Response(Username,Password)
  40.  
  41.           if len(ResOut) < 44:
  42.              print('Login failed.')
  43.           else:
  44.              List = ResOut
  45.              for Items in List.split():
  46.                  print(str(Items,'utf-8'))
  47.              print('--------------------------------------')
  48.              Save_AccInfo(ResOut)
  49.          
  50.              
  51.              
  52.        else:
  53.           print ("You forgot to enter your Username or Password")
  54.           sys.exit(0)
  55.     except:
  56.           print('Error Accured!')
  57.        
  58. def List_Exec(FileName):#Check's a list with account's if there broken or still working.
  59.  
  60.     try:
  61.         CurrDir = os.getcwd() + '\\'
  62.         FileHwnd = open(CurrDir + FileName)
  63.    
  64.         for line in FileHwnd.readlines():
  65.             sBuffer = line
  66.             AccountInfo = sBuffer.split(':')
  67.             RsUsername = AccountInfo[0]
  68.             RsPassword = AccountInfo[1]
  69.            
  70.             ResOut = HTTP_Response(RsUsername,RsPassword)
  71.  
  72.             if len(ResOut) < 44:
  73.                print('Username:{} Password:{} is not working. :('.format(RsUsername,RsPassword))
  74.                print('------------------------------------------------------------------------')
  75.             else:
  76.                print('Username:{} Password:{} is working!'.format(RsUsername,RsPassword))
  77.                print('------------------------------------------------------------------------')
  78.  
  79.                #Open File and write/append all working account's in it.
  80.                File = open(CurrDir + 'Working Accounts.txt','a')
  81.                File.writelines(RsUsername + ':' + RsPassword + '\n')
  82.         File.close()
  83.         print("\nAll working account's have been saved in the file (Working Account's.txt)")
  84.         print("*************************************************************************")
  85.         print("For suggestion's found bugs and idea's mail me kresha7@hotmail.com")
  86.  
  87.     except:
  88.           print('Error Accured!')
  89.  
  90. def HTTP_Response(RsUsername,RsPassword):#Handles HTTP Response
  91.     try:
  92.        Response = urllib.request.urlopen("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login="+RsUsername+"&password="+RsPassword)
  93.        Res = Response.read()
  94.        Response.close()    
  95.        return Res
  96.     except:
  97.           print('Error.')
  98.          
  99. def Save_AccInfo(Output):#Save Account Information into a local file.
  100.     Save = input('Do you want to save the Account Info? [y/n]:')
  101.  
  102.     try:
  103.        if Save == ('y'):
  104.           CurrDir = os.getcwd() + '\\'
  105.           List = Output
  106.           FHandle = open(CurrDir + 'RsAccountInfo.txt','a')
  107.          
  108.           for Items in List.split():
  109.               FHandle.write(str(Items,'utf-8'))
  110.               FHandle.write('\n')
  111.           FHandle.close()
  112.           print('Information Saved')
  113.        else:
  114.           os.system('exit')
  115.     except Exception as E:
  116.           print (repr(E))
  117.           print('Error Saving the Info.')
  118.  
  119.          
  120. if __name__ == '__main__':main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement