07/06/2014

[OpenSSH] Convert putty PPK key to OpenSSH format

To convert a putty-generated PPK key to the OpenSSH format, you can use puttygen:

puttygen MY_PPK_KEY.ppk -O private-openssh -o MY_OpenSSH_KEY

to convert a private key and:

puttygen MY_PPK_KEY.ppk -O public-openssh -o MY_OpenSSH_KEY

to convert a public key

[VMware Player] Share USB mobile broadband between host and guest OS

To share a USB mobile broadband connection between the host and guest OSs with VMware Player, simply set the guest OS network interface to use the NAT mode instead of the bridged mode.

This way you'll also be able to set up routing rules on the host OS which will apply to the guest OS too.

24/05/2014

[Windows] Scan hosts for open ports without Telnet with PortQry

When testing a connection, you'll probably want to check if a particular port is reachable on the destination host. Telnet is fine enough for this task:

telnet host port

but unfortunately, Windows comes with the Telnet client disabled by default. Since enabling it requires you to have Administrator privileges, an alternative is to use Microsoft PortQry which is a command line tool with no installation required.

After downloading and extracting it, you can run it as:

portqry -n host -e port

[VmWare] Reduce guest swapping

VmWare allows you to specify how the guest system handles swapping to the host disk. Much like Linux's swappiness value, you can suggest to use more host memory instead of swapping to disk; this is especially useful if you do not have a swap partition.

To edit the setting, open your VM's .vmx file, while the VM is powered off, using text editor and add these lines:

MemTrimRate = "0"
mainMem.useNamedFile = "FALSE"
sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"

Note: If you are using a Linux host, use the following entry instead of mainMem.useNamedFile which only applies to Windows hosts:

mainmem.backing = "swap"


[Ubuntu] Add swap partition and change swappiness

If for some reason(s) you decided to install Ubuntu without specifying a swap partition, you can still add one (or a swapfile) later on without too much hassle.

[Debian] Run Wireshark as non-root user

Wireshark by default enables only the root user to capture network traffic; the idea is that as a root user you'll capture and store the traffic and as non-root user you'll perform any analysis you need. This unfortunately does not allow you to perform a "live capture" where you can work on the data while it is freshly captured from your network interface.

To enable non-root users to run a live capture too, simply dpkg-reconfigure it:

sudo apt-get install wireshark
sudo dpkg-reconfigure wireshark-common

When prompted to allow non-root user to perform restricted operations, say Yes.

Then logout and login again and you should be set. If not, add your user to the wireshark group:

sudo usermod -a -G wireshark $USER

[Debian] Test APT changes without altering the system

The APT package manager allows you to test the changes a command would perform without altering the system. To do that, simply add --dry-run to the desired command (usually an install or remove one).

Eg:

apt-get install SOMEPACKAGE --dry-run

Will show you what dependencies will be installed alongside the specified package but no actual installation will take place.