Thursday, September 8, 2016

How to download a file with Anti-virus warning on Gmail [easy solution]





How to download a file with Anti-virus warning on Gmail [easy solution]





gmail-anti-virus-warning

Yesterday, I was searching in my Gmail for old files that I wanted to download. Once the email opened, I had a particular surprise: Anti-virus warning – 2 attachments contain a virus or blocked file. Downloading these attachments is disabled.
gmail-anti-virus-warning

Why do we have this anti-virus warning?

Like I said, this error was kind of surprising since I know for sure those files don’t contain viruses. After reading the Learn more link, I realized that those files were marked as a virus because they contained another .zip file in it. According to this link again, it is also possible to have a file blocked if it figures in the list of the Gmail blocked file type (for example a .bat file). You can take a look to the banned files type list here.
I think this is good that an anti-virus has been implemented into Gmail, but it should let the user choose if they want to be able to download their files anyway. They should only put a warning and let the download happens if this is what the user want. Since this is not the case, we need to think outside of the box to be able to download those files!

How to download the blocked files anyway

When I saw this error yesterday, I first made a Google search to try to find a solution. I fall into many blog posts with solutions which weren’t working for me, or was simply too much work. Since I’m lazy, I tried to find a solution that could be simpler and I found one. To download your blocked files, simply follow the following steps.
1- Hover your file, right click on the download button and select Inspect in the menu.
gmail-anti-virus-inspect-element
2- The inspector will then show up with the element selected. Below the selected element, you will have a div with the title Save to drive. Select that element.
gmail-anti-virus-save-to-drive
3- Now, double click on the style attribute of the element. The style attribute should be selected. Erase it by pressing the backspace.
gmail-anti-virus-erase-style-attribute
4- Now go back in your browser and hover your file again. The save to drive button should have appears. Click on it and the file will be saved in your Google drive!
gmail-anti-virus-save-to-drive-button
5- Tadaaaa. Go on Google drive and you should have no problems to download your file from there now.
gmail-anti-virus-gdrive-save
I hope this little trick will help you have a better day!

Tuesday, July 19, 2016

How To Format Write-Protected USB Drive and SD Card

How To Format Write-Protected USB Drive and SD Card

How to format USB drives and memory cards which are write protected. You cannot delete contents or make any new files on right protected USB drives and SD Cards. But there is a way to format USB drives which are right-protected. Let see how:
How to Remove Write-Protection of USB Using System Registry (regedit.exe)
  • Select “Start” then “RUN”, write “regedit.exe” and press Enter.
  • Click “Computer\HKEY_LOCAL_MACHINE\SYSTEM\”
  • Then select “CurrentControlSet\Control\StorageDevicePolicies”
  • Search “WriteProtect value” in the right-hand windows of Regedit.exe.
  • Double-click on it and change the Value data from 1 to 0
  • Click OK
  • Close regedit.exe and restart your computer
Now connect your USB drive and format the drive as it’s no longer write protected. To format the drive, right-clicking on it and select Format option. There may be a situation when you will not find “StorageDevicePolicies” in regedit.exe. Create the “StorageDevicePolicies” key. To create a new key, right-click in the white space and choose New > Key entering the name “StorageDevicePolicies” and restart your system.
How to Remove Write-Protection of USB Using Command Prompt (CMD)
  • Plug in your USB to your PC
  • Launch command prompt (in Windows XP, select “Start” then open “RUN”, write CMD and press Enter. In Windows 8 PC, select Start menu and search cmd.exe)
  • Once your CMD screen is open and ready to use.
Type the following commands (please press Enter key after your write each command)
diskpart
list disk
select disk x (x is the number of USB flash drive)
attributes disk clear readonly
clean
create partition primary
format fs=fat32
And you are done.
If you get an “access is denied” error message, run Command Prompt (cmd.exe) with administrator rights. To open Command Prompt (cmd.exe) with administrator rights, right-click on the CMD shortcut and choose Run as administrator (Windows XP).

Tuesday, April 26, 2016

Clear or Disable the Windows 7 Explorer Search History


