Table of Contents

Configs

Install Script

For a new install, I built a bash script to tweak a new system out of the box for how I like things:

  1. Builds and installs a color prompt (user and root)
  2. Updates sources.list for a standard Debian Testing install (optional)
  3. Downloads and installs my custom .vimrc file
  4. Downloads and installs my gman1.vim colorscheme
  5. Download here: configure_me.sh | Full URL

Full URL:

https://nix.kedrovsky.net/_media/config_script/configure_me.sh

.bashrc

Old Kali PS1 color prompts (which are pretty cool).

root:

PS1='\[\e[0;36m\]\t \[\e[0;33m\][\[\e[0;31m\]\u\[\e[0;33m\]] \[\e[0;32m\]\h \[\e[0;31m\][\w]\e[0m\]\$\[\e[m\]\[\e[0;32m\] '

user:

PS1='\[\e]0;\u@\h: \w\a\]\[\e[0;36m\]\t \[\e[0;33m\][\[\e[0;37m\]\u\[\e[0;33m\]] \[\e[0;32m\]\h \[\e[0;31m\][\w]\e[0m\]\$\[\e[m\]\[\e[0;37m\] '

user

## Add additional dirs to my path
export PATH="$PATH:$HOME"      # add home dir to path
# export PATH="$PATH:$HOME/bin"  # I put poweroff, reboot, ifconfig here

## User-defined aliases
alias ls='ls --color --group-directories-first'

PS1='\[\e[1;33m\]'   # set color (yellow)
PS1+='['             # opening bracket

PS1+='\[\e[1;34m\]'  # set color (blue)
PS1+='\u'            # user

PS1+='\[\e[1;31m\]'  # set color (red)
PS1+='@'             # separator

PS1+='\[\e[1;33m\]'  # set color (yellow)
PS1+='\h'            # host

PS1+='\[\e[1;37m\]'  # set color (white)
PS1+=':'

PS1+='\[\e[1;36m\]'  # set color (cyan)
PS1+='\w'            # working directory

PS1+='\[\e[1;33m\]'  # set color (yellow)
PS1+=']'             # closing bracket

PS1+='\[\e[0m\]'     # end ch (text reset)

PS1+='$ '            # $ for normal user

export PS1

## Reference:
# Codes:
#  https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
# Colors:
#  https://unix.stackexchange.com/questions/124407/what-color-codes-can-i-use-in-my-ps1-prompt#124408

root

# GAK root .bashrc

## User-defined aliases
alias ls='ls --color --group-directories-first'

PS1='\[\e[1;33m\]'     # set color (yellow)
PS1+='['               # opening bracket

PS1+='\[\e[1;31m\]'    # set color (red)
PS1+='\u'              # user

PS1+='\[\e[1;37m\]'    # set color (white)
PS1+='@'               # separator

PS1+='\[\e[1;33m\]'    # set color (yellow)
PS1+='\h'              # host

PS1+='\[\e[1;37m\]'    # set color (white)
PS1+=':'               # separator

PS1+='\[\e[1;36m\]'    # set color (cyan)
PS1+='\w'              # working directory

PS1+='\[\e[1;33m\]'    # set color (yellow)
PS1+=']'               # closing bracket

PS1+='\[\e[0m\]'       # end ch (text reset)

PS1+='# '              # hash (#) for root

export PS1

## Reference:
# Codes:
#  https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
# Colors:
#  https://unix.stackexchange.com/questions/124407/what-color-codes-can-i-use-in-my-ps1-prompt#124408

Boot to CLI

In Debian:

systemctl set-default multi-user.target # boot to cli (runlevels 2,3,4)
systemctl set-default graphical.target  # boot to graphical (runlevel 5)

GenMon

XFCE General Monitor Panel App

I wanted to get my VPN address on the panel so I could easily see it to work on some TryHackMe rooms.

#!/usr/bin/zsh

if [ -e /sys/class/net/tun0 ]
then
    hostname -I | awk '{print$2}'
else
    echo "Not Connected"
fi

sources.list

The entries in this file normally follow this format (example only).

deb http://site.example.com/debian distribution component1 component2 component3
deb-src http://site.example.com/debian distribution component1 component2 component3

The distribution can be either the release code name (stretch, buster, bullseye, sid) or the release class name (old stable, stable, testing, unstable). If you mean to be tracking a release class then use the class name, if you want to track a Debian point release, use the code name.

At the time I'm writing this…

Stable is exactly what it means. Testing has been 80-90% okay for me over the years… but it's a pain the sphincter when it's not.

