Permalink
Browse files

Major update: re-named most of the files, added a README.md file, and…

… added a decryption module. This change breaks compatibility with previous versions, unfortunately.
  • Loading branch information...
iagox86
iagox86 committed Dec 18, 2016
1 parent 0b21db6 commit a5cfad76ada97862bdc1eb558937f03ad96d4ee6
Showing with 323 additions and 341 deletions.
  1. +33 −31 Demo.rb
  2. +0 −111 DoTests.rb
  3. +0 −69 LocalTestModule.rb
  4. +141 −86 Poracle.rb
  5. +135 −0 README.md
  6. +0 −36 RemoteTestModule.rb
  7. +14 −8 RemoteTestServer.rb
View
64 Demo.rb
@@ -1,3 +1,5 @@
# encoding: ASCII-8BIT
##
# Demo.rb
# Created: February 10, 2013
@@ -7,36 +9,36 @@
##
#
require 'httparty'
require './poracle'
class DemoModule
attr_reader :iv, :data, :blocksize
NAME = "DemoModule(tm)"
# This function should load @data, @iv, and @blocksize appropriately
def initialize()
@data = HTTParty.get("http://localhost:20222/encrypt").parsed_response
# Parse 'data' here
@data = [@data].pack("H*")
@iv = nil
@blocksize = 16
end
# This should make a decryption attempt and return true/false
def attempt_decrypt(data)
result = HTTParty.get("http://localhost:20222/decrypt/#{data.unpack("H*").pop}").parsed_response
# Match 'result' appropriately
return result !~ /Fail/
end
# Optionally define a character set, with the most common characters first
def character_set()
return ' eationsrlhdcumpfgybw.k:v-/,CT0SA;B#G2xI1PFWE)3(*M\'!LRDHN_"9UO54Vj87q$K6zJY%?Z+=@QX&|[]<>^{}'.chars.to_a
end
end
require './Poracle'
BLOCKSIZE = 16
mod = DemoModule.new
puts "DECRYPTED: #{Poracle.decrypt(mod, mod.data, mod.iv, true)}"
poracle = Poracle.new(BLOCKSIZE, true) do |data|
url = "http://localhost:20222/decrypt/#{data.unpack('H*').pop()}"
result = HTTParty.get(url)
# Return
result.parsed_response !~ /Fail/
end
data = HTTParty.get("http://localhost:20222/encrypt").parsed_response
print "Trying to decrypt: %s" % data
result = poracle.decrypt([data].pack('H*'))
puts("-----------------------------")
puts("Decryption result")
puts("-----------------------------")
puts result
puts("-----------------------------")
puts()
data = "The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents."
print "Trying to encrypt: %s" % data
result = poracle.encrypt(data)
puts("-----------------------------")
puts("Encrypted string")
puts("-----------------------------")
puts result.unpack('H*')
puts("-----------------------------")
puts()
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit a5cfad7

Please sign in to comment.