ansible srv46.karloluiten.nl -m ansible.builtin.setup
RPM only list/query package names
rpm -qa –qf “%{NAME}\n”
Mount raw ovirt / kvm disk
losetup -f -P root.img
osetup -l
mount -o ro /dev/loop* /mnt/
Linux remove last newline from file
perl -pi -e ‘chomp if eof’ macaroon
newline remove
nc in powershell (test remote open port/tcp)
Test-NetConnection -Port 80 -InformationLevel "Detailed" -ComputerName example.com
Simple wireshark filter host+port
ip.src == 10.1.72.1 and tcp.port == 12228
Excel return text right of last occurrence of string
=TRIM(RIGHT(SUBSTITUTE(A1;” “;REPT(” “;LEN(A1)));LEN(A1)))
Update RHEL/CentOS from local repo (iso/cd)
sudo -i
mount -o loop /tmp/*77*.iso /mnt
cat > /etc/yum.repos.d/cd.repo
[cd]
name=cd
baseurl=file:///mnt/
enabled=1
gpgcheck=0
#[PRESS enter and CTRL-d]
yum clean all; rm -rf rm -rf /var/cache/yum; yum makecache fast
yum -y update --skip-broken
yum update
yum erase *devel
yum update kernel redhat-release
umount /mnt
rm -i /etc/yum.repos.d/cd.repo /tmp/*iso
cat /etc/redhat-release
reboot
Pihole CORS problems
Fix:
edit
/var/www/html/admin/scripts/pi-hole/php/auth.php
add your host names to
AUTHORIZED_HOSTNAMES
array
Move cygwin to different disk, including services
Stop all services, log out other users, in process explorer, add command line column, stop all in old pathIn cygwin, go to /cygdrive, cp -vR c/cygwin* d/mount -m > /usr/bin/mountCommands.bat
# not sure if we really need thisin explorer, rename c:/cygwin to OLD , log off all users if it fails, use lsof alternative if neededchange shortcut on desktop (C:\Users\Public\Desktop
)change start menu items ["C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cygwin\Cygwin64 Terminal.lnk"
]change NEWLOC/cygwin.batRegedit toHLM\system\CurrentControlSet\services\sshd and \cron and \syslog-ng
change paths (for all services, docygrunsrv -L
)cygrunsrv --stop sshd; cygrunsrv --remove sshd; cygrunsrv --install sshd --path /usr/sbin/sshd
Some more magic..?reboot
ubnt / ubiquiti edgerouter passwordless login ssh keys
ubnt@er4gw:~$ configure
[edit]
ubnt@er4gw# set system login user ubnt authentication public-keys lb7 type ssh-rsa
[edit]
ubnt@er4gw# set system login user ubnt authentication public-keys lb7 key AAAA****3tfv0vaEUl
ubnt@er4gw# commit
ubnt@er4gw# exit
Warning: configuration changes have not been saved.
ubnt@er4gw:~$ cd .ssh
ubnt@er4gw:~/.ssh$ cat au*
# Automatically generated by Vyatta configuration
# Do not edit, all changes will be lost
ssh-rsa AAAA****3tfv0vaEUl lb7
ubnt@er4gw:~/.ssh$ configure
[edit]
ubnt@er4gw# save
Convert m4b to mp3 on Centos/Fedora using ffmpeg
for m4b in *.m4b; do ffmpeg -i $m4b -acodec libmp3lame -ar 22050 ${m4b}.mp3; done
Bash remove spaces from file names
find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
AWK print longest line in file
awk ‘{ if (length($0) > max) {max = length($0); maxline = $0} } END { print maxline }’ YOURFILE
Outlook unblock “unsafe” attachments
Regedit, find:
Outlook 2007
[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security]
Outlook 2010
[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security]
Outlook 2013
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Security]
Outlook 2016, Outlook 2019 and Office 365
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security]
Level1Remove string
Value .cer;.exe;.xxx for the stuff you want to unblock.
Excel conditional formatting search for literal question mark [?]
Use ~? instead of ?
NPM (node) install fail as root
Do not install as root, or use –unsafe-perm
Windows “File is open in another program” (lsof in windows)
First get handle: https://docs.microsoft.com/en-us/sysinternals/downloads/handle
Run handle once without searching for anything, to accept license.
Run in a CMD AS ADMIN: handle64.exe > output.txt . Find the file you want. Then scroll up to header to see what proc is taking it.
Extend a LVM-based swap partition
Sometimes your swap is not large enough
[root@server ~]# free -g
total used free shared buff/cache available
Mem: 23 3 13 0 7 19
Swap: 1 0 1
[root@server ~]# grep swap /etc/fstab
/dev/mapper/vg00-swapvol swap swap defaults 0 0
[root@server ~]# swapoff /dev/mapper/vg00-swapvol
[root@server ~]# lvextend -L10g $_
Size of logical volume vg00/swapvol changed from 2.00 GiB (16 extents) to 10.00 GiB (80 extents).
Logical volume vg00/swapvol successfully resized.
[root@server ~]# mkswap $_
mkswap: /dev/mapper/vg00-swapvol: warning: wiping old swap signature.
Setting up swapspace version 1, size = 10485756 KiB
no label, UUID=xxx
[root@server ~]# swapon $_
[root@server ~]# free -g
total used free shared buff/cache available
Mem: 23 3 13 0 7 19
Swap: 9 0 9
Fix bricked firmware update jabra (evolve)
Get firmware from support site. Then update via “C:\Program Files (x86)\Jabra\SDKFirmwareUpdater\JabraFwUpdater.exe”
Tmux save all output (history) to file
bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
Add above in tmux.conf. Then do Prefix+Shift+P
Upgrade dumb shell to interactive shell (tty)
python -c ‘import pty; pty.spawn(“/bin/bash”)’
yay python
Excel return last line of multi line cell
=TRIM(RIGHT(SUBSTITUTE(B5,CHAR(10),REPT(” “;200));200))
Especially useful for project trackers. Add a LEFT(XXX;10) for returning dates.
Keeping a (GitHub) fork up to date with upstream master
1. Clone your fork:
git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
2. Add remote from original repository in your forked repository:
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
3. Updating your fork from original repo to keep up with their changes:
git pull upstream master
MySQL / MariaDB DB and user creation
create user ‘nextcloud’@’localhost’ identified by ‘xxx’;
create database nextcloud;
grant all privileges on nextcloud.* to ‘nextcloud’@’localhost’ identified by ‘xxx’;
FLUSH PRIVILEGES;
AutoRecon over proxychains
Since we have no icmp/ping over proxychains, we have to change syntax a bit
~/svn/proxychains-ng/proxychains4 -f ~/proxychains.conf ~/svn/AutoRecon/autorecon.py –nmap ‘\-sT \-Pn’ 10.1.1.{1,224,235,246,248}
Set scp port
scp -P 80 …
yes, capital P
Find Linux architecture without arch command
getconf LONG_BIT
though uname -a should help too
GNOME add minimize maximize
I think I had a blog like this before. Apparently not. Adding minimize and maximize buttons to gnome (in kali for example, if you cannot update:)
gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
Linux run (ELF) binary without execute rights
/lib/ld-linux.so /bin/chmod +x /bin/chmod
or find your own ld location