1st commit

This commit is contained in:
booboy 2018-02-23 20:17:05 -06:00
parent 0cec425f17
commit 282947de7b
2 changed files with 20 additions and 0 deletions

2
README.md Normal file
View file

@ -0,0 +1,2 @@
#### List of Tools
- **generate_invite_code.rb** - generates an invite code for hackthebox.eu

18
generate_invite_code.rb Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'base64'
# send the POST request to generate the code
uri = URI('https://www.hackthebox.eu/api/invite/generate')
res = Net::HTTP.post_form(uri, 'q' => 'ruby', 'max' => '50')
# parse through the http response from our POST request and extract just the
# base64 encode data
json = JSON.parse res.body
# base64 decode it
invite_code = Base64.decode64(json['data']['code'])
puts invite_code