///An interface for obtaining an IObject given a moniker string. ///A moniker can be used to obtain a particular object using a human-readable string to describe it, ///rather than having to know the object's UUID. Human-readable strings are, unfortunately, not ///guaranteed to be universally unique, so you might (theoretically) not get the object you want. ///It is an object that implements the IMoniker interface. A moniker acts as a name that uniquely ///identifies a COM object. In the same way that a path identifies a file in the file system, ///a moniker identifies a COM object in the directory namespace. ///A COM object that is used to create instances of other objects. Monikers save programmers time ///when coding various types of COM-based functions such as linking one document to another (OLE). See COM and OLE. /// <summary> /// Start capturing /// </summary> private bool Initialize() { if (this._selectDevice == null) { return(false); } if (this._selectDevice.CaptureDevice == null) { return(false); } IMoniker moniker = this._selectDevice.CaptureDevice.Moniker; if (moniker == null) { UIMessage.Info("Please select a capturing device", TITLE); return(false); } if (string.IsNullOrEmpty(this.txt_saveCapturedPath.Text)) { UIMessage.Info("Please select a path to save captured video", TITLE); return(false); } if (string.IsNullOrEmpty(this.txt_keyLive.Text)) { UIMessage.Info("Key lenght must be atleast 4 characters and atmost 256 characters", TITLE); return(false); } this._liveProcessor = new CaptureStegoProcess(moniker); this._liveProcessor.Setup(this.txt_saveCapturedPath.Text, this.vidOwner); return(true); }
private void btn_start_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this._srcFile)) { UIMessage.Info("Please select source AVI file for decompression.", TITLE); return; } if (string.IsNullOrEmpty(this._dcFile)) { UIMessage.Info("Please specify save path for decompressed AVI file.", TITLE); return; } if (this.worker.IsBusy) { return; } this.worker.RunWorkerAsync(); }
/// <summary> /// Extract the message from stego object /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_extract_Click(object sender, EventArgs e) { this.progress.Value = 0; if (this._processor == null) { UIMessage.Info("No stego object selected to extract data from", "Extract Message"); return; } ///Check whether user has entered the key if (this.txt_stegoKey.Text.Length == 0) { UIMessage.Info("Please provide the key used to hide the message", "Extract Message"); return; } ///Run the extraction process in background worker thread this.backgroundWorker.RunWorkerAsync(new BackgroundWorkerArgs() { Action = ActionType.Extract, Key = this.txt_stegoKey.Text }); }
/// <summary> /// Hide the message in cover object /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_hide_Click(object sender, EventArgs e) { this.progress.Value = 0; ///If no cover object selected yet if (this._processor == null) { UIMessage.Info("Please select a cover object to hide message in", "Hide Message"); return; } ///Check the legth of key if (this.txt_key.Text.Length < 4 || this.txt_key.Text.Length > Stego.Message.MAX_KEY_LEN) { UIMessage.Info("Key lenght must be atleast 4 characters and atmost 256 characters", "Hide Message"); return; } ///Check if there is enough room in cover object to store secret message and key in it if (this._hidingCapacity < (this.rtxt_message.Text.Length + this.txt_key.Text.Length + 8)) { UIMessage.Error("Message is bigger then hiding capacity", "Hide Message"); return; } ///Initialize the porgress bar this.progress.Minimum = 0; this.progress.Maximum = (int)this._processor.HostObject.Length; ///See if user hasn't entered the save path for stego object if (string.IsNullOrEmpty(this.txt_saveStego.Text)) { UIMessage.Info("Please select a path to save stego object", "Hide Message"); return; } ///Run the hiding process in background worker thread this.backgroundWorker.RunWorkerAsync(new BackgroundWorkerArgs() { Action = ActionType.Hide, Message = new HideIt.Stego.Message(this.txt_key.Text, this.rtxt_message.Text), SinkPath = this.txt_saveStego.Text }); using (new Status(this, this.lbl_status, "Logging information in database...")) { ///data insertion to maintain log table string _stego_file_name = txt_saveStego.Text; string _key = txt_key.Text; string _time = DateTime.Now.ToLongTimeString(); string _date = DateTime.Now.ToShortDateString(); SqlConnection con = new SqlConnection(DB.DbConnectionStr.conect()); ///SqlConnection con = new SqlConnection(constr); SqlCommand query = new SqlCommand("insert into Log_Table values('" + _stego_file_name + "','" + _key + "', '" + _date + "', '" + _time + "')", con); try { con.Open(); query.ExecuteNonQuery(); MessageBox.Show("Record entered successfully."); con.Close(); } catch (SqlException ex) { UIMessage.Error(ex.Message, TITLE); } } }
/// <summary> /// Called when new task is registered with background worker /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorkerArgs args = e.Argument as BackgroundWorkerArgs; ///Set the result to args that will be used when operations completes e.Result = args; if (args != null) { switch (args.Action) { case ActionType.Hide: //User has entered a save path for stego object, start hiding using (Status status = new Status(this, this.lbl_status, "Hidding...")) { RC4 encrypt = new RC4(args.Message.Key, args.Message.SecertMessage); HideIt.Stego.Message message = new HideIt.Stego.Message( args.Message.Key, encrypt.ApplyRC4()); using (LockUI lockUi = new LockUI(this)) { this._processor.Hide(message, args.SinkPath); //"hide" tab selected } } break; case ActionType.Extract: using (Status status = new Status(this, this.lbl_status, "Extracting...")) { using (LockUI lockUi = new LockUI(this)) { args.Message = this._processor.Extract(args.Key); //"extract" tab selected } } if (args.Message == null) { UIMessage.Info("Cannot extract message from stego object because of one of the following reasons:\r\n" + "-Stego object do no contain any message\r\n" + "-Key provided do not match with the key used to hide message", "Extract Message"); return; } RC4 decrypt = new RC4(args.Key, args.Message.SecertMessage); if (this.rtxt_hiddenMsg.InvokeRequired) { this.rtxt_hiddenMsg.Invoke((MethodInvoker)(() => { this.rtxt_hiddenMsg.Text = decrypt.ApplyRC4(); })); } else { this.rtxt_hiddenMsg.Text = decrypt.ApplyRC4(); } break; } } }