warding 0.2.2 → 0.2.3

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: 81fa1b5b10e9a4384861450dcceafd24ec0261c98f3ce0dc04f0e603e667ebf5
4
+ data.tar.gz: eceff3e46e35301b583285e4dfae47b33354e70f4f189d7028355d661888d0f1
5
5
  SHA512:
6
- metadata.gz: 4a0a0cc120709fbf4a54fc15dff0e9eb7be9771770af18a30c2469b5611f7686a4467888d2c77c72a2e143c7f4e8dbc3483ed70f2ca7429fe3e30a9a77891080
7
- data.tar.gz: 1878c15ac726beb3aa05b976e80ff7436c829a35594fb44cf6cac908f8f2916f7a27c9dd06152b77553eef2ab61fdc79e838dff007e01b396b636df0f12338a6
6
+ metadata.gz: 42bdac299222725ab7c8f4b791653816d6165ae5bcdfac5226c42a8f90a2f6ed85997b63cc2d791222cafb05c98cd222c37471d3891d1ac54c9a503a5acd5021
7
+ data.tar.gz: 5f5dffce2b978e2707808d9c87c679f7381eb1ae79311c6fa3b75f90da5cf3b8c36aaee51aae7081415c499384e5ab72b0f6d6f14e15a0e6376eeb7de970b0b9
@@ -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"
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,19 @@ 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
 
19
23
  * Code missing features.
20
24
  * Add extra checks.
21
25
  * Test installation.
22
26
  * Add GitHub actions.
27
+ * Publish gem/package on GitHub.
23
28
 
24
29
  ## Contributing
25
30
 
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,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'warding/version'
4
- require 'tty-prompt'
3
+ require "warding/version"
4
+ require "tty-prompt"
5
5
 
6
6
  module Warding
7
7
  class Error < StandardError; end
@@ -25,13 +25,14 @@ module Warding
25
25
  end
26
26
 
27
27
  def check
28
- unless `uname -a`.include?('archiso')
29
- @@prompt.error('Exiting, this is not an Arch Linux distribution!')
28
+ unless `uname -a`.include?("archiso")
29
+ @@prompt.error("Exiting...")
30
+ @@prompt.warn("Warding can only be installed from within the live ISO context!")
30
31
  exit!
31
32
  end
32
33
 
33
- unless `[ -d /sys/firmware/efi ] && echo true`.include?('true')
34
- @@prompt.error('UEFI/EFI must be enabled to install warding')
34
+ unless `[ -d /sys/firmware/efi ] && echo true`.include?("true")
35
+ @@prompt.error("UEFI/EFI must be enabled to install warding")
35
36
  exit!
36
37
  end
37
38
  end
@@ -41,53 +42,53 @@ module Warding
41
42
  keymaps_list = %w[us uk br en fr de zh ru it es]
42
43
 
43
44
  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)
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)
47
48
 
48
- unless @@prompt.yes?('Set timezone automatically?', default: true)
49
- key(:update_timezone).ask('Enter timezone:', required: true)
49
+ unless @@prompt.yes?("Set timezone automatically?", default: true)
50
+ key(:update_timezone).ask("Enter timezone:", required: true)
50
51
  end
51
52
 
52
- key(:root_password).mask('Insert new root password:', required: true)
53
+ key(:root_password).mask("Insert new root password:", required: true)
53
54
 
54
55
  key(:system_settings) do
55
- bootloader = key(:bootloader).select('Which bootloader to use?', %w[systemd-boot grub])
56
+ bootloader = key(:bootloader).select("Which bootloader to use?", %w[systemd-boot grub])
56
57
  partitions = key(:partitions).select(
57
- 'Select partition scheme to use:', ['/boot and /root', '/boot, /root and /home']
58
+ "Select partition scheme to use:", ["/boot and /root", "/boot, /root and /home"]
58
59
  )
59
60
 
60
- key(:boot_size).slider('Boot drive partition size (MiB):', min: 512, max: 4096, default: 1024, step: 128)
61
+ key(:boot_size).slider("Boot drive partition size (MiB):", min: 512, max: 4096, default: 1024, step: 128)
61
62
 
62
- if partitions == '/boot, /root and /home'
63
- key(:home_size).slider('Home partition size (MiB):', min: 2048, max: 8192, default: 4096, step: 256)
63
+ if partitions == "/boot, /root and /home"
64
+ key(:home_size).slider("Home partition size (MiB):", min: 2048, max: 8192, default: 4096, step: 256)
64
65
  end
65
66
 
66
- key(:swap_size).slider('Swap partition size (MiB):', min: 1024, max: 8192, default: 2048, step: 256)
67
+ key(:swap_size).slider("Swap partition size (MiB):", min: 1024, max: 8192, default: 2048, step: 256)
67
68
 
68
- if @@prompt.yes?('Enable encryption?', default: false)
69
+ if @@prompt.yes?("Enable encryption?", default: false)
69
70
  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
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
74
75
  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'
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"
77
78
  end
78
- key(:encryption_key).mask('Insert the encryption key:', required: true)
79
+ key(:encryption_key).mask("Insert the encryption key:", required: true)
79
80
  end
80
81
  end
81
82
  end
82
83
 
83
- key(:extra_settings).multi_select('Select extra options:', %w[tools themes cron])
84
+ key(:extra_settings).multi_select("Select extra options:", %w[tools themes cron])
84
85
  end
