Quite often do I leave for work, leaving my precious laptop at home, running some tasks or just downloading  stuff.  As a casual day goes by, do I worry about it, thinking how’s my buddy doing out there, all alone, in an empty flat? In fact, it’s not that safe to leave your electrical appliances working heavily, processing tons of data, heating up. So, I thought, is there a way to monitor and control you PC remotely? Of course there are many ways and a variety of tools. But what if I don’t need all that bloated software? What if I need one script, that could do simple stuff like checking, running simple tasks and reporting back?

As a result, I wrote a script for that purpose. How it actually works? Very simple, it probes your gmail account every 15 min. for arrived emails, which, in fact, are commands to perform. Let’s get into more details.

The script uses cron and curl  to probe gmail account for newly arrived letters, it extracts the email’s subject, which should be a command to perform. Then it reports back the command output.

On first boot, the script asks for your gmail login name (the account you will send your commands to), password for that account and a second email address to send reports to. After that it creates a cron job to be executed every 15 min and starts checking the indicated account for new emails.

For the script to work properly, you have to do two things though. Create a new gmail account and configure your ssmtp service. Piece of cake, I must say!

First — create a separate gmail account, exclusively for the purpose of receiving your email-commands. It is very important not only for normal work of the script, but mainly for security reasons. You don’t want your PC to receive a “mv *.* ~/.config” command as an innocent joke from a good old friend. Create a new gmail account, make filters, so that it accepts email only from several reliable sources. This is how it’s done:

1. Upon making and logging into a new gmail account open up settings and click filters tab.

2. Choose “Create a new filter”

3. In the newly opened window click on “from:” field and put down the addresses you are going to receive email-commands from like this:

“!mail@gmail.com !12345@mms.mygsm.com”

4. Click “continue”, check “delete it” box and click “Create filter”.

Now after you have set up your gmail filters, you will receive email-commands only from the above mentioned “certified” accounts. Remember, your security is always your responsibility, and even the strongest passwords will not excuse your negligence.

Second — we need to install ssmtp package and configure ssmtp service, so that the script would know how and where to send reports. It’s pretty straightforward, install ssmtp from your repository. Then under root open /etc/ssmtp/ssmtp.conf file and edit it like this:

root=yourmail@gmail.com   #the one you’ll use for receiving script reports

mailhub=smtp.gmail.com:587   #the mail server to send emails to

rewriteDomain=gmail.com   #the address, where the email appears to come from

hostname=local   #your PC hostname

UseTLS=Yes

UseSTARTTLS=Yes

AuthUser=mygmail   #your gmail account login name

AuthPass=mypass   #your gmail account password

FromLineOverride=yes

Finally, put the script to “/usr/local/bin” and run it (don’t forget to “chmod +x” it;). In a few seconds you’ll be able to send emails to your PC and it will answer you back:)

Oh, did I forget to tell you how to send an email-command? Very simple, go to your gmail account (remember, the one which was set not to be filtered), and compose a letter to your new gmail account for remote control with the subject field containing a shell command like “ls -l” (you can leave the letter empty).

Take notice, there are some dependencies. You need to have “zenity” ,”curl” and “ssmtp” as was mentioned above.

Download link for the script: http://evalm-script.googlecode.com/files/evalm


I always tend to think of the Internet as a global awareness system.  If there were no Internet, how much would you know about the world around us? How fast would you be aware of new information and how effective would be your actions? Though resembling something chaotic and uncontrollable, it is already our great overmind, the system each of us is a tiny part of.

How does the internet look today?

The Internet

How it is connected physically?

Submarine cable map

By what?

Submarine communications cable

How does it work?

Internet operation infrastructure

How is it connected virtually, what is the capacity and usage?

Global map, usage and capacity

Where from and where to does the information go?

 Global traffic map

How fast is the Internet today?

Internet speed and costs

How many people are connected?

Internet usage per country

What language does it speak?

Internet language usage

 What is happening there right now?

60 seconds of Internet

 And what do people do?

Online activity

Do we really depend on the Internet?

Addicted or not?

I hope you’ve got the picture and found plenty of food for thought, actually sitting in the Internet now. After all  this is what it was made for;)

 

 

 

References:

http://blog.hostdime.com.br/noticias/novidades/rompimento-de-fibra-submarina-afeta-clientes-embratel/

http://www.yeeeeee.com/2008/10/09/the-whole-internet-in-one-picture/

http://expertlywrapped.wordpress.com/2010/11/11/geographically-correct-a-world-wide-web-of-accessibility/

http://mikesenese.com/DOIT/2011/11/undersea-cable-cross-section-and-interactive-submarine-cable-maps/#.T1Xvr_CTXng

http://visual.ly/2009-submarine-cable-map

http://www.telegeography.com/telecom-resources/map-gallery/submarine-cable-map-2011/index.html

http://www.theatlantic.com/technology/archive/2011/06/infographic-global-internet-traffic-expected-to-quadruple-by-2015/240182/

