ronin-web 1.0.2 → 2.0.0.rc1
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 +4 -4
- data/.github/workflows/ruby.yml +3 -2
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -0
- data/ChangeLog.md +46 -1
- data/Gemfile +25 -12
- data/README.md +257 -51
- data/Rakefile +9 -0
- data/data/completions/ronin-web +203 -0
- data/gemspec.yml +18 -5
- data/lib/ronin/web/cli/browser_options.rb +92 -0
- data/lib/ronin/web/cli/browser_shell.rb +448 -0
- data/lib/ronin/web/cli/command.rb +1 -1
- data/lib/ronin/web/cli/commands/browser.rb +373 -0
- data/lib/ronin/web/cli/commands/completion.rb +63 -0
- data/lib/ronin/web/cli/commands/diff.rb +60 -8
- data/lib/ronin/web/cli/commands/html.rb +21 -33
- data/lib/ronin/web/cli/commands/irb.rb +1 -1
- data/lib/ronin/web/cli/commands/new/{webapp.rb → app.rb} +8 -8
- data/lib/ronin/web/cli/commands/new/nokogiri.rb +4 -4
- data/lib/ronin/web/cli/commands/new/server.rb +1 -1
- data/lib/ronin/web/cli/commands/new/spider.rb +1 -1
- data/lib/ronin/web/cli/commands/new.rb +5 -3
- data/lib/ronin/web/cli/commands/reverse_proxy.rb +1 -1
- data/lib/ronin/web/cli/commands/screenshot.rb +186 -0
- data/lib/ronin/web/cli/commands/server.rb +1 -1
- data/lib/ronin/web/cli/commands/session_cookie.rb +265 -0
- data/lib/ronin/web/cli/commands/spider.rb +61 -467
- data/lib/ronin/web/cli/commands/user_agent.rb +177 -0
- data/lib/ronin/web/cli/commands/vulns.rb +463 -0
- data/lib/ronin/web/cli/commands/wordlist.rb +484 -0
- data/lib/ronin/web/cli/commands/xml.rb +149 -0
- data/lib/ronin/web/cli/js_shell.rb +69 -0
- data/lib/ronin/web/cli/ruby_shell.rb +1 -1
- data/lib/ronin/web/cli/spider_options.rb +919 -0
- data/lib/ronin/web/cli.rb +3 -1
- data/lib/ronin/web/html.rb +1 -1
- data/lib/ronin/web/root.rb +1 -1
- data/lib/ronin/web/version.rb +2 -2
- data/lib/ronin/web/xml.rb +1 -1
- data/lib/ronin/web.rb +4 -364
- data/man/ronin-web-browser.1 +92 -0
- data/man/ronin-web-browser.1.md +96 -0
- data/man/ronin-web-completion.1 +76 -0
- data/man/ronin-web-completion.1.md +78 -0
- data/man/ronin-web-diff.1 +14 -21
- data/man/ronin-web-diff.1.md +13 -6
- data/man/ronin-web-html.1 +30 -46
- data/man/ronin-web-html.1.md +27 -17
- data/man/ronin-web-irb.1 +9 -16
- data/man/ronin-web-irb.1.md +6 -2
- data/man/ronin-web-new-app.1.md +39 -0
- data/man/ronin-web-new-nokogiri.1 +9 -20
- data/man/ronin-web-new-nokogiri.1.md +5 -5
- data/man/ronin-web-new-server.1 +11 -23
- data/man/ronin-web-new-server.1.md +5 -5
- data/man/ronin-web-new-spider.1 +44 -88
- data/man/ronin-web-new-spider.1.md +37 -37
- data/man/ronin-web-new.1 +18 -30
- data/man/ronin-web-new.1.md +15 -11
- data/man/ronin-web-reverse-proxy.1 +33 -38
- data/man/ronin-web-reverse-proxy.1.md +20 -14
- data/man/ronin-web-screenshot.1 +56 -0
- data/man/ronin-web-screenshot.1.md +56 -0
- data/man/ronin-web-server.1 +15 -29
- data/man/ronin-web-server.1.md +13 -9
- data/man/ronin-web-session-cookie.1 +38 -0
- data/man/ronin-web-session-cookie.1.md +41 -0
- data/man/ronin-web-spider.1 +121 -130
- data/man/ronin-web-spider.1.md +115 -66
- data/man/ronin-web-user-agent.1 +44 -0
- data/man/ronin-web-user-agent.1.md +46 -0
- data/man/ronin-web-vulns.1 +175 -0
- data/man/ronin-web-vulns.1.md +177 -0
- data/man/ronin-web-wordlist.1 +258 -0
- data/man/ronin-web-wordlist.1.md +263 -0
- data/man/ronin-web-xml.1 +43 -0
- data/man/ronin-web-xml.1.md +46 -0
- data/man/ronin-web.1 +67 -18
- data/man/ronin-web.1.md +55 -4
- data/scripts/setup +58 -0
- metadata +122 -31
- data/lib/ronin/web/mechanize.rb +0 -84
- data/man/ronin-web-new-webapp.1.md +0 -39
- /data/data/new/{webapp → app}/.gitignore +0 -0
- /data/data/new/{webapp → app}/.ruby-version.erb +0 -0
- /data/data/new/{webapp → app}/Dockerfile.erb +0 -0
- /data/data/new/{webapp → app}/Gemfile +0 -0
- /data/data/new/{webapp → app}/app.rb.erb +0 -0
- /data/data/new/{webapp → app}/config.ru +0 -0
- /data/data/new/{webapp → app}/docker-compose.yml.erb +0 -0
@@ -0,0 +1,203 @@
|
|
1
|
+
# ronin-web 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-web_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-web_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
|
+
'browser'*'--inject-js-file')
|
32
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
|
33
|
+
;;
|
34
|
+
|
35
|
+
'screenshot'*'--directory')
|
36
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
|
37
|
+
;;
|
38
|
+
|
39
|
+
'wordlist'*'--ignore-host')
|
40
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
41
|
+
;;
|
42
|
+
|
43
|
+
'wordlist'*'--visit-host')
|
44
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
45
|
+
;;
|
46
|
+
|
47
|
+
'reverse-proxy'*'--host')
|
48
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
49
|
+
;;
|
50
|
+
|
51
|
+
'spider'*'--ignore-host')
|
52
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
53
|
+
;;
|
54
|
+
|
55
|
+
'spider'*'--git-archive')
|
56
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
|
57
|
+
;;
|
58
|
+
|
59
|
+
'spider'*'--visit-host')
|
60
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
61
|
+
;;
|
62
|
+
|
63
|
+
'vulns'*'--ignore-host')
|
64
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
65
|
+
;;
|
66
|
+
|
67
|
+
'vulns'*'--visit-host')
|
68
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
69
|
+
;;
|
70
|
+
|
71
|
+
'screenshot'*'--file')
|
72
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
|
73
|
+
;;
|
74
|
+
|
75
|
+
'reverse-proxy'*'-H')
|
76
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
77
|
+
;;
|
78
|
+
|
79
|
+
'spider'*'--history')
|
80
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
|
81
|
+
;;
|
82
|
+
|
83
|
+
'spider'*'--archive')
|
84
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
|
85
|
+
;;
|
86
|
+
|
87
|
+
'wordlist'*'--host')
|
88
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
89
|
+
;;
|
90
|
+
|
91
|
+
'session_cookie'*)
|
92
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--verbose -v --format -F")" -- "$cur" )
|
93
|
+
;;
|
94
|
+
|
95
|
+
'reverse-proxy'*)
|
96
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--host -H --port -p --show-body -b --rewrite-requests --rewrite-responses")" -- "$cur" )
|
97
|
+
;;
|
98
|
+
|
99
|
+
'screenshot'*'-f')
|
100
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
|
101
|
+
;;
|
102
|
+
|
103
|
+
'screenshot'*'-d')
|
104
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
|
105
|
+
;;
|
106
|
+
|
107
|
+
'server'*'--host')
|
108
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
109
|
+
;;
|
110
|
+
|
111
|
+
'server'*'--root')
|
112
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
|
113
|
+
;;
|
114
|
+
|
115
|
+
'spider'*'--host')
|
116
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
117
|
+
;;
|
118
|
+
|
119
|
+
'new nokogiri'*)
|
120
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_ronin-web_completions_filter "--url -U")" -- "$cur" )
|
121
|
+
;;
|
122
|
+
|
123
|
+
'vulns'*'--host')
|
124
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
125
|
+
;;
|
126
|
+
|
127
|
+
'completion'*)
|
128
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--print --install --uninstall")" -- "$cur" )
|
129
|
+
;;
|
130
|
+
|
131
|
+
'new server'*)
|
132
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_ronin-web_completions_filter "--host -H --port -p")" -- "$cur" )
|
133
|
+
;;
|
134
|
+
|
135
|
+
'new spider'*)
|
136
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_ronin-web_completions_filter "--host --domain --site --every-link --every-url --every-failed-url --every-url-like --all-headers --every-page --every-ok-page --every-redirect-page --every-timedout-page --every-bad-request-page --every-unauthorized-page --every-forbidden-page --every-missing-page --every-internal-server-error-page --every-txt-page --every-html-page --every-xml-page --every-xsl-page --every-javascript-page --every-css-page --every-rss-page --every-atom-page --every-ms-word-page --every-pdf-page --every-zip-page --every-doc --every-html-doc --every-xml-doc --every-xsl-doc --every-rss-doc --every-atom-doc")" -- "$cur" )
|
137
|
+
;;
|
138
|
+
|
139
|
+
'screenshot'*)
|
140
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--browser -B --width -W --height -H --file -f --format -F --directory -d --full --css-path -C")" -- "$cur" )
|
141
|
+
;;
|
142
|
+
|
143
|
+
'user_agent'*)
|
144
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--browser -B --chrome-version --firefox-version --linux-distro -D --arch -A --os -O --os-version")" -- "$cur" )
|
145
|
+
;;
|
146
|
+
|
147
|
+
'server'*'-H')
|
148
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
|
149
|
+
;;
|
150
|
+
|
151
|
+
'server'*'-r')
|
152
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
|
153
|
+
;;
|
154
|
+
|
155
|
+
'wordlist'*)
|
156
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--host --domain --site --open-timeout --read-timeout --ssl-timeout --continue-timeout --keep-alive-timeout --proxy -P --header -H --host-header --user-agent-string -U --user-agent -u --referer -R --delay -d --limit -l --max-depth -d --enqueue --visited --strip-fragments --strip-query --visit-scheme --visit-schemes-like --ignore-scheme --ignore-schemes-like --visit-host --visit-hosts-like --ignore-host --ignore-hosts-like --visit-port --visit-ports-like --ignore-port --ignore-ports-like --visit-link --visit-links-like --ignore-link --ignore-links-like --visit-ext --visit-exts-like --ignore-ext --ignore-exts-like --robots -r --output -o --content-xpath -X --content-css-path -C --meta-tags --no-meta-tags --comments --no-comments --alt-tags --no-alt-tags --paths --query-params-names --query-param-values --only-paths --only-query-param --only-query-param-values --format -f --append -A --lang -L --stop-word --ignore-word --digits --no-digits --special-char --numbers --no-numbers --acronyms --no-acronyms --normalize-case --no-normalize-case --normalize-apostrophes --no-normalize-apostrophes --normalize-acronyms --no-normalize-acronyms")" -- "$cur" )
|
157
|
+
;;
|
158
|
+
|
159
|
+
'browser'*)
|
160
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--browser -B --width -W --height -H --headless --visible --x -x --y -y --inject-js --inject-js-file --bypass-csp --print-urls --print-status --print-requests --print-responses --print-traffic --print-headers --print-cookies --print-body --shell --js-shell")" -- "$cur" )
|
161
|
+
;;
|
162
|
+
|
163
|
+
'new app'*)
|
164
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_ronin-web_completions_filter "--port --ruby-version --git --dockerfile -D")" -- "$cur" )
|
165
|
+
;;
|
166
|
+
|
167
|
+
'server'*)
|
168
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--host -H --port -p --basic-auth -A --dir -d --file -f --root -r --redirect -R")" -- "$cur" )
|
169
|
+
;;
|
170
|
+
|
171
|
+
'spider'*)
|
172
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--host --domain --site --open-timeout --read-timeout --ssl-timeout --continue-timeout --keep-alive-timeout --proxy -P --header -H --host-header --user-agent-string -U --user-agent -u --referer -R --delay -d --limit -l --max-depth -d --enqueue --visited --strip-fragments --strip-query --visit-scheme --visit-schemes-like --ignore-scheme --ignore-schemes-like --visit-host --visit-hosts-like --ignore-host --ignore-hosts-like --visit-port --visit-ports-like --ignore-port --ignore-ports-like --visit-link --visit-links-like --ignore-link --ignore-links-like --visit-ext --visit-exts-like --ignore-ext --ignore-exts-like --robots -r --verbose -v --print-stauts --print-headers --print-header --history --archive --git-archive --xpath -X --css-path -C --print-hosts --print-certs --save-certs --print-js-strings --print-js-url-strings --print-js-path-strings --print-js-absolute-path-strings --print-js-relative-path-strings --print-html-comments --print-js-comments --print-comments")" -- "$cur" )
|
173
|
+
;;
|
174
|
+
|
175
|
+
'vulns'*)
|
176
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--host --domain --site --open-timeout --read-timeout --ssl-timeout --continue-timeout --keep-alive-timeout --proxy -P --header -H --host-header --user-agent-string -U --user-agent -u --referer -R --delay -d --limit -l --max-depth -d --enqueue --visited --strip-fragments --strip-query --visit-scheme --visit-schemes-like --ignore-scheme --ignore-schemes-like --visit-host --visit-hosts-like --ignore-host --ignore-hosts-like --visit-port --visit-ports-like --ignore-port --ignore-ports-like --visit-link --visit-links-like --ignore-link --ignore-links-like --visit-ext --visit-exts-like --ignore-ext --ignore-exts-like --robots -r --db --db-uri --db-file --first -F --all -A --print-curl --print-http --import --lfi-os --lfi-depth --lfi-filter-bypass --rfi-filter-bypass --rfi-script-lang --rfi-test-script-url --sqli-escape-quote --sqli-escape-parens --sqli-terminate --ssti-test-expr --open-redirect-url")" -- "$cur" )
|
177
|
+
;;
|
178
|
+
|
179
|
+
'diff'*)
|
180
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--format -f")" -- "$cur" )
|
181
|
+
;;
|
182
|
+
|
183
|
+
'html'*)
|
184
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--xpath -X --first -F --text -t --css-path -C --meta-tags -M --links -l --style -S --stylesheet-urls -s --javascript -J --javascript-urls -j --form-urls -f --urls -u")" -- "$cur" )
|
185
|
+
;;
|
186
|
+
|
187
|
+
'new'*)
|
188
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "help app nokogiri server spider")" -- "$cur" )
|
189
|
+
;;
|
190
|
+
|
191
|
+
'xml'*)
|
192
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--xpath -X --first -F --text -t")" -- "$cur" )
|
193
|
+
;;
|
194
|
+
|
195
|
+
*)
|
196
|
+
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-web_completions_filter "--version -V help browser completion diff html irb new reverse-proxy screenshot server session-cookie spider user-agent vulns wordlist xml")" -- "$cur" )
|
197
|
+
;;
|
198
|
+
|
199
|
+
esac
|
200
|
+
} &&
|
201
|
+
complete -F _ronin-web_completions ronin-web
|
202
|
+
|
203
|
+
# ex: filetype=sh
|
data/gemspec.yml
CHANGED
@@ -20,7 +20,10 @@ metadata:
|
|
20
20
|
rubygems_mfa_required: 'true'
|
21
21
|
|
22
22
|
generated_files:
|
23
|
+
- data/completions/ronin-web
|
23
24
|
- man/ronin-web.1
|
25
|
+
- man/ronin-web-browser.1
|
26
|
+
- man/ronin-web-completion.1
|
24
27
|
- man/ronin-web-diff.1
|
25
28
|
- man/ronin-web-html.1
|
26
29
|
- man/ronin-web-irb.1
|
@@ -29,22 +32,32 @@ generated_files:
|
|
29
32
|
- man/ronin-web-new-server.1
|
30
33
|
- man/ronin-web-new-spider.1
|
31
34
|
- man/ronin-web-new-webapp.1
|
35
|
+
- man/ronin-web-screenshot.1
|
32
36
|
- man/ronin-web-server.1
|
33
37
|
- man/ronin-web-spider.1
|
34
38
|
- man/ronin-web-reverse-proxy.1
|
39
|
+
- man/ronin-web-session-cookie.1
|
40
|
+
- man/ronin-web-user-agent.1
|
41
|
+
- man/ronin-web-vulns.1
|
42
|
+
- man/ronin-web-wordlist.1
|
43
|
+
- man/ronin-web-xml.1
|
35
44
|
|
36
45
|
dependencies:
|
37
46
|
nokogiri: ~> 1.4
|
38
|
-
nokogiri-ext: ~> 0.1
|
39
47
|
nokogiri-diff: ~> 0.2
|
40
|
-
|
48
|
+
robots: ~> 0.10
|
41
49
|
open_namespace: ~> 0.4
|
50
|
+
wordlist: ~> 1.0, >= 1.0.1
|
42
51
|
# Ronin dependencies:
|
43
|
-
ronin-support: ~> 1.0
|
52
|
+
ronin-support: ~> 1.1.0.rc1
|
53
|
+
ronin-support-web: ~> 0.1.0.rc1
|
54
|
+
ronin-web-browser: ~> 0.1.0.rc1
|
44
55
|
ronin-web-server: ~> 0.1, >= 0.1.1
|
45
|
-
ronin-web-spider: ~> 0.
|
56
|
+
ronin-web-spider: ~> 0.2.0.rc1
|
46
57
|
ronin-web-user_agents: ~> 0.1
|
47
|
-
ronin-
|
58
|
+
ronin-web-session_cookie: ~> 0.1.0.rc1
|
59
|
+
ronin-core: ~> 0.2.0.rc1
|
60
|
+
ronin-vulns: ~> 0.2.0.rc1
|
48
61
|
|
49
62
|
development_dependencies:
|
50
63
|
bundler: ~> 2.0
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-web - A collection of useful web helper methods and commands.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-web is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# ronin-web is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ronin-web. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/web/browser'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Web
|
25
|
+
class CLI
|
26
|
+
#
|
27
|
+
# Adds options for opening a browser.
|
28
|
+
#
|
29
|
+
# @since 2.0.0
|
30
|
+
#
|
31
|
+
module BrowserOptions
|
32
|
+
#
|
33
|
+
# Adds the browser options to the command including {BrowserOptions}.
|
34
|
+
#
|
35
|
+
# @param [Class<Command>] command
|
36
|
+
# The command including {BrowserOptions}.
|
37
|
+
#
|
38
|
+
def self.included(command)
|
39
|
+
command.option :browser, short: '-B',
|
40
|
+
value: {
|
41
|
+
type: String,
|
42
|
+
usage: 'NAME|PATH'
|
43
|
+
},
|
44
|
+
desc: 'The browser name or path to execute'
|
45
|
+
|
46
|
+
command.option :width, short: '-W',
|
47
|
+
value: {
|
48
|
+
type: Integer,
|
49
|
+
default: 1024,
|
50
|
+
usage: 'WIDTH'
|
51
|
+
},
|
52
|
+
desc: 'Sets the width of the browser viewport'
|
53
|
+
|
54
|
+
command.option :height, short: '-H',
|
55
|
+
value: {
|
56
|
+
type: Integer,
|
57
|
+
default: 768,
|
58
|
+
usage: 'HEIGHT'
|
59
|
+
},
|
60
|
+
desc: 'Sets the height of the browser viewport'
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# The browser agent.
|
65
|
+
#
|
66
|
+
# @return [Ronin::Web::Browser::Agent]
|
67
|
+
#
|
68
|
+
def browser
|
69
|
+
@browser ||= Web::Browser.new(**browser_kwargs)
|
70
|
+
end
|
71
|
+
|
72
|
+
#
|
73
|
+
# Keyword arguments for `Ronin::Web::Browser.new`.
|
74
|
+
#
|
75
|
+
# @return [Hash{Symbol => Object}]
|
76
|
+
# The keyword arguments.
|
77
|
+
#
|
78
|
+
def browser_kwargs
|
79
|
+
kwargs = {
|
80
|
+
window_size: [options[:width], options[:height]]
|
81
|
+
}
|
82
|
+
|
83
|
+
if options[:browser]
|
84
|
+
kwargs[:browser_path] = options[:browser]
|
85
|
+
end
|
86
|
+
|
87
|
+
return kwargs
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|