warding 0.2.2 → 0.2.7

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: 6664d72129e9eb2f510103cc7db9e6643e7302c3fd2a32a58d20af3ab1c913b2
4
- data.tar.gz: 94929749291032b927fc2315b7eb576840bdc8a7f630f5186cc407a38c03f85b
3
+ metadata.gz: 80f1a448f9e2dca165d0ae31d4d745b2bd6641a768d2455d64086bb04132a098
4
+ data.tar.gz: d6afdd80c3497c2a6fd39dda60ebdcedb63d02483116c8ee68b0861f079f93a1
5
5
  SHA512:
6
- metadata.gz: 4a0a0cc120709fbf4a54fc15dff0e9eb7be9771770af18a30c2469b5611f7686a4467888d2c77c72a2e143c7f4e8dbc3483ed70f2ca7429fe3e30a9a77891080
7
- data.tar.gz: 1878c15ac726beb3aa05b976e80ff7436c829a35594fb44cf6cac908f8f2916f7a27c9dd06152b77553eef2ab61fdc79e838dff007e01b396b636df0f12338a6
6
+ metadata.gz: 3baef4c001d534fc9dcb595fb10b4b222121e2a161980c153856bee1365db895055b29b644f14739bba69b59535b9cf84359c7c3df69f52be676f8648916b10f
7
+ data.tar.gz: 5acd8f21a504566276ad9e54a6407307bca3ea3b9e16f7d2001dadc8f80b60f62615f7fc4fac49f77caec34c6f1cf9c8563d13c80b1d0caed57e8f7301f7f22c
@@ -0,0 +1,35 @@
1
+ name: Ruby Gem
2
+ on:
3
+ release:
4
+ types: [created]
5
+ jobs:
6
+ build:
7
+ name: Build/Publish
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby 2.6
12
+ uses: actions/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.6.x
15
+ - name: Publish to GPR
16
+ run: |
17
+ mkdir -p $HOME/.gem
18
+ touch $HOME/.gem/credentials
19
+ chmod 0600 $HOME/.gem/credentials
20
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
21
+ gem build *.gemspec
22
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
23
+ env:
24
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
25
+ OWNER: ${{ github.repository_owner }}
26
+ - name: Publish to RubyGems
27
+ run: |
28
+ mkdir -p $HOME/.gem
29
+ touch $HOME/.gem/credentials
30
+ chmod 0600 $HOME/.gem/credentials
31
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
32
+ gem build *.gemspec
33
+ gem push *.gem
34
+ env:
35
+ GEM_HOST_API_KEY: "Bearer ${{secrets.RUBYGEMS_AUTH_TOKEN}}"
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/
@@ -0,0 +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
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rake', '~> 12.0'
8
- gem 'tty-prompt'
7
+ gem "rake", "~> 12.0"
8
+ gem "tty-prompt"
@@ -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,6 +1,6 @@
1
- # Warding
1
+ # Warding [![Gem Version](https://badge.fury.io/rb/warding.svg)](https://badge.fury.io/rb/warding)
2
2
 
3
- > Custom Arch Linux designed for security assessments and pentesting.
3
+ > Custom Arch Linux installer designed for security assessments and pentesting.
4
4
 
5
5
  ## Installation
6
6
 
@@ -12,14 +12,22 @@ gem install warding
12
12
 
13
13
  ## Usage
14
14
 
15
- WIP.
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.
16
20
 
17
- ## Todo
21
+ ## Tasklist
18
22
 
23
+ * Add sddm and gdm extra confs.
24
+ * Refactor.
25
+ * Suppress outputs.
26
+ * Add AUR support.
19
27
  * Code missing features.
20
28
  * Add extra checks.
21
- * Test installation.
22
29
  * Add GitHub actions.
30
+ * Publish gem/package on GitHub.
23
31
 
24
32
  ## Contributing
25
33
 
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
3
+ require "bundler/gem_tasks"
4
4
  task default: :spec
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'warding'
4
+ require "warding"
5
5
 
