示例#1
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            try
            {
                string pythonFile     = Path.GetFullPath(parameters["PythonFile"]);
                string pythonCompiler = Path.GetFullPath(parameters["PythonCompiler"]);

                //Check for python compiler
                if (File.Exists(pythonCompiler))
                {
                    if (File.Exists(pythonFile))
                    {
                        this._returnValue = pinfo.ExecutePython(pythonCompiler, pythonFile, true);
                    }
                    else
                    {
                        this._returnValue = "Python file specified doesn't exists";
                    }
                }
                else
                {
                    this._returnValue = "Python compiler specified doesn't exists";
                }
            }
            catch (Exception exception)
            {
                this._returnValue = exception.Message;
            }
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string tempFileName = Path.GetTempFileName();


            _returnValue = tempFileName.ToString();
        }
示例#3
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var inicontainer = (FBcontainer)ubotStudio.ContainerParent;
            var token        = inicontainer.Token;

            try
            {
                var facebook = new FacebookGraphApi(token.Trim());
                facebook.ProxyStr  = inicontainer.Proxy;
                facebook.FBversion = inicontainer.Version;


                //Post Wall Post
                if (inicontainer.Attachement.Count == 0)
                {
                    facebook.PutWallPost(parameters["Message"], null, parameters["ProfileId"]);
                }
                else
                {
                    facebook.PutWallPost(parameters["Message"], inicontainer.Attachement, parameters["ProfileId"]);
                }
            }
            catch (Exception exp)
            {
                if (exp.GetType() == typeof(FacebookGraphApiException))
                {
                    inicontainer.Error = (exp as FacebookGraphApiException).Message;
                }
                else
                {
                    inicontainer.Error = exp.Message;
                }
            }
        }
示例#4
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string path     = parameters["Path to CSV file"];
            string csstyle  = parameters["CSS style"];
            string tblstyle = parameters["Table style"];
            string trstyle  = parameters["Tr style"];
            string tdstyle  = parameters["Td style"];
            string bdrsize  = parameters["Border size"];
            string list     = parameters["Return Result"];

            const char token = '\t';

            string[]      lines  = File.ReadAllLines(path);
            StringBuilder result = new StringBuilder();

            result.Append("<html><head>" + csstyle + "<table border ='" + bdrsize + "' " + tblstyle + ">");
            foreach (string line in lines)
            {
                string[] parts = line.Split(token);
                string   row   = "<tr " + trstyle + "><td " + tdstyle + ">" + string.Join("</td></tr>", parts) + "</td></tr>";
                string   v     = row.Replace(",", "</td><td " + tdstyle + ">");
                result.Append(v);
            }
            result.Append("</table></body></html>");

            ubotStudio.SetVariable(list, result.ToString());
        }
示例#5
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string textdata = parameters["Comma Delimited Text"];
            string csstyle  = parameters["CSS style"];
            string tblstyle = parameters["Table style"];
            string trstyle  = parameters["Tr style"];
            string tdstyle  = parameters["Td style"];
            string bdrsize  = parameters["Border size"];
            string list     = parameters["Return Result"];

            const char token = '\n';

            string[]      lines  = { textdata };
            StringBuilder result = new StringBuilder();

            result.Append("<html><head>" + csstyle + "<table border ='" + bdrsize + "' " + tblstyle + ">");
            foreach (string line in lines)
            {
                string[] parts = line.Split(token);
                string   row   = "<tr " + trstyle + "><td " + tdstyle + ">" + string.Join("</td></tr>", parts) + "</td></tr>";
                string   u     = row.Replace("</tr>", "</tr><td " + tdstyle + ">");
                string   v     = u.Replace(",", "</td><td " + tdstyle + ">");
                string   w     = v.Replace("</tr><td " + tdstyle + ">", "</tr><tr " + trstyle + "><td " + tdstyle + ">");

                result.Append(w);
            }
            result.Append("</table></body></html>");
            string newlist = result.ToString();
            string x       = newlist.Replace("<tr " + trstyle + "><td " + tdstyle + "></table>", "</table>");

            ubotStudio.SetVariable(list, x.ToString());
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var inicontainer = (FBcontainer)ubotStudio.ContainerParent;
            var token        = inicontainer.Token;

            try
            {
                var facebook = new FacebookGraphApi(token.Trim());
                facebook.ProxyStr  = inicontainer.Proxy;
                facebook.FBversion = inicontainer.Version;
                //post to my wall
                var data = new Dictionary <string, string>();
                data.Add("message", parameters["Status"]);
                var putobject = facebook.PutObject(parameters["Parent"], "feed", data);

                //Post Wall Post
                //facebook.PutWallPost(parameters["Status"], null, parameters["Parent"]);
            }
            catch (Exception exp)
            {
                if (exp.GetType() == typeof(FacebookGraphApiException))
                {
                    inicontainer.Error = (exp as FacebookGraphApiException).Message;
                }
                else
                {
                    inicontainer.Error = exp.Message;
                }
            }
        }
