ronin-app 0.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +3 -0
  3. data/.document +6 -0
  4. data/.env.dev +1 -0
  5. data/.github/workflows/ruby.yml +44 -0
  6. data/.gitignore +16 -0
  7. data/.rspec +1 -0
  8. data/.rubocop.yml +26 -0
  9. data/.ruby-version +1 -0
  10. data/.yardopts +1 -0
  11. data/CONTRIBUTING.md +34 -0
  12. data/COPYING.txt +661 -0
  13. data/ChangeLog.md +38 -0
  14. data/Dockerfile +27 -0
  15. data/Gemfile +61 -0
  16. data/Procfile +2 -0
  17. data/Procfile.dev +2 -0
  18. data/README.md +215 -0
  19. data/Rakefile +44 -0
  20. data/app/db.rb +680 -0
  21. data/app/scanning.rb +173 -0
  22. data/app.rb +372 -0
  23. data/bin/ronin-app +34 -0
  24. data/config/database.rb +17 -0
  25. data/config/puma.rb +24 -0
  26. data/config/redis.rb +4 -0
  27. data/config/sidekiq.rb +23 -0
  28. data/config/sidekiq.yml +12 -0
  29. data/config.ru +33 -0
  30. data/docker-compose.yml +45 -0
  31. data/etc/systemd/user/ronin-app-sidekiq.1.service +17 -0
  32. data/etc/systemd/user/ronin-app-web.1.service +18 -0
  33. data/etc/systemd/user/ronin-app.target +5 -0
  34. data/gemspec.yml +55 -0
  35. data/lib/middleware/sidekiq/active_record_connection_pool.rb +47 -0
  36. data/lib/ronin/app/cli.rb +197 -0
  37. data/lib/ronin/app/helpers/html.rb +71 -0
  38. data/lib/ronin/app/root.rb +28 -0
  39. data/lib/ronin/app/schemas/params_schema.rb +66 -0
  40. data/lib/ronin/app/schemas/payloads/build_schema.rb +56 -0
  41. data/lib/ronin/app/schemas/payloads/encoders/encode_schema.rb +60 -0
  42. data/lib/ronin/app/types/import.rb +35 -0
  43. data/lib/ronin/app/types/nmap.rb +81 -0
  44. data/lib/ronin/app/types/spider.rb +49 -0
  45. data/lib/ronin/app/types/vulns.rb +69 -0
  46. data/lib/ronin/app/types.rb +66 -0
  47. data/lib/ronin/app/validations/import_params.rb +71 -0
  48. data/lib/ronin/app/validations/install_repo_params.rb +78 -0
  49. data/lib/ronin/app/validations/masscan_params.rb +122 -0
  50. data/lib/ronin/app/validations/nmap_params.rb +183 -0
  51. data/lib/ronin/app/validations/recon_params.rb +86 -0
  52. data/lib/ronin/app/validations/spider_params.rb +103 -0
  53. data/lib/ronin/app/validations/vulns_params.rb +83 -0
  54. data/lib/ronin/app/version.rb +26 -0
  55. data/log/.gitkeep +0 -0
  56. data/man/ronin-app.1 +63 -0
  57. data/man/ronin-app.1.md +61 -0
  58. data/public/images/favicon.png +0 -0
  59. data/public/images/favicon.svg +78 -0
  60. data/public/images/logo.svg +78 -0
  61. data/public/images/sidekiq.svg +24 -0
  62. data/public/javascript/app.js +60 -0
  63. data/public/javascript/notes.js +28 -0
  64. data/public/javascript/tabs.js +40 -0
  65. data/public/stylesheets/app.css +216 -0
  66. data/public/stylesheets/bulma.min.css +1 -0
  67. data/ronin-app.gemspec +63 -0
  68. data/scripts/console +7 -0
  69. data/scripts/server +134 -0
  70. data/scripts/setup +447 -0
  71. data/scripts/update +55 -0
  72. data/tmp/.gitkeep +0 -0
  73. data/views/_authors.erb +62 -0
  74. data/views/_delete.erb +4 -0
  75. data/views/_delete_all.erb +4 -0
  76. data/views/_encoding_tabs.erb +25 -0
  77. data/views/_notes.erb +33 -0
  78. data/views/_pagination.erb +1 -0
  79. data/views/_param_fields.erb +66 -0
  80. data/views/_params.erb +35 -0
  81. data/views/about.erb +30 -0
  82. data/views/db/advisories/index.erb +30 -0
  83. data/views/db/advisories/show.erb +105 -0
  84. data/views/db/asns/index.erb +19 -0
  85. data/views/db/asns/show.erb +61 -0
  86. data/views/db/credentials/index.erb +30 -0
  87. data/views/db/credentials/show.erb +51 -0
  88. data/views/db/email_addresses/index.erb +30 -0
  89. data/views/db/email_addresses/show.erb +44 -0
  90. data/views/db/host_names/index.erb +30 -0
  91. data/views/db/host_names/show.erb +52 -0
  92. data/views/db/ip_addresses/index.erb +19 -0
  93. data/views/db/ip_addresses/show.erb +98 -0
  94. data/views/db/mac_addresses/index.erb +19 -0
  95. data/views/db/mac_addresses/show.erb +62 -0
  96. data/views/db/open_ports/index.erb +19 -0
  97. data/views/db/open_ports/show.erb +87 -0
  98. data/views/db/organizations/departments/show.erb +82 -0
  99. data/views/db/organizations/index.erb +28 -0
  100. data/views/db/organizations/members/show.erb +87 -0
  101. data/views/db/organizations/show.erb +111 -0
  102. data/views/db/oses/index.erb +19 -0
  103. data/views/db/oses/show.erb +46 -0
  104. data/views/db/passwords/index.erb +30 -0
  105. data/views/db/passwords/show.erb +52 -0
  106. data/views/db/people/index.erb +31 -0
  107. data/views/db/people/show.erb +120 -0
  108. data/views/db/phone_numbers/index.erb +30 -0
  109. data/views/db/phone_numbers/show.erb +63 -0
  110. data/views/db/ports/index.erb +30 -0
  111. data/views/db/ports/show.erb +70 -0
  112. data/views/db/services/index.erb +30 -0
  113. data/views/db/services/show.erb +65 -0
  114. data/views/db/software/index.erb +19 -0
  115. data/views/db/software/show.erb +52 -0
  116. data/views/db/software_vendors/index.erb +19 -0
  117. data/views/db/software_vendors/show.erb +36 -0
  118. data/views/db/street_addresses/index.erb +19 -0
  119. data/views/db/street_addresses/show.erb +63 -0
  120. data/views/db/url_query_param_names/index.erb +19 -0
  121. data/views/db/url_query_param_names/show.erb +50 -0
  122. data/views/db/url_schemes/index.erb +19 -0
  123. data/views/db/url_schemes/show.erb +36 -0
  124. data/views/db/urls/index.erb +30 -0
  125. data/views/db/urls/show.erb +103 -0
  126. data/views/db/user_names/index.erb +30 -0
  127. data/views/db/user_names/show.erb +48 -0
  128. data/views/db/vulns/index.erb +19 -0
  129. data/views/db/vulns/show.erb +104 -0
  130. data/views/db.erb +152 -0
  131. data/views/exploits/index.erb +9 -0
  132. data/views/exploits/show.erb +100 -0
  133. data/views/import.erb +30 -0
  134. data/views/index.erb +7 -0
  135. data/views/layout.erb +98 -0
  136. data/views/masscan.erb +459 -0
  137. data/views/nmap.erb +1009 -0
  138. data/views/payloads/build.erb +19 -0
  139. data/views/payloads/encoders/encode.erb +35 -0
  140. data/views/payloads/encoders/index.erb +9 -0
  141. data/views/payloads/encoders/show.erb +47 -0
  142. data/views/payloads/index.erb +9 -0
  143. data/views/payloads/show.erb +47 -0
  144. data/views/queue.erb +28 -0
  145. data/views/recon.erb +55 -0
  146. data/views/repos/index.erb +30 -0
  147. data/views/repos/install.erb +45 -0
  148. data/views/repos/show.erb +39 -0
  149. data/views/spider.erb +372 -0
  150. data/views/vulns.erb +214 -0
  151. data/workers/import.rb +96 -0
  152. data/workers/install_repo.rb +40 -0
  153. data/workers/masscan.rb +135 -0
  154. data/workers/nmap.rb +216 -0
  155. data/workers/purge_repos.rb +40 -0
  156. data/workers/recon.rb +95 -0
  157. data/workers/remove_repo.rb +40 -0
  158. data/workers/spider.rb +148 -0
  159. data/workers/update_repo.rb +42 -0
  160. data/workers/update_repos.rb +40 -0
  161. data/workers/vulns.rb +111 -0
  162. data/workers.rb +37 -0
  163. metadata +538 -0
