Monday, October 17, 2016

Scan for Virus while uploading document in asp.net.using ClamAV(OpenSource) software


Download latest ClamAV from "https://www.clamav.net/downloads"

Download .zip folder(clamav-0.99.2.tar.gz this is latest while at time of writing this blog) unzip .tar file you will get "ClamAV-x64" folder.

Using command prompt navigate to "ClamAV-x64" folder and execute below commands.

freshclam.exe  software will update, if you get

"ERROR: Can't open/parse the config file D:\ClamAVx64\freshclam.conf"

this means config files does not exist, COPY clamd.conf.sample and freshclam.conf.sample  files from "conf_examples" folder, and rename them to clamd.conf and freshclam.conf respectively.

Now run command "freshclam.conf" you will get below error:-

ERROR: Please edit the example config file D:\ClamAVx64\freshclam.conf
ERROR: Can't open/parse the config file D:\ClamAVx64\freshclam.conf

then open "freshclam.conf" and COMMENT OR REMOVE "Example" line in config file

Now run command "freshclam.conf" you will get below error:-

 ERROR: Can't change dir to D:\ClamAVx64\database

The above error means database folder does not exit create folder with name database (we can change folder name in config file)

 Now run command "freshclam.conf", this time it should run successfully with below message

ClamAV update process started at Mon Oct 17 16:35:14 2016
main.cvd is up to date (version: 57, sigs: 4218790, f-level: 60, builder: amishh
ammer)..................

once update process is complete run "clamd.exe" you will get below error:-

ERROR: Please edit the example config file D:\ClamAVx64\clamd.conf
ERROR: Can't open/parse the config file D:\ClamAVx64\clamd.conf

open "freshclam.conf" and COMMENT OR REMOVE "Example" line in config file,

UnComment "TCPSocket("3310 by default) and "TCPAddr"(127.0.0.1) and


MaxEmbeddedPE
MaxHTMLNormalize
MaxHTMLNoTags
MaxScriptNormalize
MaxZipTypeRcg
 
now run  "clamd.exe" it will start, keep to command prompt and test you application..

Now clamd server is running on localhost on 3310 port. 
 
 
Reference Link:-
https://www.clamav.net/downloads
http://architectryan.com/2011/05/19/nclam-a-dotnet-library-to-virus-scan/#.WASr1aJvqPt
http://askubuntu.com/questions/250290/how-do-i-scan-for-viruses-with-clamav ---Commands
 
 
Happy coding...;-)
 

Monday, October 3, 2016

Get Biggest UserName in postgres.

Get Biggest UserName in postgres:-

select max(char_length(user_name)),user_name from users group by user_name order by max(char_length(user_name)) desc;