[Solved] ‘Public key is not available’ error on apt-get update in Ubuntu

I came across this error while doing sudo apt-get update

W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E19B8
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9ABD05E22847688C


This made me do some hunting on the web. I tried quite a few solutions out of which the following worked.

Run the following command in terminal:

gpg –keyserver subkeys.pgp.net –recv 5A9BF3BB4E5E19B8
gpg –export –armor 5A9BF3BB4E5E19B8 | sudo apt-key add –

Replace 5A9BF3BB4E5E19B8 with your own key. This solved the error. I repeated the procedure for second key and I stopped getting error messages.

On the first command, sometimes the server maybe down. In that case you can try the following servers.

hkp://subkeys.pgp.net
hkp://pgp.mit.edu
hkp://pool.sks-keyservers.net
hkp://keys.nayr.net
http://keys.gnupg.net

To use these servers just replace subkeys.pgp.net with any of the server above. For eg;

gpg –keyserver http://keys.gnupg.net –recv 5A9BF3BB4E5E19B8

Source:
http://gentoo-blog.de/ubuntu/ubuntu-gpg-error-httpppalaunchpadnet-intrepid-release/

Cheers!

[HowTo] Playing wmv files in Ubuntu

I had many wmv files but I wasn’t able to play them.
Ubuntu by default doesn’t support wmv files due to legal reasons. You can, however, make them play.

In terminal, type:
sudo apt-get install ubuntu-restricted-extras

Or, you can go to synaptic package manager and install ubuntu-restricted-extras.

After installation, you will be able to play wmv files.

Cheers!

Auto mounting partitions at start-up in Ubuntu

System -> Administration -> Synaptic Package Manager

Search for pysdm and click on the square and click on ‘Mark for installation’ and click apply. The package will be installed.

Alternatively you can go to Applications->Accessories->Terminal and type ‘sudo apt-get install pysdm‘. It will ask the password, enter it and pysdm will be installed.

Once installed,  type sudo pysdm in terminal to launch the application. After that, its pretty easy to configure the application to auto mount the partitions on startup.

Select the partition from the left panel, browse its mountpoint and in options, defaults will do. Defaults already have the auto mount option. Otherwise you can click on assistant to check the options you want. Do the same with all the partition and click on Apply and close.

Done. Simple, isn’t it?

There are other ways which require modification of configuration files but I found this method to be the easiest.

Cheers!

[HowTo] Convert HTML to PDF using PHP

In a recent project, I had to output to a PDF file as well as to the browser. For this purpose first I downloaded the library from here. Then this code:

<?php
 
ob_start();  //Start buffering the output
 
//your coding starts here
 
....
 
....
 
...
 
...
 
//Coding ends here
 
$html = ob_get_contents(); //dumb the buffer as a string in variable $html
 
ob_flush();  //Output the buffer to browser
 
//Start outputting to PDF
 
define('HTML2FPDF_VERSION','3.0(beta)');
define('RELATIVE_PATH','fpdf/');
define('FPDF_FONTPATH','font/');
 
require_once(RELATIVE_PATH.'fpdf.php');
require_once(RELATIVE_PATH.'htmltoolkit.php');
require_once(RELATIVE_PATH.'html2fpdf.php');
$pdf = new HTML2FPDF();
$pdf->WriteHTML($html);
$name="doc.pdf";
$pdf->Output($name);
 
?>

When you run this script, you’ll get a pdf file “doc.pdf” in your script directory with the output of the current script.

For outputting something else other than the current script:

<?php
 
//Your code
 
....
 
....
 
....
 
// To make a pdf file:
 
$html= "<h1>hello</h1>";  //To add more html code use $html.= yourcode; in the next line
 
define('HTML2FPDF_VERSION','3.0(beta)');
define('RELATIVE_PATH','fpdf/');
define('FPDF_FONTPATH','font/');
 
