Visualizzazione post con etichetta antivirus. Mostra tutti i post
Visualizzazione post con etichetta antivirus. Mostra tutti i post

giovedì 7 aprile 2022

Un sito di programmi freeware , ProgrammiFree.com

 Un sito rilevante dedicato ai programmi freeware è programmifree.com , sul sito sono recensiti molti programmi divisi per categorie ed in genere con una valutazione . A mio avviso sono particolarmente interessanti le prove comparative come quella relativa agli antivirus  che potete trovare qui https://programmifree.com/confronti/confronto-antivirus-2022.htm :  a differenza di alcune delle comparazioni che si trovano su internet qui viene fatta una prova concreta caricando un disco di virus che viene poi  analizzato dai singoli antivirus trovando la percentuale di virus rilevati.

Altra prova comparativa degna di nota è quella dei software (freeware) per eseguire il backup https://www.programmifree.com/confronti/confronto-backup.htm  , purtroppo la prova risale a qualche hanno fà ma in linea di massima le caratteristiche prese in considerazione per il confronto sono tutt'ora valide . La tabella comparativa delle caratteristiche supportate dai singoli programmi di backup rende immediato verificare la presenza delle funzioni di nostro interesse .


lunedì 5 aprile 2021

Eseguire automaticamente un antivirus su un file scaricato usando Chrome , alla fine del download

 Il codice è in versione pre-alpha . Qui il codice sorgente https://sourceforge.net/projects/antivirusdefenderforchrome/  . 
Supponiamo di utilizzare su un pc due antivirus: ad esempio Avira e Defender , il primo di occupa della scansione a realtime , il secondo viene utilizzato per eseguire delle scansioni periodiche , in questo modo si può usufruire,su richiesta, di due distinte liste aggiornate di segnature di virus per effettuare le scansioni e di due motori euristici .
Durante il download, il file scaricato da Chrome nella dir Download assume una o più fra tre estensioni temporanee : ".tmp" , ".crdownload",".part" ,gli altri browser hanno funzionamenti differenti ed il codice seguente richiede l'uso di una versione attuale di Chrome ,se il file ha un'altra estensione significa che il download è finito, il cambiamento del nome del file viene intercettato dall'evento Renamed  dell'oggetto FileSystemWatcher  e l'estensione è verificata dal metodo FindExtension :
scegliamo la directory da monitorare :







 public partial class Form1 : Form

    {
        string selectedPath = null;
        FileSystemWatcher watcher = new FileSystemWatcher();
        
        public Form1()
        {
            InitializeComponent();
        }             

        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult result = this.folderBrowserDialog1.ShowDialog();
            if (result == DialogResult.OK)
            {
                selectedPath = folderBrowserDialog1.SelectedPath;
                this.textBox1.Text = selectedPath;
            }
            watcher.Path = selectedPath;
            watcher.NotifyFilter = NotifyFilters.FileName;
            watcher.Filter = "*.*";
            watcher.Created += new FileSystemEventHandler(OnCreated);
            watcher.Renamed += new RenamedEventHandler(OnRenamed);
            watcher.EnableRaisingEvents = true;            
        }


 per eseguire chiamate  threadsafe  al controllo textBox2 utilizziamo la classe ParametrizedThread  ,

 il percorso sul vostro pc del file MpCmdRun.exe (l'eseguibile da linea di comando di Defender) potrebbe essere diverso da  "C:\Program Files\Windows Defender\MpCmdRun.exe" :

private void OnCreated(object source, FileSystemEventArgs e)
        {
            string name = e.Name;
            string s = this.textBox2.Text;
            s = s + name + " created file " + Environment.NewLine;
            ParametrizedThread p = new ParametrizedThread();
            p.currentForm = this;
            p.c = this.textBox2;
            p.text = s;
            Thread t = new Thread(p.ThreadProcSafe);
            t.Start();
        }

private void OnRenamed(object source, FileSystemEventArgs e)

        {   
            string ext=Path.GetExtension(e.FullPath);
            bool b = FindExtension(ext);
            if (!b)
            {
                string name = e.Name;
                string s = this.textBox2.Text;
                s = s + name + " renamed file completo" + Environment.NewLine;
                ParametrizedThread p = new ParametrizedThread();
                p.currentForm = this;
                p.c = this.textBox2;
                p.text = s;
                Thread t = new Thread(p.ThreadProcSafe);
                t.Start();
                
                ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files\Windows Defender\MpCmdRun.exe");               
                string fileName = e.FullPath;
                info.Arguments = " -Scan -ScanType 3 -File " + '"' + fileName + '"';
                info.WindowStyle = ProcessWindowStyle.Maximized;
                info.UseShellExecute = false;
                info.RedirectStandardOutput = true;
                Process proc = Process.Start(info);
                StreamReader sr = proc.StandardOutput;
                string msg = sr.ReadToEnd();
                string w = this.textBox2.Text;
                w = w + msg + Environment.NewLine;
                ParametrizedThread pt = new ParametrizedThread();
                pt.currentForm = this;
                pt.c = this.textBox2;
                pt.text = w;
                Thread t1 = new Thread(pt.ThreadProcSafe);
                t1.Start();
            } else { 
                string name = e.Name;
                string s = this.textBox2.Text;
                s = s + name + " renamed" + Environment.NewLine;
                ParametrizedThread p = new ParametrizedThread();
                p.currentForm = this;
                p.c = this.textBox2;
                p.text = s;
                Thread t = new Thread(p.ThreadProcSafe);
                t.Start();
            }
        }

         private bool FindExtension(string ext )
        {
            bool b = true;
            List<string> l = new List<string>();
            //funziona solo con chrome
            l.Add(".tmp");
            l.Add(".crdownload");
            l.Add(".part");            
            int result=l.FindIndex(element => element==ext);
            if(result == -1)
            {
                b = false;
            }
            return b;
        }
         ...................................
         ................................
         ...........................


    public class ParametrizedThread
    {

        public TextBox c = null;
        public string text = null;        
        delegate void SetTextCallback(string text ,Control c);       
        public Form currentForm = null;        
        public ParametrizedThread()
        {
        }
        public void ThreadProcSafe()
        {
            SetText(this.text,this.c);
        }           

        private void SetText(string text,Control c)
        {            
            if (c.InvokeRequired)
            {
                SetTextCallback d = new SetTextCallback(SetText);
                currentForm.Invoke(d, new object[] { text, c});
            }
            else
            {                
                c.Text = text;                
            }
        }        
    }









SourceCodeSafer aggiunta chiusura "automatica" dell'applicazione che fornisce la password da remoto

SourceCodeSafer 4.7 versione  alpha ,  qui   il codice : aggiunta la possibilità di chiudere automaticamente l'applicazione che fornisce...