C# Extracting Email:Password and Username:Passwords from string - -PUBG- - Dec 29, 2018
I know the usual way I would go about this would be to use Regex, My question being how would I extract all Email and passwords or username and passwords out of a string and put it into a string by itself. Thanks!
RE: C# Extracting Email:Password and Username:Passwords from string - TCP - Dec 29, 2018
If you have mixed contents and you need to recognize a pattern you should use a regex solution, any reason for not using it?
RE: C# Extracting Email:Password and Username:Passwords from string - -PUBG- - Dec 29, 2018
I know that regex is the way to go I just don't know the pattern to use.
RE: C# Extracting Email:Password and Username:Passwords from string - Onireves - Dec 29, 2018
Shouldn't it be something like this?
Code string details = "user:pass";
string[] detail = details.Split(':');
string user = detail[0];
string pass = detail[1];
RE: C# Extracting Email:Password and Username:Passwords from string - Disease - Dec 29, 2018
(Dec 29, 2018 07:12 PM)Onireves Wrote: Shouldn't it be something like this?
Code string details = "user:pass";
string[] detail = details.Split(':');
string user = detail[0];
string pass = detail[1];
Only if the data is perfectly delineated by colons. By the sound of the OP though, it's far from that.
(Dec 29, 2018 04:54 PM)RapidHost™ Wrote: I know the usual way I would go about this would be to use Regex, My question being how would I extract all Email and passwords or username and passwords out of a string and put it into a string by itself. Thanks!
Show us a sample of the dataset, and we can better work up a potential RegEx pattern.
RE: C# Extracting Email:Password and Username:Passwords from string - -PUBG- - Dec 29, 2018
See that is what I am getting at, I am trying to make it extract in any situation or close to it, So if it has 1,000 lines and there is arandom username/password or email/password like
Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data username:password Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data [email protected]:password Data Data Data Data Data Data Data Data Data Data Data
or something such as that.
I guess I don't know the best way to go about it and make it grab them all.
RE: C# Extracting Email:Password and Username:Passwords from string - 0xDEAD10CC - Dec 30, 2018
The regex for email is publicly available all over the internet. Why couldn't you combine it with a colon, and a pattern to match the charset used for the passwords?
And if you're splitting by colon, the first colon should be fine because the email probably won't contain one, but a password may, so even the split method above is bugged unless you introduce the count parameter for a value of 2 to avoid it splitting after the first occurrence.
RE: C# Extracting Email:Password and Username:Passwords from string - gigajew - Dec 30, 2018
You could try regular expression. I'm not that good, but here's a start https://rubular.com/r/4JzzeG7g7LhF
RE: C# Extracting Email:Password and Username:Passwords from string - .TheMarv - Dec 30, 2018
if you have like this:
Code DATA DATA DATA DATA DATA [email protected]:password DATA DATA DATA DATA DATA DATA DATA DATA [email protected]:password DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA [email protected]:password DATA DATA DATA DATA DATA DATA test:password DATA DATA DATA DATA DATA DATA DATA test:password DATA DATA DATA DATA DATA
you can use this Regex.
it finds user:pass and mail:pass, but will probably be bugged if there are other : unrelated to user:pass or mail:pass.
Example usage:
Code string data = "DATA here";
List<string> results = new List<string>();
Regex r = new Regex(@"\s?([^\s]*:[^\s]*)");
foreach(Match m in r.Matches(data)){
results.Add(m.Groups[1].Value);
}
code not tested tho(but should be working)
RE: C# Extracting Email:Password and Username:Passwords from string - -PUBG- - Dec 30, 2018
Thank you all for the replies and all of your help :)
(Dec 30, 2018 10:24 AM).TheMarv Wrote: if you have like this:
Code DATA DATA DATA DATA DATA [email protected]:password DATA DATA DATA DATA DATA DATA DATA DATA [email protected]:password DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA [email protected]:password DATA DATA DATA DATA DATA DATA test:password DATA DATA DATA DATA DATA DATA DATA test:password DATA DATA DATA DATA DATA
you can use this
Regex.
it finds user:pass and mail:pass, but will probably be bugged if there are other : unrelated to user:pass or mail:pass.
Example usage:
Code string data = "DATA here";
List<string> results = new List<string>();
Regex r = new Regex(@"\s?([^\s]*:[^\s]*)");
foreach(Match m in r.Matches(data)){
results.Add(m.Groups[1].Value);
}
code not tested tho(but should be working)
This grabs all the data that has a : in it. Which messed it all up.
Here is an example of what I am trying to parse, The email:password out of a file for example in this
http://pasted.co/306daa3b
RE: C# Extracting Email:Password and Username:Passwords from string - deiski - Dec 30, 2018
(Dec 30, 2018 03:44 PM)RapidHost™ Wrote: Thank you all for the replies and all of your help :)
This grabs all the data that has a : in it. Which messed it all up.
Here is an example of what I am trying to parse, The email:password out of a file for example in this
http://pasted.co/306daa3b
That's far from the original sample of data you provided.
RE: C# Extracting Email:Password and Username:Passwords from string - 0xBB - Dec 30, 2018
(Dec 30, 2018 03:44 PM)RapidHost™ Wrote: Thank you all for the replies and all of your help :)
This grabs all the data that has a : in it. Which messed it all up.
Here is an example of what I am trying to parse, The email:password out of a file for example in this
http://pasted.co/306daa3b
Here how about this pattern:
Code [\w\.-]+@[\w\.-]+:.*
Example (Repl.it link):
Code using System;
using System.Text.RegularExpressions;
class MainClass {
public static void Main (string[] args) {
var leData = @"
--------------------------------------------------------
-------------------<EpicAccount>------------------------
- Login: [email protected]:suckmyfuckinghugedick4312
--------------------------------------------------------
--------------------------------------------------------
----------------------<Skins>---------------------------
--------------------------------------------------------
=> Havoc
=> Sub Commander
--------------------------------------------------------
----------------------<Back Bling>------------------------
--------------------------------------------------------
=> Backup Plan
--------------------------------------------------------
----------------------<Pickaxes>------------------------
--------------------------------------------------------
=> Default Pickaxe
=> Instigator
--------------------------------------------------------
----------------------<Gliders>------------------------
--------------------------------------------------------
=> Slipstream
=> Default Glider
--------------------------------------------------------
----------------------<Dances>------------------------
--------------------------------------------------------
=> Dance Moves
=> Salute
=> Regal Wave
--------------------------------------------------------
----------------------<Emoji's>------------------------
--------------------------------------------------------
=> Let's Rock
=> In Love
=> Let's Rock
=> Battle Bus
--------------------------------------------------------
----------------------<Loading Screens>------------------------
--------------------------------------------------------
=> Drift
=> Calamity
--------------------------------------------------------
----------------------<Total Item Count>------------------------
--------------------------------------------------------
Total Skins -----> 2
Total BackBling -----> 1
Total Axes -----> 2
Total Gliders -----> 3
Total Dances -----> 3
Total Emoji's -----> 4
Total Loading Screens -----> 2
Total Items On Account -----> 17
--------------------------------------------------------
----------------------<Other Useful Information>------------------------
--------------------------------------------------------
Profile ID: (7814a9e6f315435db396e5bf4d2109da)
Account ID: (1a35a7ba8c614f1e83c405f4e7a6e94c)
Account Creation Date: (2018-03-02 2:12:44 AM)
Game Last Played: (2018-12-18 2:47:51 PM)
LifeTime Wins (0)
Season Level (1)
Account Level (51)
Has Current Battlepass: False
Has Save The World ---> False
Has Vbucks ---> False
Main Platform Used: EpicPC
Platforms Used/Linked:
PC
Can Send Gift: True
Can Recieve Gift: True
Completed 1ST B-Day Challenges: No
Plays On Galaxy Note 9: No
Has Twitch Prime Pack #1: Yes
Has Twitch Prime Pack #2: No
Has Bought Starter Pack: No
Has Mail Access: No
--------------------------------------------------------
----------------------<BattlePass Information>------------------------
--------------------------------------------------------
Had Season 2 BattlePass ---> No
Had Season 3 BattlePass ---> No
Had Season 4 BattlePass ---> No
Had Season 5 BattlePass ---> No
Has Current Battlepass (Season 6) ---> No
--------------------------------------------------------
----------------------<Past Season Info>------------------------
--------------------------------------------------------
Season #3
Season Wins: 0
Season XP: 571
Season Final Level: 22
Had BattlePass: False
Season #4
Season Wins: 0
Season XP: 0
Season Final Level: 1
Had BattlePass: False
Season #5
Season Wins: 0
Season XP: 1116
Season Final Level: 18
Had BattlePass: False
Season #6
Season Wins: 0
Season XP: 550
Season Final Level: 9
Had BattlePass: False
--------------------------------------------------------
----------------------<Account Information>------------------------
--------------------------------------------------------
Account ID: 1a35a7ba8c614f1e83c405f4e7a6e94c
Display Name: Bwr3ck
Email Address: [email protected]
First Name: Brad
Last Name: Bereck
Number Of Failed Logins: 0
Last Login Date: 2018-12-24 5:36:49 AM
Number Of Name Changes: 0
Country: US
Language: en
TFA Enabled: False
--------------------------------------------------------
--------------------DONE CHECKING-------------------------------
--------------------------------------------------------
-------------------<EpicAccount>------------------------
- Login: [email protected]:trashkidfuck213
--------------------------------------------------------
--------------------------------------------------------
----------------------<Skins>---------------------------
--------------------------------------------------------
=> Blue Team Leader
--------------------------------------------------------
----------------------<Back Bling>------------------------
--------------------------------------------------------
--------------------------------------------------------
----------------------<Pickaxes>------------------------
--------------------------------------------------------
=> Default Pickaxe
";
Regex r = new Regex(@"[\w\.-]+@[\w\.-]+:.*");
foreach(Match m in r.Matches(leData)){
Console.WriteLine (m.Value);
}
}
}
RE: C# Extracting Email:Password and Username:Passwords from string - Aristocles - Dec 30, 2018
PHP Code
<?php using System; using System.Net; using System.Text.RegularExpressions;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string txt = new WebClient().DownloadString("https://pastebin.com/raw/L7nbhyTT");
string re1 = "([\\w-+]+(?:\\.[\\w-+]+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,7})"; // Email Address 1 string re2 = "(.)"; // Any Single Character 1 string re3 = "((?:[a-z][a-z]*[0-9]+[a-z0-9]*))"; // Alphanum 1 string re4 = "(\\s+)"; // White Space 1
Regex r = new Regex(re1 + re2 + re3 + re4, RegexOptions.IgnoreCase | RegexOptions.Singleline); foreach (Match ItemMatch in r.Matches(txt)) { Console.WriteLine(ItemMatch); } Console.ReadLine(); } } }
]
RE: C# Extracting Email:Password and Username:Passwords from string - DBots - Jan 1, 2019
According to the pattern that I see, you could search for "- Login: " in each line and work with that.
Here is a VB sample, find a converter if you can't read it
https://pastebin.com/FFgZtNkW
Result:
RE: C# Extracting Email:Password and Username:Passwords from string - gigajew - Jan 1, 2019
If you still use regular expression, this is all you need:
Code Login:\s(.*?):(.*?)$
And here's an example code without regex:
|