Skip to content

Commit

Permalink
(1.4 / Fixed #42) Bug fix --raw options, added --raw-ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Feb 11, 2020
1 parent 2fb1eea commit f90a457
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 49 deletions.
101 changes: 54 additions & 47 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions exe/XSpear
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ require "XSpear"

XOptions = Struct.new(:url, :data, :headers, :params, :options)

def true?(obj)
obj.to_s.downcase == "true"
end

class Parser
def self.parse(options)
args = XOptions.new('xspear')
Expand Down Expand Up @@ -50,6 +54,10 @@ class Parser
args.options['raw'] = n
end

opts.on('--raw-ssl=BOOLEAN', '[optional] http/https switch for burp raw file e.g: true/false') do |n|
args.options['raw-ssl'] = n
end

opts.on('-p', '--param=PARAM', '[optional] Test paramters') do |n|
args.options['params'] = n
end
Expand Down Expand Up @@ -135,15 +143,23 @@ if !options.options['raw'].nil?
end
end
end

# Burp or ZAP
# http, https로 시작하면 zap 아니면 burp 포맷
url = ""
if (path.index('http://') == 0 || path.index('https://') == 0)
url = path
else
url = "http://"+headers_hash['Host'].to_s.chomp!+"/"+path
if options.options['raw-ssl'].nil?
url = "https://"+headers_hash['Host'].to_s.chomp!+"/"+path
else
if true? options.options['raw-ssl']
url = "https://"+headers_hash['Host'].to_s.chomp!+"/"+path
else
url = "http://"+headers_hash['Host'].to_s.chomp!+"/"+path
end
end
end
puts url
options.url = url
if headers.length > 0
options.options['headers'] = headers
Expand Down

0 comments on commit f90a457

Please sign in to comment.