Sha256: f51de8c002bdd07ced52d298cf37db5f3d00076eb3d7d741a18081a1855812ec

Contents?: true

Size: 1.63 KB

Versions: 404

Compression:

Stored size: 1.63 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('-sIP', '--jenkins_ip=IP', '<Required - Jenkins Server IP>') { |s| opts[:jenkins_ip] = s }

  options.on('-dPORT', '--dest-port=PORT', '<Optional - Jenkins Server Port (Defaults to 8080)>') do |port|
    opts[:port] = port
  end

  options.on('-UUSER', '--username=USER', '<Required - Jenkins Username>') do |user|
    opts[:username] = user
  end

  options.on('-PPASS', '--password=PASS', '<Required - Jenkins Password>') do |pass|
    opts[:password] = pass
  end

  options.on('-vVIEW', '--view-name=VIEW', '<Required - View Name to Create>') do |view_name|
    opts[:view_name] = view_name
  end

  options.on('-rREGX', '--regx-filter=REGEX', '<Required - RegEx >') do |regex_filter|
    opts[:regex_filter] = regex_filter
  end
end.parse!

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

jenkins_ip = opts[:jenkins_ip].to_s.scrub
port = opts[:port].to_i
username = opts[:username]
password = opts[:password]
view_name = opts[:view_name].to_s.chomp.strip.scrub
regex_filter = opts[:regex_filter].to_s.chomp.strip.scrub

if port.positive?
  jenkins_obj = PWN::Plugins::Jenkins.connect(
    jenkins_ip: jenkins_ip,
    port: port,
    username: username,
    password: password
  )
else
  jenkins_obj = PWN::Plugins::Jenkins.connect(
    jenkins_ip: jenkins_ip,
    username: username,
    password: password
  )
end

jenkins_obj.view.create_list_view(
  name: view_name,
  regex: regex_filter
)

PWN::Plugins::Jenkins.disconnect(jenkins_obj: jenkins_obj)

Version data entries

404 entries across 404 versions & 1 rubygems

Version Path
pwn-0.4.774 bin/pwn_jenkins_create_view
pwn-0.4.773 bin/pwn_jenkins_create_view
pwn-0.4.772 bin/pwn_jenkins_create_view
pwn-0.4.771 bin/pwn_jenkins_create_view
pwn-0.4.770 bin/pwn_jenkins_create_view
pwn-0.4.769 bin/pwn_jenkins_create_view
pwn-0.4.768 bin/pwn_jenkins_create_view
pwn-0.4.767 bin/pwn_jenkins_create_view
pwn-0.4.766 bin/pwn_jenkins_create_view
pwn-0.4.765 bin/pwn_jenkins_create_view
pwn-0.4.764 bin/pwn_jenkins_create_view
pwn-0.4.762 bin/pwn_jenkins_create_view
pwn-0.4.761 bin/pwn_jenkins_create_view
pwn-0.4.760 bin/pwn_jenkins_create_view
pwn-0.4.759 bin/pwn_jenkins_create_view
pwn-0.4.758 bin/pwn_jenkins_create_view
pwn-0.4.757 bin/pwn_jenkins_create_view
pwn-0.4.756 bin/pwn_jenkins_create_view
pwn-0.4.755 bin/pwn_jenkins_create_view
pwn-0.4.754 bin/pwn_jenkins_create_view