Skip to content

🔐 Karlo Luiten

Think Evil, DO Good

🔐 Karlo Luiten

Think Evil, DO Good

  • Home
  • About me
    • About me
    • LinkedIn
    • Guide to Karlo
  • SELinux cheat sheet
  • CISSP Reference
  • Contact
    • Home
    • Linux
    • CLI and tools
CLI and tools Linux

Add a simple password to apache site

karlo May 11, 2023 0 Comments

To add a password to your site: apt install apache2-utils htpasswd -c /etc/apache2/.htpasswd user # Config <Directory "/var/www/html"> AuthType Basic AuthName "Restricted Content" AuthUserFile /etc/apache2/.htpasswd Require valid-user </Directory>

CLI and tools

SSH in for loop (consuming stdin / using file descriptor 3)

karlo May 7, 2023 0 Comments

Ever found yourself using a for/while loop using SSH in the loop, only to find out your loop only runs once? Your stdin is captured by ssh... This can be…

CLI and tools

Bash clear tmp files (for script) on exit (trap)

karlo May 7, 2023 0 Comments

TMP="$(mktemp -d)" trap 'rm -rf -- "$TMP"' EXIT

CLI and tools

Add Microsoft fonts (like Arial) to Nextcloud Office (Collabora)

karlo April 4, 2023 0 Comments

On Debian 11: apt install ttf-mscorefonts-installer -ydpkg-reconfigure fontconfig-configcoolconfig update-system-templatesystemctl restart coolwsd.service

CLI and tools Linux

Friendly (ionice/nice) rsync on remote server

karlo March 17, 2023 0 Comments

Add --rsync-path="ionice -c 3 nice rsync" to your rsync command (on sending side) Friendly for both sender and receiver: ionice -c3 nice rsync --rsync-path="ionice -c 3 nice rsync"

CLI and tools

jq unix timestamp to datetime

karlo January 11, 2023 0 Comments

| todateiso8601

CLI and tools

Bash script template

karlo October 28, 2022 0 Comments

#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then echo…

CLI and tools

Bash remove spaces from file names

karlo June 4, 2020 0 Comments

find . -depth -name '* *' \ | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

CLI and tools

Upgrade dumb shell to interactive shell (tty)

karlo January 29, 2020 0 Comments

python -c 'import pty; pty.spawn("/bin/bash")' yay python

CLI and tools

Bash sort IPs naturally

karlo November 12, 2019 0 Comments

sort -t . -k 3,3n -k 4,4n IPs

CLI and tools

bash add IP in PWD to variable for easy reference

karlo November 11, 2019 0 Comments

Add to .bashrc: export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} ip=\$( echo \$PWD | grep -oE '{1,3}\.{1,3}\.{1,3}\.{1,3}' ) " Now if you browse to/in a directory which has an ipv4 ip, the IP will…

CLI and tools

Easy AutoRecon summary (bash)

karlo November 11, 2019 0 Comments

echo "===SUMMARY===";grep . */report/notes.txt| while read line; do IP=$( echo -ne $line|cut -d'/' -f1| tr -d '\n' ); ] && echo; echo -n $IP ; echo -n $line | cut…

CLI and tools

Proxychains on fedora / centos7

karlo November 5, 2019 0 Comments

Clone the repo: https://github.com/rofl0r/proxychains-ng ./configure && make && sudo make install cp src/proxychains.conf /etc/proxychains.conf && vi /etc/proxychains.conf echo "alias p='/usr/local/bin/proxychains4'" >> ~/.bashrc && . .bashrc p ssh xx@ip

CLI and tools

Bash while loop input (stdin reading from while-input) fix

karlo October 26, 2019 0 Comments

while read line <&3; do echo "==== $line ===="; yes y | sqlmap -u http://$line/ --crawl=1; read -p press\ enter; done 3< webservers.ip Using input 3 to read your list,…

CLI and tools

Bash array operations and examples

karlo June 11, 2019 0 Comments

Split to array: while IFS=';' read -ra ADDR; do for i in "${ADDR}"; do # process "$i" done done <<< "$IN" Define: distro=("redhat" "debian" "gentoo") Element: ${ArrayName} Length: echo "${#distro}"…

CLI and tools

Bash color variables

karlo April 11, 2019 0 Comments

# Reset Color_Off='\033[0m' # Text Reset # Regular Colors Black='\033[0;30m' # Black Red='\033[0;31m' # Red Green='\033[0;32m' # Green Yellow='\033[0;33m' # Yellow Blue='\033[0;34m' # Blue Purple='\033[0;35m' # Purple Cyan='\033[0;36m' # Cyan…

CLI and tools

Bash add UTF8 (UTF-8) BOM to file

karlo January 31, 2019 0 Comments

sed -i '1s/^\(\xef\xbb\xbf\)\?/\xef\xbb\xbf/' foo-*

CLI and tools

Tail: prepend file name to tailing output (bash)

karlo September 4, 2018 0 Comments

cd /opt/arcsight/connectors/; tail -f *_con1_rsyslog_paloalto_2500*/current/logs/agent.out.wrapper.log | awk '/^==> / {a=substr($0, 5, length-8); next} {print a":"$0}'