The way you search for files and folder in Windows 7 is different from the way you do it in older versions of Windows like Windows XP where you used the search companion to help you find your files. Many people don't like the new feature and say it doesn't work as good as the older XP style of searching. That is up for debate and up to you to decide once you use the new Windows search method.
With Windows 7 you type your search word(s) in the search box in the upper right hand corner of Windows Explorer. Then you will notice a green status bar going across the top of the window as it searches. Finally your search results will be displayed in the main window along with other information such as the path to the file and so on. One thing you may have noticed that it keeps a history of your past searches and you may not want that search history to be kept. You may or may not want this history to be kept on your computer for whatever reason.
Windows 7 Search
If you want to clear the history of searched for items you will need to edit the registry. Always be careful when editing the registry since any changes are made instantly. It may be a good idea to export your registry first just in case you make a mistake which can be done from the File menu and then clicking on Export. To open the registry editor click on Start and then type in regedit in the search box and press Enter. Then navigate to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\WordWheelQuery
Right click on WordWheelQuery and choose Delete and then you can close the Registry Editor. Now your search history will be deleted but any new searches will show up in the history again.
Registry Editor

If you want to disable the search history altogether then you can do so by using the Local Group Policy Editor which is used to define user and computer configurations for things such as policies, security options and software options etc. To open the Local Group Policy Editor, Click on Start and then type in gpedit.msc in the search box. Now navigate to
User Configuration\Administrative Templates\Windows Components\Windows Explorer
Then find the entry that says Turn off display of recent search entries in the Windows Explorer search box.
Local Group Policy Editor
Double click the entry and change the setting to Enabled and click OK. Now whenever you do a search in Windows explorer it will not keep your search history.

Wednesday, April 13, 2016

Configure Apache to enable cgi-bin user directories to run cgi, perl and python in UBUNTU

1. First enable cgi module using the below lines.
sudo a2enmod cgi
sudo service apache2 restart
After latest apache with cgi mod enabled. 
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

  Options +ExecCGI
  AddHandler cgi-script .cgi .pl .py
  Options FollowSymLinks
  Require all granted
3. Create CGI script CGI works with multiple languages, but for now we start with bash shell. We will show examples for some other languages later. Here is a simples version of the CGI bash example:
#!/bin/bash
echo "Content-type: text/html"
echo ''
echo 'CGI Bash Example'
Copy the above code and paste it to a new file in /usr/lib/cgi-bin/ called example-bash.sh. Once done make the file executable using thechmod command:
$ sudo chmod 755 /usr/lib/cgi-bin/example-bash.sh
4. View CGI script
All what remains is to navigate with your browser to host-name or IP address of your web server. In our case the URL will be: http://cgi-example.local/cgi-bin/example-bash.sh
CGI bash example
You can edit this example to display a disk usage of server's root partition "/". You are only limited by your imagination:
#!/bin/bash
echo "Content-type: text/html"
echo ''
echo 'CGI Bash example
'
echo `df -h / | grep -v Filesystem`
The above code will check for free disk space for a root partition and produce the following page:
CGI bash example 2

5. More CGI examples

As promised, here are more CGI examples for a few more programming languages to get you started.

5.1. Perl

Create and make executable the following /usr/lib/cgi-bin/example-perl.pl with a content:
#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <

CGI Perl Example

CGI Perl Example

CGI Perl Example htmlcode

5.2. Python

Create and make executable the following /usr/lib/cgi-bin/example-python.py with a content:


CGI Python Example

CGI Python Example

CGI Python Example """

5.3. C

For C and C++ to work we will need to have a compiler installed. First, install compiler with:
$ sudo apt-get install build-essential
Once installed create a file example-c.c with the following code:
#include 
int main(void)
{
printf("Content-Type: text/plain \n\n");
printf("CGI C Example \n");
}
save the content of example-c.c file and compile it with the following command:
$ sudo gcc -o /usr/lib/cgi-bin/example-c example-c.c
now you should be able to access your C compiled CGI script with: http://cgi-example.local/cgi-bin/example-c

5.4. C++

For C and C++ to work we will need to have a compiler installed. First, install compiler with:
$ sudo apt-get install build-essential
Once installed create a file example-cpp.c with a following code:
#include 
using namespace std;

int main()
{
        cout << "content-type: text/html" << endl << endl;
        cout << "

CGI C++ example

" << endl; return 0; }
save the content of example-cpp.c file and compile it with the following command:
$ sudo g++ -o /usr/lib/cgi-bin/example-cpp example-cpp.c
now you should be able to access your C compiled CGI script with: http://cgi-example.local/cgi-bin/example-cpp

6. Conclusion

As mentioned earlier the CGI is quite old and was largely superseded by different programing languages such as PHP, etc. However, as you can see, it is still relatively simple tool to use to automate your Linux administration tasks such as a remote custom monitoring for your Linux servers using a web browser.

https://www.youtube.com/watch?v=ELFdP7eEZ5w

Saturday, March 19, 2016