ronin-listener 0.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -0
  3. data/.github/workflows/ruby.yml +47 -0
  4. data/.gitignore +14 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +11 -0
  7. data/.ruby-version +1 -0
  8. data/.yardopts +1 -0
  9. data/COPYING.txt +165 -0
  10. data/ChangeLog.md +8 -0
  11. data/Gemfile +40 -0
  12. data/README.md +132 -0
  13. data/Rakefile +43 -0
  14. data/bin/ronin-listener +34 -0
  15. data/data/completions/ronin-listener +103 -0
  16. data/data/new/dns.rb.erb +7 -0
  17. data/data/new/http.rb.erb +14 -0
  18. data/gemspec.yml +39 -0
  19. data/lib/ronin/listener/cli/command.rb +40 -0
  20. data/lib/ronin/listener/cli/commands/completion.rb +61 -0
  21. data/lib/ronin/listener/cli/commands/dns.rb +137 -0
  22. data/lib/ronin/listener/cli/commands/http.rb +159 -0
  23. data/lib/ronin/listener/cli/commands/new/dns.rb +123 -0
  24. data/lib/ronin/listener/cli/commands/new/http.rb +130 -0
  25. data/lib/ronin/listener/cli/commands/new.rb +71 -0
  26. data/lib/ronin/listener/cli.rb +50 -0
  27. data/lib/ronin/listener/output_formats.rb +39 -0
  28. data/lib/ronin/listener/root.rb +28 -0
  29. data/lib/ronin/listener/version.rb +26 -0
  30. data/man/ronin-listener-completion.1 +76 -0
  31. data/man/ronin-listener-completion.1.md +78 -0
  32. data/man/ronin-listener-dns.1 +59 -0
  33. data/man/ronin-listener-dns.1.md +55 -0
  34. data/man/ronin-listener-http.1 +69 -0
  35. data/man/ronin-listener-http.1.md +60 -0
  36. data/man/ronin-listener-new-dns.1 +35 -0
  37. data/man/ronin-listener-new-dns.1.md +36 -0
  38. data/man/ronin-listener-new-http.1 +38 -0
  39. data/man/ronin-listener-new-http.1.md +39 -0
  40. data/man/ronin-listener-new.1 +56 -0
  41. data/man/ronin-listener-new.1.md +52 -0
  42. data/man/ronin-listener.1 +38 -0
  43. data/man/ronin-listener.1.md +40 -0
  44. data/ronin-listener.gemspec +62 -0
  45. data/scripts/setup +58 -0
  46. metadata +153 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7caf08ff5f57fb24edcf6a23f1297bbc1844ccfc7b1ab0ffe93bbb0c9fa51de8
