אנטי וירוס חושד בתוכנה כוירוס - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

אנטי וירוס חושד בתוכנה כוירוס


eido300
 Share

Recommended Posts

יש למישהו מושג למה האנטי וירוס חושד בתוכנה שלי כוירוס?

 התוכנה אמורה לרשום זמן כניסה ויציאה של עבודה שאני עושה.

לא מבין מה הבעיה של האנטי וירוס.

צירפתי את הקוד מקור, אשמח גם להערות והארות אם אפשר.

תודה

 

קישור לתוכן
שתף באתרים אחרים

  • תגובות 77
  • נוצר
  • תגובה אחרונה

משתתפים בולטים בדיון

avast מתעקש לבדוק את התוכנה כל פעם שמפעילים אותה, בתכלס הוא לא מוצא כלום (אין סיבה שימצא, אני כתבתי אותה...).

virus total טוען שאנטי ויורס אחד מצא בעיה

 

השאלה ה יכול לגרום לזה

 

קישור לתוכן
שתף באתרים אחרים

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
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 partial class form1 : Form
    {

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

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

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

        /// <summary>
        /// read the selcted data file and fill the time table 
        /// </summary>
        /// <param name="filePath">path of the data file </param>
 
        void readFile(string filePath)
        {
            try
            {
                if (File.Exists(filePath))
                {
                    using (TextReader tr = new StreamReader(filePath))
                    {
                        int durationInMinutTemp;
                        DateTime forChecking = new DateTime();
                        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 ((DateTime.TryParse(listOfData[0], out forChecking)) &&
                                (DateTime.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("מבנה קובץ לא חוקי");
                            }
                        }
                    }
                    sumOfAllWorkTB.Text = format(durationOfAllWorksTime);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.Data, "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            now = DateTime.Now;
            //את השעה הנוכחית textboxמציג ב
            timeNow.Text = (now.ToString("HH:mm:ss"));
        }

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

        /// <summary>
        /// fill the time table with stop time and stop date
        /// update the duration variables
        /// save the details in the data file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void stopBtn_Click(object sender, EventArgs e)
        {
            this.stop = DateTime.Now;
            stopTimeInString = stop.ToString("HH:mm");
            timeTable.Rows[timeTable.Rows.Count - 1].Cells[1].Value = stopTimeInString;
            startBtn.Enabled = true;
            stopBtn.Enabled = false;
            int durationByMinute = sum();
            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);
            File.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");

        }

        /// <summary>
        /// save all the details in excel document
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void יצאלאקסלToolStripMenuItem_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] = "שם הפרוייקט:";
            doc.Cells[1, 2] = nameLbl.Text;
            doc.Cells[3, 1] = "שעת התחלה";
            doc.Cells[3, 2] = "תאריך התחלה";
            doc.Cells[3, 3] = "שעת סיום";
            doc.Cells[3, 4] = "תאריך סיום";
            doc.Cells[3, 5] = "סה\"כ";
            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] = "סה\"כ";
            doc.Cells[2, 7] = sumOfAllWorkTB.Text;

        }

        /// <summary>
        /// calculate and return the work duration in minute
        /// </summary>
        /// <returns>return the work duration in minute</returns>
        public int sum()
        {
            // (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);
        }

        /// <summary>
        /// return the minute in xx:xx format
        /// </summary>
        /// <param name="sumOfMinute"></param>
        /// <returns>return the minute in xx:xx formt</returns>
        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;
        DateTime now = DateTime.Now, start = new DateTime(), stop = new DateTime();

        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 אפסToolStripMenuItem_Click(object sender, EventArgs e)
        {
            File.Create(pathOfFile).Close();
            timeTable.Rows.Clear();
            durationOfAllWorksTime = 0;
            sumOfAllWorkTB.Text = "";
        }
    }
}

 

קישור לתוכן
שתף באתרים אחרים

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

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

        // path = the folder that contain 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(file));
            }
        }

        // 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 (File.Exists(pathOfSelctedFile))
                    {
                        nameOfTheSelctedFile = listBox1.SelectedItem.ToString();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(nameOfTheSelctedFile + "לא קיים", "שגיאה", MessageBoxButtons.OK);
                        nameOfTheSelctedFile = pathOfSelctedFile = "";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "שגיאה", 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 (File.Exists(pathOfSelctedFile))
            {
                MessageBox.Show(nameOfTheSelctedFile + " קיים כבר", "שגיאה", 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;
            }
        }

        /// <summary>
        /// checking if there's invalid chars in the name
        /// </summary>
        /// <returns>return true if is valid name for file</returns>
 
        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("?האם אתה בטוח שברצונך למחוק קובץ זה \r\n  !יכול להיות שלא תהיה אפשרות לשחזרו", "אזהרה", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign))
                {
                    File.Delete(pathOfTheDataDirectory + "\\" + listBox1.SelectedItem.ToString() + ".wt1");
                    listBox1.Items.RemoveAt(listBox1.SelectedIndex);
                }
            }
        }
    }
}

 

