public string StartPoison() { using (SshClient client = new SshClient(this.connectionInfo)) { try { client.Connect(); var result = client.CreateCommand(String.Format("EniacSpi ARPpoison {0} {1}", this.SelectedTargetHost.MAC, this.SelectedNetwork.MAC)).Execute(); client.Disconnect(); } catch (SocketException ex) { return($"{ex.HResult}: Target machine actively refused SSH connection"); } catch (SshAuthenticationException ex) { return($"{ex.HResult}: Failed to authenticate SSH request"); } catch (Exception ex) { return($"{ex.HResult}: Failed to start Poison attack"); } } DropboxEvents.OnDropboxChanged(TargetHostTrafficReceived); return("Success"); }
public async Task <ActionResult> Dropbox() { // Get the request signature var signatureHeader = Request.Headers.GetValues("X-Dropbox-Signature"); if (signatureHeader == null || !signatureHeader.Any()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // Get the signature value string signature = signatureHeader.FirstOrDefault(); // Extract the raw body of the request string body = null; using (StreamReader reader = new StreamReader(Request.InputStream)) { body = await reader.ReadToEndAsync(); } // Check that the signature is good string appSecret = "6p8fg1v2ud59n9t"; using (HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(appSecret))) { if (!VerifySha256Hash(hmac, body, signature)) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } // Do your thing here... e.g. store it in a queue to process later DropboxEvents.DropboxChanged(); // Return A-OK return(new HttpStatusCodeResult(HttpStatusCode.OK)); }