pentest 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 195a88c8e21c3486bb9a1873e5009952b6b5948876f1329e18b0dabc4cfa247c
4
- data.tar.gz: b8386287f2655eba62b96bb715676cb19572995904980ba3d2445713baff7ed8
3
+ metadata.gz: 3547b3f94cd85caca4403a70837c6c34274a0a3d32dd558126e487e57d094b92
4
+ data.tar.gz: be2427f73734cb304511956f153ac8b9d0bea0ab7f329816071346d20298fee3
5
5
  SHA512:
6
- metadata.gz: 2e7da539e2433c292b9be7f6cf937a63cfc3556f0ed8a4f801457ad26de60aacac276a599245985bb96bb2b686121e6d5b5fd43bbe3f36fdfd5959e1e86b7ba7
7
- data.tar.gz: f7771f7d8ea746e4ae8bfbce8083d9612cb24dc9378c5c2f4aa9c66e892256cfbb0d19295bdd98de2df16483db252d10fae61e22ffdebedc41eceb551e08e493
6
+ metadata.gz: a00c70df512440d9bf89992dd9f341a95c4ff8850614586836426caa687df54d5908ec8df04e2f9c842d4ce2481cde21a888def1f12b1761d43d7ca6b808b257
7
+ data.tar.gz: 560a984fc2ec3131b29846eef3218ff40f6fd06a06123431556d939de36c362e724661c3cb80ab1063580ac6496bbb27646bfd450a874c2a20d3e9b2d7240a28
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pentest (0.1.2)
4
+ pentest (1.0.0)
5
5
  arproxy
6
6
  callsite
7
7
  gda
data/README.md CHANGED
@@ -1,26 +1,38 @@
1
1
  # Pentest
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pentest`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Full-automated dynamic vulnerability scanning tool for Ruby on Rails project!
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ![](https://i.imgur.com/WpxmMUY.gif)
6
6
 
7
- ## Prerequisite
7
+ ## About
8
+
9
+ The word "Pentest" is taken from penetration testing, which simulates cyberattacks
10
+
11
+ This gem loads controller methods of Rails project and cracks against it.
12
+
13
+ ## Installation Prerequisite
8
14
 
9
15
  * libgda
10
16
 
11
- ### Windows
17
+ ### Windows Instruction
12
18
 
13
- ### Mac
19
+ \# TODO
14
20
 
15
- Please be reminded that you should link keg-only dependent libxml2.
21
+ ### Mac Instruction
22
+
23
+ Please be reminded that you have to link keg-only dependent libxml2.
16
24
 
17
25
  ```
18
- brew install libgda
19
- brew link libxml2 --force
20
- bundle install
26
+ $ brew install libgda
27
+ $ brew link libxml2 --force
28
+ $ bundle install
21
29
  ```
22
30
 
23
- ### Ubuntu
31
+ ### Ubuntu Instruction
32
+
33
+ ```
34
+ $ apt install libgda-5.0
35
+ ```
24
36
 
25
37
  ## Installation
26
38
 
@@ -41,7 +53,12 @@ Or install it yourself as:
41
53
  ## Usage
42
54
 
43
55
  ```
