module PWN::Plugins::TwitterAPI
def self.app_only_login(opts = {})
def self.app_only_login(opts = {}) tps://api.twitter.com' s[:consumer_key].to_s.strip.chomp.scrub if opts[:consumer_secret].nil? PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Consumer Secret') else opts[:consumer_secret].to_s.chomp.strip.scrub end .strict_encode64("#{consumer_key}:#{consumer_secret}") ent_type] = 'application/x-www-form-urlencoded;charset=UTF-8' orization] = "Basic #{authz_str}" ging into TwitterAPI REST API: #{base_api_uri}") :Plugins::TransparentBrowser.open(browser_type: :rest) ser_obj[:browser]::Request ient.execute( _uri}/oauth2/token", aders, type=client_credentials' taining the post-authenticated TwitterAPI REST API token ON.parse(response, symbolize_names: true) ess_token] => e
def self.app_only_logout(opts = {})
def self.app_only_logout(opts = {}) s[:bearer_token] ging out...') Session if Possible via API Call => e
def self.authors
def self.authors st.pentest@0dayinc.com>
def self.help
def self.help {self}.app_only_login( 'required - consumer key for app-only authentication', t: 'optional - consumer secret (will prompt if nil)' _logout( 'required bearer_token returned from #app_only_login method'
def self.twitter_rest_call(opts = {})
def self.twitter_rest_call(opts = {}) [:bearer_token] est_call].to_s.scrub ts[:http_method].nil? t s[:http_method].to_s.scrub.to_sym ms] ttp_body].to_s.scrub [:host] [:port] "http://#{host}:#{port}" Plugins::TransparentBrowser.open(browser_type: :rest) er_obj[:browser]::Request lient.execute( p_api_uri}/#{rest_call}", s se lient.execute( p_api_uri}/#{rest_call}", 'application/json; charset=UTF-8' ody, se ror("Unsupported HTTP Method #{http_method} for #{self} Plugin") SystemExit, Interrupt => e ) unless bearer_token.nil?