Antivirus Suspected Software Virus - Programming - HWzone Forums
Skip to content
  • Create an account
  • About Us

    Hello Guest!

     
    Please note - in order to participate in our community, comment and open new discussions, you must join as a registered member.

    Our members enjoy many advantages, including the ability to participate in discussions, enjoy raffles and promotions for members of the site, and receive our weekly content directly by email.

    Do not like being harassed by email? You can register for the site but do not submit your registration to the weekly email updates.

Antivirus suspects software as a virus


Recommended Posts

Does anyone have any idea why the antivirus suspects my software as a virus?

 The software is supposed to record the entry and exit time of work I do.

Do not understand what the problem with antivirus.

I have attached the source code, I would also be happy for comments and clarifications if possible.

Thanks

 

Post Reply Direct Link To This Post
Share on other sites
  • תגובות 77
  • Opens on
  • Last comment

Prominent participants in the discussion

Prominent participants in the discussion

Popular responses

The operating system passes the path of the file (or several files) to your software as an argument, so the simplest way is to deploy System.Environment.GetCommandLineArgs. For example, if you run the software on the file.txt file in the spray

You probably do not understand anything here. An antivirus scan engine does not know what you have in the source code and it does not interest it. What he checks is the binary and what patterns he can find there that are reminiscent of suspicious behavior. Simple things like

You do not want to know ... I rummaged through the WPF source code is definitely worth it. Died on WPF. But UWP is pretty much a dead horse. Not on one foot at all ... I will mention a few differences: the layout of WPF is much more flexible than that of WINFOR

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Date;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Microsoft.Office.Interop.Excel;

