itdis 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '02957cae7870578bcf2c51b6e9df6dcd6c05b885ea02dbdcaaf74f82e3b8fce9'
4
+ data.tar.gz: 6225c2a3c3a98aac3200aec771742e2cdcc3c95363d53c403827f79a36b19a62
5
+ SHA512:
6
+ metadata.gz: 68d48e54ca89e2a68e144d1f277b8dd939d0125e35d3c7744690b4283bf386e0446b1abafe989bca72c189adb319aa6b9a5006db1f4a99974923b661410229d0
7
+ data.tar.gz: b17505b1337ddebbcf83cbace09c7461acc7b6bfa6173e51d985ae2cd27a26bc5b7df54a7f350b7d1227243eb062f5d421276f74d5afae1fbdd01d8109a08946
@@ -0,0 +1,6 @@
1
+ .yardoc
2
+ *.gem
3
+ /pkg
4
+ /doc
5
+ /vendor
6
+ .bundle/
@@ -0,0 +1,51 @@
1
+ # Official language image. Look for the different tagged releases at:
2
+ # https://hub.docker.com/r/library/ruby/tags/
3
+
4
+ # Caching: https://docs.gitlab.com/ee/ci/caching/#caching-ruby-dependencies
5
+ cache:
6
+ key: ${CI_COMMIT_REF_SLUG}
7
+ paths:
8
+ - vendor/ruby # cache gems in between builds
9
+
10
+ before_script:
11
+ - ruby -v # Print out ruby version for debugging
12
+ - gem install bundler --no-document # Bundler is not installed with the image
13
+ # install nproc (coreutils) for bundle -j
14
+ # install git for building the gemspec
15
+ # install make, gcc for building gem native extension (commonmarker)
16
+ # libc-dev for musl-dev dependency (stdlib.h) needed by gcc
17
+ - apk --no-cache add coreutils git make gcc libc-dev
18
+ - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
19
+ #- bundle exec rake install # install the gem
20
+
21
+ # Anchors: https://docs.gitlab.com/ee/ci/yaml/README.html#anchors
22
+ .test_template: &job_definition
23
+ stage: test
24
+ script:
25
+ - bundle exec rubocop
26
+ #- bundle exec rake test
27
+
28
+ #test:2.4:
29
+ # <<: *job_definition
30
+ # image: ruby:2.4-alpine
31
+
32
+ #test:2.5:
33
+ # <<: *job_definition
34
+ # image: ruby:2.5-alpine
35
+
36
+ test:2.6:
37
+ <<: *job_definition
38
+ image: ruby:2.6-alpine
39
+
40
+ pages:
41
+ stage: deploy
42
+ image: ruby:2.6-alpine
43
+ script:
44
+ - bundle exec yard doc
45
+ - mkdir public
46
+ - mv doc/* public/
47
+ artifacts:
48
+ paths:
49
+ - public
50
+ only:
51
+ - master
@@ -0,0 +1,49 @@
1
+ # Issue
2
+
3
+ See [bug](issue_templates/Bug.md) or [Feature proposal](issue_templates/Feature_proposal.md) issue templates.
4
+
5
+ I borrow the [issue guidelines of the YARD project](https://github.com/lsegal/yard/blob/master/CONTRIBUTING.md).
6
+
7
+ ## Filing a Bug Report
8
+
9
+ If you believe you have found a bug, please include a few things in your report:
10
+
11
+ 1. **A minimal reproduction of the issue.** Providing a huge blob of code is better than nothing, but providing the shortest possible set of instructions is even better. Take out any instructions or code that, when removed, have no effect on the problematic behavior. The easier your bug is to triage and diagnose, the higher up in the priority list it will go. We can do this stuff, but limited time means this may not happen immediately. Make your bug report extremely accessible and you will almost guarantee a quick fix.
12
+ 2. **Your environment and relevant versions.** Please include your Ruby, itdis, and system versions (including OS) when reporting a bug. This makes it easier to diagnose problems. If the issue or stack trace includes another library, consider also listing any dependencies that may be affecting the issue. This is where a minimal reproduction case helps a lot.
13
+ 3. **Your expected result.** Tell us what you think should happen. This helps us to understand the context of your problem. Many complex features can contain ambiguous usage, and your use case may differ from the intended one. If we know your expectations, we can more easily determine if the behavior is intentional or not.
14
+
15
+ Finally, please **DO NOT** submit a report that states a feature simply "does not work" without any additional information in the report. Consider the issue from the maintainer's perspective: in order to fix your bug, we need to drill down to the broken line of code, and in order to do this, we must be able to reproduce the issue on our end to find that line of code. The easier we can do this, the quicker your bug gets fixed. Help us help you by providing as much information as you possibly can. We may not have the tools or environment to properly diagnose your issue, so your help may be required to debug the issue.
16
+
17
+ Also **consider opening a merge request** to fix the issue yourself if you can. This will likely speed up the fix time significantly.
18
+
19
+ ## Asking a Question
20
+
21
+ Question or discussion about an idea are accepted.
22
+
23
+ ## Asking for a Feature
24
+
25
+ Feature proposal are accepted.
26
+
27
+ Also **consider opening a merge request** to fix the issue yourself if you can. This will likely speed up the fix time significantly.
28
+
29
+ # Merge Request
30
+
31
+ See the [merge request](merge_request_templates/MR.md) template.
32
+
33
+ I borrow the [merge request guidelines of the YARD project](https://github.com/lsegal/yard/blob/master/CONTRIBUTING.md).
34
+
35
+ ## Making a Change via Merge Request
36
+
37
+ If you've been working on a patch or feature that you want in itdis, here are some tips to ensure the quickest turnaround time on getting it merged in:
38
+
39
+ 1. **Keep your changes small.** If your feature is large, consider splitting it up into smaller portions and submit pull requests for each component individually. Feel free to describe this in your first MR or on the mailing list, but note that it will be much easier to review changes if they affect smaller portions of code at a time.
40
+ 2. **Keep commits brief and clean**: itdis uses Git and tries to maintain a clean repository. Please ensure that you use commit conventions to make things nice and neat both in the description and commit history. Specifically, consider squashing commits if you have partial or complete reverts of code. Each commit should provide an atomic change that moves the project forwards, not back. Any changes that only fix other parts of your MR should be hidden from the commit history.
41
+ 3. **Follow our coding conventions.** itdis uses typical Ruby source formatting, though it occasionally has minor differences with other projects you may have seen. Please look through a few files (at least the file you are editing) to ensure that you are consistent in the formatting your MR is using.
42
+ 4. **Make sure you have tests.** Not all changes require tests, but if your changes involve code, you should consider adding at least one new test case for your change (and ideally a couple of tests). This will add confidence when reviewing and will make accepting the change much easier.
43
+ 5. **Make sure ALL the tests pass.** itdis has a fairly large suite of tests. Please make sure you can run all of the tests (bundle exec rake) prior to submitting your MR. Please also remember that itdis supports a number of environments, and a number of older Ruby versions, so if you can test under these environments, that helps (but is not required). At the very least, be aware of this fact when submitting code.
44
+
45
+ If your change is large, consider opening an issue to ask a question or starting a discussion; we will be happy to have a conversation and let you know if the feature would be considered. They usually are, but it might be prudent to ask first!
46
+
47
+ ## Maintainers
48
+
49
+ **Interested in helping to maintain itdis?** Offering to be a project maintainer is an important contribution to open source software, and your work will be highly valued in the community. If you have been a contributor, consider being a member of the core team to help handle day-to-day operations, such as releases, bug fixes, and triage. You can do some of this as a non-maintainer too, but if you like this project, we can always use more hands on deck!
@@ -0,0 +1,55 @@
1
+ Provide a general summary of the issue in the Title above
2
+
3
+ Please read this!
4
+
5
+ Before opening a new issue, make sure to search for keywords in the issues
6
+ filtered by the "regression" or "bug" label, and verify the issue you're about to submit isn't a duplicate.
7
+
8
+ Please remove this notice if you're confident your issue isn't a duplicate.
9
+
10
+ ------
11
+
12
+ ### Summary
13
+
14
+ (Summarize the bug encountered concisely)
15
+
16
+ ### Steps to reproduce
17
+
18
+ (How one can reproduce the issue - this is very important)
19
+
20
+ ### What is the current *bug* behavior?
21
+
22
+ (What actually happens)
23
+
24
+ ### What is the expected *correct* behavior?
25
+
26
+ (What you should see instead)
27
+
28
+ ### Relevant logs and/or screenshots
29
+
30
+ (Paste any relevant logs - please use code blocks (```) to format console output,
31
+ logs, and code as it's very hard to read otherwise.)
32
+
33
+ ### Possible fixes
34
+
35
+ (If you can, link to the line of code that might be responsible for the problem,
36
+ suggest a fix/reason for the bug, or ideas how to implement the addition
37
+ or change )
38
+
39
+ ## Context
40
+
41
+ (How has this issue affected you? What are you trying to accomplish?)
42
+ (Providing context helps us come up with a solution that is most useful in the real world)
43
+
44
+ ## Your Environment
45
+
46
+ (Include as many relevant details about the environment you experienced the bug in)
47
+ * Version used:
48
+ + Version (stable release) `gem query itdis`
49
+ + Commit ID (development release) `git --no-pager log -1`
50
+ * Ruby version: `ruby -v`
51
+ * Operating System and version:
52
+ * Relevant software dependency/versions:
53
+ * Any 3rd party libs required to reproduce, omit if none
54
+
55
+ /label ~bug
@@ -0,0 +1,9 @@
1
+ ### Description
2
+
3
+ (Include problem, use cases, benefits, and/or goals)
4
+
5
+ ### Proposal
6
+
7
+ ### Links / references
8
+
9
+ /label ~"feature proposal"
@@ -0,0 +1,33 @@
1
+ ### What does this MR do?
2
+
3
+ ### Are there points in the code the reviewer needs to double check?
4
+
5
+ ### Why was this MR needed?
6
+
7
+ ### Screenshots (if relevant)
8
+
9
+ ## Types of changes
10
+
11
+ What types of changes does your code introduce? Put an `x` in all the boxes that apply:
12
+ - [ ] Bug fix (non-breaking change which fixes an issue)
13
+ - [ ] New feature (non-breaking change which adds functionality)
14
+ - [ ] Breaking change (fix or feature that would cause existing functionality to change)
15
+
16
+ ### Does this MR meet the acceptance criteria?
17
+
18
+ (Go over all the following points, and put an `x` in all the boxes that apply.)
19
+ (If you're unsure about any of these, don't hesitate to ask. We're here to help!)
20
+
21
+ * [ ] I have read the [**CONTRIBUTING**](../CONTRIBUTING.md) document.
22
+ * [ ] Changelog entry added, if necessary
23
+ * [ ] Documentation created/updated
24
+ * [ ] Tests added for this feature/bug
25
+ * [ ] All new and existing tests passed
26
+ * [ ] Conform by the style guides (0 issue with rubocop / codacy)
27
+ * [ ] [Squashed related commits together](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_squashing)
28
+
29
+ ### Related issues
30
+
31
+ (This project only accepts pull requests related to open issues)
32
+ (If suggesting a new feature or change, please discuss it in an issue first)
33
+ (If fixing a bug, there should be an issue describing it with steps to reproduce)
@@ -0,0 +1,49 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Layout/AlignHash:
5
+ EnforcedHashRocketStyle: table
6
+
7
+ # Rubocop is too stupid too see that the variable is used
8
+ Lint/UselessAssignment:
9
+ Enabled: false
10
+
11
+ Metrics/AbcSize:
12
+ Enabled: false
13
+
14
+ Metrics/BlockLength:
15
+ Max: 50
16
+
17
+ Metrics/BlockNesting:
18
+ Max: 4
19
+
20
+ Metrics/ClassLength:
21
+ Enabled: false
22
+
23
+ Metrics/CyclomaticComplexity:
24
+ Max: 20
25
+
26
+ Metrics/LineLength:
27
+ Enabled: false
28
+
29
+ Metrics/MethodLength:
30
+ Max: 100
31
+
32
+ Metrics/PerceivedComplexity:
33
+ Enabled: false
34
+
35
+ Naming/VariableName:
36
+ EnforcedStyle: snake_case
37
+
38
+ Security/JSONLoad:
39
+ Enabled: false
40
+
41
+ Style/FrozenStringLiteralComment:
42
+ EnforcedStyle: never
43
+
44
+ Style/PerlBackrefs:
45
+ AutoCorrect: false
46
+
47
+ # Allow explicit return
48
+ Style/RedundantReturn:
49
+ Enabled: false
@@ -0,0 +1 @@
1
+ 2.6.0
@@ -0,0 +1,10 @@
1
+ --protected
2
+ --private
3
+ --output-dir doc/
4
+ -
5
+ --main README.md
6
+ LICENSE.txt
7
+ pages/INSTALL.md
8
+ pages/EXAMPLES.md
9
+ pages/CHANGELOG.md
10
+ .gitlab/CONTRIBUTING.md
@@ -0,0 +1,4 @@
1
+ ```
2
+ itdis -s 205.251.242.103 -D /tmp/domains.txt
3
+ itdis -S /tmp/scope.txt -D /tmp/domains.txt
4
+ ```
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in .gemspec
4
+ gemspec
@@ -0,0 +1,60 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ itdis (0.0.1)
5
+ docopt (~> 0.6)
6
+ paint (~> 2.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.0)
12
+ commonmarker (0.18.2)
13
+ ruby-enum (~> 0.5)
14
+ concurrent-ruby (1.1.4)
15
+ docopt (0.6.1)
16
+ github-markup (3.0.3)
17
+ i18n (1.5.3)
18
+ concurrent-ruby (~> 1.0)
19
+ jaro_winkler (1.5.2)
20
+ minitest (5.11.3)
21
+ paint (2.1.0)
22
+ parallel (1.14.0)
23
+ parser (2.6.0.0)
24
+ ast (~> 2.4.0)
25
+ powerpack (0.1.2)
26
+ psych (3.1.0)
27
+ rainbow (3.0.0)
28
+ rake (12.3.2)
29
+ redcarpet (3.4.0)
30
+ rubocop (0.65.0)
31
+ jaro_winkler (~> 1.5.1)
32
+ parallel (~> 1.10)
33
+ parser (>= 2.5, != 2.5.1.1)
34
+ powerpack (~> 0.1)
35
+ psych (>= 3.1.0)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ ruby-progressbar (~> 1.7)
38
+ unicode-display_width (~> 1.4.0)
39
+ ruby-enum (0.7.2)
40
+ i18n
41
+ ruby-progressbar (1.10.0)
42
+ unicode-display_width (1.4.1)
43
+ yard (0.9.18)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ bundler (~> 2.0)
50
+ commonmarker (~> 0.18)
51
+ github-markup (~> 3.0)
52
+ itdis!
53
+ minitest (~> 5.11)
54
+ rake (~> 12.3)
55
+ redcarpet (~> 3.4)
56
+ rubocop (~> 0.65)
57
+ yard (~> 0.9)
58
+
59
+ BUNDLED WITH
60
+ 2.0.1
@@ -0,0 +1,7 @@
1
+ Copyright 2019 Alexandre ZANNI
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ [![pipeline status](https://gitlab.com/noraj/itdis/badges/master/pipeline.svg)](https://gitlab.com/noraj/itdis/commits/master)
2
+
3
+ [![Gem version](https://img.shields.io/gem/v/itdis.svg)][rubygems]
4
+ [![Gem stable](https://img.shields.io/gem/dv/itdis/stable.svg)][rubygems]
5
+ [![Gem latest](https://img.shields.io/gem/dtv/itdis.svg)][rubygems]
6
+ [![Gem total download](https://img.shields.io/gem/dt/itdis.svg)][rubygems]
7
+
8
+ # ITDIS (Is This Domain In Scope)
9
+
10
+ Is a small tool that allows you to check if a list of domains you have been provided is in the scope of your pentest or not.
11
+
12
+ Name | Link
13
+ --- | ---
14
+ Website | [link](https://noraj.gitlab.io/itdis/)
15
+ Documentation | [link](https://noraj.gitlab.io/itdis/)
16
+ Gem | [link](https://rubygems.org/gems/itdis)
17
+ Git repository | [link](https://gitlab.com/noraj/itdis)
18
+ Merge Requests | [link](https://gitlab.com/noraj/itdis/merge_requests)
19
+ Issues | [link](https://gitlab.com/noraj/itdis/issues)
20
+
21
+ ## Quick help
22
+
23
+ ```
24
+ $ itdis -h
25
+ ITDIS (Is This Domain In Scope)
26
+
27
+ Usage:
28
+ itdis [options] (-s <IPs> | -S <file>) (-d <domains> | -D <file>)
29
+ itdis -h | --help
30
+ itdis --version
31
+
32
+ Options:
33
+ -s <IPs>, --scope <IPs> Specify the scope: one or multiple IP addresses separated by a comma (,)
34
+ -S <file>, --scope-file <file> Specify the scope: a file path, the file must contain one IP address per line
35
+ -d <domains>, --domains <domains> Specify domains to check: one or multiple domains separated by a comma (,)
36
+ -D <file>, --domains-file <file> Specify domains to check: a file path, the file must contain one domain per line
37
+ --no-color Disable colorized output
38
+ --short Display in a short format: display only domains in scope
39
+ --debug Display arguments
40
+ -h --help Show this screen.
41
+ --version Show version.
42
+
43
+ Examples:
44
+ itdis -s 1.1.1.1 -D /tmp/domains.txt
45
+ itdis -s 205.251.242.103,176.32.98.166 -d amazon.com
46
+ itdis -S /tmp/scope.txt -D /tmp/domains.txt --no-color
47
+ ```
48
+
49
+ For more help see the documentation.
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'itdis'
4
+ require 'docopt'
5
+ require 'paint'
6
+
7
+ doc = <<~DOCOPT
8
+ ITDIS (Is This Domain In Scope)
9
+
10
+ Usage:
11
+ itdis [options] (-s <IPs> | -S <file>) (-d <domains> | -D <file>)
12
+ itdis -h | --help
13
+ itdis --version
14
+
15
+ Options:
16
+ -s <IPs>, --scope <IPs> Specify the scope: one or multiple IP addresses separated by a comma (,)
17
+ -S <file>, --scope-file <file> Specify the scope: a file path, the file must contain one IP address per line
18
+ -d <domains>, --domains <domains> Specify domains to check: one or multiple domains separated by a comma (,)
19
+ -D <file>, --domains-file <file> Specify domains to check: a file path, the file must contain one domain per line
20
+ --no-color Disable colorized output
21
+ --short Display in a short format: display only domains in scope
22
+ --debug Display arguments
23
+ -h --help Show this screen.
24
+ --version Show version.
25
+
26
+ Examples:
27
+ itdis -s 1.1.1.1 -D /tmp/domains.txt
28
+ itdis -s 205.251.242.103,176.32.98.166 -d amazon.com
29
+ itdis -S /tmp/scope.txt -D /tmp/domains.txt --no-color
30
+ DOCOPT
31
+
32
+ def clean_array(arr)
33
+ arr.map!(&:chomp) # remove end of line
34
+ arr.reject!(&:empty?) # remove empty values
35
+ arr
36
+ end
37
+
38
+ def file_to_array(file)
39
+ data = File.readlines(file)
40
+ scope = clean_array(data)
41
+ end
42
+
43
+ def colorize_hash(hash)
44
+ colorized_output = []
45
+ hash.each do |key, val|
46
+ color = nil
47
+ if val == true
48
+ color = :green
49
+ elsif val == false
50
+ color = :red
51
+ end
52
+ colorized_output.push(Paint[key, color])
53
+ end
54
+ colorized_output
55
+ end
56
+
57
+ begin
58
+ args = Docopt.docopt(doc, version: Itdis::VERSION)
59
+ # use case 1, using the tool
60
+ # don't need more checks for mutual exclusion, etc. because docopt does it
61
+ if args['--scope'] || args['--scope-file']
62
+ scope = domains = []
63
+ if args['--scope']
64
+ scope = args['--scope'].split(',')
65
+ elsif args['--scope-file']
66
+ scope = file_to_array(args['--scope-file'])
67
+ end
68
+ if args['--domains']
69
+ domains = args['--domains'].split(',')
70
+ elsif args['--domains-file']
71
+ domains = file_to_array(args['--domains-file'])
72
+ end
73
+ res = Itdis.new(scope, domains).check
74
+ require 'pp'
75
+ pp args if args['--debug']
76
+ # print result
77
+ res.each do |host, ips|
78
+ if args['--no-color']
79
+ if args['--short']
80
+ # pass the else
81
+ else
82
+ in_scope = ips.select { |_k, v| v == true }
83
+ in_scope = in_scope.keys.join(', ')
84
+ out_of_scope = ips.select { |_k, v| v == false }
85
+ out_of_scope = out_of_scope.keys.join(', ')
86
+ puts "#{host}:\n In scope: [#{in_scope}]\n Out of scope: [#{out_of_scope}]"
87
+ end
88
+ elsif args['--short']
89
+ # pass the else
90
+ else
91
+ puts "#{host}: [#{colorize_hash(ips).join(', ')}]"
92
+ end
93
+ puts host if args['--short'] && ips.value?(true)
94
+ end
95
+ end
96
+ # use case 2, help: already handled by docopt
97
+ # use case 3, version: already handled by docopt
98
+ rescue Docopt::Exit => e
99
+ puts e.message
100
+ end
@@ -0,0 +1,44 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'itdis/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'itdis'
7
+ s.version = ItdisVersion::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.date = '2019-02-27'
10
+ s.summary = 'Is This Domain In Scope'
11
+ s.description = 'Is a small tool that allows you to check if a list of domains you have been provided is in the scope of your pentest or not.'
12
+ s.authors = ['Alexandre ZANNI']
13
+ s.email = 'alexandre.zanni@europe.com'
14
+ s.homepage = 'https://noraj.gitlab.io/itdis/'
15
+ s.license = 'MIT'
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
+ # s.test_files = s.files.grep(%r{^(test)/})
20
+ s.require_paths = ['lib']
21
+
22
+ s.metadata = {
23
+ 'yard.run' => 'yard',
24
+ 'bug_tracker_uri' => 'https://gitlab.com/noraj/itdis/issues',
25
+ 'changelog_uri' => 'https://noraj.gitlab.io/itdis/file.CHANGELOG.html',
26
+ 'documentation_uri' => 'https://noraj.gitlab.io/itdis/',
27
+ 'homepage_uri' => 'https://noraj.gitlab.io/itdis/',
28
+ 'source_code_uri' => 'https://gitlab.com/noraj/itdis/tree/master'
29
+ }
30
+
31
+ s.required_ruby_version = '~> 2.6'
32
+
33
+ s.add_runtime_dependency('docopt', '~> 0.6') # for argument parsing
34
+ s.add_runtime_dependency('paint', '~> 2.1') # for colorized ouput
35
+
36
+ s.add_development_dependency('bundler', '~> 2.0')
37
+ s.add_development_dependency('commonmarker', '~> 0.18') # for GMF support in YARD
38
+ s.add_development_dependency('github-markup', '~> 3.0') # for GMF support in YARD
39
+ s.add_development_dependency('minitest', '~> 5.11')
40
+ s.add_development_dependency('rake', '~> 12.3')
41
+ s.add_development_dependency('redcarpet', '~> 3.4') # for GMF support in YARD
42
+ s.add_development_dependency('rubocop', '~> 0.65')
43
+ s.add_development_dependency('yard', '~> 0.9')
44
+ end
@@ -0,0 +1,78 @@
1
+ # @author Alexandre ZANNI <alexandre.zanni@engineer.com>
2
+
3
+ # Ruby internal (stdlib)
4
+ require 'resolv'
5
+ # Project internal
6
+ require 'itdis/version'
7
+
8
+ # The class used for resolving domains
9
+ class Itdis
10
+ # Load constants
11
+ include ItdisVersion
12
+
13
+ # @overload scope
14
+ # Get the scope
15
+ # @!macro return_scope
16
+ # @return [Array<String>] Array of IP addresses that are in the scope
17
+ # @!macro return_scope
18
+ # @example
19
+ # ['192.168.0.42']
20
+ # @overload scope(=scope)
21
+ # Set the scope
22
+ # @param scope [Array<String>] Array of IP addresses that are in the scope
23
+ # @!macro return_scope
24
+ attr_reader :scope
25
+
26
+ # @overload domains
27
+ # Get domains
28
+ # @!macro return_domains
29
+ # @return [Array<String>] Array of domains that must be checked
30
+ # @!macro return_domains
31
+ # @example
32
+ # ['example.org', 'example.com']
33
+ # @overload domains=(domains)
34
+ # Set domains
35
+ # @param domains [Array<String>] Array of domains that must be checked
36
+ # @!macro return_domains
37
+ attr_reader :domains
38
+
39
+ def scope=(scope)
40
+ raise TypeError, 'scope must be an array' unless scope.is_a?(Array)
41
+
42
+ @scope = scope
43
+ end
44
+
45
+ def domains=(domains)
46
+ raise TypeError, 'domains must be an array' unless domains.is_a?(Array)
47
+
48
+ @domains = domains
49
+ end
50
+
51
+ # A new instance of resolver
52
+ # @param scope [Array<String>] see {#scope}
53
+ # @param domains [Array<String>] see {#domains}
54
+ def initialize(scope, domains)
55
+ self.scope = scope
56
+ self.domains = domains
57
+ end
58
+
59
+ # Check if the domains of the instance are in the scope
60
+ # @return [Hash] the domain and associated IPs checked.
61
+ # true if in scope false else.
62
+ # @example
63
+ # irb(main):001:0> Itdis.new(['127.0.0.1', '205.251.242.103'],['amazon.com']).check
64
+ # => {"amazon.com"=>{"205.251.242.103"=>true, "176.32.103.205"=>false, "176.32.98.166"=>false}}
65
+ def check
66
+ checked = {}
67
+ @domains.each do |domain|
68
+ ips = {}
69
+ Resolv.each_address(domain.chomp) do |ip|
70
+ is_in_scope = false
71
+ is_in_scope = true if @scope.include?(ip)
72
+ ips.store(ip, is_in_scope)
73
+ end
74
+ checked.store(domain, ips)
75
+ end
76
+ return checked
77
+ end
78
+ end
@@ -0,0 +1,3 @@
1
+ module ItdisVersion
2
+ VERSION = '0.0.1'.freeze
3
+ end
@@ -0,0 +1,5 @@
1
+ # [0.0.1] - 1 March 2019
2
+
3
+ [0.0.1]: https://gitlab.com/noraj/itdis/tags/v0.0.1
4
+
5
+ - First release.
@@ -0,0 +1,84 @@
1
+ # Examples
2
+
3
+ For all examples don't forget to add `require 'itdis'`.
4
+
5
+ ## Help
6
+
7
+ ```
8
+ $ itdis -h
9
+ ITDIS (Is This Domain In Scope)
10
+
11
+ Usage:
12
+ itdis [options] (-s <IPs> | -S <file>) (-d <domains> | -D <file>)
13
+ itdis -h | --help
14
+ itdis --version
15
+
16
+ Options:
17
+ -s <IPs>, --scope <IPs> Specify the scope: one or multiple IP addresses separated by a comma (,)
18
+ -S <file>, --scope-file <file> Specify the scope: a file path, the file must contain one IP address per line
19
+ -d <domains>, --domains <domains> Specify domains to check: one or multiple domains separated by a comma (,)
20
+ -D <file>, --domains-file <file> Specify domains to check: a file path, the file must contain one domain per line
21
+ --no-color Disable colorized output
22
+ --short Display in a short format: display only domains in scope
23
+ --debug Display arguments
24
+ -h --help Show this screen.
25
+ --version Show version.
26
+
27
+ Examples:
28
+ itdis -s 1.1.1.1 -D /tmp/domains.txt
29
+ itdis -s 205.251.242.103,176.32.98.166 -d amazon.com
30
+ itdis -S /tmp/scope.txt -D /tmp/domains.txt --no-color
31
+ ```
32
+
33
+ ## Quick use
34
+
35
+ ```
36
+ $ itdis -s 205.251.242.103,176.32.98.166 -d amazon.com,google.com
37
+ amazon.com: [176.32.103.205, 205.251.242.103, 176.32.98.166]
38
+ google.com: [216.58.209.238]
39
+ ```
40
+
41
+ You can't see here, but in scope domains are in green and out of scope ones are in red.
42
+
43
+ ## Load from file
44
+
45
+ ```
46
+ $ itdis -S /tmp/scope.txt -D /tmp/domains.txt
47
+ amazon.com: [176.32.103.205, 205.251.242.103, 176.32.98.166]
48
+ google.com: [216.58.209.238]
49
+ ```
50
+
51
+ With `/tmp/scope.txt`:
52
+
53
+ ```
54
+ 205.251.242.103
55
+ 176.32.98.166
56
+ ```
57
+
58
+ And `/tmp/domains.txt`:
59
+
60
+ ```
61
+ amazon.com
62
+ google.com
63
+ ```
64
+
65
+ ## Short output
66
+
67
+ Only in scope domains are displayed:
68
+
69
+ ```
70
+ $ itdis -s 205.251.242.103,176.32.98.166 -d amazon.com,google.com --short
71
+ amazon.com
72
+ ```
73
+
74
+ ## No color
75
+
76
+ ```
77
+ $ itdis -s 205.251.242.103,176.32.98.166 -d amazon.com,google.com --no-color
78
+ amazon.com:
79
+ In scope: [176.32.98.166, 205.251.242.103]
80
+ Out of scope: [176.32.103.205]
81
+ google.com:
82
+ In scope: []
83
+ Out of scope: [216.58.209.238]
84
+ ```
@@ -0,0 +1,59 @@
1
+ # Installation
2
+
3
+ ## Production
4
+
5
+ ### Install from rubygems.org
6
+
7
+ ```
8
+ $ gem install itdis
9
+ ```
10
+
11
+ ## Development
12
+
13
+ It's better to use [rbenv](https://github.com/rbenv/rbenv) to have latests version of ruby and to avoid trashing your system ruby.
14
+
15
+ ### Install from rubygems.org
16
+
17
+ ```
18
+ $ gem install --development itdis
19
+ ```
20
+
21
+ ### Build from git
22
+
23
+ Just replace `x.x.x` with the gem version you see after `gem build`.
24
+
25
+ ```
26
+ $ git clone https://gitlab.com/noraj/itdis.git itdis
27
+ $ cd itdis
28
+ $ gem install bundler
29
+ $ bundler install
30
+ $ gem build itdis.gemspec
31
+ $ gem install itdis-x.x.x.gem
32
+ ```
33
+
34
+ Note: if an automatic install is needed you can get the version with `$ gem build itdis.gemspec | grep Version | cut -d' ' -f4`.
35
+
36
+ ### Run the API in irb without installing the gem
37
+
38
+ Useful when you want to try your changes without building the gem and re-installing it each time.
39
+
40
+ ```
41
+ $ git clone https://gitlab.com/noraj/itdis.git itdis
42
+ $ cd itdis
43
+ $ irb -Ilib -ritdis
44
+ ```
45
+
46
+ Same for the CLI tool:
47
+
48
+ ```
49
+ $ ruby -Ilib -ritdis bin/itdis
50
+ ```
51
+
52
+ # Publishing
53
+
54
+ ```
55
+ $ git tag vx.x.x
56
+ $ gem push itdis-x.x.x.gem
57
+ ```
58
+
59
+ https://guides.rubygems.org/publishing/
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itdis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alexandre ZANNI
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: docopt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: paint
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: commonmarker
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.18'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.18'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github-markup
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.11'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '5.11'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '12.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '12.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: redcarpet
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.4'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.4'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.65'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.65'
139
+ - !ruby/object:Gem::Dependency
140
+ name: yard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.9'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.9'
153
+ description: Is a small tool that allows you to check if a list of domains you have
154
+ been provided is in the scope of your pentest or not.
155
+ email: alexandre.zanni@europe.com
156
+ executables:
157
+ - itdis
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - ".gitignore"
162
+ - ".gitlab-ci.yml"
163
+ - ".gitlab/CONTRIBUTING.md"
164
+ - ".gitlab/issue_templates/Bug.md"
165
+ - ".gitlab/issue_templates/Feature_proposal.md"
166
+ - ".gitlab/merge_request_templates/MR.md"
167
+ - ".rubocop.yml"
168
+ - ".ruby-version"
169
+ - ".yardopts"
170
+ - EXAMPLES.md
171
+ - Gemfile
172
+ - Gemfile.lock
173
+ - LICENSE.txt
174
+ - README.md
175
+ - bin/itdis
176
+ - itdis.gemspec
177
+ - lib/itdis.rb
178
+ - lib/itdis/version.rb
179
+ - pages/CHANGELOG.md
180
+ - pages/EXAMPLES.md
181
+ - pages/INSTALL.md
182
+ homepage: https://noraj.gitlab.io/itdis/
183
+ licenses:
184
+ - MIT
185
+ metadata:
186
+ yard.run: yard
187
+ bug_tracker_uri: https://gitlab.com/noraj/itdis/issues
188
+ changelog_uri: https://noraj.gitlab.io/itdis/file.CHANGELOG.html
189
+ documentation_uri: https://noraj.gitlab.io/itdis/
190
+ homepage_uri: https://noraj.gitlab.io/itdis/
191
+ source_code_uri: https://gitlab.com/noraj/itdis/tree/master
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '2.6'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubygems_version: 3.0.1
208
+ signing_key:
209
+ specification_version: 4
210
+ summary: Is This Domain In Scope
211
+ test_files: []