Source.list Generator: https://debgen.simplylinux.ch/index.php

source.list for stable:

#-------------------------------------------------------------------#
#               OFFICIAL DEBIAN REPOS - STABLE                      #
#-------------------------------------------------------------------#

deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free

deb http://deb.debian.org/debian stable-updates main contrib non-free
deb-src http://deb.debian.org/debian stable-updates main contrib non-free

# deb http://deb.debian.org/debian stable-backports main contrib non-free
# deb-src http://deb.debian.org/debian stable-backports main contrib non-free

deb http://security.debian.org/debian-security/ stable-security main contrib non-free
deb-src http://security.debian.org/debian-security/ stable-security main contrib non-free

source.list for Bullseye (testing, for now–OUT OF DATE… needs some attention…):

#-------------------------------------------------------------------#
#         OFFICIAL DEBIAN REPOS - TESTING / BULLSEYE                #
#-------------------------------------------------------------------#

deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free

deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free

deb http://deb.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security bullseye-security main contrib non-free

VIM

Column Indicators

If you have Vim >= v7.3, add this to your .vimrc to highlight column 72 (where comments should end) and 80 and onward (so 79 is your last valid column for lines of code; per PEP 8):

let &colorcolumn="72,".join(range(80,999),",")

You need to set the ColorColumn highlight (shorthand: hi) color in your color scheme. Add the following to your color scheme file (for a black background this color works okay; your mileage may vary… see color codes here):

hi ColorColumn ctermbg=233

## The following line includes a setting for the vim GUI:
# hi ColorColumn ctermbg=233 guibg=#2c2d27

You can find your colorschemes here:

/usr/share/vim/vim82/colors

If you don't know which colorscheme vim is currently using, open up vim, type “:” and in the bottom command line enter colorscheme and hit ENTER.

If you want to see what colorschemes are available, after entering colorscheme, enter a space then tab. You can use your arrow keys to move left and right. ENTER to select the one you want. If you want to make that scheme permanent, you have to add it to your .vimrc (include your colorscheme name where I have gman1):

" Change the color scheme
" install color scheme in /usr/share/vim/vim74/colors/
colorscheme gman1

.vimrc

"" Greg's .vimrc
" Ideas: http://vim.wikia.com/wiki/Example_vimrc

" Enable syntax highlighting
syntax on

" Better command-line completion
set wildmenu

" Show partial commands in the last line of the screen
set showcmd

" Display line numbers on the left
set number

" Display line numbers above and below, relative to current
" Makes yanking a bunch of lines that much easier.
" set relativenumber

" Hybrid line numbers
" https://jeffkreeftmeijer.com/vim-number/
augroup numbertoggle
  autocmd!
  autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu   | endif
  autocmd BufLeave,FocusLost,InsertEnter,WinLeave   * if &nu                  | set nornu | endif
augroup END

" Enable smart handling of the tab key
set smarttab

" Use spaces instead of tabs
set expandtab

" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4

" ColorScheme Crap
" install color scheme in /usr/share/vim/vim74/colors/
" The t_Co=256 line should not be needed unles... 
"  Your term emulator or termcap/terminfo db is configured incorrectly.
"  Or you're using tmux.
set t_Co=256
" Choose the color scheme loaded by default
colorscheme gman1

" Disable autocomment character insertion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o

" Set a column marker at 72 -- comments <= 72 char
" Set a different color for column 80 and beyond -- code lines <= 79 char
" Color for column markers is set in the colorscheme
let &colorcolumn="72,".join(range(80,999),",")

" Settings for a different colored current line number
" Color for the line number is set in the colorscheme: CursorLineNR
set cursorline
set cursorlineopt=number

" End

vim colorscheme

Create a text file named gman1.vim (for example) and paste in the text below.

" Vim colorscheme -- gman1
"
" Created specifically for Python
" Based on PyChimp by Pratheek <pratheek.i@gmail.com>
"
" This colorscheme is specifically created, to work in a translucent
" background provided by terminal and supports 256 color terminals
" Tip -- add <t_Co=256> in your ~/.vimrc to utilize the theme well. 

" ctermfg (for setting the foreground)
" ctermbg (for setting the background)
" cterm   (for additional properties)

" 256 Color Cheat Sheet:
" https://www.ditig.com/256-colors-cheat-sheet

let g:colors_name = "gman1"

" The Basic (Normal) Text Style

hi Normal      ctermfg=253  ctermbg=NONE  cterm=NONE 

