Teología 101

Porque no es tan difícil...

Herramientas de usuario

Herramientas del sitio


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: configureMe.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

sources.list

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

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

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

deb http://deb.debian.org/debian-security testing-security main
deb-src http://deb.debian.org/debian-security testing-security main

.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

" 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

" Change the color scheme
" install color scheme in /usr/share/vim/vim[##]/colors/
set t_Co=256
colorscheme gman1

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

" End

vim colorscheme

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

  • Copy your colorscheme file (gman1.vim) into: /usr/share/vim/vim[##]/colors/
  • Set the colorescheme in your .vimrc file (see above)
" 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. 

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=16   ctermbg=215   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 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

Reinstall GRUB

I triple boot O/Ss… so once in a while one will update and over-write my MBR. To get the correct GRUB into the MBR, boot into the preferred O/S and run (as root):

# grub-install /dev/sda  ## Assuming sda contains the MBR

Then:

# update-grub

Done.


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

Networking

See IP Info (pick one, they basically do the same thing):

 ifconfig -a        # Debian net-tools pkg
 ls /sys/class/net  # ls interface names
 ip a
 ip a show
 ip a show eth0

config: interfaces

You can set up as many network configs for as many interfaces as you want. Just set them up, comment them out, and when you want to use one remove the # and bring it up.

  • As root, edit: /etc/network/interfaces.
  • Note: Keep the loopback and everything else your *nix install put in there… you have been warned.
  • The following example assumes eth0 for wired network and wlan0 for wireless.
# +-------------------------+ #
# | Wired Network Interface | #
# +-------------------------+ #

# Comment out these lines if you want to manually bring up your network
    allow-hotplug eth0  # bring up the interface on a hotplug event like plugging in a usb cable
    auto eth0           # bring up the interface on boot

## The following w/o auto or allow-hotplug requires manual up.

## [1] STATIC (replace subnet with your own):
#iface eth0 inet static
#    address   192.168.0.100
#    netmask   255.255.255.0
#    network   192.168.0.0
#    gateway   192.168.0.1
#    broadcast 192.168.0.255

## [2] DHCP (one or the other):
#iface eth0 inet dhcp  # IPv4
#iface eth0 inet6 auto # IPv6

# +----------------------------+ #
# | Wireless Network Interface | #
# +----------------------------+ #

# Comment out these lines if you want to manually bring up your network
    allow-hotplug wlan0
    auto wlan0

## The following w/o auto or allow-hotplug requires manual up.

## [1] STATIC (replace subnet with your own; either WEP or WPA/WPA2):

# WEP static
#iface wlan0 inet static
#    address        10.0.0.10
#    netmask        255.255.255.0
#    network        10.0.0.0
#    gateway        10.0.0.1
#    broadcast      10.0.0.255
#    wireless-essid SSID_of_Router
#    wireless-key   Not_the_Passphrase_TheKEY

## WPA/WPA2 static
#iface wlan0 inet static
#    address   10.0.0.10
#    netmask   255.255.255.0
#    network   10.0.0.0
#    gateway   10.0.0.1
#    broadcast 10.0.0.255
#    wpa-ssid  SSID_of_Router
#    wpa-psk   PassPhrase

## [2] DHCP (either WEP or WPA/WPA2):

## WEP dhcp
#iface wlan0 inet dhcp
#    wireless-essid SSID_of_Router
#    wireless-key   Not_the_Passphrase_TheKEY
    
## WPA/WPA2 dhcp
#iface wlan0 inet dhcp
#    wpa-ssid SSID_of_Router
#    wpa-psk  PassPhrase

manual up/down

Manually bringing your network up and down (nixCraft has a good explanation):

  • Assuming eth0 (change for whichever interface you want to manipulate).

Generic Method:

ifdown eth0   # Turn off eth0
ifup eth0     # Turn on eth0

Debian Method (as root):

/etc/init.d/networking restart  # Restarts network interfaces, or stop/start... 
/etc/init.d/networking stop     # Stops network interfaces
/etc/init.d/networking start    # Starts network interfaces

systemctl restart networking    # For those with lovely systemd
systemctl status network        # See status of network systemd

ifupdown vs. ifconfig

Debian, overview:

  • ifup and ifdown control interfaces that are listed in /etc/network/interfaces.
  • ifconfig directly controls network interfaces (much like the newer ip command)

The ifupdown package: high-level network configuration

  • The ifup and ifdown commands may be used to configure or deconfigure network interfaces based on interface definitions in the file /etc/network/interfaces.
  • Example: bring up the network with ifup eth0 based on eth0 configuration in /etc/network/interfaces.
  • ifupdown will wrap ifconfig with the network configuration files (i.e., ifdown or ifup will execute ifconfig down or ifconfig up inside it). That means:
    • ifup eth0 will fetch the interface config file and bring up the interface with the correct IP address, mask, routes etc.
    • ifconfig eth0 up would just start the interface with no IP, etc. (important for sniffing in monitor mode because you don't want an IP address, etc.; you want an open broadcase).

The ifconfig command: a low-level network command (and deprecated, sadly)

  • An ifconfig up eth0 activates eth0 but does not setup IP addresses, etc.
  • An ifup eth0 sets up IP addresses and other options based on the interface's configuration in /etc/network/interfaces.

ip command

Usage of the ip command:

  • If your distro did not install ifconfig, you can install it in Debian with apt install net-tools.
  • Or you can use the horridly ugly syntax for ip (complex and hard-to-understand help can be found here or an easier-to-understand explanation here).
  • From the following example you will need to replace the IP and the interface with your own.

[1] Assign an IP address to a specific interface:

ip addr add 192.168.0.100/24 dev eth0

[2] Bring up the interface link (do NOT skip this step or you will get a “Network is unreachable” error!):

ip link set eth0 up

[3] Bring up the interface link:

ip route add default via 192.168.0.1

[1-3] All in one place… looks like this:

ip addr add 192.168.0.100/24 dev eth0
ip link set eth0 up
ip route add default via 192.168.0.1

Note on Persistence: This will only set up your network for your current work session. You'll lose it on reboot.

  • ip (like the old net-tools ifconfig stuff) interacts with /etc/network/interfaces, so put all your network configuration information there and just up/down your network with these commands:
/etc/init.d/networking restart  # Restarts network interfaces, or stop/start... 
/etc/init.d/networking stop     # Stops network interfaces
/etc/init.d/networking start    # Starts network interfaces

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.

  • When you install Kali Linux, you’ll be asked to create non-root user that will have admin privileges. Tools and commands that require root access will be run with sudo.
  • So you have to type sudu… sudo… sudo… sudo… (really, guys??).

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


Edit DokuWiki Sidebar

Go here: Sidebar

configs.txt · Última modificación: 2020/04/17 09:49 por gregkedro