namespace timeWork
{
    public partially class form1 : Form
    {

        public form1()
        {
            InitializeComponent();
            openFiles of = new openFiles();
            Switch (of.ShowDialog()
            {
                // ok - exists file
                homes DialogResult.OK:
                    pathOfFile = of.pathOfSelctedFile;
                    readFile(of.pathOfSelctedFile);
                    nameLbl.Text = of.nameOfTheSelctedFile;
                    break;

                // yes - new file
                homes DialogResult.Yes:
                    pathOfFile = of.pathOfSelctedFile;
                    nameLbl.Text = of.nameOfTheSelctedFile;
                    break;

                // default - no file has selcted
                default:
                    nameLbl.Text = "";
                    startBtn.Enabled = false;
                    break;
            }
        }

        ///
        /// read the selcted data file and fill the time table 
        ///
        /// path of the data file
 
        void readFile(string filePath)
        {
            try
            {
                if (Fillet.Exists(filePath))
                {
                    using (TextReader tr = new StreamReader(filePath))
                    {
                        int durationInMinutTemp;
                        Date Time forChecking = new Date Time();
                        string line;
                        string[] listOfData;
                        while ((line = tr.ReadLine() != null)
                        {
                            // [0] start time, [1] date of start, [2] stop time, [3] date of stop, [4] sum of work time
                            listOfData = line.Split('#');
                            timeTable.Rows.Add();
                            if ((Date Time.TryParse(listOfData[0], out forChecking)) &&
                                (Date Time.TryParse(listOfData[2], out forChecking))/ * && (DateTime.TryParse (lines [1], out forChecking)) && (DateTime.TryParse (lines [3], out forChecking)) * /&&
                                (int.TryParse(listOfData[4], out durationInMinutTemp)))
                            {
                                timeTable["startTime", timeTable.Rows.Count - 1].Value = listOfData[0];
                                timeTable["stopTime", timeTable.Rows.Count - 1].Value = listOfData[2];
                                timeTable["dateStartCol", timeTable.Rows.Count - 1].Value = listOfData[1];
                                timeTable["dateStopCol", timeTable.Rows.Count - 1].Value = listOfData[3];
                                durationOfAllWorksTime += durationInMinutTemp;
                                timeTable["sumCol", timeTable.Rows.Count - 1].Value = format(durationInMinutTemp);
                            }
                            else
                            {
                                throw new Exception("Invalid file structure");
                            }
                        }
                    }
                    sumOfAllWorkTB.Text = format(durationOfAllWorksTime);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.Date, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            now = Date Time.Now;
            // The current time textbox displays in
            timeNow.Text = (now.ToString("HH: mm: ss"));
        }

        ///
        /// create new row and save the time and date of the start
        ///
        ///
        ///
        private void startBtn_Click(object sender, EventArgs e)
        {
            this.start = Date Time.Now;
            startTimeInString = start.ToString("HH: mm");
            timeTable.Rows.Add("", "", startTimeInString, start.Date.ToShortDateString() "");
            startBtn.Enabled = false;
            stopBtn.Enabled = true;
        }

        ///
        /// fill the time table with stop time and stop date
        /// update the duration variables
        /// save the details in the data file
        ///
        ///
        ///
        private void stopBtn_Click(object sender, EventArgs e)
        {
            this.stop = Date Time.Now;
            stopTimeInString = stop.ToString("HH: mm");
            timeTable.Rows[timeTable.Rows.Count - 1].Cells[1].Value = stopTimeInString;
            startBtn.Enabled = true;
            stopBtn.Enabled = false;
            int durationByMinute = catfish();
            durationOfAllWorksTime += durationByMinute;
            timeTable.Rows[timeTable.Rows.Count - 1].Cells[0].Value = format(durationByMinute);
            timeTable.Rows[timeTable.Rows.Count - 1].Cells[4].Value = stop.Date.ToShortDateString();
            sumOfAllWorkTB.Text = format(durationOfAllWorksTime);
            Fillet.AppendAllText(pathOfFile, startTimeInString + "#" + timeTable.Rows[timeTable.Rows.Count - 1].Cells[3].Value + "#" + stopTimeInString + "#" + timeTable.Rows[timeTable.Rows.Count - 1].Cells[4].Value + "#" + durationByMinute + "\ r \ n");

        }

        ///
        /// save all the details in excel document
        ///
        ///
        ///
        private void ItzalaxelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Microsoft.Office.Interop.Excel.Application doc = new Microsoft.Office.Interop.Excel.Application();
            doc.Workbooks.Add();
            doc.Visible = true;
            doc.Cells[1, 1] = "the project's name:";
            doc.Cells[1, 2] = nameLbl.Text;
            doc.Cells[3, 1] = "Beginning time";
            doc.Cells[3, 2] = "Start Date";
            doc.Cells[3, 3] = "End time";
            doc.Cells[3, 4] = "end date";
            doc.Cells[3, 5] = "Total";
            for (int row = 4, i = 0; i <= timeTable.Rows.Count - 1; row++, i+)
            {
                doc.Cells[row, 1] = timeTable[2, i].Value;
                doc.Cells[row, 2] = timeTable[3, i].Value;
                doc.Cells[row, 3] = timeTable[1, i].Value;
                doc.Cells[row, 4] = timeTable[4, i].Value;
                doc.Cells[row, 5] = timeTable[0, i].Value;
            }
            doc.Cells[1, 7] = "Total";
            doc.Cells[2, 7] = sumOfAllWorkTB.Text;

        }

        ///
        /// calculate and return the work duration in minutes
        ///
        /// return the work duration in minutes
        public int catfish()
        {
            // (stop.DayOfYear - start.DayOfYear) * 24 + stop.Hour) -> calculate how much hour, good if work from 23:00 to 01:00 and etc.
            return (((stop.DayOfYear - start.DayOfYear) * 24 + stop.hour) * 60 + stop.Minute) - (start.hour * 60 + start.Minute);
        }

        ///
        /// return the minute in xx: xx format
        ///
        ///
        /// return the minute in xx: xx formt
        string format(int sumOfMinute)
        {
            int hours = sumOfMinute / 60;
            int minute = sumOfMinute - (hours * 60);
            return (hours < 10 ? '0' + hours.ToString() : hours.ToString() + ':' + (minute < 10 ? '0' + minute.ToString() : minute.ToString());
        }

        string pathOfFile, stopTimeInString, startTimeInString;
        int durationOfAllWorksTime = 0;
        Date Time now = Date Time.Now, start = new Date Time() stop = new Date Time();

        private void showAlways_Click(object sender, EventArgs e)
        {
            if (showAlways.checked)
            {
                TopMost = true;
            }
            else
            {
                TopMost = false;
            }
        }

        private void form1_Load(object sender, EventArgs e)
        {

        }

        private void zeroToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Fillet.Create(pathOfFile).Close();
            timeTable.Rows.Clear();
            durationOfAllWorksTime = 0;
            sumOfAllWorkTB.Text = "";
        }
    }
}

 

Post Reply Direct Link To This Post
Share on other sites
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Date;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace timeWork
{
    public partially class openFiles : Form
    {
        ///
        /// choose if open exists file or begin new one
        ///
        public openFiles()
        {
            InitializeComponent();
            if (!Directory.Exists(pathOfTheDataDirectory))
            {
                Directory.Createdirectory(pathOfTheDataDirectory);
            }
        }

        // path = the folder that contains the data files of the software 
        string pathOfTheDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ workingTime";
        public string pathOfSelctedFile, nameOfTheSelctedFile;

        // add the names of the data files from the data folder to list box
        private void openFiles_Load(object sender, EventArgs e)
        {
            foreach (string file in Directory.GetFiles(pathOfTheDataDirectory))
            {
                listBox1.items.Add(Path.GetFileNameWithoutExtension(fillet));
            }
        }

        // save the path and the name of the selcted file and close the form, it's bring you to main form
        private void openBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (listBox1.SelectedIndex >= 0)
                {
                    pathOfSelctedFile = pathOfTheDataDirectory + "\\" + listBox1.SelectedItem.ToString() + ".wt1";
                    if (Fillet.Exists(pathOfSelctedFile))
                    {
                        nameOfTheSelctedFile = listBox1.SelectedItem.ToString();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(nameOfTheSelctedFile + "Does not exist", "Error", MessageBoxButtons.OK);
                        nameOfTheSelctedFile = pathOfSelctedFile = "";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
            }
        }

        // creat new "work", save the path and the name of the new file and close the form, it's bring you to main form
        private void newBtn_Click(object sender, EventArgs e)
        {
            nameOfTheSelctedFile = textBox1.Text;
            pathOfSelctedFile = pathOfTheDataDirectory + "\\" + nameOfTheSelctedFile + ".wt1";
            if (Fillet.Exists(pathOfSelctedFile))
            {
                MessageBox.Show(nameOfTheSelctedFile + " already exists", "Error", MessageBoxButtons.OK);
                nameOfTheSelctedFile = pathOfSelctedFile= "";
            }
            else
            {
                this.Close();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        // enable and disable the open and delete button
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex >= 0)
            {
                openBtn.Enabled = dltBtn.Enabled = true;
            }
            else
            {
                openBtn.Enabled = dltBtn.Enabled = false;
            }
        }

        // you can create new "work" only if it's a leagel name
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && isValid()
            {
                newBtn.Enabled = true;
            }
            else
            {
                newBtn.Enabled = false;
            }
        }

        ///
        /// checking if there's invalid chars in the name
        ///
        /// return true if is valid name for file
 
        bool isValid()
        {
            foreach (var item in Path.GetInvalidFileNameChars()
            {
                if (textBox1.Text.Contains(item))
                {
                    return false;
                }
            }
            return true;
        }

        // delete file from the list and from the data folder
        private void dltBtn_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex >= 0)
            {
                if (DialogResult.Yes == MessageBox.Show("? Are you sure you want to delete this file \ r \ n! It may not be possible to recover it", "warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign))
                {
                    Fillet.Delete(pathOfTheDataDirectory + "\\" + listBox1.SelectedItem.ToString() + ".wt1");
                    listBox1.items.RemoveAt(listBox1.SelectedIndex);
                }
            }
        }
    }
}

 

Post Reply Direct Link To This Post
Share on other sites

You probably do not understand anything here. An antivirus scan engine does not know what you have in the source code and it does not interest it.

What he examines is the binary and what patterns he can find there that are reminiscent of suspicious behavior. Simple things like UPX compression can bounce it off.

Edited By multicore
Post Reply Direct Link To This Post
Share on other sites

For files where the details are stored I made a special extension (.wt1) How do I do that every time they open the file itself (and not the software) the software will open and process it (as it would if I had opened the software and through it opened the file)?

I manually assigned it to the software as a default program so that every time you click on it the software opens.

 

And another question, because there is a possibility to export the details to Excel, and it caused me errors on the computer that does not have Excel (and probably not you either .office.interop.excel), I need to configure in the software that if you do not have this dll that you will not use it and do not enable the above button, how do you do that?

 

Thanks.

Post Reply Direct Link To This Post
Share on other sites
Quote of eido300

For files where the details are stored I made a special extension (.wt1) How do I do that every time they open the file itself (and not the software) the software will open and process it (as it would if I had opened the software and through it opened the file)?

I manually assigned it to the software as a default program so that every time you click on it the software opens.

The association is in the registry. This is usually done in Installer. Depending on the platform you are using.

 

Quote of eido300

And another question, because there is a possibility to export the details to Excel, and it caused me errors on the computer that does not have Excel (and probably not you either Microsoft.office.interop.excel), I need to configure in the software that if you do not have this dll that you will not use it and do not enable the above button, how do you do that?

System.Reflection.Assembly.Load

Post Reply Direct Link To This Post
Share on other sites
Quote by af db creid

And another question, because there is an option to export the details to Excel, and it caused me errors on the computer that does not have Excel

Another option to consider is using a directory that can produce Excel files without having Excel installed in the system

Post Reply Direct Link To This Post
Share on other sites

 

Quote by af db creid

The association is in the registry. This is usually done in Installer. Depending on the platform you are using.

 

System.Reflection.Assembly.Load

A. True, but since there is no installer and I do not want the software to need admin privileges every time so I did it manually ... My question is how to make the software "load the file" as a Word document does not just open the Word but uploads the entire document, so the software Mine will do.

 

B. Reflection will also need permissions obviously, is there a way to do without needing special permissions? And how do you do that with reflection?

 

Quote of etal

Another option to consider is using a directory that can produce Excel files without having Excel installed in the system

 

What libraries are there?

Post Reply Direct Link To This Post
Share on other sites

Join the discussion

You can then join the discussion and then join our community. If you already have an account with us, please Log in now To comment under your username.
Note that: The comment will appear to the surfers after approval by the board management team.

guest
Add a comment

×   The content pasted is with formatting.   Remove formatting

  Only 75 emoji are allowed.

×   Your link has been automatically assimilated.   Show as regular link

×   Your previous content has been automatically restored.   Clear all

×   You can not paste images directly. Upload or insert images from URL.


×
  • Create new ...

At the top of the news:

New: NVIDIA's Ampere Small

Three different manufacturers are adopting a particularly compact Mini-ITX configuration for the GeForce RTX 3060, so that even miniature computer systems can enjoy the benefits of the new generation - in case the availability does not disappoint once again

new on the site

You have an update

You have an update

Buzz Zone: The Instagram spaces #buzzzone You have an update A photo posted by HWzone.co.il (@ hwzone.co.il) on 2021-01-20 16:09:29 You have an update