├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── bin ├── console ├── randomua └── setup ├── lib └── randomua.rb └── randomua.gemspec /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.gem -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: ruby 3 | rvm: 4 | - 2.3.2 5 | before_install: gem install bundler -v 1.13.6 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at kgruber1@emich.edu. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in randomua.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kent Gruber 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Randomua 2 | 3 | [![Gem Version](https://badge.fury.io/rb/randomua.svg)](https://rubygems.org/gems/randomua) 4 | [![GitHub license](https://img.shields.io/github/license/picatz/randomua)](https://github.com/picatz/randomua/blob/master/LICENSE.txt) 5 | 6 | ![random_panda](http://i.imgur.com/cdoYV6s.jpg) 7 | 8 | A command-line application to generate random user agent strings. Acting as a command-line interface to the [user-agent-randomizer](https://github.com/asconix/user-agent-randomizer) gem without the need to do any ruby programming. 9 | 10 | ## Installation 11 | 12 | $ gem install randomua 13 | 14 | ## Usage 15 | 16 | ``` 17 | $ randomua -h 18 | random user agent | Generate a random user agent string. 19 | -c, --crawler Gereate a random crawler user agent string 20 | -d, --desktop-browser Gereate a random desktop browser user agent string 21 | -m, --mobile-browser Gereate a random mobile browser user agent string 22 | -o, --console Gereate a random console user agent string 23 | -f, --offline-browser Gereate a random offline browser user agent string 24 | -e, --email-client Gereate a random email client user agent string 25 | -l, --link-checker Gereate a random link checker user agent string 26 | -a, --email-collector Gereate a random email collector user agent string 27 | -v, --validator Gereate a random validator user agent string 28 | -r, --feed-reader Gereate a random feed reader user agent string 29 | -i, --library Gereate a random library user agent string 30 | -u, --cloud-platform Gereate a random cloud platform user agent string 31 | -t, --other Gereate a random other user agent string 32 | -s, --version Print version and exit 33 | -h, --help Show this message 34 | ``` 35 | 36 | ## License 37 | 38 | The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 39 | 40 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'bundler/setup' 4 | require 'randomua' 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require 'pry' 11 | # Pry.start 12 | 13 | require 'irb' 14 | IRB.start 15 | -------------------------------------------------------------------------------- /bin/randomua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'randomua' 4 | require 'docopt' 5 | 6 | doc = <<~DOCOPT 7 | randomua (random user agent) | Generate a random user agent string. 8 | 9 | Usage: 10 | randomua [options] 11 | randomua -h | --help 12 | randomua --version 13 | 14 | Options: 15 | -c, --crawler Gereate a random crawler user agent string 16 | -d, --desktop-browser Gereate a random desktop browser user agent string 17 | -m, --mobile-browser Gereate a random mobile browser user agent string 18 | -o, --console Gereate a random console user agent string 19 | -f, --offline-browser Gereate a random offline browser user agent string 20 | -e, --email-client Gereate a random email client user agent string 21 | -l, --link-checker Gereate a random link checker user agent string 22 | -a, --email-collector Gereate a random email collector user agent string 23 | -v, --validator Gereate a random validator user agent string 24 | -r, --feed-reader Gereate a random feed reader user agent string 25 | -i, --library Gereate a random library user agent string 26 | -u, --cloud-platform Gereate a random cloud platform user agent string 27 | -t, --other Gereate a random other user agent string 28 | -s, --version Print version and exit 29 | -h, --help Show this message 30 | 31 | Examples: 32 | randomua -d 33 | DOCOPT 34 | 35 | begin 36 | args = Docopt.docopt(doc, version: Randomua::VERSION) 37 | # use case 1, using the tool 38 | if args.empty? 39 | puts UserAgentRandomizer::UserAgent.fetch.string 40 | else 41 | type = 'crawler' if args['--crawler'] 42 | type = 'desktop_browser' if args['--desktop-browser'] 43 | type = 'mobile_browser' if args['--mobile-browser'] 44 | type = 'console' if args['--console'] 45 | type = 'offline_browser' if args['--offline-browser'] 46 | type = 'email_client' if args['--email-client'] 47 | type = 'link_checker' if args['--link-checker'] 48 | type = 'email_collector' if args['--email-collector'] 49 | type = 'validator' if args['--validator'] 50 | type = 'feed_reader' if args['--feed-reader'] 51 | type = 'library' if args['--library'] 52 | type = 'cloud_platform' if args['--cloud-platform'] 53 | type = 'other' if args['--other'] 54 | puts UserAgentRandomizer::UserAgent.fetch(type: type).string 55 | end 56 | # use case 2, help: already handled by docopt 57 | # use case 3, version: already handled by docopt 58 | rescue Docopt::Exit => e 59 | puts e.message 60 | end 61 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /lib/randomua.rb: -------------------------------------------------------------------------------- 1 | require 'user_agent_randomizer' 2 | 3 | module Randomua 4 | VERSION = '1.1.0' 5 | end 6 | -------------------------------------------------------------------------------- /randomua.gemspec: -------------------------------------------------------------------------------- 1 | lib = File.expand_path('../lib', __FILE__) 2 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 3 | require 'randomua' 4 | 5 | Gem::Specification.new do |spec| 6 | spec.name = 'randomua' 7 | spec.version = Randomua::VERSION 8 | spec.authors = ['Kent Gruber', 'Alexandre ZANNI'] 9 | spec.email = ['kgruber1@emich.edu', 'alexandre.zanni@europe.com'] 10 | 11 | spec.summary = %q{A command-line application to generate random user agent strings.} 12 | spec.description = %q{A command-line application to generate random user agent strings. Acting as a command-line interface to the user-agent-randomizer gem without the need to do any ruby programming.} 13 | spec.homepage = 'https://github.com/picatz/randomua' 14 | spec.license = 'MIT' 15 | 16 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 17 | spec.bindir = 'bin' 18 | spec.executable = 'randomua' 19 | spec.require_paths = ['lib'] 20 | 21 | spec.add_dependency 'docopt', '~> 0.6' 22 | spec.add_dependency 'user-agent-randomizer', '~> 0.2' 23 | 24 | spec.add_development_dependency 'bundler', '~> 2.1' 25 | spec.add_development_dependency 'rake', '>= 12.3.3' 26 | end 27 | --------------------------------------------------------------------------------