November 2008
Intermediate to advanced
208 pages
4h 32m
English
Now that you have seen the client and all of its magic, it's time to analyze the server. The server receives the data, checks that the SHA1 hash is valid, decrypts the data, and, finally, executes the command string based on the payload transmitted.
require 'socket' require 'digest/sha1'priv_key = OpenSSL::PKey::RSA.new(1024) pub_key = priv_key.public_key host = ARGV[0] || 'localhost' port = (ARGV[1] || 8887).to_i
server = TCPServer.new(host, port) while session = server.accept begin puts "Connection ...
Read now
Unlock full access