require_once(RELATIVE_PATH.'fpdf.php');
require_once(RELATIVE_PATH.'htmltoolkit.php');
require_once(RELATIVE_PATH.'html2fpdf.php');
$pdf = new HTML2FPDF();
$pdf->WriteHTML($html);
$name="doc.pdf";
$pdf->Output($name);
 
?>

[HowTo] A trick to get access to protected sites.

Sometimes, when you search in google for something, you find very nice results but when you visit those sites, they seem to be protected i.e; you need to either sign-up or maybe you need to pay for it. So, here’s a way to get access to it without paying or even signing up.

Mostly people want their exclusive content to be protected. Since it is exclusive, they would want people to know about it so that more people join the site. That is why they let search engines to access their protected content so that it gets listed in their results and site gets traffic for that. Now search engines are similar to people. Websites only have one way to differentiate between them – User agents. All the search engines have user agents which makes them differentiate from humans.

As we all know, Google is the greatest and largest search engine (hope Bing will capture the market too).
Its user-agent is “Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)”.

With this information, we can get access to protected sites which is freely available only to search engines.

We need Mozilla Firefox for the purpose. Download it from here if you don’t have it.

Now, get this user agent switcher addon for firefox:
https://addons.mozilla.org/en-US/firefox/addon/59

Now, download this file:
http://www.techmindz.com/useragents.xml

Now, import the user-agent strings into the add-on by:
In Mozilla Firefox:
Tools -> User Agent Switcher -> Options -> Options -> User agents -> Import
Select the file you just downloaded.

When accessing the protected site, goto Tools -> User agent switcher -> Googlebot 2.1 (New Version)

You will get access to its contents.

Any queries will be answered here.
Regards

[HowTo] Remove almost any kind of viruses from Windows

Being attacked by many viruses in the recent times, I thought why not make people learn from my experience. Having faced about a dozen of different viruses in past 2 weeks, I have experience enough to write this guide. I faced trojans, trojan downloaders, rootkits and what not. So here’s my little guide which will help you get rid of your virus.

We’ve got a huge amount of viruses floating over the internet. New viruses are being made by evil programmers daily. Due to this innocent computer users are being infected and suffering from infected system which results in compromising of private data, destruction of data, unusability of computer etc. For non techy people virus removal is a tough task. Fortunately, for tech-savvy people its not so difficult.

I am writing this guide so as to help people from removal of viruses from their computer.

A brief introduction about viruses. A virus is generally a malicious software which tries to steal personal information from your computer or uses your computer for other malicious activities like spamming, used as proxy from illegal activities, spreading malware etc.

Computer can be infected from virus through many means. You can get infected from a mail you opened from unknown person, some software installation, a friends pen-drive which you just inserted in your computer etc.

Until now, only Microsoft Windows have been known to be infected by viruses. Linux and Mac OS remains unaffected. There are only few known viruses for them. Windows on other hand has thousands of viruses with new viruses being produced everyday.

To protect yourself from viruses you will need to have good combination of security tools.
Tools required:

1. Sysinternals Process Explorer.
2. Good anti-virus software (preferably Kaspersky, NOD32, or Norton).
3. Malwarebytes Anti-Malware
4. Registry Fix.
5. Task Manager Fix.
6. UnHackMe.
7. Lavasoft Ad-Aware latest 2009 version. (Older version has many drawbacks)
8. HijackThis
9. Spybot S&D. (Optional)

Most of the viruses won’t let you know when they install themselves on your computer. You won’t even notice them unless they do something noticable like use internet extensively which draws your attention etc.

When you get infected by a virus and you are sure about it:
You know that you have been infected by a virus and you don’t know what to do. Just bear with me and you will find quick solutions to your answers.

To check if virus is using the internet:

1. First of all check if it is using internet. Go to Start Menu-> Run -> Type “cmd” without quotes and enter.
2. Then type “netstat -b” without quotes in the console and press enter.
3. On the left hand side, you will see a list of executables and right to that, you will see the sites it is connecting to. If you see any unknown executable connecting to any unknown site. It means that it is using your internet. In this case, I recommend disconnecting from internet to protect yourself.