CLI and tools

Personal (manual) template for internal hosts

karlo July 20, 2018 0 Comments

This might help someone else, too. These are the things I do for an internal VM (on my hypervisor at home). This document will/might evolve over time. Default OS is…

CLI and tools

Bash suppress all output of script (echo off – style)

karlo January 5, 2018 0 Comments

exec 1>/dev/null 2>/dev/null at the top of your script

CLI and tools

Bash compound commands (()){{}}{}[[]]

karlo November 1, 2016 0 Comments

Compound Commands A compound command is one of the following. In most cases a list in a command's description may be separated from the rest of the command by one…

CLI and tools

Bash inline number increase (( ++i ))

karlo November 1, 2016 0 Comments

i=0 (( ++i )) echo $i Will give 1

CLI and tools

Run programs without execute rights on file

karlo August 30, 2016 0 Comments

/bin/bash script.sh /lib64/ld-linux-x86-64.so.2 binary.bin /usr/bin/php file.php

CLI and tools

Bash keyboard shortcuts

karlo August 10, 2016 0 Comments

Found here: http://ss64.com/bash/syntax-keyboard.html Bash Keyboard Shortcuts Moving the cursor: Ctrl + a Go to the beginning of the line (Home) Ctrl + e Go to the End of the line…

CLI and tools

Self extracting zipped encrypted linux package

karlo March 7, 2016 0 Comments

#!/bin/bash T=`mktemp -d /tmp/$$XXXX`;trap "rm -rf $T" EXIT SIGINT; tail -n+3 $0|openssl enc -d -aes-256-cbc|tar zx -C $T;C=`pwd`; cd $T;./_;cd $C;exit 0 build: #!/bin/bash find . -name "*~" -delete TMP=`mktemp…

CLI and tools

Bash percentage calculate snippet

karlo September 5, 2014 0 Comments

MEMLINE=$( tac $MGRBASE/$REL_LOGLOC/server.status.log | egrep -m1 '\*\*.*Memory Status:' ) USED=$( echo "$MEMLINE" | egrep -o '+ MB Used' | sed 's/\..*//;s/,//' ) MAX=$( echo "$MEMLINE" | egrep -o '+ MB…

CLI and tools

Bash file age check snippet

karlo September 5, 2014 0 Comments

if ]; then #Check age if ]; then echo "Backup takes too long" else echo "Doing backup" fi fi

CLI and tools

[FIX] Clean up old puppet reports and reclaim mysql space (ibdata)

karlo November 13, 2013 0 Comments

MySQL for puppet dashboard gets BIG. You can make this smaller by deleting old records. Source for this article is here. To get the size in GB of the dashboard:…

CLI and tools

Bash get full path of file

karlo October 14, 2013 0 Comments

Get the full path of a file via: $ readlink -f ./file Tip: make an alias: alias fullpath='readlink -f'

CLI and tools

Dell Linux Dock display switcher script

karlo October 10, 2013 0 Comments

This might be helpful for someone. A quick script I made for changing output modes on my Dell laptop. There are different configurations. laptop: laptop screen only vga: vga output…

Posts navigation

1 2

Next Page »

Posts

  • Python upgrade venv python binary/version September 15, 2023
  • Git use different ssh key once September 12, 2023
  • TASK ERROR: zfs error: could not find any snapshots to destroy; check snapshot names. September 5, 2023
  • Upgrade postgresql cluster from 13 to 15 June 29, 2023
  • Upgrade debian 11 to 12 June 29, 2023
  • Elasticsearch start fail on debian 11 after install from ES repos May 16, 2023
  • Add a simple password to apache site May 11, 2023
  • Linux: add user to existing group May 11, 2023
  • Mikrotik RouterOS guest VLAN routed over ProtonVPN (2023) May 9, 2023
  • SSH in for loop (consuming stdin / using file descriptor 3) May 7, 2023
  • Bash clear tmp files (for script) on exit (trap) May 7, 2023
  • Apache2 (apache) forward https headers May 3, 2023
  • Postgres read long lines (wrap text) May 1, 2023
  • Install `strings` command in debian/linux April 30, 2023
  • SSH jump host config April 8, 2023
  • Wireguard site-to-site (proxmox to mikrotik/routeros) April 8, 2023
  • Masquerade ip forward for Proxmox on hetzner (single IP) April 7, 2023
  • Proxmox migrate to node outside of cluster April 7, 2023
  • Fix “Cannot remove image, a guest with VMID ‘xxx’ exists!” April 7, 2023
  • Add Microsoft fonts (like Arial) to Nextcloud Office (Collabora) April 4, 2023

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Posts

Uncategorized

Python upgrade venv python binary/version

Uncategorized

Git use different ssh key once

Uncategorized

TASK ERROR: zfs error: could not find any snapshots to destroy; check snapshot names.

Uncategorized

Upgrade postgresql cluster from 13 to 15

🔐 Karlo Luiten

Think Evil, DO Good

Copyright © All rights reserved | Blogus by Themeansar.