-
-
Save anonymous/b4e4e5801d5785c2bbe0b6c0721c244c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'socket' | |
puts "Starting Server" | |
server = TCPServer.open(23) | |
puts "Server Started" | |
loop { | |
puts "Waiting on connections" | |
Thread.start(server.accept) do |client| | |
puts "New connection #{client}" | |
client.print('USER ID: ') | |
print('USER ID: ') | |
@userid = client.gets.chomp.to_s | |
puts(@userid) | |
client.print('PASSPHRASE: ') | |
print('PASSPHRASE: ') | |
@passphase = client.gets.chomp.to_s | |
puts(@passphrase) | |
if (@userid == "001" and @passphase == "pickles") then #TODO: Add in different usernames and passwords for different members of WLHQ | |
client.puts("Ident confirmed. Welcome Agent.") #TODO: Add in agent names for different UIDs | |
client.puts(" _ _ _ _ _ _ _ _ _____ _____ ") | |
client.puts(" _ _ _| |_|_| |_ ___| |_|___| |_| |_ ___|_|___ ___| | __|") | |
client.puts("| | | | | | _| -_| | | . | | _| | | | . | | |__ |") | |
client.puts("|_____|_|_|_|_| |___|_|_|_ |_|_|_| |_|_|_|_|_|_ |_____|_____|") | |
client.puts(" |___| |___| ") | |
loop do | |
if client.closed? | |
puts "Client going byebye" | |
break | |
end | |
client.print("$:> ") | |
command = client.gets.chomp.to_s | |
case command | |
when "version" | |
client.puts("WhiteLightningOS V0.1 Written by and for WhiteLightningHQ") | |
when "exit" | |
client.puts("Goodbye Agent") | |
client.close() | |
when "global thermonuclear war" | |
client.puts("I win. Thanks for playing!") | |
else | |
client.puts("That's not implemented yet, only current commands are version, exit, and global thermonuclear war") | |
end | |
end | |
else | |
client.puts("Ident confirmation failed, system tracking enabled") | |
client.close | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment