warding 0.2.5 → 0.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c9a32dc1d152b257a75f9135ba8c90744bd0b0b651f13219c0151b1d1b66487
4
- data.tar.gz: 49a842f3525b1805b24b3b5017e92aabb6ee2f7001a5886e2c7ddbdddafa8bbb
3
+ metadata.gz: 6c34288feb935d5458a0a3edad7b09638861d8122d0d6675c45eff07e3e6c283
4
+ data.tar.gz: 50f8b7a2c1a5e04d50c9841427445e2c9bc0c1197fa7e4127fa241776e600cf1
5
5
  SHA512:
6
- metadata.gz: '038593e77f575fcb096244b249af59c708b2da350e36d1a3fe048f65c23f13f72dfde781d477d5f2e68243a889b8664cffb45acb16bc012f01d058384f403180'
7
- data.tar.gz: 2baa3f15ca340c6baf4bc67c3157a5faf574438e04665ffeb1cff7ee057a25d084560711bef0525fd8a47bbb9ce10cdc73245dd21bfae0b90130ea9b3543e68e
6
+ metadata.gz: 4e48333eae63a98dc386e9d9160d7647121c9272be000e8a1c7fbe1c62f15fedf789e5dd4e395e55c681678edeba01c22edadd89a69410816622c6906c691fcf
7
+ data.tar.gz: 8657a758c6a956cfca4e4b13732215ea3460e2d6dd0c4528f5502f01652c3c460c65e544805f2a5e5ea43a1d7ca6340776bec6b4659a7f33ef47c22b68534a27
data/.gitignore CHANGED
@@ -1,8 +1,8 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -1,155 +1,155 @@
1
- AllCops:
2
- TargetRubyVersion: 2.4
3
- # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
4
- # to ignore them, so only the ones explicitly set in this file are enabled.
5
- DisabledByDefault: true
6
-
7
- # Prefer &&/|| over and/or.
8
- Style/AndOr:
9
- Enabled: true
10
-
11
- # Align `when` with `case`.
12
- Layout/CaseIndentation:
13
- Enabled: true
14
-
15
- # Align comments with method definitions.
16
- Layout/CommentIndentation:
17
- Enabled: true
18
-
19
- Layout/ElseAlignment:
20
- Enabled: true
21
-
22
- # Align `end` with the matching keyword or starting expression except for
23
- # assignments, where it should be aligned with the LHS.
24
- Layout/EndAlignment:
25
- Enabled: true
26
- EnforcedStyleAlignWith: variable
27
- AutoCorrect: true
28
-
29
- Layout/EmptyLineAfterMagicComment:
30
- Enabled: true
31
-
32
- Layout/EmptyLinesAroundBlockBody:
33
- Enabled: true
34
-
35
- # In a regular class definition, no empty lines around the body.
36
- Layout/EmptyLinesAroundClassBody:
37
- Enabled: true
38
-
39
- # In a regular method definition, no empty lines around the body.
40
- Layout/EmptyLinesAroundMethodBody:
41
- Enabled: true
42
-
43
- # In a regular module definition, no empty lines around the body.
44
- Layout/EmptyLinesAroundModuleBody:
45
- Enabled: true
46
-
47
- Layout/FirstArgumentIndentation:
48
- Enabled: true
49
-
50
- # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
51
- Style/HashSyntax:
52
- Enabled: true
53
-
54
- # Two spaces, no tabs (for indentation).
55
- Layout/IndentationWidth:
56
- Enabled: true
57
-
58
- Layout/LeadingCommentSpace:
59
- Enabled: true
60
-
61
- Layout/SpaceAfterColon:
62
- Enabled: true
63
-
64
- Layout/SpaceAfterComma:
65
- Enabled: true
66
-
67
- Layout/SpaceAroundEqualsInParameterDefault:
68
- Enabled: true
69
-
70
- Layout/SpaceAroundKeyword:
71
- Enabled: true
72
-
73
- Layout/SpaceAroundOperators:
74
- Enabled: true
75
-
76
- Layout/SpaceBeforeComma:
77
- Enabled: true
78
-
79
- Layout/SpaceBeforeFirstArg:
80
- Enabled: true
81
-
82
- Style/DefWithParentheses:
83
- Enabled: true
84
-
85
- # Defining a method with parameters needs parentheses.
86
- Style/MethodDefParentheses:
87
- Enabled: true
88
-
89
- Style/FrozenStringLiteralComment:
90
- Enabled: true
91
- EnforcedStyle: always
92
-
93
- # Use `foo {}` not `foo{}`.
94
- Layout/SpaceBeforeBlockBraces:
95
- Enabled: true
96
-
97
- # Use `foo { bar }` not `foo {bar}`.
98
- Layout/SpaceInsideBlockBraces:
99
- Enabled: true
100
-
101
- # Use `{ a: 1 }` not `{a:1}`.
102
- Layout/SpaceInsideHashLiteralBraces:
103
- Enabled: true
104
-
105
- Layout/SpaceInsideParens:
106
- Enabled: true
107
-
108
- # Check quotes usage according to lint rule below.
109
- Style/StringLiterals:
110
- Enabled: true
111
- EnforcedStyle: double_quotes
112
-
113
- # Detect hard tabs, no hard tabs.
114
- Layout/IndentationStyle:
115
- Enabled: true
116
-
117
- # Blank lines should not have any spaces.
118
- Layout/TrailingEmptyLines:
119
- Enabled: true
120
-
121
- # No trailing whitespace.
122
- Layout/TrailingWhitespace:
123
- Enabled: true
124
-
125
- # Use quotes for string literals when they are enough.
126
- Style/RedundantPercentQ:
127
- Enabled: true
128
-
129
- # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
130
- Lint/RequireParentheses:
131
- Enabled: true
132
-
133
- Lint/RedundantStringCoercion:
134
- Enabled: true
135
-
136
- Lint/UriEscapeUnescape:
137
- Enabled: true
138
-
139
- Style/ParenthesesAroundCondition:
140
- Enabled: true
141
-
142
- Style/RedundantReturn:
143
- Enabled: true
144
- AllowMultipleReturnValues: true
145
-
146
- Style/Semicolon:
147
- Enabled: true
148
- AllowAsExpressionSeparator: true
149
-
150
- # Prefer Foo.method over Foo::method
151
- Style/ColonMethodCall:
152
- Enabled: true
153
-
154
- Style/TrivialAccessors:
155
- Enabled: true
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
4
+ # to ignore them, so only the ones explicitly set in this file are enabled.
5
+ DisabledByDefault: true
6
+
7
+ # Prefer &&/|| over and/or.
8
+ Style/AndOr:
9
+ Enabled: true
10
+
11
+ # Align `when` with `case`.
12
+ Layout/CaseIndentation:
13
+ Enabled: true
14
+
15
+ # Align comments with method definitions.
16
+ Layout/CommentIndentation:
17
+ Enabled: true
18
+
19
+ Layout/ElseAlignment:
20
+ Enabled: true
21
+
22
+ # Align `end` with the matching keyword or starting expression except for
23
+ # assignments, where it should be aligned with the LHS.
24
+ Layout/EndAlignment:
25
+ Enabled: true
26
+ EnforcedStyleAlignWith: variable
27
+ AutoCorrect: true
28
+
29
+ Layout/EmptyLineAfterMagicComment:
30
+ Enabled: true
31
+
32
+ Layout/EmptyLinesAroundBlockBody:
33
+ Enabled: true
34
+
35
+ # In a regular class definition, no empty lines around the body.
36
+ Layout/EmptyLinesAroundClassBody:
37
+ Enabled: true
38
+
39
+ # In a regular method definition, no empty lines around the body.
40
+ Layout/EmptyLinesAroundMethodBody:
41
+ Enabled: true
42
+
43
+ # In a regular module definition, no empty lines around the body.
44
+ Layout/EmptyLinesAroundModuleBody:
45
+ Enabled: true
46
+
47
+ Layout/FirstArgumentIndentation:
48
+ Enabled: true
49
+
50
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
51
+ Style/HashSyntax:
52
+ Enabled: true
53
+
54
+ # Two spaces, no tabs (for indentation).
55
+ Layout/IndentationWidth:
56
+ Enabled: true
57
+
58
+ Layout/LeadingCommentSpace:
59
+ Enabled: true
60
+
61
+ Layout/SpaceAfterColon:
62
+ Enabled: true
63
+
64
+ Layout/SpaceAfterComma:
65
+ Enabled: true
66
+
67
+ Layout/SpaceAroundEqualsInParameterDefault:
68
+ Enabled: true
69
+
70
+ Layout/SpaceAroundKeyword:
71
+ Enabled: true
72
+
73
+ Layout/SpaceAroundOperators:
74
+ Enabled: true
75
+
76
+ Layout/SpaceBeforeComma:
77
+ Enabled: true
78
+
79
+ Layout/SpaceBeforeFirstArg:
80
+ Enabled: true
81
+
82
+ Style/DefWithParentheses:
83
+ Enabled: true
84
+
85
+ # Defining a method with parameters needs parentheses.
86
+ Style/MethodDefParentheses:
87
+ Enabled: true
88
+
89
+ Style/FrozenStringLiteralComment:
90
+ Enabled: true
91
+ EnforcedStyle: always
92
+
93
+ # Use `foo {}` not `foo{}`.
94
+ Layout/SpaceBeforeBlockBraces:
95
+ Enabled: true
96
+
97
+ # Use `foo { bar }` not `foo {bar}`.
98
+ Layout/SpaceInsideBlockBraces:
99
+ Enabled: true
100
+
101
+ # Use `{ a: 1 }` not `{a:1}`.
102
+ Layout/SpaceInsideHashLiteralBraces:
103
+ Enabled: true
104
+
105
+ Layout/SpaceInsideParens:
106
+ Enabled: true
107
+
108
+ # Check quotes usage according to lint rule below.
109
+ Style/StringLiterals:
110
+ Enabled: true
111
+ EnforcedStyle: double_quotes
112
+
113
+ # Detect hard tabs, no hard tabs.
114
+ Layout/IndentationStyle:
115
+ Enabled: true
116
+
117
+ # Blank lines should not have any spaces.
118
+ Layout/TrailingEmptyLines:
119
+ Enabled: true
120
+
121
+ # No trailing whitespace.
122
+ Layout/TrailingWhitespace:
123
+ Enabled: true
124
+
125
+ # Use quotes for string literals when they are enough.
126
+ Style/RedundantPercentQ:
127
+ Enabled: true
128
+
129
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
130
+ Lint/RequireParentheses:
131
+ Enabled: true
132
+
133
+ Lint/RedundantStringCoercion:
134
+ Enabled: true
135
+
136
+ Lint/UriEscapeUnescape:
137
+ Enabled: true
138
+
139
+ Style/ParenthesesAroundCondition:
140
+ Enabled: true
141
+
142
+ Style/RedundantReturn:
143
+ Enabled: true
144
+ AllowMultipleReturnValues: true
145
+
146
+ Style/Semicolon:
147
+ Enabled: true
148
+ AllowAsExpressionSeparator: true
149
+
150
+ # Prefer Foo.method over Foo::method
151
+ Style/ColonMethodCall:
152
+ Enabled: true
153
+
154
+ Style/TrivialAccessors:
155
+ Enabled: true
data/Gemfile CHANGED
File without changes
@@ -1,33 +1,33 @@
1
- PATH
2
- remote: .
3
- specs:
4
- warding (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- pastel (0.8.0)
10
- tty-color (~> 0.5)
11
- rake (12.3.3)
12
- tty-color (0.5.1)
13
- tty-cursor (0.7.1)
14
- tty-prompt (0.22.0)
15
- pastel (~> 0.8)
16
- tty-reader (~> 0.8)
17
- tty-reader (0.8.0)
18
- tty-cursor (~> 0.7)
19
- tty-screen (~> 0.8)
20
- wisper (~> 2.0)
21
- tty-screen (0.8.1)
22
- wisper (2.0.1)
23
-
24
- PLATFORMS
25
- ruby
26
-
27
- DEPENDENCIES
28
- rake (~> 12.0)
29
- tty-prompt
30
- warding!
31
-
32
- BUNDLED WITH
33
- 2.1.4
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ warding (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ pastel (0.8.0)
10
+ tty-color (~> 0.5)
11
+ rake (12.3.3)
12
+ tty-color (0.5.1)
13
+ tty-cursor (0.7.1)
14
+ tty-prompt (0.22.0)
15
+ pastel (~> 0.8)
16
+ tty-reader (~> 0.8)
17
+ tty-reader (0.8.0)
18
+ tty-cursor (~> 0.7)
19
+ tty-screen (~> 0.8)
20
+ wisper (~> 2.0)
21
+ tty-screen (0.8.1)
22
+ wisper (2.0.1)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ rake (~> 12.0)
29
+ tty-prompt
30
+ warding!
31
+
32
+ BUNDLED WITH
33
+ 2.1.4
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Marlos Pomin
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Marlos Pomin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,38 +1,38 @@
1
- # Warding [![Gem Version](https://badge.fury.io/rb/warding.svg)](https://badge.fury.io/rb/warding)
2
-
3
- > Custom Arch Linux installer designed for security assessments and pentesting.
4
-
5
- ## Installation
6
-
7
- Install warding by using the `gem install` command.
8
-
9
- ```bash
10
- gem install warding
11
- ```
12
-
13
- ## Usage
14
-
15
- 1. Download Arch Linux.
16
- 2. Boot from the live ISO.
17
- 3. Install warding (Ruby may also be required).
18
- 4. Run the binary executable `warding` and fill in the prompts.
19
- 5. Enjoy.
20
-
21
- ## Tasklist
22
-
23
- * Fix steps that contain pipes.
24
- * Add default smb conf.
25
- * Add AUR support.
26
- * Add `NetworkManager` support.
27
- * Code missing features.
28
- * Add extra checks.
29
- * Add GitHub actions.
30
- * Publish gem/package on GitHub.
31
-
32
- ## Contributing
33
-
34
- Bug reports and pull requests are welcome on GitHub at https://github.com/marlospomin/warding.
35
-
36
- ## License
37
-
38
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1
+ # Warding [![Gem Version](https://badge.fury.io/rb/warding.svg)](https://badge.fury.io/rb/warding)
2
+
3
+ > Custom Arch Linux installer designed for security assessments and pentesting.
4
+
5
+ ## Installation
6
+
7
+ Install warding by using the `gem install` command.
8
+
9
+ ```bash
10
+ gem install warding
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ 1. Download Arch Linux.
16
+ 2. Boot from the live ISO.
17
+ 3. Install warding (Ruby may also be required).
18
+ 4. Run the binary executable `warding` and fill in the prompts.
19
+ 5. Enjoy.
20
+
21
+ ## Tasklist
22
+
23
+ * Fix steps that contain pipes.
24
+ * Add default smb conf.
25
+ * Add AUR support.
26
+ * Add `NetworkManager` support.
27
+ * Code missing features.
28
+ * Add extra checks.
29
+ * Add GitHub actions.
30
+ * Publish gem/package on GitHub.
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/marlospomin/warding.
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
File without changes
@@ -1,248 +1,257 @@
1
- # frozen_string_literal: true
2
-
3
- require "warding/version"
4
- require "tty-prompt"
5
-
6
- module Warding
7
- class Error < StandardError; end
8
-
9
- class Installer
10
- @@prompt = TTY::Prompt.new
11
-
12
- def banner
13
- puts <<~'EOF'
14
-
15
- ( ( (
16
- )\))( ' ) ( )\ ) ( ( (
17
- ((_)()\ ) ( /( )( (()/( )\ ( )\))(
18
- _(())\_)() )(_)) (()\ ((_)) ((_) )\ ) ((_))\
19
- \ \((_)/ /((_)_ ((_) _| | (_) _(_/( (()(_)
20
- \ \/\/ / / _` | | '_| / _` | | | | ' \)) / _` |
21
- \_/\_/ \__,_| |_| \__,_| |_| |_||_| \__, |
22
- |___/
23
-
24
- EOF
25
- end
26
-
27
- def check
28
- unless `uname -a`.include?("archiso")
29
- @@prompt.error("Exiting...")
30
- @@prompt.warn("Warding can only be installed from within the live ISO context!")
31
- exit!
32
- end
33
-
34
- unless `[ -d /sys/firmware/efi ] && echo true`.include?("true")
35
- @@prompt.error("UEFI/EFI must be enabled to install warding")
36
- exit!
37
- end
38
- end
39
-
40
- def gather
41
- locales_list = %w[en-US es-ES pt-BR ru-RU fr-FR it-IT de-DE ja-JP ko-KR zh-CN]
42
- keymaps_list = %w[us uk br en fr de zh ru it es]
43
-
44
- parsed_input = @@prompt.collect do
45
- key(:update_mirrors).yes?("Update mirrorlist?")
46
- key(:system_language).select("Pick the desired system language:", locales_list)
47
- key(:keyboard_keymap).select("Pick your keyboard layout:", keymaps_list)
48
-
49
- unless @@prompt.yes?("Set timezone automatically?", default: true)
50
- key(:update_timezone).ask("Enter timezone:", required: true)
51
- end
52
-
53
- key(:root_password).mask("Insert new root password:", required: true)
54
-
55
- key(:system_settings) do
56
- bootloader = key(:bootloader).select("Which bootloader to use?", %w[systemd-boot grub])
57
- partitions = key(:partitions).select(
58
- "Select partition scheme to use:", ["/boot and /root", "/boot, /root and /home"]
59
- )
60
-
61
- key(:boot_size).slider("Boot drive partition size (MiB):", min: 512, max: 4096, default: 1024, step: 128)
62
-
63
- if partitions == "/boot, /root and /home"
64
- key(:home_size).slider("Home partition size (MiB):", min: 2048, max: 8192, default: 4096, step: 256)
65
- end
66
-
67
- key(:swap_size).slider("Swap partition size (MiB):", min: 1024, max: 8192, default: 2048, step: 256)
68
-
69
- if @@prompt.yes?("Enable encryption?", default: false)
70
- key(:encryption_settings) do
71
- key(:encryption_mode).expand("Which cryptic setup to use?") do |q|
72
- if partitions == "/boot, /root and /home"
73
- q.choice key: "m", name: "minimal (/home only)" do :minimal end
74
- q.choice key: "s", name: "safe (/home, /var, /tmp and swap)", value: :safe
75
- end
76
- q.choice key: "p", name: "paranoid (full disk encryption, except /boot)", value: :paranoid
77
- q.choice key: "i", name: "insane (full disk encryption)", value: :insane if bootloader == "grub"
78
- end
79
- key(:encryption_key).mask("Insert the encryption key:", required: true)
80
- end
81
- end
82
- end
83
-
84
- key(:extra_settings).multi_select("Select extra options:", %w[desktop-environment hacking-tools crons])
85
- end
86
-
87
- parsed_input
88
- end
89
-
90
- def install(data)
91
- if @@prompt.yes?("Confirm settings and continue?")
92
-
93
- @@prompt.say("Installing, please wait...")
94
-
95
- def setup_mirrors
96
- `reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
97
- end
98
-
99
- setup_mirrors if data[:update_mirrors]
100
-
101
- def setup_timezone(timezone = false)
102
- `timedatectl set-ntp true`
103
- if timezone
104
- `timedatectl set-timezone #{timezone}`
105
- else
106
- `timedatectl set-timezone "$(curl -s https://ipapi.co/timezone)"`
107
- end
108
- end
109
-
110
- data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
111
-
112
- def setup_partitions(boot_size)
113
- `parted -s -a optimal /dev/sda \
114
- mklabel gpt \
115
- mkpart primary fat32 0% #{boot_size}Mib \
116
- set 1 esp on \
117
- mkpart primary ext4 #{boot_size}Mib 100% \
118
- set 2 lvm on
119
- `
120
- end
121
-
122
- setup_partitions(data[:system_settings][:boot_size])
123
-
124
- def setup_lvm(scheme, swap_size, home_size = false)
125
- `pvcreate /dev/sda2`
126
- `vgcreate vg0 /dev/sda2`
127
- `lvcreate -L #{swap_size}Mib vg0 -n swap`
128
- if scheme == "/boot, /root and /home"
129
- `lvcreate -L #{home_size}Mib vg0 -n home`
130
- end
131
- `lvcreate -l 100%FREE vg0 -n root`
132
-
133
- `mkfs.ext4 /dev/vg0/root`
134
- `mount /dev/vg0/root /mnt`
135
-
136
- if scheme == "/boot, /root and /home"
137
- `mkfs.ext4 /dev/vg0/home`
138
- `mount /dev/vg0/home /mnt/home`
139
- end
140
-
141
- `mkfs.fat -F32 /dev/sda1`
142
- `mkdir /mnt/boot`
143
- `mount /dev/sda1 /mnt/boot`
144
-
145
- `mkswap /dev/vg0/swap`
146
- `swapon /dev/vg0/swap`
147
- end
148
-
149
- if data[:system_settings][:partition] == "/boot, /root and /home"
150
- setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
151
- else
152
- setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
153
- end
154
-
155
- # setup encryption
156
-
157
- def setup_packages
158
- `pacman -Sy`
159
- `pacstrap /mnt base base-devel linux linux-firmware lvm2 mkinitcpio reflector man-db nano vi fuse wget openbsd-netcat dhcpcd samba openssh openvpn unzip vim git zsh`
160
- `genfstab -U /mnt >> /mnt/etc/fstab`
161
- end
162
-
163
- setup_packages
164
-
165
- def setup_chroot(lang, keymap, password)
166
- `arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl -s https://ipapi.co/timezone)" /etc/localtime`
167
- `arch-chroot /mnt hwclock --systohc`
168
-
169
- `echo "#{lang}.UTF-8" > /mnt/etc/locale.gen`
170
- `arch-chroot /mnt locale-gen`
171
- `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
172
- `echo "KEYMAP=#{keymap}" > /mnt/etc/vconsole.conf`
173
- `echo "warding" > /mnt/etc/hostname`
174
- `echo "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
175
-
176
- `echo -e "#{password}\n#{password}" | arch-chroot /mnt passwd`
177
-
178
- `sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
179
- `arch-chroot /mnt mkinitcpio -p linux 2>/dev/null`
180
- `arch-chroot /mnt pacman -S intel-ucode --noconfirm`
181
- end
182
-
183
- setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
184
-
185
- def setup_bootloader(loader)
186
- if loader == "systemd-boot"
187
- `arch-chroot /mnt bootctl install 2>/dev/null`
188
- `echo "title Warding Linux
189
- linux /vmlinuz-linux
190
- initrd /intel-ucode.img
191
- initrd /initramfs-linux.img
192
- options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
193
- else
194
- # TODO: grub
195
- end
196
- end
197
-
198
- setup_bootloader(data[:system_settings][:bootloader])
199
-
200
- def setup_usability
201
- `arch-chroot /mnt systemctl enable dhcpcd`
202
- `arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh`
203
- `arch-chroot /mnt wget -qO- https://blackarch.org/strap.sh | sh`
204
- end
205
-
206
- setup_usability
207
-
208
- def setup_visuals
209
- `arch-chroot /mnt pacman -S xorg-server xf86-video-intel plasma konsole dolphin kmix sddm kvantum-qt5`
210
- `mkdir -p /mnt/etc/sddm.conf.d`
211
- `echo "[Theme]\nCurrent=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
212
- `echo "[Autologin]\nUser=root" > /mnt/etc/sddm.conf.d/login.conf`
213
- `arch-chroot /mnt systemctl enable sddm`
214
- `arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install.sh | sh`
215
- `arch-chroot /mnt wget -qO- https://git.io/papirus-icon-theme-install | sh`
216
- end
217
-
218
- setup_visuals if data[:extra_settings].include?("desktop-emvironment")
219
-
220
- def setup_tools
221
- `arch-chroot /mnt pacman -S nmap impacket go ruby php firefox atom hashcat john jre-openjdk proxychains-ng exploitdb httpie metasploit bind-tools radare2 sqlmap wpscan xclip --noconfirm`
222
- `arch-chroot /mnt mkdir -p /usr/share/wordlists`
223
- `arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Passwords/Leaked-Databases/rockyou.txt.tar.gz -O /usr/share/wordlists/rockyou.txt.tar.gz`
224
- `arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Discovery/Web-Content/common.txt -O /usr/share/wordlists/common.txt`
225
- end
226
-
227
- setup_tools if data[:extra_settings].include?("hacking-tools")
228
-
229
- def setup_cron
230
- `arch-chroot /mnt pacman -S cronie --noconfirm`
231
- `arch-chroot /mnt systemctl enable cronie`
232
- `echo "#!/bin/bash\nreflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist" > /mnt/etc/cron.hourly/mirrorlist; chmod +x /mnt/etc/cron.hourly/mirrorlist`
233
- `echo "#!/bin/bash\npacman -Sy" > /mnt/etc/cron.weekly/pacman-sync; chmod +x /mnt/etc/cron.weekly/pacman-sync`
234
- `echo "#!/bin/bash\npacman -Syu --noconfirm" > /mnt/etc/cron.monthly/system-upgrade; chmod +x /mnt/etc/cron.monthly/system-upgrade`
235
- end
236
-
237
- setup_cron if data[:extra_settings].include?("crons")
238
-
239
- def finish
240
- `umount -R /mnt`
241
- `reboot`
242
- end
243
-
244
- finish
245
- end
246
- end
247
- end
248
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "warding/version"
4
+ require "tty-prompt"
5
+
6
+ module Warding
7
+ class Error < StandardError; end
8
+
9
+ class Installer
10
+ @@prompt = TTY::Prompt.new
11
+
12
+ def banner
13
+ puts <<~'EOF'
14
+
15
+ ( ( (
16
+ )\))( ' ) ( )\ ) ( ( (
17
+ ((_)()\ ) ( /( )( (()/( )\ ( )\))(
18
+ _(())\_)() )(_)) (()\ ((_)) ((_) )\ ) ((_))\
19
+ \ \((_)/ /((_)_ ((_) _| | (_) _(_/( (()(_)
20
+ \ \/\/ / / _` | | '_| / _` | | | | ' \)) / _` |
21
+ \_/\_/ \__,_| |_| \__,_| |_| |_||_| \__, |
22
+ |___/
23
+
24
+ EOF
25
+ end
26
+
27
+ def check
28
+ unless `uname -a`.include?("archiso")
29
+ @@prompt.error("Exiting...")
30
+ @@prompt.warn("Warding can only be installed from within the live ISO context!")
31
+ exit!
32
+ end
33
+
34
+ unless `[ -d /sys/firmware/efi ] && echo true`.include?("true")
35
+ @@prompt.error("UEFI/EFI must be enabled to install warding")
36
+ exit!
37
+ end
38
+ end
39
+
40
+ def gather
41
+ locales_list = %w[en-US es-ES pt-BR ru-RU fr-FR it-IT de-DE ja-JP ko-KR zh-CN]
42
+ keymaps_list = %w[us uk br en fr de zh ru it es]
43
+
44
+ parsed_input = @@prompt.collect do
45
+ key(:update_mirrors).yes?("Update mirrorlist?")
46
+ key(:system_language).select("Pick the desired system language:", locales_list)
47
+ key(:keyboard_keymap).select("Pick your keyboard layout:", keymaps_list)
48
+
49
+ unless @@prompt.yes?("Set timezone automatically?", default: true)
50
+ key(:update_timezone).ask("Enter timezone:", required: true)
51
+ end
52
+
53
+ key(:root_password).mask("Insert new root password:", required: true)
54
+
55
+ key(:system_settings) do
56
+ bootloader = key(:bootloader).select("Which bootloader to use?", %w[systemd-boot grub])
57
+ partitions = key(:partitions).select(
58
+ "Select partition scheme to use:", ["/boot and /root", "/boot, /root and /home"]
59
+ )
60
+
61
+ key(:boot_size).slider("Boot drive partition size (MiB):", min: 512, max: 4096, default: 1024, step: 128)
62
+
63
+ if partitions == "/boot, /root and /home"
64
+ key(:home_size).slider("Home partition size (MiB):", min: 2048, max: 8192, default: 4096, step: 256)
65
+ end
66
+
67
+ key(:swap_size).slider("Swap partition size (MiB):", min: 1024, max: 8192, default: 2048, step: 256)
68
+
69
+ if @@prompt.yes?("Enable encryption?", default: false)
70
+ key(:encryption_settings) do
71
+ key(:encryption_mode).expand("Which cryptic setup to use?") do |q|
72
+ if partitions == "/boot, /root and /home"
73
+ q.choice key: "m", name: "minimal (/home only)" do :minimal end
74
+ q.choice key: "s", name: "safe (/home, /var, /tmp and swap)", value: :safe
75
+ end
76
+ q.choice key: "p", name: "paranoid (full disk encryption, except /boot)", value: :paranoid
77
+ q.choice key: "i", name: "insane (full disk encryption)", value: :insane if bootloader == "grub"
78
+ end
79
+ key(:encryption_key).mask("Insert the encryption key:", required: true)
80
+ end
81
+ end
82
+ end
83
+
84
+ key(:extra_settings).multi_select("Select extra options:", %w[desktop-environment hacking-tools crons])
85
+ end
86
+
87
+ parsed_input
88
+ end
89
+
90
+ def install(data)
91
+ if @@prompt.yes?("Confirm settings and continue?")
92
+
93
+ @@prompt.say("Installing, please wait...")
94
+
95
+ def setup_mirrors
96
+ `reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
97
+ end
98
+
99
+ setup_mirrors if data[:update_mirrors]
100
+
101
+ def setup_timezone(timezone = false)
102
+ `timedatectl set-ntp true`
103
+ if timezone
104
+ `timedatectl set-timezone #{timezone}`
105
+ else
106
+ `timedatectl set-timezone "$(curl -s https://ipapi.co/timezone)"`
107
+ end
108
+ end
109
+
110
+ data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
111
+
112
+ def setup_partitions(boot_size)
113
+ `parted -s -a optimal /dev/sda \
114
+ mklabel gpt \
115
+ mkpart primary fat32 0% #{boot_size}Mib \
116
+ set 1 esp on \
117
+ mkpart primary ext4 #{boot_size}Mib 100% \
118
+ set 2 lvm on
119
+ `
120
+ end
121
+
122
+ setup_partitions(data[:system_settings][:boot_size])
123
+
124
+ def setup_lvm(scheme, swap_size, home_size = false)
125
+ `pvcreate /dev/sda2`
126
+ `vgcreate vg0 /dev/sda2`
127
+ `lvcreate -L #{swap_size}Mib vg0 -n swap`
128
+ if scheme == "/boot, /root and /home"
129
+ `lvcreate -L #{home_size}Mib vg0 -n home`
130
+ end
131
+ `lvcreate -l 100%FREE vg0 -n root`
132
+
133
+ `mkfs.ext4 /dev/vg0/root`
134
+ `mount /dev/vg0/root /mnt`
135
+
136
+ if scheme == "/boot, /root and /home"
137
+ `mkfs.ext4 /dev/vg0/home`
138
+ `mount /dev/vg0/home /mnt/home`
139
+ end
140
+
141
+ `mkfs.fat -F32 /dev/sda1`
142
+ `mkdir /mnt/boot`
143
+ `mount /dev/sda1 /mnt/boot`
144
+
145
+ `mkswap /dev/vg0/swap`
146
+ `swapon /dev/vg0/swap`
147
+ end
148
+
149
+ if data[:system_settings][:partition] == "/boot, /root and /home"
150
+ setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
151
+ else
152
+ setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
153
+ end
154
+
155
+ # setup encryption
156
+
157
+ def setup_packages
158
+ `pacman -Syy`
159
+ `pacstrap /mnt base base-devel linux linux-firmware lvm2 mkinitcpio reflector man-db nano vi fuse wget openbsd-netcat dhcpcd samba openssh openvpn unzip vim git zsh`
160
+ `genfstab -U /mnt >> /mnt/etc/fstab`
161
+ end
162
+
163
+ setup_packages
164
+
165
+ def setup_chroot(lang, keymap, password)
166
+ `arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl -s https://ipapi.co/timezone)" /etc/localtime`
167
+ `arch-chroot /mnt hwclock --systohc`
168
+
169
+ `echo "#{lang}.UTF-8" > /mnt/etc/locale.gen`
170
+ `arch-chroot /mnt locale-gen`
171
+ `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
172
+ `echo "KEYMAP=#{keymap}" > /mnt/etc/vconsole.conf`
173
+ `echo "warding" > /mnt/etc/hostname`
174
+ `echo "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
175
+
176
+ `echo -e "#{password}\n#{password}" | arch-chroot /mnt passwd`
177
+
178
+ `sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
179
+ `arch-chroot /mnt mkinitcpio -p linux 2>/dev/null`
180
+ `arch-chroot /mnt pacman -S intel-ucode --noconfirm`
181
+ end
182
+
183
+ setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
184
+
185
+ def setup_bootloader(loader)
186
+ if loader == "systemd-boot"
187
+ `arch-chroot /mnt bootctl install 2>/dev/null`
188
+ `echo "title Warding Linux
189
+ linux /vmlinuz-linux
190
+ initrd /intel-ucode.img
191
+ initrd /initramfs-linux.img
192
+ options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
193
+ else
194
+ # TODO: grub
195
+ end
196
+ end
197
+
198
+ setup_bootloader(data[:system_settings][:bootloader])
199
+
200
+ def setup_usability
201
+ `arch-chroot /mnt systemctl enable dhcpcd`
202
+
203
+ `arch-chroot /mnt sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"`
204
+
205
+ `wget -q https://blackarch.org/keyring/blackarch-keyring.pkg.tar.xz{,.sig}`
206
+ `gpg --keyserver hkp://pgp.mit.edu --recv-keys 4345771566D76038C7FEB43863EC0ADBEA87E4E3 > /dev/null 2>&1`
207
+ `gpg --keyserver-options no-auto-key-retrieve --with-fingerprint blackarch-keyring.pkg.tar.xz.sig > /dev/null 2>&1`
208
+ `rm blackarch-keyring.pkg.tar.xz.sig`
209
+ `pacman-key --init`
210
+ `pacman --config /dev/null --noconfirm -U blackarch-keyring.pkg.tar.xz`
211
+ `pacman-key --populate`
212
+ `pacman -Syy`
213
+ end
214
+
215
+ setup_usability
216
+
217
+ def setup_visuals
218
+ `arch-chroot /mnt pacman -S xorg-server xf86-video-intel plasma konsole dolphin kmix sddm kvantum-qt5`
219
+ `mkdir -p /mnt/etc/sddm.conf.d`
220
+ `echo "[Theme]\nCurrent=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
221
+ `echo "[Autologin]\nUser=root" > /mnt/etc/sddm.conf.d/login.conf`
222
+ `arch-chroot /mnt systemctl enable sddm`
223
+ `arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install.sh | sh`
224
+ `arch-chroot /mnt wget -qO- https://git.io/papirus-icon-theme-install | sh`
225
+ end
226
+
227
+ setup_visuals if data[:extra_settings].include?("desktop-emvironment")
228
+
229
+ def setup_tools
230
+ `arch-chroot /mnt pacman -S nmap impacket go ruby php firefox atom hashcat john jre-openjdk proxychains-ng exploitdb httpie metasploit bind-tools radare2 sqlmap wpscan xclip --noconfirm`
231
+ `arch-chroot /mnt mkdir -p /usr/share/wordlists`
232
+ `arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Passwords/Leaked-Databases/rockyou.txt.tar.gz -O /usr/share/wordlists/rockyou.txt.tar.gz`
233
+ `arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Discovery/Web-Content/common.txt -O /usr/share/wordlists/common.txt`
234
+ end
235
+
236
+ setup_tools if data[:extra_settings].include?("hacking-tools")
237
+
238
+ def setup_cron
239
+ `arch-chroot /mnt pacman -S cronie --noconfirm`
240
+ `arch-chroot /mnt systemctl enable cronie`
241
+ `echo "#!/bin/bash\nreflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist" > /mnt/etc/cron.hourly/mirrorlist; chmod +x /mnt/etc/cron.hourly/mirrorlist`
242
+ `echo "#!/bin/bash\npacman -Sy" > /mnt/etc/cron.weekly/pacman-sync; chmod +x /mnt/etc/cron.weekly/pacman-sync`
243
+ `echo "#!/bin/bash\npacman -Syu --noconfirm" > /mnt/etc/cron.monthly/system-upgrade; chmod +x /mnt/etc/cron.monthly/system-upgrade`
244
+ end
245
+
246
+ setup_cron if data[:extra_settings].include?("crons")
247
+
248
+ def finish
249
+ `umount -R /mnt`
250
+ `reboot`
251
+ end
252
+
253
+ finish
254
+ end
255
+ end
256
+ end
257
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module Warding
4
- VERSION = "0.2.5"
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Warding
4
+ VERSION = "0.2.6"
5
+ end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlos Pomin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-18 00:00:00.000000000 Z
11
+ date: 2020-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
- rubygems_version: 3.1.2
68
+ rubygems_version: 3.0.3
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: Warding Linux installer.