Saturday, October 27, 2018

Quick Tip: Disable UAC from the command line

Using elevated command prompt, run:

c:\> reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

This will also disable "User Account Control: Turn on Admin Approval Mode."

Reference(s)
https://www.top-password.com/blog/tag/disable-uac-from-command-line/

Monday, October 22, 2018

Installing QNX SDP 6.6 Linux on Ubuntu 18.10

QNX SDP 6.6 (Software Development Platform) on Linux is a 32-bit application. Now it can be installed on Ubuntu 18.10 64-bit OS but you need to install the following pre-requisite libraries:

$: sudo apt install libc6:i386 default-jre-headless:i386 libgtk2.0-0:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libatk-adaptor:i386

You should be able to run QNX Momentics at this point (/opt/qnx660/run-qde.sh) but you will get a lot of error messages on the console like below:

(qde:8603): Gtk-WARNING **: 01:12:34.312: Unable to locate theme engine in module_path: "adwaita",

. To clean it up, do:

$: sudo apt install gtk2-engines-murrine:i386 gtk2-engines-pixbuf:i386 gtk2-engines:i386 gnome-themes-extra:i386

</>

Sunday, October 21, 2018

C#: Convert SecureString to String

Sample code to convert C# SecureString to String. Note that this is not the most secure to access SecureString.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var secure = new SecureString();
foreach (char c in "p@$$w0rd")
{
secure.AppendChar(c);
}
var password = new System.Net.NetworkCredential(string.Empty, secure).Password;
Console.WriteLine(password);
Func<SecureString, string> SecureToString = secureString =>
{
IntPtr valuePtr = IntPtr.Zero;
try
{
valuePtr = System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(secureString);
return System.Runtime.InteropServices.Marshal.PtrToStringUni(valuePtr);
}
finally
{
System.Runtime.InteropServices.Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
}
};
var pass2 = SecureToString(secure);
Console.WriteLine(pass2);
}
}
}
Line 20 is one example of converting SecureString to String, this only works for .Net Framework 4.0 or later.

Lines 23 to 38 converts SecureString to String and works using .Net Framework 2.0 or up.

Reference(s):
https://stackoverflow.com/questions/818704/how-to-convert-securestring-to-system-string
</>

Copy/paste text from Ubuntu 18.10 (Cosmic Cuttlefish) VM from/to Windows host using VirtualBox

Tested on:
Host: Windows 10 Enterprise (1803) with VirtualBox 5.2.20
Guest: Ubuntu 18.10 (Cosmic Cuttlefish)

Goal: Copy/paste text from/to Ubuntu 18.10 from/to Windows host

Solution:

This is not absolutely necessary but it is a good practice to update Ubuntu 18.10 to the latest using a terminal, like:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt autoremove

I would advice to reboot the machine at this point so that we will be running the latest kernel. The next command may also pick the wrong version of the kernel headers if the machine(VM) is running the older version of the kernel. Now, install dkms so that VirtualBox guest additions can be compiled as part of the kernel, like:

$ sudo apt install dkms

Now mount VirtualBox guest additions, this will be done from the external/host UI of the VirtualBox guest VM. For example, click on Devices | Insert Guest Additions CD Image... Now head into the VM and do:

$ cd /media/<username>/VBox_GAs_5.2.20
$ sudo ./VBoxLinuxAdditions.run
Of course you have to change VBox_GAs_5.2.20 to the version of VirtualBox version you are using. 

Then reboot the machine. To copy/paste do Devices | Shared Clipboard | Bidirectional or other options as appropriate. Copy/paste between the host and VM should now work.

Wednesday, October 17, 2018

Copy/paste text from Kali Linux (VM) to Windows host using VirtualBox

Tested on:
Host: Windows 10 Enterprise (1803) with VirtualBox 5.2.18
Guest: Kali Linux 2018.3a

Goal: Copy/paste text from Kali Linux from/to Windows host

Solution:

This is not absolutely necessary but is a good practice, update Kali to latest version using a terminal, like:

:/# apt update
:/# apt upgrade
:/# apt autoremove

Sometimes this is not enough to bring Kali to the latest and greatest, you may have to also upgrade it, like:
:/# apt full-upgrade

I would advice to reboot the machine at this point so that we will be running the latest kernel. The next command may also pick the wrong version of the kernel headers if the machine(VM) is running the older version of the kernel. Now, install dkms so that VirtualBox guest additions can be compiled as part of the kernel, like:
:/# apt install dkms

Now mount VirtualBox guest additions, this will be done from the external/host UI of the VirtualBox guest VM. For example, click on Devices | Insert Guest Additions CD Image... Now head into the VM and do:
:/# cd /media/cdrom
:/# sh ./VBoxLinuxAdditions.run

Then reboot the machine. To copy/paste do Devices | Shared Clipboard | Bidirectional or other options as appropriate. Copy/paste between the host and VM should now work.

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04 I am planning to run qemu-system-ppc to play around QEMU ...