Etichette

mercoledì 31 dicembre 2014

Install Android MTP support on Arch Linux & co.




The most straight forward way to do this (after trying everything unsuccessfully):

pacman -S libmtp
pacman -S jmptfs

Now you should be able to mount the MTP's device like this:

jmtpfs /mountfolder

and access it with any browser (tested with pcmanfm).

To unmount it:

fusermount -u /mountfolder

If this doesn't work out of the box, you should create a new udev rule:

lsusb
*locate your device in the output and make sure you remember vendorid : productid

nano /usr/lib/udev/rules.d//51-android.rules

and type this rule:


ATTR{idVendor}=="YOURVENDORID", ATTR{idProduct}=="YOURPRODUCTID", SYMLINK+="libmtp",  MODE="660", ENV{ID_MTP_DEVICE}="1"

reload the rules:

udevadm control --reload

and reboot.

Hope this helped, thanks for reading.

lunedì 29 dicembre 2014

Clone MBR and GPT with DD (and monitor the process).

I recently had to clone a 8 GB USB GPT formatted content to a 32 GB...



And thanks to the amazing "dd" Unix command, this was easier than I thought.
Basically the structure of my USB was something like this:
-GUID partitioning scheme
-BIOS boot partition 1 Mb
-Linux file system 7400 Mb
-EFI boot partition 300 Mb

What I've done:

dd if=/dev/disk8gb of=/dev/disk32gb bs=8192 conv=notrunc,noerror

You might know:
if=input file, the disk to be copied
of=output file, the disk to be copied to
bs=block size, in this case, 8192 gave me copying 8 GB in less than an hour and a half, without any problem.

But the problem is: the two disks aren't of the same size, and the GPT partitioning scheme need to know how big is the USB. I initially thought of using gdisk to fix things, but it turns out that the solution was actually pretty simple: the 32 GB USB was recognized as a 8 GB one, and the rest of the space... it was like having a gigantic empty space, or at least full of random data and stuff, like the difference between Earth (8 GB recognized) and Outer Space (24 GB unrecognized)... pretty deep thoughts after all, but how to fix this?
If you are either cloning a bigger disk to a smaller one or in this case vice versa, you should follow this guide to fix the partitioning scheme: http://kudzia.eu/b/2013/07/cloning-gpt-disk-to-a-smaller-drive/.

And finally, you can monitor the dd process like this:
-If you are using a Mac, press CTRL+T during the process to monitor the process (temporary kill the process).
-Use pipe viewer: http://askubuntu.com/questions/215505/how-do-you-monitor-the-progress-of-dd
-Use the iostat command to watch in real time the input process (run dd and iostat at the same time so that the output of iostat corresponds to the bytes copied with dd) like this:
iostat -Iw 5 diskpointer
to have an update every 5 seconds (resource: http://pfynotes.blogspot.it/2011/05/monitoring-progress-of-dd-on-osx.html).

How to boot Linux from an Android device with DriveDroid.

Sometimes you just need to boot Linux from Android.
Why? I don't know you are looking for that :p


I found this amazing application on the Play Store called "DriveDroid".

DriveDroid lets you... yeah you got this.

Your device needs to be rooted!
So let's give a first look to this:
-Once you first run the application, carefully follow the wizard setup.
-To give it a try, you've been given a "drivedroid.img" image that can be both BIOS and UEFI booted. You should first try with this little image to see if the application works properly. If it doesn't work, the probably no else distro will work.
-One little consideration first: your Android device can have different USB modes. I mean:
1) It can be MTP (media transfer protocol): this allows you to access the external sd card and the internal archive once connected with USB to a computer.
2) It can be USM (usb mass storage): this allows you you to access a given space that can be partitioned just as it was a USB.
-Once you press on "drivedroid.img" and choose how to host the image, you should be able to boot from it in both BIOS and UEFI. However this doesn't work with every distro. You now entered the USM (or at least a fake version) mode. A little consideration: I'm using a Samsung Galaxy S5 and the USB mode doesn't work, I can only access the shared storage as a non-rewritable CD, which sucks, but can't be solved. If this happens to you, too bad :(, however I can tell you for sure that Ubuntu 14 totally works with both UEFI and BIOS in this situation ;) (but I wasn't able to run Kali Linux, and I didn't try with Arch, though they told me it works).
-To revert to MTP mode, tap on drivedroid's notification. If that doesn't work, unlock developer settings and check (or uncheck) USB debug.

That's it, hope this helped!

martedì 23 dicembre 2014

The Ultimate guide about Arch Linux Installation

Arch Linux is awesome, and if you are here, you probably already know what this is all about.
This is not a real guide, but a reference and recap.



Our objective is to create an Arch Linux USB that can boot anywhere, Macs and PCs, BIOS and UEFI, as lightweight as possible.

Notice: You should not just install the base package, I recommend the devel package too.

MBR (BIOS) only: http://lifehacker.com/5680453/build-a-killer-customized-arch-linux-installation-and-learn-all-about-linux-in-the-process

If you want to boot in BIOS with GPT, follow this guide when the above one comes to partitioning and installing boot loader:http://m157q.logdown.com/posts/2013/12/31/arch-linux-quick-installation-with-gpt-in-bios
If you want to also boot in UEFI, combine the above guide with this one: http://wood1978.techarea.org/~wood/wordpress/2013/08/08/uefi-systems-install-arch-linux-note
If you need dual-boot, create a new partition with linux filesystem, pacman "or-prober", use it and then run grub-mkconfig and then grub-install targeting respectively pc-i386 and efi as normal. Basically run or-prober before the installation of grub, same path and commands followed in the two articles, just that.

If you want to install a GUI, I suggest "Awesome wm": http://romans-it.blogspot.it/2013/06/arch-linux-with-awesome-wm.html

You'll be needing Slim (as seen in the previous guide). Slim and Awesome WM have a lot of customization, check the Arch Wiki posts about it.

If you need a Browser, the most lightweight and interesting at the same time is midori, however, I suggest Chromium, which has flash player integration and is quite faster.

If you want to download AUR packages without wasting time on building and stuff, check out yaourt (where you can download metasploit-git, the best option): https://archlinux.fr/yaourt-en

If you'd like to have interfaces shown as wlan0 and eth0 (pretty interesting in hacking automization), follow this:http://unix.stackexchange.com/questions/81834/how-can-i-change-the-default-ens33-network-device-to-old-eth0-on-fedora-19

Most common video drivers are
xf86-video-ati
xf86-video-mesa
xf86-video-intel (for Macs too)
xf86-video-nouveau (Nvidia)
Try to install only the one you need or they might conflict (this happened to me).

Wireless card Drivers for Mac:
yaourt b43-firmware
or
yaourt broadcom-wl

Pm-utils is a very interesting package that lets you enable suspension of the computer in RAM.

Finally if you want a very cool transparent terminal, my favorite choice is always "xfce4" with a lot of customization and interesting stuff,  for example support (as xterm does) of commands at start with the -e option, very useful in an atomization enviroment.
And that's all for now, thanks for reading, and hope this helped.