Sha256: e0f32b72820d85393c1415b245fb6972ea2ca067b4f5d50725d4fa976e14d89d

Contents?: true

Size: 1.1 KB

Versions: 411

Compression:

Stored size: 1.1 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'pwn'
require 'optparse'

opts = {}
OptionParser.new do |options|
  options.banner = "USAGE:
    #{$PROGRAM_NAME} [opts]
  "

  options.on('-rPATTERN', '--regex=PATTERN', "<Required - Regex Pattern for Interesting Pastes ('.*' for All)>") do |r|
    opts[:regex] = r
  end

  options.on('-pPROXY', '--proxy=PROXY', '<Optional - HTTP or Socks Proxy || tor>') do |p|
    opts[:proxy] = p
  end
end.parse!

if opts.empty?
  puts `#{$PROGRAM_NAME} --help`
  exit 1
end

proxy = opts[:proxy]
regex = opts[:regex]

browser_obj = PWN::WWW::Pastebin.open(
  browser_type: :headless,
  proxy: proxy
)

browser = browser_obj[:browser]

begin
  loop do
    browser.div(id: 'menu_2').links[0].click
    code_frame = browser.div(id: 'code_frame').text
    if code_frame.match?(/#{regex}/mi)
      puts "\nCurrent Link: #{browser.url}"
      puts "#{code_frame}\n\n\n"
    else
      print '.'
    end
    sleep 9
  end
rescue StandardError => e
  raise e
ensure
  if browser_obj
    browser_obj = PWN::Plugins::TransparentBrowser.close(
      browser_obj: browser_obj
    )
  end
end

Version data entries

411 entries across 411 versions & 1 rubygems

Version Path
pwn-0.4.712 bin/pwn_pastebin_sample_filter
pwn-0.4.711 bin/pwn_pastebin_sample_filter
pwn-0.4.710 bin/pwn_pastebin_sample_filter
pwn-0.4.709 bin/pwn_pastebin_sample_filter
pwn-0.4.708 bin/pwn_pastebin_sample_filter
pwn-0.4.707 bin/pwn_pastebin_sample_filter
pwn-0.4.706 bin/pwn_pastebin_sample_filter
pwn-0.4.705 bin/pwn_pastebin_sample_filter
pwn-0.4.704 bin/pwn_pastebin_sample_filter
pwn-0.4.703 bin/pwn_pastebin_sample_filter
pwn-0.4.702 bin/pwn_pastebin_sample_filter