data/scripts/server ADDED
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #
4
+ # Prints a log message.
5
+ #
6
+ function log()
7
+ {
8
+ if [[ -t 1 ]]; then
9
+ echo -e "\x1b[1m\x1b[32m>>>\x1b[0m \x1b[1m$1\x1b[0m"
10
+ else
11
+ echo ">>> $1"
12
+ fi
13
+ }
14
+
15
+ #
16
+ # Prints a warn message.
17
+ #
18
+ function warn()
19
+ {
20
+ if [[ -t 1 ]]; then
21
+ echo -e "\x1b[1m\x1b[33m***\x1b[0m \x1b[1m$1\x1b[0m" >&2
22
+ else
23
+ echo "*** $1" >&2
24
+ fi
25
+ }
26
+
27
+ #
28
+ # Prints an error message.
29
+ #
30
+ function error()
31
+ {
32
+ if [[ -t 1 ]]; then
33
+ echo -e "\x1b[1m\x1b[31m!!!\x1b[0m \x1b[1m$1\x1b[0m" >&2
34
+ else
35
+ echo "!!! $1" >&2
36
+ fi
37
+ }
38
+
39
+ #
40
+ # Prints an error message and exists with -1.
41
+ #
42
+ function fail()
43
+ {
44
+ error "$@"
45
+ exit -1
46
+ }
47
+
48
+ environment="development"
49
+ port=1337
50
+
51
+ #
52
+ # Print the --help usage.
53
+ #
54
+ function print_usage()
55
+ {
56
+ cat <<USAGE
57
+ usage: ./scripts/server [OPTIONS]
58
+
59
+ Options:
60
+ -e, --environment production|development
61
+ Sets the environment
62
+ -p, --port PORT Sets the web server port
63
+ -V, --version Prints the version
64
+ -h, --help Prints this message
65
+
66
+ USAGE
67
+ }
68
+
69
+ #
70
+ # Parse additional command-line options.
71
+ #
72
+ function parse_options()
73
+ {
74
+ while [[ $# -gt 0 ]]; do
75
+ case "$1" in
76
+ -e|--environment)
77
+ case "$2" in
78
+ production|development)
79
+ environment="$2"
80
+ shift 2
81
+ ;;
82
+ *)
83
+ echo "server: invalid environment $2" >&2
84
+ return 1
85
+ ;;
86
+ esac
87
+ ;;
88
+ -p|--port)
89
+ port="$2"
90
+ shift 2
91
+ ;;
92
+ -h|--help)
93
+ print_usage
94
+ exit
95
+ ;;
96
+ -*)
97
+ echo "server: unrecognized option $1" >&2
98
+ return 1
99
+ ;;
100
+ *)
101
+ echo "server: unexpected argument $1" >&2
102
+ return 1
103
+ ;;
104
+ esac
105
+ done
106
+ }
107
+
108
+ parse_options "$@" || exit $?
109
+
110
+ pids=()
111
+
112
+ if [[ -z "$(pgrep redis-server)" ]]; then
113
+ if ! command -v redis-server >/dev/null; then
114
+ fail "server: redis-server is not installed!"
115
+ fi
116
+
117
+ redis-server &
118
+ pids+=($!)
119
+ fi
120
+
121
+ log "Starting Web server on localhost:${port} and Sidekiq ..."
122
+
123
+ case "$environment" in
124
+ development)
125
+ bundle exec foreman start -p "$port" -f Procfile.dev -e .env.dev
126
+ ;;
127
+ production)
128
+ bundle exec foreman start -p "$port"
129
+ ;;
130
+ esac
131
+
132
+ for pid in "${pids[@]}"; do
133
+ wait "$pid"
134
+ done
data/scripts/setup ADDED
@@ -0,0 +1,447 @@
1
+ #!/usr/bin/env bash
2
+
3
+ gem="gem"
4
+ gem_opts=(--no-format-executable)
5
+
6
+ bundler_version="~> 2.0"
7
+
8
+ #
9
+ # Prints a log message.
10
+ #
11
+ function log()
12
+ {
13
+ if [[ -t 1 ]]; then
14
+ echo -e "\x1b[1m\x1b[32m>>>\x1b[0m \x1b[1m$1\x1b[0m"
15
+ else
16
+ echo ">>> $1"
17
+ fi
18
+ }
19
+
20
+ #
21
+ # Prints a warn message.
22
+ #
23
+ function warn()
24
+ {
25
+ if [[ -t 1 ]]; then
26
+ echo -e "\x1b[1m\x1b[33m***\x1b[0m \x1b[1m$1\x1b[0m" >&2
27
+ else
28
+ echo "*** $1" >&2
29
+ fi
30
+ }
31
+
32
+ #
33
+ # Prints an error message.
34
+ #
35
+ function error()
36
+ {
37
+ if [[ -t 1 ]]; then
38
+ echo -e "\x1b[1m\x1b[31m!!!\x1b[0m \x1b[1m$1\x1b[0m" >&2
39
+ else
40
+ echo "!!! $1" >&2
41
+ fi
42
+ }
43
+
44
+ #
45
+ # Prints an error message and exists with -1.
46
+ #
47
+ function fail()
48
+ {
49
+ error "$@"
50
+ exit -1
51
+ }
52
+
53
+ #
54
+ # Checks that $LANG is set correctly.
55
+ #
56
+ function check_lang()
57
+ {
58
+ if [[ "$LANG" == "C" ]]; then
59
+ error "ruby will not work properly with LANG=C"
60
+ fail "Please set LANG to en_US.UTF-8 or another UTF-8 language"
61
+ fi
62
+ }
63
+
64
+ #
65
+ # Sets os_platform and os_arch.
66
+ #
67
+ function detect_os()
68
+ {
69
+ os_platform="$(uname -s)"
70
+ os_arch="$(uname -m)"
71
+ }
72
+
73
+ #
74
+ # Don't use sudo if already root.
75
+ #
76
+ function detect_sudo()
77
+ {
78
+ if (( UID == 0 )); then sudo=""
79
+ else sudo="sudo"
80
+ fi
81
+ }
82
+
83
+ #
84
+ # Auto-detect the package manager.
85
+ #
86
+ function detect_package_manager()
87
+ {
88
+ case "$os_platform" in
89
+ Linux)
90
+ if [[ -f /etc/redhat-release ]]; then
91
+ if command -v dnf >/dev/null; then
92
+ package_manager="dnf"
93
+ elif command -v yum >/dev/null; then
94
+ package_manager="yum"
95
+ fi
96
+ elif [[ -f /etc/debian_version ]]; then
97
+ if command -v apt-get >/dev/null; then
98
+ package_manager="apt"
99
+ fi
100
+ elif [[ -f /etc/SuSE-release ]]; then
101
+ if command -v zypper >/dev/null; then
102
+ package_manager="zypper"
103
+ fi
104
+ elif [[ -f /etc/arch-release ]]; then
105
+ if command -v pacman >/dev/null; then
106
+ package_manager="pacman"
107
+ fi
108
+ elif [[ -f /etc/os-release ]]; then
109
+ if command -v pacman >/dev/null; then
110
+ package_manager="pacman"
111
+ elif command -v zypper >/dev/null; then
112
+ package_manager="zypper"
113
+ fi
114
+ fi
115
+ ;;
116
+ Darwin)
117
+ if command -v brew >/dev/null; then
118
+ package_manager="brew"
119
+ elif command -v port >/dev/null; then
120
+ package_manager="port"
121
+ fi
122
+ ;;
123
+ *BSD)
124
+ if command -v pkg >/dev/null; then
125
+ package_manager="pkg"
126
+ fi
127
+ ;;
128
+ esac
129
+ }
130
+
131
+ #
132
+ # Detect the ruby version.
133
+ #
134
+ function detect_ruby_version()
135
+ {
136
+ if command -v ruby >/dev/null; then
137
+ ruby_version="$(ruby -e 'print RUBY_VERSION')"
138
+ fi
139
+ }
140
+
141
+ #
142
+ # Detect the system.
143
+ #
144
+ function detect_system()
145
+ {
146
+ check_lang
147
+ detect_os
148
+ detect_sudo
149
+ detect_package_manager
150
+ detect_ruby_version
151
+ }
152
+
153
+ #
154
+ # Detect where rubygems installs gems into and whether it's writable.
155
+ #
156
+ function detect_rubygems_install_dir()
157
+ {
158
+ local gem_dir="$(gem env gemdir)"
159
+
160
+ if (( UID == 0 )); then
161
+ gem_opts+=(--no-user-install)
162
+ elif [[ -d "$gem_dir" ]] && [[ ! -w "$gem_dir" ]]; then
163
+ gem="sudo $gem"
164
+ gem_opts+=(--no-user-install)
165
+ fi
166
+ }
167
+
168
+ #
169
+ # Installs a list of package names using the detected package manager.
170
+ #
171
+ function install_packages()
172
+ {
173
+ case "$package_manager" in
174
+ apt) $sudo apt-get install -y "$@" || return $? ;;
175
+ dnf|yum)$sudo $package_manager install -y "$@" || return $? ;;
176
+ port) $sudo port install "$@" || return $? ;;
177
+ pkg) $sudo pkg install -y "$@" || return $? ;;
178
+ brew)
179
+ local brew_owner="$(/usr/bin/stat -f %Su "$(command -v brew)")"
180
+ sudo -u "$brew_owner" brew install "$@" ||
181
+ sudo -u "$brew_owner" brew upgrade "$@" || return $?
182
+ ;;
183
+ pacman)
184
+ local missing_pkgs=($(pacman -T "$@"))
185
+
186
+ if (( ${#missing_pkgs[@]} > 0 )); then
187
+ $sudo pacman -Sy --noconfirm "${missing_pkgs[@]}" || return $?
188
+ fi
189
+ ;;
190
+ zypper) $sudo zypper -n in -l $* || return $? ;;
191
+ "") warn "Could not determine Package Manager. Proceeding anyway." ;;
192
+ esac
193
+ }
194
+
195
+ #
196
+ # Install redis-server if it's not already installed.
197
+ #
198
+ function auto_install_redis()
199
+ {
200
+ if ! command redis-server >/dev/null; then
201
+ log "Installing redis ..."
202
+ case "$package_manager" in
203
+ apt) install_packages redis-server ;;
204
+ *) install_packages redis ;;
205
+ esac
206
+ fi
207
+ }
208
+
209
+ #
210
+ # Installs git, if it's not installed.
211
+ #
212
+ function auto_install_git()
213
+ {
214
+ if ! command -v git >/dev/null; then
215
+ log "Installing git ..."
216
+ install_packages git || fail "Failed to install git!"
217
+ fi
218
+ }
219
+
220
+ #
221
+ # Installs ruby via homebrew and configures it.
222
+ #
223
+ function homebrew_install_ruby()
224
+ {
225
+ install_packages ruby
226
+ brew pin ruby
227
+
228
+ # make the homebrew ruby the default ruby for the script
229
+ PATH="$(brew --prefix ruby)/bin:$PATH"
230
+ hash -r
231
+
232
+ # make the homebrew ruby the default ruby for zshrc
233
+ cat >> ~/.zshrc <<CONFIG
234
+ PATH="\$(brew --prefix ruby)/bin:\$PATH"
235
+ PATH="\$(gem env gemdir)/bin:\$PATH"
236
+ CONFIG
237
+ }
238
+
239
+ #
240
+ # Installs ruby 3, if it's not installed.
241
+ #
242
+ function auto_install_ruby()
243
+ {
244
+ # check if ruby-3.x is already installed
245
+ if [[ ! "$ruby_version" == "3."* ]]; then
246
+ log "Installing ruby 3.x ..."
247
+ case "$package_manager" in
248
+ brew) homebrew_install_ruby ;;
249
+ dnf|yum) install_packages ruby-devel ruby-bundled-gems ;;
250
+ zypper) install_packages ruby-devel ;;
251
+ apt) install_packages ruby-full ;;
252
+ pacman) install_packages community/ruby ;;
253
+ *) install_packages ruby ;;
254
+ esac || fail "Failed to install ruby!"
255
+ fi
256
+
257
+ auto_install_rubygems
258
+ }
259
+
260
+ #
261
+ # Install rubygems if it's missing.
262
+ #
263
+ function auto_install_rubygems()
264
+ {
265
+ if ! command -v gem >/dev/null; then
266
+ log "Installing rubygems ..."
267
+ case "$package_manager" in
268
+ dnf|yum) install_packages rubygems ;;
269
+ pacman) install_packages community/rubygems ;;
270
+ *)
271
+ fail "rubygems was not installed along with ruby. Aborting!"
272
+ ;;
273
+ esac
274
+ fi
275
+
276
+ detect_rubygems_install_dir
277
+ }
278
+
279
+ #
280
+ # Install gcc if there's no C compiler on the system.
281
+ #
282
+ function auto_install_gcc()
283
+ {
284
+ if ! command -v cc >/dev/null; then
285
+ log "Installing gcc ..."
286
+ install_packages gcc || fail "Failed to install gcc!"
287
+ fi
288
+ }
289
+
290
+ #
291
+ # Install g++ if there's no C++ compiler on the system.
292
+ #
293
+ function auto_install_gpp()
294
+ {
295
+ if ! command -v c++ >/dev/null; then
296
+ log "Installing g++ ..."
297
+ case "$package_manager" in
298
+ dnf|yum) install_packages gcc-g++ ;;
299
+ zypper) install_packages gcc-c++ ;;
300
+ *) install_packages g++ ;;
301
+ esac || fail "Failed to install g++!"
302
+ fi
303
+ }
304
+
305
+ #
306
+ # Install make if it's not already installed.
307
+ #
308
+ function auto_install_make()
309
+ {
310
+ if ! command -v make >/dev/null; then
311
+ log "Install make ..."
312
+ install_packages make || fail "Failed to install make!"
313
+ fi
314
+ }
315
+
316
+ #
317
+ # Installs bundler, if it's not installed.
318
+ #
319
+ function auto_install_bundler()
320
+ {
321
+ if ! command -v bundle >/dev/null; then
322
+ log "Installing bundler ..."
323
+ $gem install ${gem_opts[@]} bundler -v "$bundler_version" ||
324
+ fail "Failed to install bundler!"
325
+ elif [[ "$(bundle --version)" == "Bundler version 1."* ]]; then
326
+ log "Updating bundler 1.x to 2.x ..."
327
+ $gem update ${gem_opts[@]} bundler
328
+ fi
329
+ }
330
+
331
+ #
332
+ # Install external dependencies for ronin.
333
+ #
334
+ function install_dependencies()
335
+ {
336
+ case "$package_manager" in
337
+ dnf|yum)libraries=(readline-devel sqlite-devel nmap masscan) ;;
338
+ zypper) libraries=(readline-devel sqlite3-devel nmap masscan) ;;
339
+ apt) libraries=(libreadline-dev libsqlite3-dev nmap masscan) ;;
340
+ *) libraries=(readline sqlite nmap masscan) ;;
341
+ esac
342
+
343
+ log "Installing external dependencies ..."
344
+ install_packages "${libraries[@]}" || \
345
+ warn "Failed to install external dependencies. Proceeding anyways."
346
+ }
347
+
348
+ #
349
+ # Set the capabilities of nmap and masscan so they can be ran without root or
350
+ # sudo.
351
+ #
352
+ function set_caps()
353
+ {
354
+ if command -v setcap >/dev/null; then
355
+ local caps="cap_net_raw,cap_net_admin,cap_net_bind_service+eip"
356
+
357
+ log "Setting capabilities for nmap so it does not require sudo/root ..."
358
+ sudo setcap "$caps" "$(which nmap)"
359
+
360
+ log "Setting capabilities for masscan so it does not require sudo/root ..."
361
+ sudo setcap "$caps" "$(which masscan)"
362
+ fi
363
+ }
364
+
365
+ #
366
+ # Print the --help usage.
367
+ #
368
+ function print_usage()
369
+ {
370
+ cat <<USAGE
371
+ usage: ./scripts/setup [OPTIONS] [REPO ...]
372
+
373
+ Options:
374
+ --package-manager [apt|dnf|yum|pacman|zypper|brew|pkg|port]
375
+ Sets the package manager to use
376
+ -V, --version Prints the version
377
+ -h, --help Prints this message
378
+
379
+ USAGE
380
+ }
381
+
382
+ #
383
+ # Parse additional command-line options.
384
+ #
385
+ function parse_options()
386
+ {
387
+ local argv=()
388
+
389
+ while [[ $# -gt 0 ]]; do
390
+ case "$1" in
391
+ --package-manager)
392
+ package_manager="$2"
393
+ shift 2
394
+ ;;
395
+ -V|--version)
396
+ echo "setup: $ronin_install_version"
397
+ exit
398
+ ;;
399
+ -h|--help)
400
+ print_usage
401
+ exit
402
+ ;;
403
+ -*)
404
+ echo "setup: unrecognized option $1" >&2
405
+ return 1
406
+ ;;
407
+ *)
408
+ argv+=($1)
409
+ shift
410
+ ;;
411
+ esac
412
+ done
413
+
414
+ if (( ${#argv[@]} > 0 )); then
415
+ github_repos=("${argv[@]}")
416
+ fi
417
+ }
418
+
419
+ parse_options "$@" || exit $?
420
+ detect_system
421
+ auto_install_redis
422
+ auto_install_git
423
+ auto_install_gcc
424
+ auto_install_gpp
425
+ auto_install_make
426
+ auto_install_ruby
427
+ auto_install_bundler
428
+ install_dependencies
429
+ set_caps
430
+
431
+ # default to installing gems into vendor/bundle
432
+ if [[ ! -f .bundle/config ]]; then
433
+ bundle config set --local path vendor/bundle >/dev/null || \
434
+ fail "Failed to run 'bundle config'"
435
+ fi
436
+
437
+ bundle install || fail "Failed to install gems!"
438
+
439
+ log "Setting up the project ..."
440
+ bundle exec rake setup || fail "Failed to setup project!"
441
+
442
+ log "ronin-app is now ready to be ran!"
443
+ echo
444
+ echo " $ ./scripts/server"
445
+ echo
446
+ echo "Then open http://localhost:1337 in your browser"
447
+ echo
data/scripts/update ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #
4
+ # Prints a log message.
5
+ #
6
+ function log()
7
+ {
8
+ if [[ -t 1 ]]; then
9
+ echo -e "\x1b[1m\x1b[32m>>>\x1b[0m \x1b[1m$1\x1b[0m"
10
+ else
11
+ echo ">>> $1"
12
+ fi
13
+ }
14
+
15
+ #
16
+ # Prints a warn message.
17
+ #
18
+ function warn()
19
+ {
20
+ if [[ -t 1 ]]; then
21
+ echo -e "\x1b[1m\x1b[33m***\x1b[0m \x1b[1m$1\x1b[0m" >&2
22
+ else
23
+ echo "*** $1" >&2
24
+ fi
25
+ }
26
+
27
+ #
28
+ # Prints an error message.
29
+ #
30
+ function error()
31
+ {
32
+ if [[ -t 1 ]]; then
33
+ echo -e "\x1b[1m\x1b[31m!!!\x1b[0m \x1b[1m$1\x1b[0m" >&2
34
+ else
35
+ echo "!!! $1" >&2
36
+ fi
37
+ }
38
+
39
+ #
40
+ # Prints an error message and exists with -1.
41
+ #
42
+ function fail()
43
+ {
44
+ error "$@"
45
+ exit -1
46
+ }
47
+
48
+ log "Updating git repository ..."
49
+ git pull origin main || fail "Failed to update git repository!"
50
+
51
+ log "Updating gems ..."
52
+ bundle update || fail "Failed to update gems!"
53
+
54
+ log "Migrating up the database ..."
55
+ bundle exec rake db:migrate || fail "Failed to migrate the database!"
data/tmp/.gitkeep ADDED
File without changes
@@ -0,0 +1,62 @@
1
+ <% authors.each do |author| %>
2
+ <p>
3
+ <%=h author.name %>
4
+
5
+ <% if author.email %>
6
+ (<a href="mailto:<%=h author.email %>"><%= author.email %></a>)
7
+ <% end %>
8
+ </p>
9
+
10
+ <ul>
11
+ <% if author.website? %>
12
+ <li>
13
+ Website:
14
+ <a href="<%=h author.website %>">
15
+ <%=h author.website %>
16
+ </a>
17
+ </li>
18
+ <% end %>
19
+
20
+ <% if author.blog? %>
21
+ <li>
22
+ Blog:
23
+ <a href="<%=h author.blog %>">
24
+ <%=h author.blog %>
25
+ </a>
26
+ </li>
27
+ <% end %>
28
+
29
+ <% if author.github? %>
30
+ <li>
31
+ GitHub:
32
+ <a href="<%=h author.github_url %>">
33
+ <%=h author.github %>
34
+ </a>
35
+ </li>
36
+ <% end %>
37
+
38
+ <% if author.gitlab? %>
39
+ <li>
40
+ GitLab:
41
+ <a href="<%=h author.gitlab_url %>">
42
+ <%=h author.gitlab %>
43
+ </a>
44
+ </li>
45
+ <% end %>
46
+
47
+ <% if author.twitter? %>
48
+ <li>
49
+ Twitter:
50
+ <a href="<%=h author.twitter_url %>">
51
+ <%=h author.twitter %>
52
+ </a>
53
+ </li>
54
+ <% end %>
55
+
56
+ <% if author.discord? %>
57
+ <li>
58
+ Discord: <%=h author.discord %>
59
+ </li>
60
+ <% end %>
61
+ </ul>
62
+ <% end %>
data/views/_delete.erb ADDED
@@ -0,0 +1,4 @@
1
+ <form action="/db/<%=hattr path %>/<%=hattr record.id %>" method="post">
2
+ <input type="hidden" name="_method" value="DELETE">
3
+ <button type="submit" class="button is-danger">Delete</button>
4
+ </form>
@@ -0,0 +1,4 @@
1
+ <form action="/db/<%=hattr path %>" method="post">
2
+ <input type="hidden" name="_method" value="DELETE">
3
+ <button type="submit" class="button is-danger">Delete All</button>
4
+ </form>