示例#7
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var inicontainer = (FBcontainer)ubotStudio.ContainerParent;
            var token        = inicontainer.Token;

            try
            {
                var facebook = new FacebookGraphApi(token.Trim());
                facebook.ProxyStr  = inicontainer.Proxy;
                facebook.FBversion = inicontainer.Version;
                //post a comment
                var putobject = facebook.PutLike(parameters["Object ID"]);
            }
            catch (Exception exp)
            {
                if (exp.GetType() == typeof(FacebookGraphApiException))
                {
                    inicontainer.Error = (exp as FacebookGraphApiException).Message;
                }
                else
                {
                    inicontainer.Error = exp.Message;
                }
            }
        }
示例#8
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var select  = parameters["Select"].Trim();
            var element = Node.WebDriverConnect.FindElement(By.XPath(select));

            element.Click();
        }
示例#9
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var taddy      = parameters["Address"];
            var tport      = parameters["Port"];
            var tuser      = parameters["Username"];
            var targuments = parameters["Arguments"];
            var tcommand   = parameters["Command"];
            var tplink     = parameters["Path to plink.exe"];


            try
            {
                var strReturn = "";

                var p = new Process {
                    StartInfo = { FileName = @"" + tplink }
                };

                if (targuments.Length == 0 || tuser.Length == 0 || taddy.Length == 0 || tport.Length == 0)
                {
                    _returnValue = new Exception("SSHClient: Invalid parameteres for SSHClient.").ToString();
                }

                var param = targuments + " " + tuser + "@" + taddy + " -P " + tport + " " + tcommand;

                if (File.Exists(@"" + tplink) == false)
                {
                    _returnValue =
                        new Exception(
                            "SSHClient: plink.exe not found. Make sure plink.exe is in the same folder as YOUR EXE.")
                        .ToString();
                }
                else
                {
                    p.StartInfo.UseShellExecute        = false;
                    p.StartInfo.RedirectStandardInput  = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.RedirectStandardError  = true;
                    p.StartInfo.CreateNoWindow         = true;
                    p.StartInfo.Arguments = param;

                    p.Start();
                    var standerOut = p.StandardOutput;

                    while (!p.HasExited)
                    {
                        if (!standerOut.EndOfStream)
                        {
                            strReturn += standerOut.ReadLine() + Environment.NewLine;
                        }
                    }
                }

                _returnValue = strReturn;
            }
            catch (Exception exp)
            {
                _returnValue = new Exception("SSHClient:", exp).ToString();
            }
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string familyName;
            string familyList = "";

            FontFamily[] fontFamilies;

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            // Get the array of FontFamily objects.
            fontFamilies = installedFontCollection.Families;

            // The loop below creates a large string that is a comma-separated
            // list of all font family names.

            int count = fontFamilies.Length;

            for (int j = 0; j < count; ++j)
            {
                familyName = fontFamilies[j].Name;
                familyList = familyList + familyName;
                familyList = familyList + ",";
            }

            //string[] pieces = familyList.Split(new string[] { "," }, StringSplitOptions.None);
            _returnValue = familyList.ToString();
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string url_of_file  = parameters["URL to gzip item"];
            string save_to_file = parameters["Save to file"];

            DownloadFile(url_of_file, save_to_file);
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string pathToImage = parameters["Path to Image"];
            string savetopath  = parameters["Save Image to"];
            int    nwidth      = Convert.ToInt32(parameters["New Width"]);
            int    nheight     = Convert.ToInt32(parameters["New Height"]);
            string AspectRatio = parameters["Preserve Aspect ratio?"];


            Image original = Image.FromFile(pathToImage);

            if (AspectRatio == "Yes")
            {
                Image resized = ResizeImage(original, new System.Drawing.Size(nwidth, nheight));
                resized.Save(savetopath, ImageFormat.Png);
                original.Dispose();
                resized.Dispose();
            }
            else if (AspectRatio == "No")
            {
                Image resized = ResizeImagef(original, new System.Drawing.Size(nwidth, nheight));
                resized.Save(savetopath, ImageFormat.Png);
                original.Dispose();
                resized.Dispose();
            }
            else
            {
                Image resized = ResizeImagef(original, new System.Drawing.Size(nwidth, nheight));
                resized.Save(savetopath, ImageFormat.Png);
                original.Dispose();
                resized.Dispose();
            }
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var foldersIn1  = parameters["Folder Path/Lists"];
            var zipSavePath = parameters["Zip Save Path"].Trim();

            try
            {
                var foldersIn2 = Regex.Split(foldersIn1, "\\n");//MessageBox.Show(String.Format("1:{0} / 2:{1}", foldersIn2[0], foldersIn2[1]));
                using (var z = new ZipOutputStream(File.Create(@zipSavePath)))
                {
                    z.UseZip64 = UseZip64.Dynamic;
                    z.SetLevel(3);
                    foreach (var folder in foldersIn2)
                    {
                        var folder2 = folder.Trim();
                        if (folder2 != "")
                        {
                            ZipFolder(@folder2, @folder2, z);
                        }
                    }
                    z.Finish();
                    z.Close();
                }
            }
            catch
            {
                //MessageBox.Show(ex.Message);
            }
        }
