Skip to content

Commit

Permalink
jwt analyzer update
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schmidt committed Sep 15, 2017
1 parent 2a0d8ba commit 57fc0b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/plugin-loader.rb
Expand Up @@ -9,7 +9,7 @@

module Watobo
module Gui
PluginLoader.new(application)
PluginLoader.new
application.create
application.run
end
Expand Down
7 changes: 4 additions & 3 deletions dev/plugin_loader/gui/main.rb
Expand Up @@ -9,12 +9,13 @@ def self.application

class PluginLoader < FXMainWindow

def initialize(app)
# Call base class initializer first
super(app, "Plugin Tester", :width => 800, :height => 600)
def initialize()

super(Watobo::Gui.application, "Plugin Tester", :width => 800, :height => 600)
frame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)

button = FXButton.new(frame, "Open Plugin", :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT, :padLeft => 10, :padRight => 10, :padTop => 5, :padBottom => 5)

button.connect(SEL_COMMAND) {
dlg = Watobo::Plugin::JWT::Gui.new
if dlg.execute != 0
Expand Down
14 changes: 8 additions & 6 deletions plugins/jwt/gui/main.rb
Expand Up @@ -103,8 +103,8 @@ def parse_raw
jhb64, jpb64, jsb64 = @raw_txt.text.strip.split('.')
return false if jhb64.nil? | jpb64.nil? | jsb64.nil?
begin
jwt_head = JSON.parse(Base64.decode64(jhb64))
jwt_payload = JSON.parse(Base64.decode64(jpb64))
jwt_head = JSON.parse(Base64.urlsafe_decode64(jhb64))
jwt_payload = JSON.parse(Base64.urlsafe_decode64(jpb64))
jwt_signature = jsb64
rescue => bang
return false
Expand All @@ -128,8 +128,8 @@ def get_token_from_chat(chat)
unless bearer.nil?
jwt = bearer.match(/Bearer (.*)/)[1]
jhb64, jpb64, jsb64 = jwt.split('.')
@jwt_head = JSON.parse(Base64.decode64(jhb64))
@jwt_payload = JSON.parse(Base64.decode64(jpb64))
@jwt_head = JSON.parse(Base64.urlsafe_decode64(jhb64))
@jwt_payload = JSON.parse(Base64.urlsafe_decode64(jpb64))
@jwt_signature = jsb64
end
bearer
Expand All @@ -138,8 +138,10 @@ def get_token_from_chat(chat)
def create_token
token = []
begin
token << Base64.encode64(JSON.parse(@head_txt.text).to_s)
token << Base64.encode64(JSON.parse(@payload_txt.text).to_s)
#token << Base64.urlsafe_encode64(JSON.parse(@head_txt.text).to_s)
token << Base64.urlsafe_encode64(@head_txt.to_s)
#token << Base64.urlsafe_encode64(JSON.parse(@payload_txt.text).to_s)
token << Base64.urlsafe_encode64(@payload_txt.to_s)
token << @signature_txt.text
@token_txt.setText(token.join('.'))
rescue => bang
Expand Down

0 comments on commit 57fc0b8

Please sign in to comment.