private void Login() { LoginButt.Enabled = false; bool worked = UploadHdr.Login(Username.Text, Password.Text); if (RegistryHdr.getValue("context") != ContextEnable.Checked.ToString() & !(ContextEnable.Checked == false & RegistryHdr.getValue("context") == "")) { //todo: E/Disable content thingy thing MessageBox.Show("An elevated Process needs to be started to enable explorer right-clicking.\nPlease click yes."); var exeName = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Substring(8).Replace('/', '\\'); ProcessStartInfo startInfo = new ProcessStartInfo(exeName); startInfo.Verb = "runas"; if (ContextEnable.Checked == true) { startInfo.Arguments = "RegisterRC"; } else { startInfo.Arguments = "DeRegisterRC"; } Process p = Process.Start(startInfo); p.WaitForExit(); RegistryHdr.setValue("context", ContextEnable.Checked.ToString()); UploadHdr.Context = ContextEnable.Checked; } if (RegistryHdr.getValue("autostart") != AutostartEnable.Checked.ToString()) { StartupHdr.Autostart(AutostartEnable.Checked); } UpdateAll(); if (worked == true) { Username.Text = ""; Password.Text = ""; ErrorText.Text = ""; System.Media.SystemSounds.Hand.Play(); } else { ErrorText.Text = "Couldn't log in!"; Password.Text = ""; System.Media.SystemSounds.Asterisk.Play(); } LoginButt.Enabled = true; }
public IconHdr() { string[] arguments = Environment.GetCommandLineArgs(); //MessageBox.Show(arguments.Concat); if (arguments.Length > 1) { if (arguments[1] == "RegisterRC") { StartupHdr.RegisterRC(); notifyIcon.Visible = false; //Application.Exit(); //MessageBox.Show("closing"); Environment.Exit(0); } else if (arguments[1] == "DeRegisterRC") { StartupHdr.DeRegisterRC(); notifyIcon.Visible = false; //Application.Exit(); //MessageBox.Show("closing"); Environment.Exit(0); } else { StartupHdr.Startup(configWindow); for (int i = 1; i < arguments.Count(); i++) { string path = arguments[i]; UploadHdr.Upload(path); } System.Media.SystemSounds.Hand.Play(); Environment.Exit(0); } } else { HotKeyHdr Hotkeys = new HotKeyHdr(); MenuItem consoleMenuItem = new MenuItem("Console", new EventHandler(ShowConsole)); MenuItem configMenuItem = new MenuItem("Configuration", new EventHandler(ShowConfig)); MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(Exit)); notifyIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);; notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { consoleMenuItem, configMenuItem, exitMenuItem }); notifyIcon.MouseClick += new MouseEventHandler(LeftClick); notifyIcon.Visible = true; StartupHdr.Startup(configWindow); } }
public static bool Recover() { Filedata = new string[] { RegistryHdr.getValue("uid"), RegistryHdr.getValue("utk") }; Boolean.TryParse(RegistryHdr.getValue("context"), out Context); Boolean.TryParse(RegistryHdr.getValue("autostart"), out Autostart); GetName(); StartupHdr.UpdateExes(Autostart, Context); if (Username != "false" & Username != "") { LoggedIn = true; return(true); } else { return(false); } }
static public string GetName() { Username = PostRequest("https://hllm.tk/php/upload/confirm", new NameValueCollection() { { "uid", Filedata[0] }, { "utk", Filedata[1] } }); if (Username == "false" || Username == "") { LoggedIn = false; StartupHdr.ShowLogin(); return(""); } try { return(Username); }catch { return(""); } }
static public void Upload(string path, string subdir = "", bool getToken = false) { if (LoggedIn) { Cursor.Current = Cursors.WaitCursor; if (File.Exists(path)) { string dataStr = Convert.ToBase64String(File.ReadAllBytes(path)); string filename = Path.GetFileName(path); Console.WriteLine("Uploading " + filename + (subdir != "" ? " under: " + subdir : "")); string response = PostRequest("https://hllm.tk/php/upload/upload", new NameValueCollection() { { "uid", Filedata[0] }, { "utk", Filedata[1] }, { "data", dataStr }, { "name", filename }, { "dir", subdir } }); if (response != "false") { if (subdir == "" || getToken) { Clipboard.SetText(response); } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("OK"); Console.ForegroundColor = ConsoleColor.White; } else { ConsoleHdr.writeE("ERROR UPLOADING"); //Console.ReadKey(); //System.Threading.Thread.Sleep(2000); } } else if (Directory.Exists(path)) { bool token = false; if (subdir == "" || getToken) { token = true; } Console.WriteLine("Encountered /" + new DirectoryInfo(path).Name + " ..."); subdir = subdir + new DirectoryInfo(path).Name + "/"; string[] paths = Directory.GetFileSystemEntries(path); foreach (string newpath in paths) { Upload(newpath, subdir); } if (token) { string response = PostRequest("https://hllm.tk/php/upload/token", new NameValueCollection() { { "uid", Filedata[0] }, { "utk", Filedata[1] }, { "name", new DirectoryInfo(path).Name }, { "dir", "" } }); Clipboard.SetText(response); } } else { ConsoleHdr.writeE(Path.GetFileName(path) + " not found!"); } } else { StartupHdr.ShowLogin(); } Cursor.Current = Cursors.Default; }
static private bool commandLineStep() { Console.Write(">"); string raw = Console.ReadLine(); int x = 2; string[] rawArray = raw.Split(new char[] { ' ' }, x); string command = rawArray[0]; List <string> args = new List <string>(); if (rawArray.Length > 1) { string pattern = "[\"'](.*?)[\"']|([^ \"'\\s]+)"; Regex rgx = new Regex(pattern); int[] groupNumbers = rgx.GetGroupNumbers(); Match m = rgx.Match(rawArray[1]); while (m.Success) { for (int i = 1; i <= 2; i++) { Group g = m.Groups[i]; CaptureCollection cc = g.Captures; if (cc.Count > 0) { args.Add(cc[0].Value); } } m = m.NextMatch(); } } switch (command) { case "damn": case "bye": case "kys": case "quit": case "close": case "exit": write("Bye!"); System.Threading.Thread.Sleep(500); return(false); //FreeCons(); break; case "upload": if (args.Count == 0) { OpenFileDialog opf = new OpenFileDialog(); DialogResult result = opf.ShowDialog(); if (result == DialogResult.OK) { UploadHdr.Upload(opf.FileName); } else { writeE("There was an problem with:\n" + opf.FileName); } } else { foreach (string path in args) { UploadHdr.Upload(path); } } break; case "logout": UploadHdr.Logout(); Console.WriteLine("Please log back in"); StartupHdr.ShowLogin(); break; case "screenshot": Process proc = Process.Start("snippingtool", "/clip"); proc.WaitForExit(); if (Clipboard.ContainsImage()) { string path = Path.GetTempPath() + "screenshot_" + DateTime.Now.ToString("dd-MM-yy_HH.mm.ss") + ".png"; Image img = Clipboard.GetImage(); img.Save(path, System.Drawing.Imaging.ImageFormat.Png); UploadHdr.Upload(path, "screenshots/", true); File.Delete(path); } else { writeE("Theres no picture!"); } break; case "fullscreenshot": string ImgPath = Path.GetTempPath() + "screenshot_" + DateTime.Now.ToString("dd-MM-yy_HH.mm.ss") + ".png"; Bitmap image = HotKeyHdr.screenshot(); image.Save(ImgPath, System.Drawing.Imaging.ImageFormat.Png); UploadHdr.Upload(ImgPath, "screenshots/", true); File.Delete(ImgPath); break; default: writeE("Unrecognized command: " + command); break; } return(true); }