85
86
 
86
87
  parsed_input
87
88
  end
88
89
 
89
90
  def install(data)
90
- if @@prompt.yes?('Confirm settings and continue?')
91
+ if @@prompt.yes?("Confirm settings and continue?")
91
92
 
92
93
  @@prompt.say("Installing, please wait...")
93
94
 
@@ -97,7 +98,7 @@ module Warding
97
98
 
98
99
  setup_mirrors if data[:update_mirrors]
99
100
 
100
- def setup_timezone(timezone=false)
101
+ def setup_timezone(timezone = false)
101
102
  `timedatectl set-ntp true`
102
103
  if timezone
103
104
  `timedatectl set-timezone #{timezone}`
@@ -120,11 +121,11 @@ module Warding
120
121
 
121
122
  setup_partitions(data[:system_settings][:boot_size])
122
123
 
123
- def setup_lvm(scheme, swap_size, home_size=false)
124
+ def setup_lvm(scheme, swap_size, home_size = false)
124
125
  `pvcreate /dev/sda2`
125
126
  `vgcreate vg0 /dev/sda2`
126
127
  `lvcreate -L #{swap_size}Mib vg0 -n swap`
127
- if scheme == '/boot, /root and /home'
128
+ if scheme == "/boot, /root and /home"
128
129
  `lvcreate -L #{home_size}Mib vg0 -n home`
129
130
  end
130
131
  `lvcreate -l 100%FREE vg0 -n root`
@@ -132,7 +133,7 @@ module Warding
132
133
  `mkfs.ext4 /dev/vg0/root`
133
134
  `mount /dev/vg0/root /mnt`
134
135
 
135
- if scheme == '/boot, /root and /home'
136
+ if scheme == "/boot, /root and /home"
136
137
  `mkfs.ext4 /dev/vg0/home`
137
138
  `mount /dev/vg0/home /mnt/home`
138
139
  end
@@ -145,7 +146,7 @@ module Warding
145
146
  `swapon /dev/vg0/swap`
146
147
  end
147
148
 
148
- if data[:system_settings][:partition] == '/boot, /root and /home'
149
+ if data[:system_settings][:partition] == "/boot, /root and /home"
149
150
  setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size], data[:system_settings[:home_size]])
150
151
  else
151
152
  setup_lvm(data[:system_settings][:partition], data[:system_settings][:swap_size])
@@ -170,9 +171,7 @@ module Warding
170
171
  `echo "LANG=#{lang}.UTF-8" > /mnt/etc/locale.conf`
171
172
  `echo KEYMAP=#{keymap} > /mnt/etc/vconsole.conf`
172
173
  `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`
174
+ `echo "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 warding.localdomain warding" > /mnt/etc/hosts`
176
175
 
177
176
  `arch-chroot /mnt echo -e "#{password}\n#{password}" | passwd`
178
177
 
@@ -185,7 +184,7 @@ module Warding
185
184
  setup_chroot(data[:system_language], data[:keyboard_keymap], data[:root_password])
186
185
 
187
186
  def setup_bootloader(loader)
188
- if loader == 'systemd-boot'
187
+ if loader == "systemd-boot"
189
188
  `arch-chroot /mnt bootctl install`
190
189
  `echo "title Warding Linux
191
190
  linux /vmlinuz-linux
@@ -203,10 +202,8 @@ module Warding
203
202
  # TODO: include gnome desktop
204
203
  `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
204
  `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`
205
+ `echo "[Theme]\nCurrent=breeze" > /mnt/etc/sddm.conf.d/theme.conf`
206
+ `echo "[Autologin]\nUser=root" > /mnt/etc/sddm.conf.d/login.conf`
210
207
  `arch-chroot /mnt systemctl enable dhcpcd`
211
208
  `arch-chroot /mnt systemctl enable sddm`
212
209
  `arch-chroot /mnt wget -qO- https://blackarch.org/strap.sh | sh`
@@ -220,7 +217,7 @@ module Warding
220
217
  `arch-chroot /mnt wget -qO- https://git.io/papirus-icon-theme-install | sh`
221
218
  end
222
219
 
223
- setup_visuals if data[:extra_settings].include?('themes')
220
+ setup_visuals if data[:extra_settings].include?("themes")
224
221
 
225
222
  def setup_extras
226
223
  `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`
@@ -229,7 +226,7 @@ module Warding
229
226
  `arch-chroot /mnt wget -q https://github.com/danielmiessler/SecLists/raw/master/Discovery/Web-Content/common.txt -O /usr/share/wordlists/common.txt`
230
227
  end
231
228
 
232
- setup_extras if data[:extra_settings].include?('tools')
229
+ setup_extras if data[:extra_settings].include?("tools")
233
230
 
234
231
  def setup_cron
235
232
  # TODO: include crons
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Warding
4
- VERSION = '0.2.2'
4
+ VERSION = "0.2.3"
5
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.3
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-17 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:
@@ -33,13 +33,12 @@ extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - ".gitignore"
36
+ - ".rubocop.yml"
36
37
  - Gemfile
37
38
  - Gemfile.lock
38
39
  - LICENSE
39
40
  - README.md
40
41
  - Rakefile
41
- - bin/console
42
- - bin/setup
43
42
  - bin/warding
44
43
  - lib/warding.rb
45
44
  - lib/warding/version.rb
@@ -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