http://www.onlineschools.org/blog/how-the-internet-works/

http://www.go-gulf.com/blog/60-seconds

http://mashable.com/2012/02/22/internet-addiction-numbers/

http://larryferlazzo.edublogs.org/2010/03/09/the-best-sites-to-learn-about-the-internet/

http://digihits.wordpress.com/tag/infographics/


Linux distribution unhomogeneous variety is like a box of chocolates. You will always feel a slight desire to pick just one more.

Different kind of distributions serve different needs, and it is good. Some may see OS as a family media center, some as a communication tool or a daily office task organizer and some as a firewall or a router — Linux serves them all. There are times, however, when you need OS functionality at your fingertips. When you need to work securely and undetected. Linux will not let you down even here, and that is awesome! The tool I’m talking about is one linux distribution — TinyCore.

TinyCore (TC) is being developed by Robert Shingledecker. Those who may have heard this name are the users of Damn Small Linux. Robert was an active developer of DSL and much of its success lies on his shoulders, it was later that he left the DSL team and started working on TC. Today TinyCore counts up to 4.3 version and can already boast a handful of useful features.

The whole distribution is an iso file that contains a kernel (vmlinuz 3.03) + core.gz  — a file system ready for deployment + Xvesa|Xorg (no more scary black screen at startup :)) + Xprogs — some utils, libs and other necessary stuff (complete list for the most curious is here) + fltk-1.10 — neat gui library (some TC utils were written in fltk) + flwm window manager (well it can be any wm you want actually) + wbar — light and fast application launcher (though lacks some configurability ><).

As you may see, not much stuff in here, but look at the size of this toy, it’s only 12MB! Wait, don’t “pfff!” right there,  trust me, TC is a real deal. Teeny-weeny size plus shell utilities (thanks to busybox) is right there at your fingertips. But that is not all, there are actually three isos, available for download. Core, TinyCore and CorePlus, where Core is just a stripped down version of TinyCore with no graphical interface but prompt (for console kung-fu masters) and CorePlus — a 64MB version full of various tools, wireless drivers, locales packed with 7 window managers for your pleasure. Now, go and pick yourself a candy.

But let’s get to the point of what TC really is and what it is not.

This linux distro resides in your RAM, so it’s damn fast. For work it needs 48 MB of your RAM and at least a i486DX CPU. It can run from a USB drive, CD or a hard drive (supported file systems are ext2/ext3/ext4, vfat/fat/fat32).

The feature that endows TC with flexibility and power and lets it really stand out among other linux distributions is its modes of operation. Operation mode is a process that governs system boot and mount behavior. TC adopts several operation modes: “cloud”mount and copy.

As was mentioned above, TC is just a linux kernel, basic file system with busybox, several core libraries and a lightweight window manager, no other preinstalled software. TC applications are downloaded from the internet repository and mounted into the memory right after download. TC application or should we better call it an extension is a package, that consists of several files: application archive (nano.tcz) + dependency file (nano.tcz.dep) + description file (nano.tcz.info). The extensions are downloaded and mounted into a memory through application browser, that handles all necessary dependencies. So here is how it all works together with operation modes.

The default is “cloud” mode is when TC boots into RAM  and user downloads the needed extensions via application browser, as soon as the desired extension is downloaded it’s loopmounted into /tmp/tcloop and linked into the current system. After reboot all is washed off so next time you boot into the system it’s recreated anew without your carefully selected apps:P This mode, in fact, is useful when you need a usb stick only for safe browsing or quick editing.

Mount mode is recommended and eventually the most widely used mode. All downloaded applications are saved and stored locally in /tce directory or any other user specifies at boot. The downloaded extensions are mounted into memory according to the onboot.lst list after reboot.

And finally copy mode. All application extensions are loaded into RAM in bulk (copy2fs.flg) or selectively (copy2fs.lst). This mode requires longer boot times and more memory, but provides more responsive and faster working experience, since everything is loaded into your RAM

Here are two excellent system architecture diagrams for mount and copy mode.

Now, what about user /home files? All user /home data is saved and stored in mydata.tgz archive under /tce directory upon shutdown or reboot, which is unpacked and loaded as /home directory at boot. User can encrypt mydata.tgz with bcrypt using “tinycore protect” boot code.

TC uses special boot codes to shift it’s usage flexibility even further. After TC installation and booting from the usb stick, right before the graphical system start-up, user is presented with a prompt screen, where a special boot code can be entered. Here is a list of the ones I found interesting:

tinycore tce={hda1|sda1} — to specify applications restore directory
tinycore restore={hda1|sda1|floppy} — to specify the location of a saved mydata.tgz file
tinycore superuser — to run as user root in textmode
tinycore host=xxxx — to set a hostname to xxxx
tinycore laptop — so force load laptop modules
tinycore xvesa=800x600x32 — to set Xvesa default screen resolution
tinycore blacklist=ssb — to blacklist a specific single module