44
- $ RAILS_ENV=test bundle exec pentest
56
+ $ bundle exec pentest
57
+ ```
58
+
59
+ ### Pentestfile
60
+
61
+ ```
45
62
  ```
46
63
 
47
64
  ## Development
@@ -52,7 +69,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
52
69
 
53
70
  ## Contributing
54
71
 
55
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pentest.
72
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hakatashi/pentest.
56
73
 
57
74
  ## License
58
75
 
@@ -27,16 +27,26 @@ module Pentest
27
27
  Logger.debug "Loading Rails project..."
28
28
  @app_path = File.expand_path(options[:app_path])
29
29
 
30
- # TODO: Check if app_path directory exists
31
- # TODO: Check if app_path directory is valid rails project
32
- # TODO: Detect rails version
33
- require File.expand_path('config/environment', @app_path)
30
+ unless File.directory?(@app_path)
31
+ Logger.error "#{options[:app_path]} is not valid directory."
32
+ return :error
33
+ end
34
+
35
+ environment_path = File.expand_path('config/environment.rb', @app_path)
36
+
37
+ unless File.file?(environment_path)
38
+ Logger.error "Your project does not contain config/environment.rb file, which must be exist on every valid Rails project. Check your configuration."
39
+ return :error
40
+ end
41
+
42
+ require environment_path
34
43
 
35
44
  unless is_project_loaded?
36
- # TODO: handle
45
+ Logger.error "Rails project not loaded. Check if your config/environment.rb file is valid."
46
+ return :error
37
47
  end
38
48
 
39
- Logger.debug "Loaded Rails project #{get_project_name.inspect}"
49
+ Logger.debug "Loaded Rails project #{get_project_name.inspect} (Rails #{Rails::VERSION::STRING})"
40
50
 
41
51
  # TODO: Check if Pentestfile exists
42
52
  pentestfile_path = options[:pentestfile] || 'Pentestfile'
@@ -73,7 +73,7 @@ class Pentest::SqliChecker < Pentest::BaseChecker
73
73
  return [nil, errors] if penetrated_payload.nil?
74
74
 
75
75
  # attack
76
- attack_payloads = generate_attack_payloads(params, penetrated_payload.values, injection_point)
76
+ attack_payloads = generate_attack_payloads(@params, penetrated_payload.values, injection_point)
77
77
 
78
78
  Pentest::SqlProxy.enable!(self.method(:handle_query))
79
79
 
@@ -9,7 +9,7 @@ class Pentest::XssChecker < Pentest::BaseChecker
9
9
  @description = "Checks for Cross-Site Scripting"
10
10
 
11
11
  XSS_PAYLOADS = File.read(File.expand_path('../fuzzers/xss.txt', File.dirname(__FILE__)), encoding: 'utf-8').lines.map(&:strip).select {|l| l.size > 5 && l =~ /\W/}
12
- CRACKER_PAYLOAD = %q(>>"<>=""'&<<"'&)
12
+ CRACKER_PAYLOAD = %q(<xzyxz>)
13
13
 
14
14
  def initialize(endpoint, params)
15
15
  super(endpoint, params)
@@ -29,7 +29,7 @@ class Pentest::XssChecker < Pentest::BaseChecker
29
29
 
30
30
  errors << normalize_error(err, payload)
31
31
  document = Nokogiri::HTML(response.body)
32
- document_errors = document.errors.reject {|e| is_allowable_error(e)}
32
+ document_errors = document.errors.select {|e| is_critical_error(e)}
33
33
 
34
34
  if document_errors.any?
35
35
  payload.penetration_type = 'Cross-Site Scripting Vulnerability'
@@ -67,8 +67,8 @@ class Pentest::XssChecker < Pentest::BaseChecker
67
67
 
68
68
  private
69
69
 
70
- def is_allowable_error(error)
71
- error.to_s =~ /Tag \w+ invalid/ || error.to_s =~ /already defined/ || error.to_s =~ /Unexpected end tag/
70
+ def is_critical_error(error)
71
+ error.to_s =~ /xzyxz/
72
72
  end
73
73
 
74
74
  def report_errors(body, errors)
@@ -1,3 +1,3 @@
1
1
  module Pentest
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Koki Takahashi"]
10
10
  spec.email = ["hakatasiloving@gmail.com"]
11
11
 
12
- spec.summary = %q{Penetration testing automation tool for Ruby on Rails application}
12
+ spec.summary = %q{Full-automated dynamic vulnerability scanning tool for Ruby on Rails project!}
13
13
  spec.description = %q{}
14
14
  spec.homepage = "https://github.com/hakatashi/pentest"
15
15
  spec.license = "MIT"
@@ -17,8 +17,6 @@ Gem::Specification.new do |spec|
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
19
  if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
-
22
20
  spec.metadata["homepage_uri"] = spec.homepage
23
21
  spec.metadata["source_code_uri"] = "https://github.com/hakatashi/pentest"
24
22
  spec.metadata["changelog_uri"] = "https://github.com/hakatashi/pentest"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pentest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koki Takahashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_parser
@@ -192,7 +192,6 @@ homepage: https://github.com/hakatashi/pentest
192
192
  licenses:
193
193
  - MIT
194
194
  metadata:
195
- allowed_push_host: https://rubygems.org
196
195
  homepage_uri: https://github.com/hakatashi/pentest
197
196
  source_code_uri: https://github.com/hakatashi/pentest
198
197
  changelog_uri: https://github.com/hakatashi/pentest
@@ -214,5 +213,5 @@ requirements: []
214
213
  rubygems_version: 3.0.3
215
214
  signing_key:
216
215
  specification_version: 4
217
- summary: Penetration testing automation tool for Ruby on Rails application
216
+ summary: Full-automated dynamic vulnerability scanning tool for Ruby on Rails project!
218
217
  test_files: []