From 91fbeda062d02968a459775c8b6212e81dcaa82a Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Mon, 11 Mar 2013 14:57:55 +0100 Subject: [PATCH] up to date --- .../admin/http/github_pulls_changes.rb | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/modules/auxiliary/admin/http/github_pulls_changes.rb b/modules/auxiliary/admin/http/github_pulls_changes.rb index cd7ed06c45..5e4a36d37f 100644 --- a/modules/auxiliary/admin/http/github_pulls_changes.rb +++ b/modules/auxiliary/admin/http/github_pulls_changes.rb @@ -48,8 +48,9 @@ class Metasploit4 < Msf::Auxiliary }) if res and res.code == 200 - if res.headers['X-RateLimit-Remaining'] > 0 + if res.headers['X-RateLimit-Remaining'].to_i == 0 print_error("Warning Rate Limit reached retrieving files for ##{id}") + print_error("Your rate limit is #{res.headers['X-RateLimit-Limit']}") end files = JSON.parse(res.body) return files.map { |f| "#{f["filename"]} => #{f["status"]}" } @@ -63,18 +64,30 @@ class Metasploit4 < Msf::Auxiliary @owner = datastore["OWNER"] @repo = datastore["REPO"] - res = send_request_cgi({ - 'uri' => normalize_uri(target_uri.path, "repos", @owner, @repo, "pulls"), - 'method' => 'GET', - 'authorization' => basic_auth(datastore['USERNAME'],datastore['PASSWORD']) - }) + pulls = [] - if res and res.code == 200 and res.headers['X-RateLimit-Remaining'] > 0 - pulls = JSON.parse(res.body) - else - print_error("Error retrieving pulls requests") - return - end + page = 1 + + begin + res = send_request_cgi({ + 'uri' => normalize_uri(target_uri.path, "repos", @owner, @repo, "pulls"), + 'method' => 'GET', + 'authorization' => basic_auth(datastore['USERNAME'],datastore['PASSWORD']), + 'vars_get' => { + 'page' => "#{page}" + } + }) + + if res and res.code == 200 and res.headers['X-RateLimit-Remaining'].to_i > 0 + p_pulls = JSON.parse(res.body) + pulls << p_pulls + pulls.flatten! + else + print_error("Error retrieving pulls requests") + return + end + page = page + 1 + end while (res and res.code == 200 and not p_pulls.empty?) results_table = Rex::Ui::Text::Table.new( 'Header' => 'GitHub Pull Requests Summary',