4
+ data.tar.gz: 7cd8e3db9038d20c459a2eeedb4457dc887219c2ba5e0cd788c7130fc4605108
5
+ SHA512:
6
+ metadata.gz: 32ea4d3be1b2114fe84e777d69ab5066717aad2d7f7819c9ab503f9373640c6239535640b805f138737f09e7334bab1c2b66d00e9bb1a668c7beb90d5c6272e3
7
+ data.tar.gz: f93339653aa627a16b245d76af048aa6871020f1b2a54f5761ec7716ab4e10809882800ffc568d30b4ae929b0e035ed62d269e18299c413181f707098de0e7ff
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ -
3
+ ChangeLog.md
4
+ COPYING.txt
@@ -0,0 +1,47 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - '3.0'
13
+ - '3.1'
14
+ - '3.2'
15
+ - '3.3'
16
+ # - jruby
17
+ # - truffleruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ # - name: Install dependencies
27
+ # run: |
28
+ # sudo apt update -y && \
29
+ # sudo apt install -y --no-install-recommends --no-install-suggests FIXME
30
+ - name: Install dependencies
31
+ run: bundle install --jobs 4 --retry 3
32
+ - name: Run tests
33
+ run: bundle exec rake test
34
+
35
+ # rubocop linting
36
+ rubocop:
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - name: Set up Ruby
41
+ uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: 3.0
44
+ - name: Install dependencies
45
+ run: bundle install --jobs 4 --retry 3
46
+ - name: Run rubocop
47
+ run: bundle exec rubocop --parallel
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /coverage
2
+ /data/completions/ronin-listener
3
+ /doc
4
+ /pkg
5
+ /man/*.[1-9]
6
+ /vendor/bundle
7
+ /Gemfile.lock
8
+ /.bundle
9
+ /.yardoc
10
+ .DS_Store
11
+ *.db
12
+ *.log
13
+ *.swp
14
+ *~
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 3.1
5
+
6
+ inherit_gem:
7
+ rubocop-ronin: rubocop.yml
8
+
9
+ #
10
+ # ronin-FIXME specific exceptions
11
+ #
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.1
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title 'Ronin::Listener Documentation' --protected
data/COPYING.txt ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/ChangeLog.md ADDED
@@ -0,0 +1,8 @@
1
+ ### 0.1.0 / 2024-XX-XX
2
+
3
+ * Initial release:
4
+ * Supports starting a DNS server for receiving exfiltrated data via DNS
5
+ queries for a domain.
6
+ * Supports starting a HTTP server for receiving exfiltrated data via HTTP
7
+ requests.
8
+
data/Gemfile ADDED
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ platform :jruby do
8
+ gem 'jruby-openssl', '~> 0.7'
9
+ end
10
+
11
+ # Ronin dependencies
12
+ # gem 'ronin-core', '~> 0.2', github: 'ronin-rb/ronin-core',
13
+ # branch: 'main'
14
+ # gem 'ronin-listener-dns', '~> 0.1', github: 'ronin-rb/ronin-listener-dns',
15
+ # branch: 'main'
16
+ # gem 'ronin-listener-http', '~> 0.1', github: 'ronin-rb/ronin-listener-http',
17
+ # branch: 'main'
18
+
19
+ group :development do
20
+ gem 'rake'
21
+ gem 'rubygems-tasks', '~> 0.2'
22
+
23
+ gem 'rspec', '~> 3.0'
24
+ gem 'simplecov', '~> 0.20'
25
+
26
+ gem 'kramdown', '~> 2.0'
27
+ gem 'kramdown-man', '~> 1.0'
28
+
29
+ gem 'redcarpet', platform: :mri
30
+ gem 'yard', '~> 0.9'
31
+ gem 'yard-spellcheck', require: false
32
+
33
+ gem 'dead_end', require: false
34
+ gem 'sord', require: false, platform: :mri
35
+ gem 'stackprof', require: false, platform: :mri
36
+ gem 'rubocop', require: false, platform: :mri
37
+ gem 'rubocop-ronin', require: false, platform: :mri
38
+
39
+ gem 'command_kit-completion', '~> 0.2', require: false
40
+ end
data/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # ronin-listener
2
+
3
+ [![CI](https://github.com/ronin-rb/ronin-listener/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-listener/actions/workflows/ruby.yml)
4
+ [![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-listener.svg)](https://codeclimate.com/github/ronin-rb/ronin-listener)
5
+
6
+ * [Website](https://ronin-rb.dev/)
7
+ * [Source](https://github.com/ronin-rb/ronin-listener)
8
+ * [Issues](https://github.com/ronin-rb/ronin-listener/issues)
9
+ * [Documentation](https://ronin-rb.dev/docs/ronin-listener)
10
+ * [Discord](https://discord.gg/6WAb3PsVX9) |
11
+ [Mastodon](https://infosec.exchange/@ronin_rb)
12
+
13
+ ## Description
14
+
15
+ ronin-listener is a small CLI utility for receiving exfiltrated data over DNS or
16
+ HTTP.
17
+
18
+ ## Features
19
+
20
+ * Supports starting a DNS server for receiving exfiltrated data via DNS queries
21
+ for a domain.
22
+ * Supports starting a HTTP server for receiving exfiltrated data via HTTP
23
+ requests.
24
+
25
+ ## Synopsis
26
+
27
+ ```
28
+ $ ronin-listener
29
+ Usage: ronin-listener [options]
30
+
31
+ Options:
32
+ -V, --version Prints the version and exits
33
+ -h, --help Print help information
34
+
35
+ Arguments:
36
+ [COMMAND] The command name to run
37
+ [ARGS ...] Additional arguments for the command
38
+
39
+ Commands:
40
+ completion
41
+ dns
42
+ help
43
+ http
44
+ ```
45
+
46
+ Listen for DNS queries on `127.0.0.1` port `5553` for the domain `example.com`:
47
+
48
+ ```shell
49
+ ronin-listener dns -H 127.0.0.1 -p 5553 example.com
50
+ ```
51
+
52
+ Listen for HTTP requests on `127.0.0.1` port `8080`:
53
+
54
+ ```shell
55
+ ronin-listener http -H 127.0.0.1 -p 8080
56
+ ```
57
+
58
+ Listen specifically for HTTP requests sent to `example.com`:
59
+
60
+ ```shell
61
+ ronin-listener http -H 127.0.0.1 -p 8080 --vhost example.com
62
+ ```
63
+
64
+ Generate a new standalone DNS listener Ruby script:
65
+
66
+ ```shell
67
+ ronin-listener new dns file.rb
68
+ ```
69
+
70
+ Generate a new standalone HTTP listener Ruby script:
71
+
72
+ ```shell
73
+ ronin-listener new http file.rb
74
+ ```
75
+
76
+ ## Requirements
77
+
78
+ * [Ruby] >= 3.0.0
79
+ * [ronin-listener-dns] ~> 0.1
80
+ * [ronin-listener-http] ~> 0.1
81
+ * [ronin-core] ~> 0.2
82
+
83
+ ## Install
84
+
85
+ ```shell
86
+ $ gem install ronin-listener
87
+ ```
88
+
89
+ ### Gemfile
90
+
91
+ ```ruby
92
+ gem 'ronin-listener', '~> 0.1'
93
+ ```
94
+
95
+ ### gemspec
96
+
97
+ ```ruby
98
+ gem.add_dependency 'ronin-listener', '~> 0.1'
99
+ ```
100
+
101
+ ## Development
102
+
103
+ 1. [Fork It!](https://github.com/ronin-rb/ronin-listener/fork)
104
+ 2. Clone It!
105
+ 3. `cd ronin-listener/`
106
+ 4. `./scripts/setup`
107
+ 5. `git checkout -b my_feature`
108
+ 6. Code It!
109
+ 7. `bundle exec rake spec`
110
+ 8. `git push origin my_feature`
111
+
112
+ ## License
113
+
114
+ Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
115
+
116
+ ronin-listener is free software: you can redistribute it and/or modify
117
+ it under the terms of the GNU Lesser General Public License as published
118
+ by the Free Software Foundation, either version 3 of the License, or
119
+ (at your option) any later version.
120
+
121
+ ronin-listener is distributed in the hope that it will be useful,
122
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
123
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124
+ GNU Lesser General Public License for more details.
125
+
126
+ You should have received a copy of the GNU Lesser General Public License
127
+ along with ronin-listener. If not, see <https://www.gnu.org/licenses/>.
128
+
129
+ [Ruby]: https://www.ruby-lang.org
130
+ [ronin-listener-dns]: https://github.com/ronin-rb/ronin-listener-dns#readme
131
+ [ronin-listener-http]: https://github.com/ronin-rb/ronin-listener-http#readme
132
+ [ronin-core]: https://github.com/ronin-rb/ronin-core#readme
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'bundler'
5
+ rescue LoadError => e
6
+ warn e.message
7
+ warn "Run `gem install bundler` to install Bundler"
8
+ exit(-1)
9
+ end
10
+
11
+ begin
12
+ Bundler.setup(:development)
13
+ rescue Bundler::BundlerError => e
14
+ warn e.message
15
+ warn "Run `bundle install` to install missing gems"
16
+ exit e.status_code
17
+ end
18
+
19
+ require 'rake'
20
+
21
+ require 'rubygems/tasks'
22
+ Gem::Tasks.new(sign: {checksum: true, pgp: true})
23
+
24
+ require 'rspec/core/rake_task'
25
+ RSpec::Core::RakeTask.new
26
+ task :test => :spec
27
+ task :default => :spec
28
+
29
+ require 'yard'
30
+ YARD::Rake::YardocTask.new
31
+ task :docs => :yard
32
+
33
+ require 'kramdown/man/task'
34
+ Kramdown::Man::Task.new
35
+
36
+ require 'command_kit/completion/task'
37
+ CommandKit::Completion::Task.new(
38
+ class_file: 'ronin/listener/cli',
39
+ class_name: 'Ronin::Listener::CLI',
40
+ output_file: 'data/completions/ronin-listener'
41
+ )
42
+
43
+ task :setup => %w[man command_kit:completion]
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # ronin-listener - A Ruby CLI utility for receiving exfiltrated data.
5
+ #
6
+ # Copyright (c) 2023 Hal Brodigan (postmodern.mod3@gmail.com)
7
+ #
8
+ # ronin-listener is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-listener is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-listener. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ root = File.expand_path(File.join(__dir__,'..'))
23
+ if File.file?(File.join(root,'Gemfile.lock'))
24
+ Dir.chdir(root) do
25
+ require 'bundler/setup'
26
+ rescue LoadError => e
27
+ warn e.message
28
+ warn "Run `gem install bundler` to install Bundler"
29
+ exit(-1)
30
+ end
31
+ end
32
+
33
+ require 'ronin/listener/cli'
34
+ Ronin::Listener::CLI.start
@@ -0,0 +1,103 @@
1
+ # ronin-listener completion -*- shell-script -*-
2
+
3
+ # This bash completions script was generated by
4
+ # completely (https://github.com/dannyben/completely)
5
+ # Modifying it manually is not recommended
6
+
7
+ _ronin-listener_completions_filter() {
8
+ local words="$1"
9
+ local cur=${COMP_WORDS[COMP_CWORD]}
10
+ local result=()
11
+
12
+ if [[ "${cur:0:1}" == "-" ]]; then
13
+ echo "$words"
14
+
15
+ else
16
+ for word in $words; do
17
+ [[ "${word:0:1}" != "-" ]] && result+=("$word")
18
+ done
19
+
20
+ echo "${result[*]}"
21
+
22
+ fi
23
+ }
24
+
25
+ _ronin-listener_completions() {
26
+ local cur=${COMP_WORDS[COMP_CWORD]}
27
+ local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
28
+ local compline="${compwords[*]}"
29
+
30
+ case "$compline" in
31
+ 'new http'*'--vhost')
32
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
33
+ ;;
34
+
35
+ 'new http'*'--root')
36
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
37
+ ;;
38
+
39
+ 'http'*'--output')
40
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
41
+ ;;
42
+
43
+ 'dns'*'--output')
44
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
45
+ ;;
46
+
47
+ 'http'*'--vhost')
48
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
49
+ ;;
50
+
51
+ 'http'*'--root')
52
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
53
+ ;;
54
+
55
+ 'new http'*'-R')
56
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
57
+ ;;
58
+
59
+ 'completion'*)
60
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "--print --install --uninstall")" -- "$cur" )
61
+ ;;
62
+
63
+ 'new http'*)
64
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "--host -H --port -p --vhost --root -R")" -- "$cur" )
65
+ ;;
66
+
67
+ 'http'*'-o')
68
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
69
+ ;;
70
+
71
+ 'http'*'-R')
72
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
73
+ ;;
74
+
75
+ 'new dns'*)
76
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "--host -H --port -p --domain -d")" -- "$cur" )
77
+ ;;
78
+
79
+ 'dns'*'-o')
80
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
81
+ ;;
82
+
83
+ 'http'*)
84
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "--output -o --output-format -F --host -H --port -p --vhost --root -R")" -- "$cur" )
85
+ ;;
86
+
87
+ 'dns'*)
88
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "--output -o --output-format -F --host -H --port -p")" -- "$cur" )
89
+ ;;
90
+
91
+ 'new'*)
92
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "help dns http")" -- "$cur" )
93
+ ;;
94
+
95
+ *)
96
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-listener_completions_filter "--version -V help completion dns http new")" -- "$cur" )
97
+ ;;
98
+
99
+ esac
100
+ } &&
101
+ complete -F _ronin-listener_completions ronin-listener
102
+
103
+ # ex: filetype=sh
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ronin/listener/dns'
4
+
5
+ Ronin::Listener::DNS.listen(<%= @domain.inspect -%>, host: <%= @host.inspect -%>, port: <%= @port -%>) do |query|
6
+ puts "Received query for #{query.type} #{query.label} from #{query.source}"
7
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ronin/listener/http'
4
+
5
+ Ronin::Listener::HTTP.listen(host: <%= @host.inspect -%>, port: <%= @port -%><%- if @vhost -%>, vhost: <%= @vhost.inspect %><%- end -%><%- if @root -%>, root: <%= @root.inspect -%><%- end -%>) do |request|
6
+ puts "#{request.method} #{request.path} #{request.version}"
7
+
8
+ request.headers.each do |name,value|
9
+ puts "#{name}: #{value}"
10
+ end
11
+
12
+ puts request.body if request.body
13
+ puts
14
+ end