personal_wordlist_cli 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ac43b8b0984062c51b933e642ddf5236299dc802
4
+ data.tar.gz: b75d6b9ea296fd56aea95b4c7b69565d89abcd76
5
+ SHA512:
6
+ metadata.gz: 18d281550323ad8928894bcde0c14eff1f9b99d5a5494b8683bbafaec370583e092173f8b494e4db55bbb0c154c76c02cd671fe59df74a8671c1d10da2233274
7
+ data.tar.gz: d41355af07756df84de9e4851f6e8190afbb0e00959a74007f2fcef79444e3c12271805b1c6b802c0fe67c2cf5510997c51109b9687d6a1a4dfef48d28308a3b
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.3
6
+ - 2.2.0
7
+ - ruby-head
8
+ - jruby-19mode
9
+ - rbx-2
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'personal_wordlist'
4
+ gem 'thor'
5
+
6
+ group :test do
7
+ gem 'rake'
8
+ gem 'rspec'
9
+ gem 'aruba', '~> 0.10.2'
10
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Turhan Coşkun
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
data/Patternfile ADDED
@@ -0,0 +1,14 @@
1
+ # This is a Patternfile for PersonalWordListCLI
2
+ # This is Ruby DSL so you can use Ruby syntax to create patterns.
3
+
4
+ #sequence(0..999) do |n|
5
+ # partial { first_name[0..2].downcase }
6
+ # partial { n.to_s }
7
+ # partial { last_name[0] }
8
+ #end
9
+
10
+ #sequence(0..999) do |n|
11
+ # partial { first_name[0..2].downcase }
12
+ # partial { n.to_s }
13
+ # partial { last_name[0] }
14
+ #end
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # personal_wordlist_cli
2
+
3
+ **personal_wordlist_cli** is a CLI application based on the [personal_wordlist](https://github.com/turhn/personal_wordlist) library. It creates dictionaries from patterns based on a social engineering personal data.
4
+
5
+ When you install the gem it will add a ```pwlcli``` command to your path.
6
+
7
+ ## Installation
8
+ Installation using Ruby Gems.
9
+
10
+ ```gem install personal_wordlist_cli```
11
+
12
+ Installation using source code.
13
+
14
+ ```bash
15
+ git clone https://github.com/turhn/personal_wordlist_cli.git && cd personal_wordlist_cli
16
+ bundle install
17
+ rake install:local
18
+ ```
19
+
20
+
21
+ ## Usage
22
+
23
+ Output to stdout.
24
+
25
+ ```pwlcli generate Patternfile --datafile sample_data.json```
26
+
27
+ ```pwlcli generate Patternfile -d sample_data.json > pwl_wordlist.txt```
28
+
29
+ Output to a specified filename.
30
+
31
+ ```pwlcli generate Patternfile -d sample_data.json -o pwl_wordlist.txt```
32
+
33
+ ### File Types
34
+ - Patternfile is a Ruby compatible DSL file. Check the [example](https://github.com/turhn/personal_wordlist#sequences) here.
35
+ - Datafile must be a valid json file. All json key names will be available as methods in the Patternfile.
36
+
37
+
38
+ ## Example
39
+
40
+ You can use generated wordlists to brute force your WordPress for a forgotten password. [WPScan](https://github.com/wpscanteam/wpscan) is a good start.
41
+
42
+ ```ruby wpscan.rb --url www.example.com --wordlist pwl_wordlist.txt --username admin```
43
+
44
+ You might create dictionaries to unlock zip files:
45
+
46
+ A simple [zip-crack](https://github.com/igniteflow/violent-python/blob/master/pwd-crackers/zip-crack.py)
47
+
48
+ Just change 'dictionay.txt' with the files created with the command above.
49
+
50
+
51
+ ## Legal Notice
52
+
53
+ This tool is created for security intentions not for brute-force attacks. Testing weak passwords or recovering forgotten passwords. I cannot be responsible of any misusage of the tool.
54
+
55
+ ## Licence
56
+
57
+ MIT
58
+
59
+ ## Contributions
60
+
61
+ Any contributions are welcome.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+ require 'cucumber/rake/task'
4
+
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ RSpec::Core::RakeTask.new :spec
8
+
9
+ Cucumber::Rake::Task.new(:features) do |t|
10
+ t.cucumber_opts = 'features --format pretty'
11
+ end
12
+
13
+ task default: ['spec', 'features']
data/bin/pwlcli ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'personal_wordlist_cli'
6
+
7
+ PersonalWordlistCLI::Runner.new(ARGV.dup).execute!
8
+
@@ -0,0 +1,28 @@
1
+ Feature: Generate wordlists
2
+
3
+ Scenario: Use stdout
4
+ When I run `pwlcli generate ../../fixtures/Patternfile -d ../../fixtures/sample_data.json`
5
+ Then the output should contain:
6
+ """
7
+ joh0D
8
+ joh1D
9
+ joh2D
10
+ joh3D
11
+ joh4D
12
+ joh5D
13
+ """
14
+
15
+ Scenario: Use output file
16
+ When I run `pwlcli generate ../../fixtures/Patternfile -d ../../fixtures/sample_data.json -o sample.txt`
17
+ Then the file "sample.txt" should exist
18
+ When I run `cat sample.txt`
19
+ Then the stdout should contain:
20
+ """
21
+ joh0D
22
+ joh1D
23
+ joh2D
24
+ joh3D
25
+ joh4D
26
+ joh5D
27
+ """
28
+
File without changes
@@ -0,0 +1,8 @@
1
+ require 'aruba/cucumber'
2
+ require 'personal_wordlist_cli'
3
+
4
+ Aruba.configure do |config|
5
+ config.command_launcher = :spawn
6
+ config.main_class = PersonalWordlistCLI::Runner
7
+ end
8
+
File without changes
@@ -0,0 +1,7 @@
1
+ Feature: Display proper version information
2
+ Scenario: Get version
3
+ When I run `pwlcli -v`
4
+ Then the output should contain:
5
+ """
6
+ 0.0.1
7
+ """
@@ -0,0 +1,9 @@
1
+ # This is a Patternfile for PersonalWordListCLI
2
+ # This is Ruby DSL so you can use Ruby syntax to create patterns.
3
+
4
+ sequence(0..5) do |n|
5
+ partial { first_name[0..2].downcase }
6
+ partial { n.to_s }
7
+ partial { last_name[0] }
8
+ end
9
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "first_name": "John",
3
+ "last_name": "Doe"
4
+ }
@@ -0,0 +1,27 @@
1
+ require 'personal_wordlist'
2
+ require 'json'
3
+ require 'thor'
4
+
5
+ module PersonalWordlistCLI
6
+ class Commands < Thor
7
+ map %w[--version -v] => :__print_version
8
+
9
+ desc 'genarate PATTERNFILE', 'Generates wordlist from a pattern file.'
10
+ option :datafile, aliases: '-d', required: true
11
+ option :output, aliases: '-o'
12
+ def generate(pattern_file_path)
13
+ dsl_file = PatternFile.new(pattern_file_path).evaluate!
14
+ data = DataFile.new(options[:datafile]).parse_json
15
+ result = PersonalWordlist.send(:generate, data, &dsl_file)
16
+ return puts result unless options[:output]
17
+ f = File.new(options[:output], 'w+')
18
+ f.puts result
19
+ f.close
20
+ end
21
+
22
+ desc '--version, -v', 'Prints the version information'
23
+ def __print_version
24
+ puts PersonalWordlistCLI::VERSION
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,11 @@
1
+ module PersonalWordlistCLI
2
+ class DataFile
3
+ def initialize(path)
4
+ @file_content = File.read(path)
5
+ end
6
+
7
+ def parse_json
8
+ JSON.parse @file_content, symbolize_names: true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module PersonalWordlistCLI
2
+ class PatternFile
3
+ def initialize(path)
4
+ @file_content = File.read(path)
5
+ end
6
+
7
+ def evaluate!
8
+ eval "proc { #{@file_content} }"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,30 @@
1
+ module PersonalWordlistCLI
2
+ class Runner
3
+ def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
4
+ @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
5
+ end
6
+
7
+ def execute!
8
+ exit_code = begin
9
+ $stderr = @stderr
10
+ $stdin = @stdin
11
+ $stdout = @stdout
12
+
13
+ PersonalWordlistCLI::Commands.start(ARGV)
14
+ 0
15
+ rescue StandardError => e
16
+ b = e.backtrace
17
+ @stderr.puts("#{b.shift}: #{e.message} (#{e.class})")
18
+ @stderr.puts(b.map{|s| "\tfrom #{s}"}.join("\n"))
19
+ 1
20
+ rescue SystemExit => e
21
+ e.status
22
+ ensure
23
+ $stderr = STDERR
24
+ $stdin = STDIN
25
+ $stdout = STDOUT
26
+ end
27
+ @kernel.exit(exit_code)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module PersonalWordlistCLI
2
+ VERSION="0.0.1".freeze
3
+ end
@@ -0,0 +1,5 @@
1
+ require_relative 'personal_wordlist_cli/version'
2
+ require_relative 'personal_wordlist_cli/pattern_file'
3
+ require_relative 'personal_wordlist_cli/data_file'
4
+ require_relative 'personal_wordlist_cli/commands'
5
+ require_relative 'personal_wordlist_cli/runner'
@@ -0,0 +1,22 @@
1
+ $LOAD_PATH << File.expand_path('../lib', __FILE__)
2
+ require 'personal_wordlist_cli/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'personal_wordlist_cli'
6
+ s.version = PersonalWordlistCLI::VERSION
7
+ s.summary = 'Generates possible words from the given rules.'
8
+ s.description = s.summary
9
+ s.homepage = 'https://github.com/turhn/personal_wordlist_cli'
10
+
11
+ s.author = 'Turhan Coskun'
12
+ s.email = 'turhancoskun@gmail.com'
13
+
14
+ s.files = `git ls-files`.split("\n").reject { |path| path =~ /\.gitignore$/ }
15
+ s.test_files = `git ls-files -- Appraisals {spec,features,gemfiles}/*`.split("\n")
16
+
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename f }
18
+ s.require_paths = ['lib']
19
+ s.required_ruby_version = Gem::Requirement.new('>= 2.0.0')
20
+ s.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.7'
21
+ s.license = 'MIT'
22
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe DataFile do
4
+ before :each do
5
+ allow(File).to receive(:read).and_return('{"foo": "bar"}')
6
+ end
7
+
8
+ subject { DataFile.new("/dev/null") }
9
+
10
+ it 'should return a symbolized hash' do
11
+ expect(subject.parse_json).to eq :foo => "bar"
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe PersonalWordlistCLI::PatternFile do
4
+ before :each do
5
+ allow(File).to receive(:read).and_return("'hello'")
6
+ end
7
+
8
+ subject { PatternFile.new('/dev/null') }
9
+
10
+ it 'should evaluate the file content' do
11
+ expect(subject.evaluate!.call).to eq 'hello'
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ require 'rspec'
2
+ require 'personal_wordlist_cli'
3
+
4
+ include PersonalWordlistCLI
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: personal_wordlist_cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Turhan Coskun
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.1.7
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.1.7
33
+ description: Generates possible words from the given rules.
34
+ email: turhancoskun@gmail.com
35
+ executables:
36
+ - pwlcli
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".rspec"
41
+ - ".travis.yml"
42
+ - Gemfile
43
+ - LICENSE
44
+ - Patternfile
45
+ - README.md
46
+ - Rakefile
47
+ - bin/pwlcli
48
+ - features/generate.feature
49
+ - features/step_definitions/cli_steps.rb
50
+ - features/support/aruba.rb
51
+ - features/support/env.rb
52
+ - features/version.feature
53
+ - fixtures/Patternfile
54
+ - fixtures/sample_data.json
55
+ - lib/personal_wordlist_cli.rb
56
+ - lib/personal_wordlist_cli/commands.rb
57
+ - lib/personal_wordlist_cli/data_file.rb
58
+ - lib/personal_wordlist_cli/pattern_file.rb
59
+ - lib/personal_wordlist_cli/runner.rb
60
+ - lib/personal_wordlist_cli/version.rb
61
+ - personal_wordlist_cli.gemspec
62
+ - spec/data_file_spec.rb
63
+ - spec/pattern_file_spec.rb
64
+ - spec/spec_helper.rb
65
+ homepage: https://github.com/turhn/personal_wordlist_cli
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 2.0.0
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.4.5.1
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Generates possible words from the given rules.
89
+ test_files:
90
+ - features/generate.feature
91
+ - features/step_definitions/cli_steps.rb
92
+ - features/support/aruba.rb
93
+ - features/support/env.rb
94
+ - features/version.feature
95
+ - spec/data_file_spec.rb
96
+ - spec/pattern_file_spec.rb
97
+ - spec/spec_helper.rb