示例#14
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            try
            {
                string phpFile     = Path.GetFullPath(parameters["PhpFile"]);
                string phpCompiler = Path.GetFullPath(parameters["PhpCompiler"]);

                //Check for php compiler
                if (File.Exists(phpCompiler))
                {
                    if (File.Exists(phpFile))
                    {
                        RunScript(phpCompiler, phpFile);
                    }
                    else
                    {
                        this._returnValue = "Php file specified doesn't exists";
                    }
                }
                else
                {
                    this._returnValue = "Php compiler specified doesn't exists";
                }
            }
            catch (Exception exception)
            {
                this._returnValue = exception.Message;
            }
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            DateTime Now = DateTime.Now;

            Now = Now.AddMonths(-1);
            this._returnValue = Now.ToString("MMMM");
        }
示例#16
0
        public void Execute(IUBotStudio ubotStudio, Dictionary<string, string> parameters)
        {
            // Grab the value of the Alert Text parameter we defined.
            string numberString = parameters["Value Numeric?"];
            //var displaymessage = parameters["Display message"].ToLower();

            // Display the MessageBox with an error icon and the text given.
            //if (displaymessage.ToLower() == "yes")
            //{
            //    MessageBox.Show(value, "Error Alert", MessageBoxButton.OK, MessageBoxImage.Error);
            //}

            //FolderBrowserDialog dialog = new FolderBrowserDialog();
            //dialog.ShowDialog();
            //string selected = dialog.SelectedPath;
            decimal numericval = 0;
            bool canConvert = decimal.TryParse(numberString, out numericval);
            if (canConvert)
            {
                //Console.WriteLine("number3 = {0}", numericval);
                _returnValue = "true";
            }
            else
            {
                //Console.WriteLine("numString is not a valid decimal");
                _returnValue = "false";
            }
        }
