Permalink
Browse files

Release v2.0.0 as a gem πŸŽ‰

  • Loading branch information...
Melvin Lammerts
Melvin Lammerts committed Nov 24, 2016
1 parent 971a31d commit 2f4af244bda8742a733b39cbc159f38dc055c6a7
View
@@ -1 +0,0 @@
-ADD_GITHUB_USER_SESSION_COOKIE_HERE
View
@@ -3,3 +3,4 @@
*.swp
!output/.gitkeep
output/*
+*.gem
View
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
gem 'pry'
-gem 'require_all'
gem 'tty'
gem 'http'
gem 'nokogiri'
View
@@ -6,22 +6,22 @@ vcsmap is a plugin-based tool to scan public version control systems (currently
![vcsmap screenshot](https://cloud.githubusercontent.com/assets/1312973/17968763/ddda7682-6ace-11e6-80af-557a6997276c.png)
## Installation
-Download the source code and run the following command. You need a recent version of Ruby with [bundler](http://bundler.io) and you might need build tools like `gcc` to build the dependencies.
-``` ruby
-$ bundle
+Install the package wity RubyGems.
+```
+$ gem install vcsmap
```
## Usage
vcsmap already includes a couple of plugins. Each plugin looks for files that match a certain search query, and extracts the right data from those files. To view all plugins run:
```
-$ ruby vcsmap.rb list
+$ vcsmap list
```
To use a plugin, look up the name of the plugin (`[plugin_name]`) and run the following command. Data is saved in CSV format to the `output` directory.
-**Due to a recent change you need to add a valid Github `user_session` cookie to `.github-cookie`.**
+**To authenticate with Github you need to set a `GITHUB_COOKIE` environment variable with a valid Github `user_session` cookie value.**
```
-$ ruby vcsmap.rb run {plugin_name} {pages} {--no-ascii}
+$ vcsmap run {plugin_name} {pages} {--no-ascii}
```
- You need to specify the amount of pages you want to search. Each (GitHub) page has 10 possible results.
- Use the `--no-ascii` flag (last) to disable rendering the results as an ASCII table in the command line.
View
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+$LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
+
+require 'vcsmap'
+
+cli = Vcsmap::CLI.new(ARGV)
+cli.run
View
@@ -0,0 +1,30 @@
+require 'http'
+require 'yaml'
+require 'nokogiri'
+
+# TODO: include only if needed
+require_relative 'vcsmap/cli'
+require_relative 'vcsmap/csv_writer'
+require_relative 'vcsmap/progress_bar'
+
+require_relative 'vcsmap/helpers'
+require_relative 'vcsmap/plugin'
+require_relative 'vcsmap/plugin_list'
+require_relative 'vcsmap/provider'
+
+# TODO: work on require_all
+require_relative 'vcsmap/plugins/base_plugin'
+require_relative 'vcsmap/plugins/aws_access_token'
+require_relative 'vcsmap/plugins/facebook_client_secrets'
+require_relative 'vcsmap/plugins/filezilla_xml'
+require_relative 'vcsmap/plugins/github_sublimesettings'
+require_relative 'vcsmap/plugins/google_oauth'
+require_relative 'vcsmap/plugins/instagram_tokens'
+require_relative 'vcsmap/plugins/solr_dataconfig'
+require_relative 'vcsmap/plugins/wordpress_config'
+
+require_relative 'vcsmap/providers/github'
+
+module Vcsmap
+ VERSION = '2.0.0'.freeze
+end
@@ -1,3 +1,5 @@
+require 'tty'
+
module Vcsmap
class CLI
def initialize(arguments)
@@ -23,7 +25,7 @@ def run
private
def usage
- "See #{Helpers::project_directory}/README.md or http://vcsmap.org for instructions."
+ "See http://vcsmap.org or open #{Helpers.project_directory}/README.md for instructions."
end
def list_plugins
@@ -34,8 +36,7 @@ def list_plugins
def run_plugin(no_ascii)
begin
- plugin = PluginList.find(@plugin)
- plugin = Object.const_get(plugin[:class_name]).new
+ plugin = PluginList.get_object(@plugin)
rescue KeyError
abort "Cannot find plugin with name '#{@plugin}'."
rescue NameError
@@ -66,8 +67,10 @@ def run_plugin(no_ascii)
data << credentials unless credentials[1].nil? || credentials[1].empty?
end
- abort "Some files were loaded (#{results.count}), but none of them contained matching credentials. " \
- 'You could try a higher page number.' if data.empty?
+ if data.empty?
+ abort "Some files were loaded (#{results.count}), but none of them contained matching credentials. " \
+ 'You could try a higher page number.'
+ end
bar.clear
@@ -1,3 +1,5 @@
+require 'csv'
+
module Vcsmap
class CsvWriter
def initialize(plugin_name, plugin_header, data)
@@ -7,7 +9,7 @@ def initialize(plugin_name, plugin_header, data)
end
def write!
- puts "Writing CSV to #{Helpers::project_directory}/#{@file_path} ..."
+ puts "Writing CSV to #{Helpers.project_directory}/#{@file_path} ..."
CSV.open(@file_path, 'wb', force_quotes: true) do |csv|
csv << @header
@data.each do |line|
@@ -1,7 +1,7 @@
module Vcsmap
module Helpers
def self.project_directory
- "#{File.dirname(File.dirname(__FILE__))}"
+ File.dirname(File.dirname(__FILE__)).to_s
end
end
end
File renamed without changes.
@@ -51,6 +51,11 @@ def self.find(name)
PLUGINS.fetch(name.to_sym)
end
+ def self.get_object(name)
+ plugin = find(name)
+ Object.const_get(plugin[:class_name]).new
+ end
+
def self.render_list
all.each do |plugin|
puts Pastel.new.green "[#{plugin[0]}] #{plugin[1][:title]}"
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,5 @@
+require 'tty'
+
module Vcsmap
class ProgressBar
def initialize(count)
File renamed without changes.
@@ -17,9 +17,9 @@ def search(plugin, total_pages)
private
def get_cookie
- cookie = File.read('.github-cookie').strip
+ cookie = ENV['GITHUB_COOKIE']
http = HTTP.cookies(user_session: cookie).get('https://github.com/login')
- abort "[Error] No valid session cookie in #{Helpers::project_directory}/.github-cookie." unless http.status == 302
+ abort "[Error] No valid session cookie in ENV['GITHUB_COOKIE']." unless http.status == 302
cookie
end
View
@@ -0,0 +1,18 @@
+require_relative 'lib/vcsmap'
+
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+
+Gem::Specification.new do |s|
+ s.name = 'vcsmap'
+ s.version = Vcsmap::VERSION
+ s.licenses = ['MIT']
+ s.summary = 'Scans public repositories for sensitive information.'
+ s.description = 'A plugin-based tool to scan public version control systems for sensitive information.'
+ s.authors = ['Melvin Lammerts']
+ s.email = 'hi@melvin.sh'
+ s.files = Dir['lib/**/*.rb']
+ s.require_paths = ['lib']
+ s.executables = 'vcsmap'
+ s.homepage = 'http://vcsmap.org'
+end
View
@@ -1,24 +0,0 @@
-require 'tty'
-require 'csv'
-require 'http'
-require 'yaml'
-require 'nokogiri'
-require 'require_all'
-
-require_relative 'lib/cli'
-require_relative 'lib/csv_writer'
-require_relative 'lib/helpers'
-require_relative 'lib/plugin'
-require_relative 'lib/plugin_list'
-require_relative 'lib/provider'
-require_relative 'lib/progress_bar'
-
-require_all 'lib/plugins'
-require_all 'lib/providers'
-
-module Vcsmap
- VERSION = '1.0.3'.freeze
-
- cli = Vcsmap::CLI.new(ARGV)
- cli.run
-end

0 comments on commit 2f4af24

Please sign in to comment.