" All the Python related stuff 

hi Number       ctermfg=141  ctermbg=NONE  cterm=NONE
hi Float        ctermfg=141  ctermbg=NONE  cterm=NONE
hi Statement    ctermfg=226  ctermbg=NONE  cterm=NONE
hi Function     ctermfg=35   ctermbg=NONE  cterm=NONE
hi Conditional  ctermfg=208  ctermbg=NONE  cterm=NONE
hi Operator     ctermfg=226  ctermbg=NONE  cterm=NONE
hi Todo         ctermfg=253  ctermbg=NONE  cterm=bold
hi Comment      ctermfg=69   ctermbg=NONE  cterm=NONE
hi Special      ctermfg=81   ctermbg=NONE  cterm=NONE
hi String       ctermfg=169  ctermbg=NONE  cterm=NONE
hi Include      ctermfg=118  ctermbg=NONE  cterm=bold
hi Constant     ctermfg=178  ctermbg=NONE  cterm=bold
hi Error        ctermfg=88   ctermbg=172   cterm=bold
hi PreProc      ctermfg=81   ctermbg=NONE  cterm=NONE
hi Boolean      ctermfg=38   ctermbg=NONE  cterm=bold
hi Character    ctermfg=142  ctermbg=NONE  cterm=NONE

"Vim Stuff

hi Visual       ctermfg=253  ctermbg=235   cterm=NONE
hi VertSplit    ctermfg=232  ctermbg=244   cterm=NONE
hi ErrorMsg     ctermfg=88   ctermbg=172   cterm=bold
hi MatchParen   ctermfg=11   ctermbg=NONE  cterm=bold
hi Folded       ctermfg=67   ctermbg=16    cterm=bold 
hi FoldColumn   ctermfg=67   ctermbg=16    cterm=NONE
hi LineNr       ctermfg=102  ctermbg=NONE  cterm=NONE
hi CursorLineNR ctermfg=202  ctermbg=NONE  cterm=none
hi NonText      ctermfg=58   ctermbg=NONE  cterm=NONE
hi Pmenu        ctermfg=81   ctermbg=16    cterm=NONE
hi PmenuSel     ctermfg=202  ctermbg=16    cterm=NONE
hi PmenuSbar    ctermfg=81   ctermbg=16    cterm=NONE
hi PmenuThumb   ctermfg=81   ctermbg=16    cterm=NONE 
hi Search       ctermfg=253  ctermbg=66    cterm=NONE
hi IncSearch    ctermfg=253  ctermbg=66    cterm=NONE
hi TabLine      ctermfg=3    ctermbg=NONE  cterm=NONE
hi TabLineSel   ctermfg=14   ctermbg=NONE  cterm=bold
hi TabLineFill  ctermfg=46   ctermbg=NONE  cterm=NONE

" Set column markers at colomn 72 and 80ff
hi ColorColumn  ctermbg=233  ctermbg=NONE  cterm=NONE

fstab NTFS

Options and setup for NTFS partition (sharing / data partition) in Linux. You will likely need to do run the id command from the command line to find your uid and gid.

UUID=[use blkid to find it] /mnt/data ntfs-3g  user,big_write,uid=1000,gid=1000,dmask=0022,fmask=0011  0  0

Kali

root

Kali made the spectacular decision to drop the default root policy and then not even allow you to configure a root password (i.e., log in as root) when you install.

To configure password-less root rights for your normal user (but you still have no access to applications that are only in root's PATH):

sudo apt install kali-grant-root
sudo dpkg-reconfigure kali-grant-root

Better: Unlock the root login. Just give root a password, log out, then log in as root:

sudo su -  # do this as a normal user, give your password; you become root
passwd     # add a password to root's account; log out, log in, shiny

Ah… happiness again in the land of hacker penguins

os-prober

After grub v2.06 os-prober is disabled by default, therefore your fresh, shiny, new Kali install will not recognize other operating systems (like Windoze). If this happens, then add this to your /etc/default/grub file:

# file: /etc/default/grub

GRUB_DISABLE_OS_PROBER=false

Then run: update-grub. If that doesn't do the try, try: grub-mkconfig (or possibly grub-mkconfig -o /boot/grub/grub.cfg)

For more on grub: see here.


Fluxbox

For a quick, lite Debian install…

  1. Install a base Debian system without any desktop environment.
  2. After you can boot to the command line…
  3. Install xorg, then fluxbox (good how-to, except I installed xorg before flux).