As you may see, TC is not a desktop distribution, though it can be installed and run from a hard drive, it was not intended to work this way. TC enjoys sitting in your RAM, being booted from a usb stick, mobile fast and hidden from the peering eyes.

Now let’s have a look at TC desktop. TinyCore utilizes a lightweight window manager flwm. The reason for this is not aesthetics or some rare functionality, but mere compatibility (many TC utils are written in ftlk, the default gui lib for TC, so is flwm). By default after start-up you are greeted with a default desktop and a wbar, which contains all the necessary tools for system administration.

On the picture above you can see (right > left) shutdown options launcher, terminal (aterm), apps audit tool, default text editor, control panel, app browser, run tool (similar to alt+f2) and partition mounting tool. A very modest variety of applications, but it is just a base for your future system. You will download the rest via app browser. With TC audit tool, you can change how your downloaded applications are loaded in mount mode (OnDemand or OnBootsee how it’s done).

TinyCore is another great linux distribution in our hands. With only 12MB in size, TC can be a fully functional system for everyday tasks. It was not made to replace your current home OS  and don’t expect it to support all the quirky hardware you have, it is more of a support tool, quickly boot, repair, restore, edit or simply surf the internet when your PC is not around. “Well I can use my home desktop distro on a usb drive too”, some will say. But it will suck, it will never be so lightning fast and easy to use as TC. Moreover, the cornerstone of any good distribution and one of the key factors to its success is its userland. Didn’t you ever feel disappointed, when you could not find your favorite app or critical dependency, browsing the repos of a newly installed distribution a friend was so desperately praising? Let me guess what was your next step, after toying around enough with it:) TC repository is no joke, it is huge and I mean it. Currently, they’ve got 24737 records of all kinds of software and libs there. Hey, they even have windowlab and echinus window manager!

Now that I’ve stirred your interest, it’s time to install TC. You’ll need a fresh TC iso (I recommend TinyCore, which is 12MB), a >512MB usb drive and core2usb utility if you are installing it within a running windows system. If it is linux you are installing it from, then you could use unetbootin to install iso onto your usb drive. Unfortunately, the lastest TC version is incompatible with unetbootin, so either you manually do  linux-way the installation, or burn the iso onto CD and install it from a running TC system (there is an original tool for usb installation).

TC has become a must-have usb OS for me, and maybe it will become for you. All best things in life are free after all, I am happy that one more linux distribution is one of them;)

Tips:

Strangely so, but TinyCore dislikes DSL modems and currently does not have a working pppoe extension. The one that is in the repository simply does not work. Please, read the discussion about pppoe setup and further workaround (you must register on TC forum first).

I strongly advise you to download dejavu-fonts-ttf extension.

When root password is needed, use sudo -s command.

After downloading all my favorite applications, TC became a bit bigger (about 250MB), keep it in mind:)

I insist that you read the official TC pageFAQ and wiki, they have tons of useful and newbie-friendly information there about each system aspect.

References:

Distrowatch interview with Robert — http://distrowatch.com/weekly.php?issue=20090323&mode=68#feature 

TinyCore FAQ — http://distro.ibiblio.org/tinycorelinux/faq.html 

TinyCore Wiki — http://wiki.tinycorelinux.net/wiki:start


If you ever wondered why the hell command “ls” does not color the output or why doesn’t it show directories first, or why does it screws the filenames with spaces, that renders it unusable for scripts, then I understand you.

The beauty of linux systems is that you are free to fix and tweak  everything yourself  (well, of course that does mean you should learn how to do it first:).  My long-term discontent with “ls” was enough for me to think about making something customized enough to suit my needs.  So this is how I started to write a script.

The first version was quite ugly slow and couldn’t do much but silly entertain its author. With the help of my guru co-worker, that re-factored my code and taught me how I should use functions properly) it became something of a useful tool for me.  It was later I found out that there was an alternative like ls++ (an awesome app!).  Still the script was done and then I decided to use another benefit of linux world — sharing. Here I am.

Some words about “whats that stuff do?”.  The script “lls” shows directory content in alphabetical order (not a big invention, heh?:), with directories coming first. It colors the output so that you can easily locate executable, readable or writable files. In addition, it can add more info on each file.

The script can filter executable, archived, text, video and audio files, which is one damn useful function, if you ever happened to cd into a Download directory file ocean. The filtering function do not depend on .extensions, so even some “system_folder” xxx video file  will be declassified in no time)

One of my favourites is a “–tree” function that draws pretty trees of directories with a number of files in them (check it out!).

“lls” is indeed a handy script, just download it and put somewhere in your $PATH.

This is it. I hope you enjoy it as much as I do, and maybe some of you will feel a pleasant content of alternative and freedom of choice, that linux world gives us ;)

Script itself –> http://lls.googlecode.com/files/lls

Archlinux AUR package –> https://aur.archlinux.org/packages.php?ID=53735

Note: Ubuntu/Debian users may need little correction, like changing “#!/bin/sh” to “#!/bin/bash”




Follow

Get every new post delivered to your Inbox.