קישור לתוכן
שתף באתרים אחרים

אתה כנראה לא מבין פה משהו.  מנוע סריקה של אנטיוירוס לא יודע מה שיש לך בקוד מקור וזה לא מעניין אותו.

מה שהוא בודק זה הבינארי ואיזה דפוסים הוא יכול למצוא שם שמזכירים התנהגות חשודה. דברים פשוטים כמו דחיסת UPX יכולים להקפיץ אותו.

נערך על-ידי multicore
קישור לתוכן
שתף באתרים אחרים

לקבצים שהפרטים נשמרים בהם עשיתי סיומת מיוחדת (.wt1) איך אני עושה שכל פעם שיפתחו את הקובץ עצמו (ולא את התוכנה) התוכנה תפתח ותעבד אותו (כמו שהיתה עושה אילו הייתי פותח את התוכנה ודרכה פותח את הקובץ)?

שייכתי אותו ידנית לתוכנה כתוכנית ברירת מחדל ככה שכל פעם שלוחצים עליו התוכנה נפתחת.

 

ועוד שאלה, מכיון שיש שם אפשרות ליצא את הפרטים לאקסל, וזה גרם לי לשגיאות במחשב שאין בו אקסל (ומן הסתם גם לא את .office.interop.excel), אני צריך להגדיר בתוכנה שאם אין את הdllהזה שלא תעשה לו usingולא תאפשר את הלחצן הנ"ל, איך עושים את זה?

 

תודה.

קישור לתוכן
שתף באתרים אחרים

ציטוט של eido300

לקבצים שהפרטים נשמרים בהם עשיתי סיומת מיוחדת (.wt1) איך אני עושה שכל פעם שיפתחו את הקובץ עצמו (ולא את התוכנה) התוכנה תפתח ותעבד אותו (כמו שהיתה עושה אילו הייתי פותח את התוכנה ודרכה פותח את הקובץ)?

שייכתי אותו ידנית לתוכנה כתוכנית ברירת מחדל ככה שכל פעם שלוחצים עליו התוכנה נפתחת.

השיוך נמצא ברגיסטרי. בד"כ עושים את זה בInstaller. תלוי באיזו פלטפורמה אתה משתמש.

 

ציטוט של eido300

ועוד שאלה, מכיון שיש שם אפשרות ליצא את הפרטים לאקסל, וזה גרם לי לשגיאות במחשב שאין בו אקסל (ומן הסתם גם לא את Microsoft.office.interop.excel), אני צריך להגדיר בתוכנה שאם אין את הdllהזה שלא תעשה לו usingולא תאפשר את הלחצן הנ"ל, איך עושים את זה?

System.Reflection.Assembly.Load

קישור לתוכן
שתף באתרים אחרים

ציטוט של af db creid

ועוד שאלה, מכיון שיש שם אפשרות ליצא את הפרטים לאקסל, וזה גרם לי לשגיאות במחשב שאין בו אקסל

אופציה אחרת שכדאי לשקול זה שימוש בספריה שמסוגלת לייצר קבצי אקסל בלי שיהיה אקסל מותקן במערכת

קישור לתוכן
שתף באתרים אחרים

 

ציטוט של af db creid

השיוך נמצא ברגיסטרי. בד"כ עושים את זה בInstaller. תלוי באיזו פלטפורמה אתה משתמש.

 

System.Reflection.Assembly.Load

א. נכון, אבל כיון שאין installer ואני לא מעוניין שהתוכנה תצטרך הרשאות אדמין כל פעם אז עשיתי את זה ידנית...  השאלה שלי היא איך עושים שהתוכנה "תטען את הקובץ" כמו שמסמך וורד לא סתם פותח את הוורד אלא מעלה את המסמך כולו, ככה שהתוכנה שלי תעשה.

 

ב. רפלקשן גם כן יצטרך הרשאות מן הסתם, יש דרך לעשות בלי שיצטרך הרשאות מיוחדות? וגם איך עושים את זה עם רפלקשן?

 

ציטוט של etal

אופציה אחרת שכדאי לשקול זה שימוש בספריה שמסוגלת לייצר קבצי אקסל בלי שיהיה אקסל מותקן במערכת

 

אילו ספריות יש?

קישור לתוכן
שתף באתרים אחרים

הצטרפ/י לדיון

בשלב זה תוכל/י להצטרף לדיון, ולאחר מכן להצטרף לקהילה שלנו. אם כבר יש לך חשבון אצלנו, אנא התחבר/י עכשיו על מנת להגיב תחת שם המשתמש שלך.
לתשומת לבך: התגובה תופיע לגולשים לאחר אישור של צוות הנהלת הפורומים.

אורח
הוסף תגובה

×   התוכן שהודבק הוא עם עיצוב.   הסר עיצוב

  Only 75 emoji are allowed.

×   הקישור שלך הוטמע אוטומטית.   הצג כקישור רגיל

×   התוכן הקודם שלך שוחזר אוטומטית.   נקה הכל

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
  • צור חדש...