Class: Analyzers::CbcMac::VariableLength::Oracles::Tcp
- Inherits:
-
Object
- Object
- Analyzers::CbcMac::VariableLength::Oracles::Tcp
- Defined in:
- lib/crypto-toolbox/analyzers/cbc_mac/variable_length/oracles/tcp.rb
Instance Method Summary collapse
- #connect ⇒ Object
-
#disconnect ⇒ Object
puts “Connected to server successfully.”.
-
#initialize(mac_host = '54.165.60.84', mac_port = 81, verify_host = '54.165.60.84', verify_port = 82) ⇒ Tcp
constructor
A new instance of Tcp.
- #mac(message) ⇒ Object
- #verify(message, tag) ⇒ Object
Constructor Details
#initialize(mac_host = '54.165.60.84', mac_port = 81, verify_host = '54.165.60.84', verify_port = 82) ⇒ Tcp
Returns a new instance of Tcp.
8 9 10 11 12 13 14 15 |
# File 'lib/crypto-toolbox/analyzers/cbc_mac/variable_length/oracles/tcp.rb', line 8 def initialize(mac_host = '54.165.60.84', mac_port = 81, verify_host = '54.165.60.84', verify_port = 82) @mac_host = mac_host @mac_port = mac_port @verify_host = verify_host @verify_port = verify_port @mac_socket = nil @verify_socket = nil end |
Instance Method Details
#connect ⇒ Object
16 17 18 19 20 |
# File 'lib/crypto-toolbox/analyzers/cbc_mac/variable_length/oracles/tcp.rb', line 16 def connect @mac_socket = TCPSocket.open(@mac_host,@mac_port) @verify_socket = TCPSocket.open(@verify_host,@verify_port) #puts "Connected to server successfully." end |
#disconnect ⇒ Object
puts “Connected to server successfully.”
21 22 23 24 |
# File 'lib/crypto-toolbox/analyzers/cbc_mac/variable_length/oracles/tcp.rb', line 21 def disconnect @verify_socket.close if @verfiy_socket @mac_socket.close if @mac_socket end |
#mac(message) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/crypto-toolbox/analyzers/cbc_mac/variable_length/oracles/tcp.rb', line 26 def mac() connect unless @mac_socket packet = () @mac_socket.write(packet) @mac_socket.read(16) end |
#verify(message, tag) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/crypto-toolbox/analyzers/cbc_mac/variable_length/oracles/tcp.rb', line 34 def verify(,tag) connect unless @verify_socket packet = (,tag) @verify_socket.write(packet) @verify_socket.read(2).to_i end |