Advertisement
Guest User

Project 1

a guest
Apr 7th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.88 KB | None | 0 0
  1. import random
  2. import time #Reseached online: http://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python
  3. #It is an import for time
  4.  
  5. openpro = 0 # This will set the variable used in task manager to negative for a program being open now
  6.  
  7. def cashcow():
  8.   global openpro    # This makes open pro usable outside this function
  9.   openpro = 1        # When this aplication is opened or called, it will set this to 1
  10.   print "=" * 50
  11.   print 'Welcome to Cash Cow'
  12.   print "="*50
  13.   print''
  14.   print "Loading",
  15.   time.sleep(1) # Learned in http://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python
  16.   print '.',
  17.   time.sleep(1) # What this does is make the program wait for the amount of time of seconds in the paranthese
  18.   print '.',
  19.   time.sleep(1)  
  20.   print '.'
  21.   time.sleep(1)
  22.   print ''
  23.   print "Type 'yes' to randomly generate credit card numbers that work!"
  24.   print''
  25.   cashchoice = raw_input("(yes/no)") # Asks if you want to start
  26.   print''
  27.   time.sleep(2)
  28.   codes = random.choice([5,7,4,3])      # This will set codes to one of these numbers
  29.   if cashchoice == "yes":              
  30.     while codes <= 10:                  # This is a while loop that will what is inside it until x is greater than 10
  31.       codes = codes + 1             # This keeps adding 1 to the orginal number that was randomly choosen so that it will be a random number of codes
  32.       d1 = random.choice(range(1,9))   # This variable choose a random digit between 1 and 9
  33.       d2 = random.choice(range(1,9))
  34.       d3 = random.choice(range(1,9))
  35.       d4 = random.choice(range(1,9))
  36.       d5 = random.choice(range(1,9))
  37.       d6 = random.choice(range(1,9))
  38.       d7 = random.choice(range(1,9))
  39.       d8 = random.choice(range(1,9))
  40.       d9 = random.choice(range(1,9))
  41.       d10 = random.choice(range(1,9))
  42.       d11 = random.choice(range(1,9))
  43.       d12 = random.choice(range(1,9))
  44.       d13 = random.choice(range(1,9))
  45.       d14 = random.choice(range(1,9))
  46.       d15 = random.choice(range(1,9))
  47.       d16 = random.choice(range(1,9))
  48.       print "%d%d%d%d %d%d%d%d %d%d%d%d %d%d%d%d" %(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16)
  49.       print''                   # Above: This will print the random numbers in groups of four
  50.     time.sleep(1)
  51.     quitcash = raw_input("Quit? (yes/no)") # Asks to quit
  52.     if quitcash == "yes":
  53.       time.sleep(1)
  54.       print''
  55.       computer()  # Goes back to computer
  56.     elif quitcash == "no":
  57.       time.sleep(3)
  58.       print "That's enought time!!!"
  59.       print''
  60.       computer() #Goes back no matter what
  61.     else:
  62.       print "Invalid input"
  63.       print''
  64.       computer()
  65.   else:
  66.     time.sleep(1) # What this does is that it makes a waitime or it makes time "sleep" for the amount of seconds in the paranthese
  67.  
  68.     computer()
  69.        
  70. def diag():
  71.   three = "This could take a few seconds...\n"     # These variables are different for each time
  72.   one = "This could take a second...\n"
  73.   five = "This could take a couple of seconds...\n"
  74.   waittime = random.choice([three,one,five])             # Chooses one of the times
  75.   if waittime == three:
  76.     print three     # The the waiting time
  77.     time.sleep(1)
  78.     print "Loading..."
  79.     print''
  80.     time.sleep(3)   # The amount of time depends on the number randomyl chosen and it will say the percent that corresponds to that number
  81.     print "System preforming at 75%"
  82.     print''
  83.     systemcheck()
  84.   elif waittime == one:
  85.     print one
  86.     time.sleep(1)
  87.     print "Loading..."
  88.     print''
  89.     time.sleep(1)
  90.     print "System preforming at 99%"
  91.     print''
  92.     systemcheck()
  93.   elif waittime == five:
  94.     print five
  95.     time.sleep(1)
  96.     print "Loading..."
  97.     print''
  98.     time.sleep(5)
  99.     print "System preforming at 42%"
  100.     print''
  101.     time.sleep(1)
  102.     systemcheck()
  103.   else:
  104.     print "Somethings not right"
  105.    
  106.  
  107. def scan():
  108.   trojan = "The file: Trojan.exe has been found"     #These are the possible outcomes of the scan.
  109.   hacked = "User: 'anonymous' is trying to gain acess to computer"
  110.   hal = "I'm sorry %s, I'm affraid I can't do that." %username
  111.   troll = """
  112.    ░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄
  113.  ░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄
  114.  ░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█
  115.  ░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░█
  116.  ░▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░█
  117.  █▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒█
  118.  █▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█
  119.  ░█▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█
  120.  ░░█░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█
  121.  ░░░█░░██░░▀█▄▄▄█▄▄█▄████░█
  122.  ░░░░█░░░▀▀▄░█░░░█░███████░█
  123.  ░░░░░▀▄░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█
  124.  ░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░█
  125.  ░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░█
  126.  ░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░█
  127.  """
  128.   safe = "Your computer is all clear!"
  129.   print "Scanning",
  130.   print''
  131.   time.sleep(1)
  132.   print ".",
  133.   time.sleep(1)
  134.   print ".",
  135.   time.sleep(1)
  136.   print "."
  137.   time.sleep(1)
  138.   virus = random.choice([trojan,hacked,hal,troll,safe]) # Randomly chooses one of the possible outcomes
  139.   if virus == trojan:
  140.     print "-"*50
  141.     print trojan    # Prints the outcome...
  142.     print "-"*50
  143.     print ""
  144.     print'+' * 50
  145.     print "Emergency Shutdown" # And this is the result
  146.     print'+' * 50
  147.     print''
  148.   elif virus == hacked:
  149.     print "-"*50
  150.     print hacked
  151.     print "-"*50
  152.     print''
  153.     print'+' * 50
  154.     print "Emergency Shutdown"
  155.     print'+' * 50
  156.     print''
  157.   elif virus == hal:
  158.     print "-"*50
  159.     print hal
  160.     print "-"*50
  161.     print''
  162.     print'+' * 50
  163.     print "Emergency Shutdown"
  164.     print'+' * 50
  165.     print''
  166.   elif virus == troll:
  167.     print troll
  168.     time.sleep(3)
  169.     computer()
  170.   elif virus == safe:
  171.     print "-"*50
  172.     print safe
  173.     print "-"*50
  174.     print''
  175.     time.sleep(2)
  176.     systemcheck()  #Goes back
  177.   else:
  178.     print "Somethings not right" # This should not happen but it was more of a test.
  179.  
  180.  
  181. def taskm():
  182.   global openpro
  183.   if openpro == 1:    # If the cash cow program was even opened, then openpro would have been set to 1
  184.     print''
  185.     print "Aplications open:\n\n\t*Cash Cow"   # This will say that it is open
  186.     print''
  187.     closprog = raw_input("Close program? (yes/no)")
  188.     if closprog == "yes":
  189.       openpro = 0             # If you close the program it will set openpro to 0 making it closed
  190.       print".",
  191.       time.sleep(1)
  192.       print "."
  193.       time.sleep(1)
  194.       computer()
  195.     elif closprog == "no":
  196.       computer()
  197.     else:
  198.       print "Please enter 'yes' or 'no'"
  199.   else:
  200.     print "-No programs open-"      # If it was never opened, or it was closed then it will say this.
  201.     print''
  202.     print "Now closing"
  203.     time.sleep(2)
  204.     computer()
  205.  
  206. def systemcheck():
  207.   print "+"*50
  208.   print "Please choose and option"
  209.   print "+"*50
  210.   global c_a_d
  211.   c_a_d = int(raw_input("\t1. Run Diagnostic\n\t2. Scan Computer\n\t3. Task Manager\n\t4. Go Back\n"))
  212.   if c_a_d == 1:              # This is just a menu or port to the three options above for system check
  213.     diag()
  214.   elif c_a_d == 2:
  215.     scan()
  216.   elif c_a_d == 3:
  217.     taskm()
  218.   elif c_a_d == 4:
  219.     time.sleep(1)
  220.     computer()
  221.   else:
  222.     print "Enter a valid number"
  223.     systemcheck()
  224.  
  225.  
  226. def computer():
  227.   print "="*50
  228.   print "Welcome Back %s" %username  # User user name to show your name
  229.   print "="*50
  230.   print''
  231.   print'-'* 35
  232.   print "What do you want to do?"
  233.   print'-'* 35
  234.   global mainmenu
  235.   mainmenu= int(raw_input("\t1. Open Cash Cow\n\t2. System Check\n\t3. Log off\n\t4. Reboot\n\t5. Shut Down\n"))
  236.   if mainmenu == 1:
  237.     cashcow()            # goes to cash cow if number is choosen
  238.   elif mainmenu == 2:
  239.     systemcheck()          # goes to system check
  240.   elif mainmenu == 3:
  241.     time.sleep(1)
  242.     logon()               # Logon below
  243.   elif mainmenu == 4:
  244.     time.sleep(1)
  245.     startup()               # reboot will call the very first function which is the start of the program
  246.   elif mainmenu == 5:
  247.     exit(0)                  # Exit 0 should end the program or kill it
  248.   else:
  249.     print "Please enter a valid numer"
  250.  
  251.  
  252. def logon():  # Logging in
  253.   print "="*50
  254.   print "Please Log In"
  255.   print "="*50
  256.   users = int(raw_input("1. Jason\n2. Jesepi\n\n")) # Two users I made
  257.   if users == 1:
  258.     print"-"*23
  259.     global username     # did this so it could be called later on
  260.     username = raw_input("What is your user name?") # Asks for name and it can be anything
  261.     print''
  262.     password = raw_input("Please enter password")
  263.     if password == "password":  # This is the password and the correct one must be entered
  264.       print""
  265.       computer() # It will go to the main menu
  266.     else:
  267.       print""
  268.       print "Incorrect, please try again"
  269.       logon()
  270.   elif users == 2: # This was just for fun
  271.     print"-"*23
  272.     name2 = raw_input("What is your user name?")  
  273.     password2 = raw_input("Please enter password")
  274.     if password2 == "anything":  # This is correct password but...
  275.       print "Incorrect!!!"  # No matter what you do it will say incorrect because Jesepi is very personal magical being
  276.       logon()
  277.     else:
  278.       time.sleep(1)
  279.       print""
  280.       print "Incorrect!!!" # Anything else will be wrong
  281.       print''
  282.       time.sleep(1)
  283.       logon()
  284.  
  285. #Start Up MAIN                  # Beginning
  286. def startup():# This makes it available out side of this function     # This variable is for the task manager
  287.   print"="*50
  288.   print "Starting up, this could take a second!"
  289.   print''
  290.   time.sleep(1)
  291.   print "Monitor Working"
  292.   time.sleep(1) # Learned in http://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python
  293.   print"..."
  294.   time.sleep(1)
  295.   print"..."
  296.   time.sleep(1)
  297.   print"..."
  298.   time.sleep(1)
  299.   print "_"*18
  300.   print "Checking for Mouse" #Mouse Check
  301.   print "_"*18
  302.   time.sleep(1)
  303.   print ".",
  304.   time.sleep(1)
  305.   print ".",
  306.   time.sleep(1)
  307.   print "."
  308.   time.sleep(1)
  309.   print ''
  310.   yesmouse = "Mouse detected"  # Setting Variables for random
  311.   nomouse = "No mouse detected"
  312.   mouse = random.choice([yesmouse,yesmouse,yesmouse,nomouse]) # 25% chance detecting no mouse
  313.   if mouse == yesmouse:
  314.     print mouse # It will say it is detected if found
  315.     print''
  316.     print'+'*15
  317.     time.sleep(1)
  318.     print''
  319.   elif mouse == nomouse: # If it is not detected:
  320.     print mouse
  321.     print''
  322.     print'+' * 50
  323.     print "Emergency Restart in 3 seconds"
  324.     print'+' * 50
  325.     print""
  326.     time.sleep(3) # Wait 3 sec then,
  327.     startup() # Starts the process over
  328.   else:
  329.     print"Somethings not right"
  330.   print "_"*21  
  331.   print "Checking for Keyboard" # Key board Check
  332.   print "_"*21
  333.   time.sleep(1)
  334.   print ".",
  335.   time.sleep(1)
  336.   print ".",
  337.   time.sleep(1)
  338.   print "."
  339.   time.sleep(1)
  340.   print''
  341.   yeskey = "Keyboard detected"
  342.   nokey = "No keyboard detected"
  343.   keyboard = random.choice([yeskey,yeskey,yeskey,yeskey,nokey]) # The keyboard works better hence the extra yeskey
  344.   if keyboard == yeskey:
  345.     print keyboard
  346.     print''
  347.   elif keyboard == nokey:
  348.     print keyboard
  349.     print''
  350.     print'+' * 50
  351.     print "Emergency Restart in 3 seconds"
  352.     print'+' * 50
  353.     print""
  354.     time.sleep(3)
  355.     startup()
  356.   else:
  357.     print"Somethings not right"
  358.   logon()
  359.  
  360. startup() # This is the only call outside a function because every other function can be called from a function so this is the only one called
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement