Пример #1
0
        // koristi se za fiskalni
        public User AddUser(string username, string password, Profile ActivProfile, MK mikrotik)
        {
            User u = null;

            try
            {
                mikrotik.Send("/ip/hotspot/user/add");
                mikrotik.Send("=profile=" + ActivProfile.Name);
                mikrotik.Send("=name=" + username);
                mikrotik.Send("=limit-uptime=" + ActivProfile.UpTime);
                mikrotik.Send("=password=" + password, true);

                List <string> res = mikrotik.Read();

                foreach (var item in res)
                {
                    logger.Info(item.ToString());
                }

                u          = new User();
                u.Username = username;
                u.Password = password;
            }
            catch (Exception ex)
            {
                return(u);
            }
            return(u);
        }
Пример #2
0
        public string AhmetMehmet()
        {
            MK mikrotik = new MK("vpn.wifiburada.com");

            if (!mikrotik.Login("admin", "As081316"))
            {
                //Console.WriteLine("Could not log in");
                mikrotik.Close();
                return("Hatalı");
            }
            var aa = "";

            //var aaa = "";
            mikrotik.Send("/ip/address/print");
            mikrotik.Send("?=address=10.1.1.1/24");
            mikrotik.Send(".tag=sss", true);
            foreach (string h in mikrotik.Read())
            {
                aa += h;
                aa += "\n";
                //return h;
                //Console.WriteLine(h);
            }


            return(aa);
        }
Пример #3
0
        private string command(string command, string router)
        {
            string output = "";
            MK mikrotik = new MK(router);

            if (!mikrotik.Login("api", "api"))
            {
                //MessageBox.Show("Could not log in");
                mikrotik.Close();
                return "false";
            }

            mikrotik.Send(command);
            mikrotik.Send(".tag=sss", true);

            foreach (string response in mikrotik.Read())
            {
                output += response;
            }
            return output;
        }