Checking if the virus is running as a process:

1. Download the Process Explorer from Sysinternals from here.
2. Run it and see under the Explorer.exe. If you find some unknown executable running there, it means the virus is running as a process. Double click it and check the TCP/IP tab. This way you can confirm if it is using the internet. Click OK to exit the properties.
3. Right the process and click “Kill Process Tree”. Click yes when asked for confirmation.

Warning: Do not kill any process under “System”. It may crash your system.

Scanning for Malware using Malwarebytes:

1. Download Malwarebytes Anti-Malware from here.
2. Run the setup and install it.
3. Run the software and update its database.
4. Do a quick scan and delete all the entries which it finds. After quick scanning, do a full scan. I believe quick scan will remove majority of the malware and full scan will remove any leftovers. Restart if it asks you to.

Scanning for viruses using your anti-virus software

1. Whichever AV you are using. Install it and update it.
2. Perform a scan and delete/quarantine all infected files.
3. Restart if it asks you to.

Scanning using Lavasoft Ad-Aware:

1. Download the latest Ad-Aware version from here. Its free.
2. Install and update. Restart after installation.
3. Run a full scan and delete all the files it detects.

You may also use Spybot S&D to scan your computer, though it is not advised as its reliability and accuracy has gone very bad.

Re-enabling your taskmanager and registry editor in case they have been disabled.

1. If you see an error on pressing CTRL+ALT+DEL saying that “It has been disabled by Administrator”, it means that virus has disabled it.
2. Similarly regedit may also have been disabled by the virus.
3. To fix these, download:
Download – Taskmanager fix
Download – Registry fix.

Some viruses also modify the existing windows installed files. To restore them:

1. Start Menu -> Run -> Type “Sfc /scannow”.
2. Note that you will need Windows XP cd for this. It will check all the system files and will replace them if they have been tampered.

You must’ve your system cleansed thoroughly by now. There is no security application which gives you complete security. You have to use them together to protect your computer. That is why so many scans are required.
Ad-aware which had gone bad in the past few years have made a come back with their latest AE edition which provides very good security. Recommended to everyone.

For removing rootkits

1. Rootkits are probably the worst kind of infection anyone could have. They go undetectable by every other tool mentioned above. Those tools simply fail to discover it. Rootkits hide themselves under critical system files, run as hidden processes and are undetectable by any means.
2. Its impossible to detect their presence. You will only know that they are on your system if you see some weird behaviour like internet being used by itself etc.
3. To remove rootkits, install UnHackMe from here.
4. Install the software and follow the instructions. You will need to restart your computer for making this program check for rootkits. It will check the boot process for infected files.
5. Delete the files which you think are rootkits and are not part of any legit software.
6. Restart to make the changes.

Note: Please install security programs from their vendor’s site. Do not use warez or torrents to download as they themselves mostly contain viruses.

If you are still unable to remove the virus, please repeat all the above steps in safe mode.

If still, you are unable to get rid of it, please post a hijackthis log on this board. I’ll try to help you get rid of it.
Download it from here .
Scan and save the log and post it on this board for us to examine it.

Disclaimer: I am not responsible for any damages caused if you fail to follow the instructions carefully.

This guide may not be published/reproduced without my permission.

This is my tutorial originally posted on my forum here: http://www.techmindz.com/index.php?topic=361.0

[HowTo] Increase Fervens’ (wordpress theme) width

Fervens is an extremely attractive and excellent theme for wordpress. After trying numerous themes, I settled for this and its really really amazing.

The only shortcoming was that its main content area was too small. On larger posts, the content would span upto numerous pages which would’ve not taken so much space if it had been a little bit wider.

I tried to experiment with the theme and modify it for greater width. It was not a difficult task and moderate knowledge in CSS is enought to make it accomplish. For the rest of you, I will teach you how to do it.

