forked from iagox86/poracle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoteTestModule.rb
More file actions
36 lines (29 loc) · 852 Bytes
/
RemoteTestModule.rb
File metadata and controls
36 lines (29 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
##
# RemoteTestModule.rb
# Created: December 10, 2012
# By: Ron Bowes
#
# A very simple implementation of a Padding Oracle module. Basically, it
# performs the attack against an instance of RemoteTestServer, which is an
# ideal padding oracle target.
##
#
require 'httparty'
class RemoteTestModule
attr_reader :iv, :data, :blocksize
NAME = "RemoteTestModule(tm)"
def initialize()
@data = HTTParty.get("http://localhost:20222/encrypt").parsed_response
@data = [@data].pack("H*")
@iv = nil
@blocksize = 16
end
def attempt_decrypt(data)
result = HTTParty.get("http://localhost:20222/decrypt/#{data.unpack("H*").pop}")
return result.parsed_response !~ /Fail/
end
def character_set()
# Return the perfectly optimal string, as a demonstration
return ' earnisoctldpukhmf,gSywb0.vWD21'.chars.to_a
end
end