Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using System.Net;
  2. using System.Text;
  3. using System.IO;
  4.  
  5. namespace inHand
  6. {
  7. class Inhand
  8. {
  9. string id;
  10. string ip;
  11. string username;
  12. string password;
  13.  
  14. public string Id { get => id; set => id = value; }
  15. public string Ip { get => ip; set => ip = value; }
  16. public string Username { get => username; set => username = value; }
  17. public string Password { get => password; set => password = value; }
  18.  
  19. public Inhand(string id, string ip, string username, string password)
  20. {
  21. Id = id;
  22. Ip = ip;
  23. Username = username;
  24. Password = password;
  25. }
  26.  
  27. public void IO_ON()
  28. {
  29. string payload = $"http://{Ip}/apply.cgi/?_ajax=1&_web_cmd=%21%0Aio%20output%201%20on%0A";
  30. byte[] byteArray = Encoding.ASCII.GetBytes(payload);
  31. WebRequest request = WebRequest.Create(payload);
  32. request.Credentials = new NetworkCredential(Username, Password);
  33. request.Method = "POST";
  34. request.ContentLength = (byteArray).Length;
  35. request.ContentType = "application/x-www-form-urlencoded";
  36. Stream datastream = request.GetRequestStream();
  37. datastream.Write(byteArray, 0, byteArray.Length);
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement