warding 0.1.0
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 +7 -0
- data/.gitignore +8 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +33 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +4 -0
- data/bin/console +8 -0
- data/bin/setup +7 -0
- data/bin/warding +15 -0
- data/lib/warding.rb +221 -0
- data/lib/warding/version.rb +5 -0
- data/warding.gemspec +28 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f3123c9bc47351bb1c1e034f6d17678c9488a43bcd53530f6585780ee11a9fa0
|
4
|
+
data.tar.gz: 20caf1e52981a0f4ef823a9499bfb2f2e0bf275f95428807d885b40824906775
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b4d282ad28fa2f4f4fd9d1d6330eaa6ac8d13dc10d25e6826c8e05f840d6b7b403ebd86dc629741360c301eb3b6dd5ed429c7b1a35658f1d4852428e2d492ad3
|
7
|
+
data.tar.gz: 842edc0b9b428379e9c5ac9fcd4834a88c48bd4a4c7132fbb95b5b7c14103663024af032ac8a934eb46c1398a85eb05c712849a67e0df4eacccfe31a774f262f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +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
|
data/LICENSE
ADDED
@@ -0,0 +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.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Warding
|
2
|
+
|
3
|
+
> Custom Arch Linux 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
|
+
WIP.
|
16
|
+
|
17
|
+
## Todo
|
18
|
+
|
19
|
+
* Code missing features.
|
20
|
+
* Add extra checks.
|
21
|
+
* Test installation.
|
22
|
+
* Add GitHub actions.
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/marlospomin/warding.
|
27
|
+
|
28
|
+
## License
|
29
|
+
|
30
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/bin/warding
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'warding'
|
5
|
+
|
6
|
+
# create a new installer
|
7
|
+
warding = Warding::Installer.new
|
8
|
+
# print banner
|
9
|
+
warding.banner
|
10
|
+
# check if everything is alright
|
11
|
+
warding.check
|
12
|
+
# gather inputs from the user
|
13
|
+
user_input = warding.gather
|
14
|
+
# install warding
|
15
|
+
warding.install(user_input)
|
data/lib/warding.rb
ADDED
@@ -0,0 +1,221 @@
|
|
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?('Arch')
|
29
|
+
@@prompt.error('Exiting, this is not an Arch Linux distribution!')
|
30
|
+
exit!
|
31
|
+
end
|
32
|
+
unless `[ -d /sys/firmware/efi ] && echo true`.include?('true')
|
33
|
+
@@prompt.error('UEFI/EFI must be enabled to install warding')
|
34
|
+
exit!
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def gather
|
39
|
+
locales_list = %w[en-US es-ES pt-BR ru-RU fr-FR it-IT de-DE ja-JP ko-KR zh-CN]
|
40
|
+
keymaps_list = %w[us uk br en fr de zh ru it es]
|
41
|
+
|
42
|
+
parsed_input = @@prompt.collect do
|
43
|
+
key(:update_mirrors).yes?('Update mirrorlist?')
|
44
|
+
key(:system_language).select('Pick the desired system language:', locales_list)
|
45
|
+
key(:keyboard_keymap).select('Pick your keyboard layout:', keymaps_list)
|
46
|
+
|
47
|
+
unless @@prompt.yes?('Set timezone automatically?', default: true)
|
48
|
+
key(:update_timezone).ask('Enter timezone:', required: true)
|
49
|
+
end
|
50
|
+
|
51
|
+
key(:root_password).mask('Insert new root password:', required: true)
|
52
|
+
|
53
|
+
key(:system_settings) do
|
54
|
+
bootloader = key(:bootloader).select('Which bootloader to use?', %w[systemd-boot grub])
|
55
|
+
partitions = key(:partitions).select(
|
56
|
+
'Select partition scheme to use:', ['/boot and /root', '/boot, /root and /home']
|
57
|
+
)
|
58
|
+
|
59
|
+
key(:boot_size).slider('Boot drive partition size (MiB):', min: 512, max: 4096, default: 1024, step: 128)
|
60
|
+
|
61
|
+
if partitions == '/boot, /root and /home'
|
62
|
+
key(:home_size).slider('Home partition size (MiB):', min: 2048, max: 8192, default: 4096, step: 256)
|
63
|
+
end
|
64
|
+
|
65
|
+
key(:swap_size).slider('Swap partition size (MiB):', min: 1024, max: 8192, default: 2048, step: 256)
|
66
|
+
|
67
|
+
if @@prompt.yes?('Enable encryption?', default: false)
|
68
|
+
key(:encryption_settings) do
|
69
|
+
key(:encryption_mode).expand('Which cryptic setup to use?') do |q|
|
70
|
+
if partitions == '/boot, /root and /home'
|
71
|
+
q.choice key: 'm', name: 'minimal (/home only)' do :minimal end
|
72
|
+
q.choice key: 's', name: 'safe (/home, /var, /tmp and swap)', value: :safe
|
73
|
+
end
|
74
|
+
q.choice key: 'p', name: 'paranoid (full disk encryption, except /boot)', value: :paranoid
|
75
|
+
q.choice key: 'i', name: 'insane (full disk encryption)', value: :insane if bootloader == 'grub'
|
76
|
+
end
|
77
|
+
key(:encryption_key).mask('Insert the encryption key:', required: true)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
key(:extra_settings).multi_select('Select extra options:', %w[tools themes cron])
|
83
|
+
end
|
84
|
+
|
85
|
+
parsed_input
|
86
|
+
end
|
87
|
+
|
88
|
+
def install(data)
|
89
|
+
if @@prompt.yes?('Confirm settings and continue?')
|
90
|
+
# setup mirrorlist
|
91
|
+
|
92
|
+
if data[:update_mirrors]
|
93
|
+
`pacman -Sy reflector --noconfirm`
|
94
|
+
`reflector --latest 25 --sort rate --save /etc/pacman.d/mirrorlist`
|
95
|
+
end
|
96
|
+
|
97
|
+
# setup timezone
|
98
|
+
|
99
|
+
`timedatectl set-ntp true`
|
100
|
+
|
101
|
+
if data[:update_timezone]
|
102
|
+
`timedatectl set-timezone #{data[:update_timezone]}`
|
103
|
+
else
|
104
|
+
`timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)"`
|
105
|
+
end
|
106
|
+
|
107
|
+
# setup paritions
|
108
|
+
|
109
|
+
`parted -s -a optimal /dev/sda \
|
110
|
+
mklabel gpt \
|
111
|
+
mkpart primary fat32 0% #{data[:system_settings][:boot_size]}Mib \
|
112
|
+
set 1 esp on \
|
113
|
+
mkpart primary ext4 #{data[:system_settings][:boot_size]}Mib 100% \
|
114
|
+
set 2 lvm on
|
115
|
+
`
|
116
|
+
|
117
|
+
`pvcreate /dev/sda2`
|
118
|
+
`vgcreate vg0 /dev/sda2`
|
119
|
+
`lvcreate -L #{data[:system_settings][:swap_size]}Mib vg0 -n swap`
|
120
|
+
`lvcreate -L #{data[:system_settings[:home_size]]}Mib vg0 -n home` if data[:system_settings][:partition] == '/boot, /root and /home'
|
121
|
+
`lvcreate -l 100%FREE vg0 -n root`
|
122
|
+
|
123
|
+
`mkfs.ext4 /dev/vg0/root`
|
124
|
+
`mount /dev/vg0/root /mnt`
|
125
|
+
|
126
|
+
if data[:system_settings][:partition] == '/boot, /root and /home'
|
127
|
+
`mkfs.ext4 /dev/vg0/home`
|
128
|
+
`mount /dev/vg0/home /mnt/home`
|
129
|
+
end
|
130
|
+
|
131
|
+
`mkfs.fat -F32 /dev/sda1`
|
132
|
+
`mkdir /mnt/boot`
|
133
|
+
|
134
|
+
`mkswap /dev/vg0/swap`
|
135
|
+
`swapon /dev/vg0/swap`
|
136
|
+
|
137
|
+
# setup encryption
|
138
|
+
|
139
|
+
# TODO: everything
|
140
|
+
|
141
|
+
# setup base packages
|
142
|
+
|
143
|
+
`pacman -S archlinux-keyring --noconfirm`
|
144
|
+
`pacstrap /mnt base base-devel`
|
145
|
+
`genfstab -U /mnt >> /mnt/etc/fstab`
|
146
|
+
|
147
|
+
# setup chroot
|
148
|
+
|
149
|
+
`arch-chroot /mnt ln -sf /usr/share/zoneinfo/"$(curl --fail https://ipapi.co/timezone)" /etc/localtime`
|
150
|
+
`arch-chroot /mnt hwclock --systohc`
|
151
|
+
|
152
|
+
`echo "#{data[:system_language]}.UTF-8" > /mnt/etc/locale.gen`
|
153
|
+
`arch-chroot /mnt locale-gen`
|
154
|
+
`echo "LANG=#{data[:system_language]}.UTF-8" > /mnt/etc/locale.conf`
|
155
|
+
|
156
|
+
`echo KEYMAP=#{data[:keyboard_keymap]} > /mnt/etc/vconsole.conf`
|
157
|
+
|
158
|
+
`echo "warding" > /mnt/etc/hostname`
|
159
|
+
|
160
|
+
`echo "127.0.0.1 localhost
|
161
|
+
::1 localhost
|
162
|
+
127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
|
163
|
+
|
164
|
+
`arch-chroot /mnt echo -e "#{data[:root_password]}\n#{data[root_password]}" | passwd`
|
165
|
+
|
166
|
+
`arch-chroot /mnt pacman -Sy archlinux-keyring linux lvm2 mkinitcpio --noconfirm`
|
167
|
+
|
168
|
+
`sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /mnt/etc/mkinitcpio.conf`
|
169
|
+
|
170
|
+
`arch-chroot /mnt mkinitcpio -p linux`
|
171
|
+
|
172
|
+
`arch-chroot /mnt pacman -S intel-ucode --noconfirm`
|
173
|
+
|
174
|
+
# bootloader
|
175
|
+
|
176
|
+
if data[:system_settings][:bootloader] == 'systemd-boot'
|
177
|
+
`arch-chroot /mnt bootctl install`
|
178
|
+
`echo "title Warding Linux
|
179
|
+
linux /vmlinuz-linux
|
180
|
+
initrd /intel-ucode.img
|
181
|
+
initrd /initramfs-linux.img
|
182
|
+
options root=/dev/vg0/root rw" > /mnt/boot/loader/entries/warding.conf`
|
183
|
+
else
|
184
|
+
# TODO: grub
|
185
|
+
end
|
186
|
+
|
187
|
+
# setup default packages
|
188
|
+
|
189
|
+
# TODO: include gnome desktop
|
190
|
+
`arch-chroot /mnt pacman -S make nano fuse wget automake cmake gcc autoconf openbsd-netcat dhcpcd samba openssh openvpn unzip vim xorg-server xf86-video-intel plasma konsole dolphin kmix sddm wget git kvantum-qt5 zsh --noconfirm`
|
191
|
+
|
192
|
+
`arch-chroot /mnt systemctl enable dhcpcd`
|
193
|
+
`arch-chroot /mnt systemctl enable sddm`
|
194
|
+
|
195
|
+
`arch-chroot /mnt wget -qO- https://blackarch.org/strap.sh | sh`
|
196
|
+
|
197
|
+
`arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh`
|
198
|
+
|
199
|
+
# setup themes
|
200
|
+
|
201
|
+
if data[:extra_settings].include?('themes')
|
202
|
+
`arch-chroot /mnt wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install.sh | sh`
|
203
|
+
`arch-chroot /mnt wget -qO- https://git.io/papirus-icon-theme-install | sh`
|
204
|
+
end
|
205
|
+
|
206
|
+
# setup extra tools
|
207
|
+
|
208
|
+
if data[:extra_settings].include?('tools')
|
209
|
+
`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`
|
210
|
+
`arch-chroot /mnt mkdir -p /usr/share/wordlists`
|
211
|
+
`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`
|
212
|
+
`arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Discovery/Web-Content/common.txt -O /usr/share/wordlists/common.txt`
|
213
|
+
end
|
214
|
+
|
215
|
+
# setup crons
|
216
|
+
|
217
|
+
# TODO: include crons
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
data/warding.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/warding/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'warding'
|
7
|
+
spec.version = Warding::VERSION
|
8
|
+
spec.authors = ['Marlos Pomin']
|
9
|
+
spec.email = ['marlospomin@gmail.com']
|
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'
|
15
|
+
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
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'
|
21
|
+
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.executables = ['warding']
|
27
|
+
spec.require_paths = ['lib']
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: warding
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marlos Pomin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Custom Arch Linux designed for security assessments and pentesting.
|
14
|
+
email:
|
15
|
+
- marlospomin@gmail.com
|
16
|
+
executables:
|
17
|
+
- warding
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- Gemfile
|
23
|
+
- Gemfile.lock
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/console
|
28
|
+
- bin/setup
|
29
|
+
- bin/warding
|
30
|
+
- lib/warding.rb
|
31
|
+
- lib/warding/version.rb
|
32
|
+
- warding.gemspec
|
33
|
+
homepage: https://github.com/marlospomin/warding
|
34
|
+
licenses:
|
35
|
+
- MIT
|
36
|
+
metadata:
|
37
|
+
homepage_uri: https://github.com/marlospomin/warding
|
38
|
+
source_code_uri: https://github.com/marlospomin/warding
|
39
|
+
changelog_uri: https://github.com/marlospomin/warding/releases
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 2.3.0
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubygems_version: 3.1.2
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Warding Linux installer.
|
59
|
+
test_files: []
|