示例#17
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string content        = parameters["csvcontent"];
            string findText       = parameters["find"].Trim().ToLower();
            string replaceText    = parameters["replace"].Trim();
            string errorMessageId = parameters["Message"];

            if (findText.Trim().Length == 0)
            {
                ubotStudio.SetVariable(errorMessageId, "find/search text can't be empty.");
                _returnValue = string.Empty;
            }
            else if (content.Trim().Length == 0)
            {
                ubotStudio.SetVariable(errorMessageId, "content can't be empty.");
            }
            else
            {
                String[] items = content.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < items.Length; i++)
                {
                    items[i] = Regex.Replace(items[i], findText, replaceText.Trim(), RegexOptions.IgnoreCase);
                }
                List <string> retList = items.Where(item => !string.IsNullOrWhiteSpace(item)).Select(item => item).ToList();
                _returnValue = string.Join(Environment.NewLine, retList);
            }
        }
示例#18
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            //string contentName = parameters["csvcontent"];

            string value = parameters["csvcontent"]; // ubotStudio.GetVariable(contentName);

            string containsHeader = parameters["Contains Headers?"];

            string delimiter = parameters["Delimiter"];

            string title = parameters["Window Title"];

            char del = ',';

            if (delimiter != null && delimiter.Trim().Length > 0)
            {
                del = Char.Parse(delimiter.Trim());
            }

            if (value != null && value.Trim().Length > 1 && containsHeader != null && containsHeader.Trim().Length > 0)
            {
                TableCSVGrid _wizardWindow = new TableCSVGrid();
                _wizardWindow.csvFileContent = value;
                _wizardWindow.containsHeader = containsHeader == "Yes" ? true : false;
                _wizardWindow.delimiter      = del;
                _wizardWindow.Title          = title;
                _wizardWindow.ShowDialog();
                _returnValue = _wizardWindow.newContent;
            }
        }
示例#19
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string twiliosid    = parameters["Twilio SID"];
            string twiliotoken  = parameters["Twilio Token"];
            string from         = parameters["From +19998889898"];
            string to           = parameters["To +19998889898"];
            string msg          = parameters["SMS Message"];
            string imageurllink = parameters["URL to image"];

            var accountSid = twiliosid;
            var authToken  = twiliotoken;

            TwilioRestClient client = new TwilioRestClient(accountSid, authToken);

            var message = client.SendMessage(from, to, msg, new string[] { imageurllink });

            //Console.WriteLine(message.Sid);

            var result = message.Sid;

            if (message.RestException != null)
            {
                _returnValue = message.RestException.Message;
            }
            if (message.RestException == null)
            {
                _returnValue = result;
            }

            // _returnValue = debug;
        }
示例#20
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string twiliosid   = parameters["Twilio SID"];
            string twiliotoken = parameters["Twilio Token"];
            string from        = parameters["From +19998889898"];
            string to          = parameters["To +19998889898"];
            string msg         = parameters["SMS Message"];

            var accountSid = twiliosid;
            var authToken  = twiliotoken;

            //TwilioRestClient client = new TwilioRestClient(accountSid, authToken);

            var twilio = new TwilioRestClient(accountSid, authToken);

            var message = twilio.SendMessage(from, to, msg);

            //var message = twilio.SendMessage("+14015371287", "[To]", null, null, null);

            //var message = client.SendSmsMessage(from, to, msg);
            //Console.WriteLine(message.Sid);

            var result = message.Sid;

            if (message.RestException != null)
            {
                _returnValue = message.RestException.Message;
            }
            if (message.RestException == null)
            {
                _returnValue = result;
            }

            // _returnValue = debug;
        }
示例#21
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string sound = parameters["Play Sound"];

            if (sound == "Asterisk")
            {
                System.Media.SystemSounds.Asterisk.Play();
            }
            else if (sound == "Beep")
            {
                System.Media.SystemSounds.Hand.Play();
            }
            else if (sound == "Exclamation")
            {
                System.Media.SystemSounds.Exclamation.Play();
            }
            else if (sound == "Hand")
            {
                System.Media.SystemSounds.Hand.Play();
            }
            else if (sound == "Question")
            {
                System.Media.SystemSounds.Question.Play();
            }
            else
            {
            }
        }
示例#22
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string myUrl        = parameters["Http URL"];
            string serviceToUse = parameters["Service?"];

            if (serviceToUse == "TinyURL")
            {
                string new_url = ShortUrlTiny(myUrl);
                _returnValue = new_url;
            }
            else if (serviceToUse == "Google")
            {
                string new_url = GShorten(myUrl);
                _returnValue = new_url;
            }
            else if (serviceToUse == "Bit.ly")
            {
                string new_url = ShortUrlBitly(myUrl);
                _returnValue = new_url;
            }
            else
            {
                string new_url = ShortUrlTiny(myUrl);
                _returnValue = new_url;
            }
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string Location      = parameters["Path to Location"];
            string StructureType = parameters["Return Data Type"];

            if (StructureType == "Full Path")
            {
                string[] result = System.IO.Directory.GetDirectories(Location);
                string   c      = "";

                //FIND ALL FOLDERS IN FOLDER
                foreach (string dir in result)
                {
                    c = c + "\n" + dir;
                }

                _returnValue = c;
            }
            else if (StructureType == "Folder Name Only")
            {
                string[] result = System.IO.Directory.GetDirectories(Location);
                string   c      = "";

                //FIND ALL FOLDERS IN FOLDER
                foreach (string dir in result)
                {
                    var dirName = new DirectoryInfo(dir).Name;
                    c = c + "\n" + dirName;
                }
                _returnValue = c;
            }
            else
            {
            }
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string ttxt = parameters["Text input"];

            var result = totalWords(ttxt);

            _returnValue = result.ToString();
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string FirstURL = parameters["Url to get final URL"];

            string result = UrlLengthen(FirstURL);

            _returnValue = result.ToString();
        }
示例#26
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            TimeSpan timeSpan    = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0);
            long     unixVersion = (long)ConvertToUnixTimestamp(DateTime.Now);


            this._returnValue = unixVersion.ToString();
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string roundnum = parameters["Item to round"];

            var result = decimal.Round(Convert.ToDecimal(roundnum));

            _returnValue = result.ToString();
        }
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string FirstURL = parameters["URL"];

            string result = RedirectPath(FirstURL);

            _returnValue = result.ToString();
        }
示例#29
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string year     = DateTime.Now.ToString("yyyy");
            int    curYear  = Convert.ToInt32(year);
            int    lastYear = curYear - 1;

            this._returnValue = lastYear.ToString();
        }
示例#30
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            int    year          = DateTime.Now.Year;
            int    month         = DateTime.Today.Month;
            string days_in_month = DateTime.DaysInMonth(year, month).ToString();

            this._returnValue = days_in_month;
        }
示例#31
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            string tableValue  = parameters["csvcontent"];
            string delimiter   = parameters["Delimiter"];
            string position    = parameters["Row Position"];
            string findText    = parameters["Find"];
            string replaceText = parameters["Replace"];
            string msgId       = parameters["ErrorMessage"];
            int    pos         = -1;
            char   del         = ',';

            if (delimiter.Trim().Length > 0)
            {
                del = char.Parse(delimiter.Trim());
            }

            bool parsed = int.TryParse(position, out pos);

            if (!parsed)
            {
                ubotStudio.SetVariable(msgId, "Only numeric value allowed for position.");
                _returnValue = string.Empty;
            }

            if (tableValue != null && tableValue.Trim().Length > 1)
            {
                List <string> rows = tableValue.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                if (pos < 0 || pos > (rows.Count - 1))
                {
                    ubotStudio.SetVariable(msgId, string.Format("Position can be from {0} to {1}.", 0, rows.Count - 1));
                    _returnValue = string.Empty;
                }
                else
                {
                    if (findText.Trim().Length == 0)
                    {
                        ubotStudio.SetVariable(msgId, "Find text can't be empty.");
                        _returnValue = string.Empty;
                    }
                    else
                    {
                        string[] items = rows[pos].Split(new char[] { del });
                        for (int i = 0; i < items.Length; i++)
                        {
                            items[i] = Regex.Replace(items[i], findText.Trim(), replaceText.Trim(), RegexOptions.IgnoreCase);
                        }
                        rows[pos]    = String.Join(del.ToString(), items.ToArray());
                        _returnValue = string.Join(Environment.NewLine, rows.ToArray());
                        ubotStudio.SetVariable(msgId, "Success");
                    }
                }
            }
            else
            {
                ubotStudio.SetVariable(msgId, "Table is empty.");
                _returnValue = string.Empty;
            }
        }