These are the steps:
Goto your admin panel and click on ‘Appearance’ and then ‘Editor’.
The default file ‘Style.css’ will open. If it doesn’t click on style.css from right hand side column.

Change these:

#bg { width: 960px; margin: 0 auto;}
to
add how much width you want to add. I’ve added 100px to mine. So 960+100 becomes 1060.
#bg { width: 1060px; margin: 0 auto;}

.con { width: 960px; float: left;}
to
.con { width: 1060px; float: left;}

.scs1 { float: left; width: 650px; margin-right: 10px;}
to
.scs1 { float: left; width: 750px; margin-right: 10px;}

.sc-all { width: 480px; background:#fff url(images/sl-top.png) no-repeat top; float: right;}
to
.sc-all { width: 580px; background:#fff url(images/sl-top.png) no-repeat top; float: right;}

.sc { padding: 20px; width: 440px; background: url(images/sl-bottom.png) no-repeat bottom;}
to
.sc { padding: 20px; width: 540px; background: url(images/sl-bottom.png) no-repeat bottom;}

Save the CSS. And see the changes. Width of middle column must’ve increased by 100px.

Its not done yet. You still have to make the rounded corners.
They’ve used 2 images – 1 for top and 1 for bottom. Thats not a good practice. You should always use 4 images so that you can change the width without modifying the pictures.

Save the two files namely:
{your-domain}/wp-content/themes/fervens-a/ferevens-a/images/sl-top.png
{your-domain}/wp-content/themes/fervens-a/ferevens-a/images/sl-bottom.png

To save the files:
Run this in your web browser. You may not see anything as it is almost white. So, just go to File-> Save.
Save the file.
Do this for the other file too.

Fire up your image editing software (I used photoshop).
Open both the images on it. You can just simply resize it to 581px which was 481px originally. Note that simply resizing won’t look that neat.

Optional:
To truly resize it expand the canvas width by 100px. Cut a portion consisting of right-side of the corner and paste it over the image and line it up at the right edge and save the image.
Flip this image vertically and you have the other image.

Upload both the edited image to the same folder from where they were download ie. {your-domain}/wp-content/themes/fervens-a/ferevens-a/images/

Reload the webpage and give a pat on your back.

Note: This method has been tested with Fervens A but it must work with B and C versions too.
Also note that I’ve increased 100px width, so I’ve put the references. If you want to increase width in greater or smaller amount, please add the corresponding width to original width.
Eg;
#bg{width: 960px
becomes
#bg{width: 1010px
for increasing width by 50 pixels. I hope you got the idea.

Any queries will be answered here.
Thanks and regards
Cheers!

Why not to encrypt your files using EFS or any other encryption

EFS or NTFS encryption can turn out to be your life’s worst nightmare in case you don’t fully read about it. I advice everyone not to use it unless you really know what you are doing and backup your certificates.

I had many folders of mine encrypted and I forgot about them completely as encryption is transparent to user who encrypted the file. It was a usual day. I was working on my computer when I wanted to access some files from ‘My Documents’ (yes, I encrypted whole My Documents folder, idiot me.) and was denied access. I thought it might be with just that file. I tried accessing other files, other folders but it gave same error. It dawned upon me. In an instant, I knew what was going on. I was shocked and confused at the same time. I didn’t know what was happening.

I remember opening a PDF file and I started getting spybot registry prompts. But PDF files were safe, weren’t they? Seems like that one wasn’t. It had a virus. I don’t know what it did, but this PDF created all the problems.
I wasn’t able to access my files only after the infection. Also, it took away my admin rights. I couldn’t use softwares like Nero.. they gave me messages that I needed admin rights to run it. I found a site to remove encryption using hex modifications of registry and some files. This is the site:
http://www.beginningtoseethelight.org/efsrecovery/index.php

Its good and this guy was the first one to have found a way to recover. But the tutorial didn’t help much and I still didn’t have any way to get my files back. I downloaded Elcomsoft Advanced EFS recovery but it said that it needed admin rights. I tried Passware EFS key recovery and it gave “Error decrypting file”.
I couldn’t do anything. I couldn’t even format my computer. That’d have made the problem worse. My encryption certificates which might have been stored somewhere on computer would’ve gone forever rendering my encrypted files useless.

I tried running chkdsk and it found many errors. I scheduled it to run at startup as C drive was locked but it didn’t start. I was stuck from everywhere. Nothing was working. I ran Event Viewer to check any errors and wasn’t surprised to see Error 7 which said “Bad block on hard drive”. I assumed that the block on harddrive which had the SAM file and my certificates went bad. Also, virus made the matters worse by removing my rights. I was no longer known to computer as the same user. I was different user for my computer.

I didn’t know what to do. Fortunately, I had another computer and I downloaded Vista Recovery CD, burned into a DVD using another computer. I booted it on my laptop, and ran chkdsk. It found and repaired errors. I rebooted into Windows XP and checked but it didn’t solve any problems. I tried using chkdsk C: /B in recovery disk again but it was of no use too.

I had lost almost all hopes when I browsed to C:\Windows\system32\config and saw automated backups stored there. The latest one was of 24th may. I thought of giving it a shot. I booted into recovery disk again, and restored the backup and booted into Windows XP again and got my admin rights back. The problem wasn’t solved – I still couldn’t access my encrypted files. I quickly ran the Elcomsoft EFS recovery and it ran without any error. I was so happy. At least, I got some hope. I had my rights back. I ran the software and recovered a test file and it succeeded.

I was in bliss. I had recovered the encrypted file. I spent next 5-6 hours recovering all the files. This nightmare was not as bad as some people who forget about the encryption and format their drives only to discover it later. At least, I hadn’t formatted the computer. I had the certificates somewhere on my filesystem but I didn’t know where.

So, it was really a nightmare.

Moral of the story: Do not encrypt files unless you really know what you are doing and be prepared to face the consequences when the worst happens. Do not encrypt the files unless absolutely necessary. Always back up your keys/certificates.

[Solved] Windows XP login logoff loop caused by a virus

Yesterday, I was infected with probably the ugliest breed of virus in computer history (atleast, for me). What it did was nothing serious. I downloaded something off the internet and ran it. Spybot gave me a warning about a registry entry and I knew it was virus. I simple denied it. It again popped up after few minutes. It confirmed that it was a virus because no other software would prompt again for the registry entry. I denied again and no matter how many times I denied, it came back again after a few minutes. So, I knew it was a time for scanning. I scanned and deleted atleast 12 virus executables created in various system folders. I deleted them all. I think the virus injected itself into some system executables too. And I deleted those files too. Everything was going fine. The virus was listed as Win32/Kryptic.AA trojan and WIN32/Rootkit.Agent by my NOD32 AV.

My AV prompted me to restart to delete some files which were too stubborn to get deleted in windows. I think those were the system files which were not being deleted. I restarted and I couldn’t login into windows anymore. On the login screen I typed my password and as soon as I logged in, it logged me out. I was in a login – logout loop. Fortunately, I had another computer. I started looking for solutions. I found solutions like editing the registry which was not possible as I wasn’t able to login even in safemode. Other methods needed me to copy some system files from WIN XP CD to the system folders. I tried all linux live CDs but none of them worked on my Laptop as it had widescreen and X won’t recognize it. Finally, PCLinuxOS worked. I copied the system files from another computer to a pen drive and put the pendrive back onto my laptop but PCLinuxOS won’t recognise it. I was out of luck. Damn! Thiks linux.

I tried googling for editing registry in Linux and found a small distro for just that. I downloaded it. I tried it but it was no good. It edited the registry successfully but it didn’t repair the computer. I was still into login-logout loop.

I tried using UBCD (ultimate boot CD) and tried to boot into DOS with CD-ROM support. I burnt a DVD with all system files from my second computer. I tried copying the files from DVD to the system32 folder using DOS but it gave an error. All the doors seem closed. I could only think formatting in my mind.

Just when I had lost all hopes, something clicked in my mind. I thought to myself, why not try another pen drive on PCLinuxOS as it was the only OS which booted perfectly on my computer. I inserted another pendrive and by God’s grace it worked. I quickly copied all the system files (The main file was userinit.exe which I think got deleted by NOD32 in the process of removing the malware. So, it was not the malware/virus that had caused the login-logoff boot but the AV which caused it) from the second computer to this pendrive. Inserted it into my laptop… copied all the system files to their respective folders and restarted and Voila! I was into windows. I felt stupid and proud at the same time. Stupid for not thinking of using another pendrive before. And proud to mend my computer without formatting (I bet most of them would’ve formatted it).
The problem wasn’t over. As soon as I booted into windows, the spybot started showing those prompts again. I knew if I restarted again, I would have to face the same all over again. So, I downloaded Malwarebytes Anti-malware which is known a very good anti-malware software. Updated it and did a full scan but it seemed to take too much time. So stopped it when it had already scanned 1,00,000 files and found only 2 infections. I did a quick scan, and it found over 50 infections in under a minute. I cleared them all. Scanned again to confirm if they were removed.

For even greater security, I type sfc/scannow in command line. Its an application which checks system files integrity and if any file has been tampered, it replaces it with the original file. It didn’t find any problems.

I still haven’t rebooted my computer. But I am confident that the virus is gone. This how I mended the login logoff loop.

UPDATE: The computer logged in fine. I just restarted it.

How I bought techmindz.com

How I bought www.techmindz.com is quite interesting. Okay, I always wanted a .com domain for my forum but lack of paypal money and credit card compelled me to use a free domain.

So, I seriously started working to collect some money. I already had 2-3 projects given to me by guys in US, but I being lazy didn’t bother to complete them. I contacted them and asked if the project was still open. One of them replied and I completed his project working hard day and night. The project was about implementing AJAX on a site. He paid me $20 on paypal. I was very happy. This was my first earning online. I decided that I will choose the domain name very carefully as it is the first thing a visitor enters in his address bar.
I posted on mazzako forum but didn’t get any nice replies.
This was 2 days ago.

Today, I searched for a new project and found one. It was about merging and compressing javascript. It sounded simple and hence I mailed a proposal. And to my amazement, the project was quite hard. Compressing the script was rendering it in errors here and there.
I tried to solve every error manually but couldn’t figure out much of the code because it was base 62 encoded.
I, finally, somehow managed to solve the problem using another compressor and few manual correction of errors.

The project was done to his full satisfaction. I hadn’t quoted him the price. I thought of quoting him $20 but it was hard work so I thought of quoting $30. I thought that would be just too much coz $30 equals to 2400 NPR. So, I quoted him $25. I was prepared for revolt. I thought he would bargain but he didn’t. Nice guy. He paid me $25 instantly.

I had $45 in my paypal account in 3 days. I was so happy. I was high. My talent was paying. Up until now, people cursed me for using computers day and night and remaining disconnected from rest of the world but my talent was starting to pay. You could very well imagine my happiness. I was euphoric.

After that, I went straight to my Bluehost cPanel. I clicked on domain manager and I searched for techmindz. I didn’t know techmindz.com was available. I had not bothered to search for it because I was quite sure that it won’t be available.

I clicked on ‘Buy’. It brought me to the next page where I had to write my payment details. I didn’t want to buy a domain. I was just fiddling around. Being evil minded myself, I thought that there must be a hidden field where subtotal was stored. I searched for hidden field on the page source and I found a hidden field which stored $10. I knew javascript injection and I changed that value to 0. I clicked next and it bought me to the paypal page. On the paypal page, there was no mentioning about the price. I thought it might be on the next page and clicked next. And guess what? It confirmed my purchase and $10 was reduced from my account. And before I knew what happened, techmindz.com was already mine.

This is how www.techmindz.com was bought. Interesting, isn’t it.

So guys, attempt to hacking can get you hacked too. ;)