Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. private void ScanPorts()
  2. {
  3. if (!(FileLocationPORTS == string.Empty))
  4. {
  5. string[] ArrayString = File.ReadAllLines(FileLocationPORTS);
  6. foreach (string host in ArrayString)
  7. {
  8. string s = host.Split(':')[0];
  9. s = host.Split(';')[0];
  10. foreach (int port in ListaPortowHTTP)
  11. {
  12. using (var tcp = new TcpClient())
  13. {
  14. var ar = tcp.BeginConnect(s, port, null, null);
  15. using (ar.AsyncWaitHandle)
  16. {
  17. if (ar.AsyncWaitHandle.WaitOne(2500, false))
  18. {
  19. try
  20. {
  21. tcp.EndConnect(ar);
  22. ++count;
  23. flatLabel4.Text = "Proxies Ports Opened: " + count;
  24. list_2.Add(s + ":" + port);
  25. File.WriteAllLines(SCANPORTSOUTPUT, list_2.Distinct().ToArray());
  26.  
  27. }
  28. catch
  29. {
  30. }
  31. tcp.Close();
  32. }
  33. else
  34. {
  35. }
  36. }
  37. }
  38. count2++;
  39. flatLabel5.Text = "Checked PORTS : " + count2 + "/23";
  40.  
  41. }
  42. flatLabel5.Text = "Checked PORTS : " + "0/23";
  43. count2 = 0;
  44. count1++;
  45. int numOfLines = File.ReadAllLines(FileLocationPORTS).Length;
  46. double xd = numOfLines / 100;
  47. Math.Round(xd);
  48. flatLabel6.Text = "Checked IPS: " + count1 + "/" + numOfLines;
  49. if (count1 % xd == 0)
  50. {
  51. portprogress.Value++;
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement