Advertisement
Guest User

WLOS

a guest
May 28th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.70 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'socket'
  4.  
  5. puts "Starting Server"
  6. server = TCPServer.open(23)
  7. puts "Server Started"
  8.  
  9. loop {
  10.     puts "Waiting on connections"
  11.     Thread.start(server.accept) do |client|
  12.         puts "New connection #{client}"
  13.         client.print('USER ID: ')
  14.         print('USER ID: ')
  15.         @userid = client.gets.chomp.to_s
  16.         puts(@userid)
  17.         client.print('PASSPHRASE: ')
  18.         print('PASSPHRASE: ')
  19.         @passphase = client.gets.chomp.to_s
  20.         puts(@passphrase)
  21.         if (@userid == "001" and @passphase == "pickles") then #TODO: Add in different usernames and passwords for different members of WLHQ
  22.             client.puts("Ident confirmed. Welcome Agent.") #TODO: Add in agent names for different UIDs
  23.             client.puts("       _   _ _       _ _     _   _       _         _____ _____ ")
  24.             client.puts(" _ _ _| |_|_| |_ ___| |_|___| |_| |_ ___|_|___ ___|     |   __|")
  25.             client.puts("| | | |   | |  _| -_| | | . |   |  _|   | |   | . |  |  |__   |")
  26.             client.puts("|_____|_|_|_|_| |___|_|_|_  |_|_|_| |_|_|_|_|_|_  |_____|_____|")
  27.             client.puts("                        |___|                 |___|            ")
  28.             until client.eof? do
  29.                 client.print("$:> ")
  30.                 command = client.gets.chomp.to_s
  31.                 case command
  32.                     when "version"
  33.                         client.puts("WhiteLightningOS V0.1 Written by and for WhiteLightningHQ")
  34.                     when "exit"
  35.                         client.puts("Goodbye Agent")
  36.                         client.close()
  37.                     when "global thermonuclear war"
  38.                         client.puts("I win. Thanks for playing!")
  39.                     else
  40.                         client.puts("That's not implemented yet, only current commands are version, exit, and global thermonuclear war")
  41.                 end
  42.             end
  43.         else
  44.             client.puts("Ident confirmation failed, system tracking enabled")
  45.             client.close
  46.         end
  47.        
  48.     end
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement