Aluf

Dictionary-Numbers-Bot

Jan 18th, 2015
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.37 KB | None | 0 0
  1. #############################
  2. # Project Aluf
  3. # Jp ~2013 - Number Dictionary Creator
  4. #############################
  5.  
  6. #IMPORTS
  7.  
  8. #json- for files
  9. import json
  10.  
  11.  
  12.  
  13. #class create numbers
  14. class CreateNumberList:
  15.   #max number
  16.   maxnum=1000000
  17.  
  18.   #min number
  19.   minnum=0
  20.  
  21.   #make empty list
  22.   numbers=[]
  23.  
  24.   #globals
  25.   global minnum,maxnum,numbers
  26.  
  27.   #create a file if none##################
  28.   f = open("numbers.txt", "w")
  29.   f.close
  30.   ########################################
  31.  
  32.  
  33.   #openfile and read possible password list
  34.   f = open("numbers.txt", "r")
  35.  
  36.   #print to console on loading of file
  37.   print("[INF]Loading Passwords DNumbers database...")
  38.  
  39.   #for each line in file , reallines
  40.   for name in f.readlines():
  41.      
  42.     #test if line is there
  43.     if len(name.strip())>0:
  44.        
  45.       #append name to list, strip away whitespace
  46.       numbers.append(name.strip())
  47.      
  48.   #close when for loop runs out of lines
  49.   f.close()
  50.  
  51.   # END #
  52.  
  53.   #MAIN - STARTING POINT
  54.   def __init__(self):
  55.     #Use methods
  56.     self.CreateNumber(minnum,maxnum)
  57.     self.Save()
  58.  
  59.   #######################
  60.   #Funtions
  61.   #######################
  62.  
  63.   #define save function
  64.   def Save(self):
  65.      
  66.     #save
  67.     print("[SAV] Saving Password in hacked.txt")
  68.  
  69.     #open file , w = write ,set f = open file
  70.     f = open("numbers.txt", "w")
  71.  
  72.     #write to file
  73.     f.write("\n".join(numbers))
  74.  
  75.     #close file
  76.     f.close()
  77.  
  78.  
  79.  
  80.   #create the number list
  81.   def CreateNumber(self,_minnum,_maxnum):
  82.  
  83.     #make counter out of loop
  84.     counter=0
  85.  
  86.     #print
  87.     print("Starting loop....")
  88.  
  89.     #loop through the range from 1 - 100 and each loop , set current number as var num
  90.     for num in range(_minnum,_maxnum):
  91.        
  92.         #set the created number to var. num(loops),add current number of loop to list
  93.         numbers.append(str(num))
  94.  
  95.         #increase int counter
  96.         counter+=1
  97.        
  98.         #check if number 100000 is reached
  99.         if counter > 100:
  100.          
  101.           #if so, Save
  102.           self.Save()
  103.          
  104.           #set counter back to 0
  105.           counter=0
  106.  
  107.         #print
  108.         print(str(num)+" - Created and .append() to list : Success...")
  109.  
  110.     #print end
  111.     print("Success "+str(_maxnum)+" number list created and saved in numbers.txt")
  112.  
  113.  
  114.  
  115. #make object to start
  116. startobj=CreateNumberList()
Advertisement
Add Comment
Please, Sign In to add comment