6
6
  # create a new installer
7
7
  warding = Warding::Installer.new
@@ -1,246 +1,288 @@
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, this is not an Arch Linux distribution!')
30
- exit!
31
- end
32
-
33
- unless `[ -d /sys/firmware/efi ] && echo true`.include?('true')
34
- @@prompt.error('UEFI/EFI must be enabled to install warding')
35
- exit!
36
- end
37
- end
38
-
39
- def gather
40
- locales_list = %w[en-US es-ES pt-BR ru-RU fr-FR it-IT de-DE ja-JP ko-KR zh-CN]
41
- keymaps_list = %w[us uk br en fr de zh ru it es]
42
-
43
- parsed_input = @@prompt.collect do
44
- key(:update_mirrors).yes?('Update mirrorlist?')
45
- key(:system_language).select('Pick the desired system language:', locales_list)
46
- key(:keyboard_keymap).select('Pick your keyboard layout:', keymaps_list)
47
-
48
- unless @@prompt.yes?('Set timezone automatically?', default: true)
49
- key(:update_timezone).ask('Enter timezone:', required: true)
50
- end
51
-
52
- key(:root_password).mask('Insert new root password:', required: true)
53
-
54
- key(:system_settings) do
55
- bootloader = key(:bootloader).select('Which bootloader to use?', %w[systemd-boot grub])
56
- partitions = key(:partitions).select(
57
- 'Select partition scheme to use:', ['/boot and /root', '/boot, /root and /home']
58
- )
59
-
60
- key(:boot_size).slider('Boot drive partition size (MiB):', min: 512, max: 4096, default: 1024, step: 128)
61
-
62
- if partitions == '/boot, /root and /home'
63
- key(:home_size).slider('Home partition size (MiB):', min: 2048, max: 8192, default: 4096, step: 256)
64
- end
65
-
66
- key(:swap_size).slider('Swap partition size (MiB):', min: 1024, max: 8192, default: 2048, step: 256)
67
-
68
- if @@prompt.yes?('Enable encryption?', default: false)
69
- key(:encryption_settings) do
70
- key(:encryption_mode).expand('Which cryptic setup to use?') do |q|
71
- if partitions == '/boot, /root and /home'
72
- q.choice key: 'm', name: 'minimal (/home only)' do :minimal end
73
- q.choice key: 's', name: 'safe (/home, /var, /tmp and swap)', value: :safe
74
- end
75
- q.choice key: 'p', name: 'paranoid (full disk encryption, except /boot)', value: :paranoid
76
- q.choice key: 'i', name: 'insane (full disk encryption)', value: :insane if bootloader == 'grub'
77
- end
78
- key(:encryption_key).mask('Insert the encryption key:', required: true)
79
- end
80
- end
81
- end
82
-
83
- key(:extra_settings).multi_select('Select extra options:', %w[tools themes cron])
84
- end
85
-
86
- parsed_input
87
- end
88
-
89
- def install(data)
90
- if @@prompt.yes?('Confirm settings and continue?')
91
-
92
- @@prompt.say("Installing, please wait...")
93
-
94
- def setup_mirrors
95
- `reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
96
- end
97
-
98
- setup_mirrors if data[:update_mirrors]
99
-
100
- def setup_timezone(timezone=false)
101
- `timedatectl set-ntp true`
102
- if timezone
103
- `timedatectl set-timezone #{timezone}`
104
- else
105
- `timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)"`
106
- end
107
- end
108
-
109
- data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
110
-
111
- def setup_partitions(boot_size)
112
- `parted -s -a optimal /dev/sda \
113
- mklabel gpt \
114
- mkpart primary fat32 0% #{boot_size}Mib \
115
- set 1 esp on \
116
- mkpart primary ext4 #{boot_size}Mib 100% \
117
- set 2 lvm on
118
- `
119
- end
120
-
121
- setup_partitions(data[:system_settings][:boot_size])
122
-
123
- def setup_lvm(scheme, swap_size, home_size=false)
124
- `pvcreate /dev/sda2`
125
- `vgcreate vg0 /dev/sda2`
126
- `lvcreate -L #{swap_size}Mib vg0 -n swap`
127
- if scheme == '/boot, /root and /home'
128
- `lvcreate -L #{home_size}Mib vg0 -n home`
129
- end
130
- `lvcreate -l 100%FREE vg0 -n root`
131
-
132
- `mkfs.ext4 /dev/vg0/root`
133
- `mount /dev/vg0/root /mnt`
134
-
135
- if scheme == '/boot, /root and /home'
136
- `mkfs.ext4 /dev/vg0/home`
137
- `mount /dev/vg0/home /mnt/home`
138
- end
139
-
140
- `mkfs.fat -F32 /dev/sda1`
141
- `mkdir /mnt/boot`
142
- `mount /dev/sda1 /mnt/boot`
143
-
144
- `mkswap /dev/vg0/swap`
145
- `swapon /dev/vg0/swap`
146
- end
147
-
148
- if data[:system_settings][:partition] == '/boot, /root and /home'
149
- setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
150
- else
151
- setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
152
- end
153
-
154
- # setup encryption
155
-
156
- def setup_packages
157
- `pacman -Sy`
158
- `pacstrap /mnt base base-devel`
159
- `genfstab -U /mnt >> /mnt/etc/fstab`
160
- end
161
-
162
- setup_packages
163
-
164
- def setup_chroot(lang, keymap, password)
165
- `arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl --fail https://ipapi.co/timezone)" /etc/localtime`
166
- `arch-chroot /mnt hwclock --systohc`
167
-
168
- `echo "#{lang}.UTF-8" > /mnt/etc/locale.gen`
169
- `arch-chroot /mnt locale-gen`
170
- `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
171
- `echo KEYMAP=#{keymap} > /mnt/etc/vconsole.conf`
172
- `echo "warding" > /mnt/etc/hostname`
173
- `echo "127.0.0.1 localhost
174
- ::1 localhost
175
- 127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
176
-
177
- `arch-chroot /mnt echo -e "#{password}\n#{password}" | passwd`
178
-
179
- `arch-chroot /mnt pacman -Sy linux lvm2 mkinitcpio --noconfirm`
180
- `sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
181
- `arch-chroot /mnt mkinitcpio -p linux`
182
- `arch-chroot /mnt pacman -S intel-ucode --noconfirm`
183
- end
184
-
185
- setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
186
-
187
- def setup_bootloader(loader)
188
- if loader == 'systemd-boot'
189
- `arch-chroot /mnt bootctl install`
190
- `echo "title Warding Linux
191
- linux /vmlinuz-linux
192
- initrd /intel-ucode.img
193
- initrd /initramfs-linux.img
194
- options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
195
- else
196
- # TODO: grub
197
- end
198
- end
199
-
200
- setup_bootloader(data[:system_settings][:bootloader])
201
-
202
- def setup_usability
203
- # TODO: include gnome desktop
204
- `arch-chroot /mnt pacman -S nano fuse wget cmake openbsd-netcat dhcpcd samba openssh openvpn unzip vim xorg-server xf86-video-intel plasma konsole dolphin kmix sddm wget git kvantum-qt5 zsh --noconfirm`
205
- `mkdir /mnt/etc/sddm.conf.d`
206
- `echo "[Theme]
207
- Current=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
208
- `echo "[Autologin]
209
- User=root" > /mnt/etc/sddm.conf.d/login.conf`
210
- `arch-chroot /mnt systemctl enable dhcpcd`
211
- `arch-chroot /mnt systemctl enable sddm`
212
- `arch-chroot /mnt wget -qO- https://blackarch.org/strap.sh | sh`
213
- `arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh`
214
- end
215
-
216
- setup_usability
217
-
218
- def setup_visuals
219
- `arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install.sh | sh`
220
- `arch-chroot /mnt wget -qO- https://git.io/papirus-icon-theme-install | sh`
221
- end
222
-
223
- setup_visuals if data[:extra_settings].include?('themes')
224
-
225
- def setup_extras
226
- `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`
227
- `arch-chroot /mnt mkdir -p /usr/share/wordlists`
228
- `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`
229
- `arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Discovery/Web-Content/common.txt -O /usr/share/wordlists/common.txt`
230
- end
231
-
232
- setup_extras if data[:extra_settings].include?('tools')
233
-
234
- def setup_cron
235
- # TODO: include crons
236
- end
237
-
238
- def finish
239
- `reboot`
240
- end
241
-
242
- finish
243
- end
244
- end
245
- end
246
- 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(:desktop_environment).select("Select your desktop environment:", %w[plasma gnome none])
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
+ # update mirrorlist
97
+ `reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
98
+ end
99
+
100
+ setup_mirrors if data[:update_mirrors]
101
+
102
+ def setup_timezone(timezone = false)
103
+ # set clock
104
+ `timedatectl set-ntp true`
105
+ # set timezone
106
+ if timezone
107
+ `timedatectl set-timezone #{timezone}`
108
+ else
109
+ `timedatectl set-timezone "$(curl -s https://ipapi.co/timezone)"`
110
+ end
111
+ end
112
+
113
+ data[:update_timezone] ? setup_timezone(data[:update_timezone]) : setup_timezone
114
+
115
+ def setup_partitions(boot_size)
116
+ # create partitions
117
+ `parted -s -a optimal /dev/sda \
118
+ mklabel gpt \
119
+ mkpart primary fat32 0% #{boot_size}Mib \
120
+ set 1 esp on \
121
+ mkpart primary ext4 #{boot_size}Mib 100% \
122
+ set 2 lvm on
123
+ `
124
+ end
125
+
126
+ setup_partitions(data[:system_settings][:boot_size])
127
+
128
+ def setup_lvm(scheme, swap_size, home_size = false)
129
+ # create physical volume
130
+ `pvcreate /dev/sda2`
131
+ # create virtual group
132
+ `vgcreate vg0 /dev/sda2`
133
+ # create logical volumes
134
+ `lvcreate -L #{swap_size}Mib vg0 -n swap`
135
+ if scheme == "/boot, /root and /home"
136
+ `lvcreate -L #{home_size}Mib vg0 -n home`
137
+ end
138
+ `lvcreate -l 100%FREE vg0 -n root`
139
+ # make and mount root fs
140
+ `mkfs.ext4 /dev/vg0/root`
141
+ `mount /dev/vg0/root /mnt`
142
+ # make and mount home folder
143
+ if scheme == "/boot, /root and /home"
144
+ `mkfs.ext4 /dev/vg0/home`
145
+ `mount /dev/vg0/home /mnt/home`
146
+ end
147
+ # make and mount boot partition
148
+ `mkfs.fat -F32 /dev/sda1`
149
+ `mkdir /mnt/boot`
150
+ if data[:system_settings][:bootloader] == "systemd-boot"
151
+ `mount /dev/sda1 /mnt/boot`
152
+ else
153
+ `mount /dev/sda1 /mnt/boot/efi`
154
+ end
155
+ # setup swap
156
+ `mkswap /dev/vg0/swap`
157
+ `swapon /dev/vg0/swap`
158
+ end
159
+
160
+ if data[:system_settings][:partition] == "/boot, /root and /home"
161
+ setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
162
+ else
163
+ setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
164
+ end
165
+
166
+ def setup_packages
167
+ # update packages list
168
+ `pacman -Syy`
169
+ # install base system
170
+ `pacstrap /mnt base base-devel linux linux-firmware lvm2 mkinitcpio dmidecode reflector networkmanager cronie man-db nano vi fuse wget openbsd-netcat dhcpcd samba openssh openvpn unzip vim git zsh`
171
+ # generate fstab
172
+ `genfstab -U /mnt >> /mnt/etc/fstab`
173
+ end
174
+
175
+ setup_packages
176
+
177
+ def setup_chroot(lang, keymap, password)
178
+ # set timezone
179
+ `arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl -s https://ipapi.co/timezone)" /etc/localtime`
180
+ # update clock
181
+ `arch-chroot /mnt hwclock --systohc`
182
+ # set locale
183
+ `echo "#{lang}.UTF-8 UTF-8" > /mnt/etc/locale.gen`
184
+ `arch-chroot /mnt locale-gen`
185
+ `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
186
+ # set keymap
187
+ `echo "KEYMAP=#{keymap}" > /mnt/etc/vconsole.conf`
188
+ # update hostname
189
+ `echo "warding" > /mnt/etc/hostname`
190
+ # update hosts
191
+ `echo "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
192
+ # update root password
193
+ `echo -e "#{password}\n#{password}" | arch-chroot /mnt passwd`
194
+ # update hooks
195
+ `sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
196
+ # recompile initramfs
197
+ `arch-chroot /mnt mkinitcpio -p linux`
198
+ # add intel microcode
199
+ `arch-chroot /mnt pacman -S intel-ucode --noconfirm`
200
+ end
201
+
202
+ setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
203
+
204
+ def setup_bootloader(loader)
205
+ # setup systemd-boot
206
+ if loader == "systemd-boot"
207
+ `arch-chroot /mnt bootctl install`
208
+ `echo "title Warding Linux
209
+ linux /vmlinuz-linux
210
+ initrd /intel-ucode.img
211
+ initrd /initramfs-linux.img
212
+ options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
213
+ else
214
+ # setup grub
215
+ `arch-chroot /mnt pacman -S grub efibootmgr --noconfirm`
216
+ `arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB`
217
+ `arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg`
218
+ end
219
+ end
220
+
221
+ setup_bootloader(data[:system_settings][:bootloader])
222
+
223
+ def setup_usability
224
+ # enable internet
225
+ `arch-chroot /mnt systemctl enable NetworkManager`
226
+ # add cron jobs
227
+ `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`
228
+ `echo "#!/bin/bash\npacman -Sy" > /mnt/etc/cron.weekly/pacman-sync; chmod +x /mnt/etc/cron.weekly/pacman-sync`
229
+ `echo "#!/bin/bash\npacman -Syu --noconfirm" > /mnt/etc/cron.monthly/system-upgrade; chmod +x /mnt/etc/cron.monthly/system-upgrade`
230
+ # enable cron jobs
231
+ `arch-chroot /mnt systemctl enable cronie`
232
+ # change default shell
233
+ `arch-chroot /mnt chsh -s $(which zsh)"`
234
+ # setup blackarch's keyring
235
+ `wget -q https://blackarch.org/keyring/blackarch-keyring.pkg.tar.xz{,.sig}`
236
+ `gpg --keyserver hkp://pgp.mit.edu --recv-keys 4345771566D76038C7FEB43863EC0ADBEA87E4E3 > /dev/null 2>&1`
237
+ `gpg --keyserver-options no-auto-key-retrieve --with-fingerprint blackarch-keyring.pkg.tar.xz.sig > /dev/null 2>&1`
238
+ `rm blackarch-keyring.pkg.tar.xz.sig`
239
+ `pacman-key --init`
240
+ `pacman --config /dev/null --noconfirm -U blackarch-keyring.pkg.tar.xz`
241
+ `pacman-key --populate`
242
+ # update package list
243
+ `pacman -Syy`
244
+ # check if on VM
245
+ if `dmidecode -s system-manufacturer`.include?("VMware, Inc.")
246
+ # install and enable VMware utils
247
+ `arch-chroot /mnt pacman -S openvpn-vm-tools --noconfirm`
248
+ `arch-chroot /mnt systemctl enable vmtoolsd`
249
+ end
250
+ end
251
+
252
+ setup_usability
253
+
254
+ def setup_visuals(theme = "none")
255
+ if theme == "none"
256
+ break
257
+ elsif theme == "kde"
258
+ # install packages
259
+ `arch-chroot /mnt pacman -S xorg-server xf86-video-intel plasma konsole dolphin kmix sddm kvantum-qt5`
260
+ # create conf dir
261
+ `mkdir -p /mnt/etc/sddm.conf.d`
262
+ # fix theme
263
+ `echo "[Theme]\nCurrent=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
264
+ # enable autologin
265
+ `echo "[Autologin]\nUser=root" > /mnt/etc/sddm.conf.d/login.conf`
266
+ # enable sddm
267
+ `arch-chroot /mnt systemctl enable sddm`
268
+ else
269
+ # install packages
270
+ `arch-chroot /mnt pacman -S xf86-video-intel gnome`
271
+ # enable gdm
272
+ `arch-chroot /mnt systemctl enable gdm`
273
+ end
274
+ end
275
+
276
+ setup_visuals(data[:desktop_environment])
277
+
278
+ def finish
279
+ # end
280
+ `umount -R /mnt`
281
+ `reboot`
282
+ end
283
+
284
+ finish
285
+ end
286
+ end
287
+ end
288
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module Warding
4
- VERSION = '0.2.2'
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Warding
4
+ VERSION = "0.2.7"
5
+ end
@@ -1,30 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'lib/warding/version'
3
+ require_relative "lib/warding/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'warding'
6
+ spec.name = "warding"
7
7
  spec.version = Warding::VERSION
8
- spec.authors = ['Marlos Pomin']
9
- spec.email = ['marlospomin@gmail.com']
8
+ spec.authors = ["Marlos Pomin"]
9
+ spec.email = ["marlospomin@gmail.com"]
10
10
 
11
- spec.summary = 'Warding Linux installer.'
12
- spec.description = 'Custom Arch Linux designed for security assessments and pentesting.'
13
- spec.homepage = 'https://github.com/marlospomin/warding'
14
- spec.license = 'MIT'
11
+ spec.summary = "Warding Linux installer."
12
+ spec.description = "Custom Arch Linux installer designed for security assessments and pentesting."
13
+ spec.homepage = "https://github.com/marlospomin/warding"
14
+ spec.license = "MIT"
15
15
 
16
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
17
17
 
18
- spec.metadata['homepage_uri'] = spec.homepage
19
- spec.metadata['source_code_uri'] = 'https://github.com/marlospomin/warding'
20
- spec.metadata['changelog_uri'] = 'https://github.com/marlospomin/warding/releases'
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/marlospomin/warding"
20
+ spec.metadata["changelog_uri"] = "https://github.com/marlospomin/warding/releases"
21
21
 
22
22
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
24
  end
25
25
 
26
- spec.executables = ['warding']
27
- spec.require_paths = ['lib']
26
+ spec.executables = ["warding"]
27
+ spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency 'tty-prompt'
29
+ spec.add_runtime_dependency "tty-prompt"
30
30
  end
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.2
4
+ version: 0.2.7
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-14 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: Custom Arch Linux designed for security assessments and pentesting.
27
+ description: Custom Arch Linux installer designed for security assessments and pentesting.
28
28
  email:
29
29
  - marlospomin@gmail.com
30
30
  executables:
@@ -32,14 +32,14 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".github/workflows/default.yml"
35
36
  - ".gitignore"
37
+ - ".rubocop.yml"
36
38
  - Gemfile
37
39
  - Gemfile.lock
38
40
  - LICENSE
39
41
  - README.md
40
42
  - Rakefile
41
- - bin/console
42
- - bin/setup
43
43
  - bin/warding
44
44
  - lib/warding.rb
45
45
  - lib/warding/version.rb
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubygems_version: 3.1.2
69
+ rubygems_version: 3.0.3
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: Warding Linux installer.
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'warding'
6
- require 'irb'
7
-
8
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
- # frozen_string_literal: true
3
- set -euo pipefail
4
- IFS=$'\n\t'
5
- set -vx
6
-
7
- bundle install