Advertisement
Guest User

5 3wstdfger2ewdarf1qa3ews

a guest
Feb 24th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.36 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MultiPortScan
  4. {
  5. /// <summary>
  6. /// A Console type Multi Port TCP Scanner
  7. /// Author : Jack Hack
  8. /// </summary>
  9.  
  10. class Program
  11. {
  12.  
  13. static void Main(string[] args)
  14. {
  15. // App info
  16. Console.ForegroundColor = ConsoleColor.White;
  17. Console.WriteLine("###########################################");
  18. Console.ForegroundColor = ConsoleColor.Green;
  19. Console.WriteLine(" PortScanner made by JackHack");
  20. Console.ForegroundColor = ConsoleColor.White;
  21. Console.WriteLine("###########################################");
  22.  
  23. // Username
  24. Console.ForegroundColor = ConsoleColor.Cyan;
  25. Console.WriteLine("Username");
  26. Console.ForegroundColor = ConsoleColor.White;
  27. string Username = Console.ReadLine();
  28.  
  29. // Password
  30. Console.ForegroundColor = ConsoleColor.Cyan;
  31. Console.WriteLine("Password");
  32. Console.ForegroundColor = ConsoleColor.White;
  33. string Password = Console.ReadLine();
  34. Console.ForegroundColor = ConsoleColor.Blue;
  35. Console.WriteLine("Login sucsessful");
  36.  
  37. string host;
  38. int portStart;
  39. int portStop;
  40. int Threads;
  41. int timeout;
  42.  
  43. youGotItWrong: //goto: Start Again
  44.  
  45. //this is for the user to select a host ip
  46. string ip;
  47. Console.ForegroundColor = ConsoleColor.Yellow;
  48. Console.WriteLine("Enter Host I.P or Domain");
  49. Console.ResetColor();
  50. Console.Write("Enter Host I.P or Domain : ");
  51. ip = Console.ReadLine();
  52. Console.WriteLine();
  53. host = ip;
  54.  
  55. //this is for the user to select the start port
  56. string startPort;
  57. Console.ForegroundColor = ConsoleColor.Yellow;
  58. Console.WriteLine("Min Start Port : 0");
  59. Console.ResetColor();
  60. Console.Write("Enter A start Port : ");
  61. startPort = Console.ReadLine();
  62. Console.WriteLine();
  63.  
  64. //THIS CHECKS TO SEE IF IT THE START PORT CAN BE PARSED OUT
  65. int number;
  66. bool resultStart = int.TryParse(startPort, out number);
  67.  
  68. if (resultStart)
  69. {
  70. portStart = int.Parse(startPort);
  71. }
  72.  
  73. else
  74. {
  75. Console.WriteLine("Try Again NOOOB!!");
  76. goto youGotItWrong;
  77. // return;
  78. }
  79.  
  80.  
  81. //this is for the end port
  82. string endPort;
  83. Console.ForegroundColor = ConsoleColor.Yellow;
  84. Console.WriteLine("Max End Port : 65535");
  85. Console.ResetColor();
  86. Console.Write("Enter A End Port : ");
  87. endPort = Console.ReadLine();
  88. Console.WriteLine();
  89.  
  90.  
  91. //THIS CHECKS TO SEE IF IT THE END PORT CAN BE PARSED OUT
  92. int number2;
  93. bool resultEnd = int.TryParse(endPort, out number2);
  94.  
  95. if (resultEnd)
  96. {
  97. portStop = int.Parse(endPort);
  98. }
  99.  
  100. else
  101. {
  102. Console.WriteLine("Try Again NOOOB!!");
  103.  
  104. goto youGotItWrong;
  105. // return;
  106. }
  107.  
  108. //this is how many threads will be started
  109. string threadsToRun;
  110. Console.ForegroundColor = ConsoleColor.Yellow;
  111. Console.WriteLine("Normal Thread amount is between 1 - 50 (less threads = higher accuracy)");
  112. Console.ResetColor();
  113. Console.Write("Enter How Many Threads To Run : ");
  114. threadsToRun = Console.ReadLine();
  115. Console.WriteLine();
  116.  
  117.  
  118. //THIS CHECKS TO SEE IF IT THE END PORT CAN BE PARSED OUT
  119. int number3;
  120. bool resultThreads = int.TryParse(threadsToRun, out number3);
  121.  
  122. if (resultThreads)
  123. {
  124. Threads = int.Parse(threadsToRun);
  125. }
  126.  
  127. else
  128. {
  129. Console.WriteLine("Try Again NOOOB!!");
  130.  
  131. goto youGotItWrong;
  132.  
  133. // return;
  134. }
  135.  
  136. //this is how many threads will be started
  137. string tcpTimeout;
  138. Console.ForegroundColor = ConsoleColor.Yellow;
  139. Console.WriteLine("Normal Timeout amount is between 1 - 10 secs ( 1 = 1 second)(higher timeout = higher accuracy)");
  140. Console.ResetColor();
  141. Console.Write("Enter Timeout : ");
  142. tcpTimeout = Console.ReadLine();
  143. Console.WriteLine();
  144.  
  145. //THIS CHECKS TO SEE IF IT THE timeout CAN BE PARSED OUT
  146. int number4;
  147. bool resultTimeout = int.TryParse(tcpTimeout, out number4);
  148.  
  149. if (resultTimeout)
  150. {
  151. timeout = int.Parse(tcpTimeout) * 1000;
  152.  
  153. }
  154.  
  155. else
  156. {
  157. Console.WriteLine("Try Again NOOOB!!");
  158.  
  159. goto youGotItWrong;
  160. // return;
  161. }
  162.  
  163. try
  164. {
  165.  
  166. host = ip;
  167. }
  168. catch (Exception ex)
  169. {
  170. Console.WriteLine(ex.Message);
  171. return;
  172. }
  173.  
  174. if (resultStart == true && resultEnd == true)
  175. {
  176. try
  177. {
  178.  
  179. portStart = int.Parse(startPort);
  180. portStop = int.Parse(endPort);
  181.  
  182. }
  183. catch (Exception ex)
  184. {
  185. Console.WriteLine(ex.Message);
  186. return;
  187. }
  188.  
  189. }
  190. if (resultThreads == true)
  191. {
  192. try
  193. {
  194.  
  195. Threads = int.Parse(threadsToRun);
  196. }
  197. catch (Exception ex)
  198. {
  199. Console.WriteLine(ex.Message);
  200.  
  201. return;
  202. }
  203. }
  204.  
  205. PortScanner ps = new PortScanner(host, portStart, portStop , timeout);
  206. ps.start(Threads);
  207.  
  208. }
  209.  
  210. }
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement