diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementConsole/AccountManagementConsole.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementConsole/AccountManagementConsole.csproj Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,63 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {756440DE-D000-4CD0-8735-30AAB282FD13} + Exe + Properties + AccountManagementConsole + AccountManagementConsole + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + .\AccountManagementEngine.dll + + + .\OTPNet.dll + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementConsole/AccountManagementConsole.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementConsole/AccountManagementConsole.sln Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountManagementConsole", "AccountManagementConsole.csproj", "{756440DE-D000-4CD0-8735-30AAB282FD13}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {756440DE-D000-4CD0-8735-30AAB282FD13}.Debug|x86.ActiveCfg = Debug|x86 + {756440DE-D000-4CD0-8735-30AAB282FD13}.Debug|x86.Build.0 = Debug|x86 + {756440DE-D000-4CD0-8735-30AAB282FD13}.Release|x86.ActiveCfg = Release|x86 + {756440DE-D000-4CD0-8735-30AAB282FD13}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementConsole/Program.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementConsole/Program.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AccountManagement; +using OTPNet; +using System.Timers; +using System.IO; + +namespace AccountManagementConsole +{ + class Program + { + + static void Main(string[] args) + { + //Timer tim; + + Dictionary options = new Dictionary(); + + if (args[0] == "-f") + { + StreamReader filestream = new StreamReader(args[1]); + string filecont = filestream.ReadToEnd(); + filestream.Close(); + string[] parts = filecont.Split(' '); + if (parts.Length == 6) + options = parseOpts(parts[5]); + string newpass = ExecuteOptions(parts[0], parts[1], parts[2], parts[3], parts[4], options); + StreamWriter filewrite = new StreamWriter(args[1]); + filecont = filecont.Replace(parts[3], newpass); + filewrite.Write(filecont); + filewrite.Flush(); + filewrite.Close(); + } + else + { + + if (args.Length == 6) + options = parseOpts(args[5]); + ExecuteOptions(args[0], args[1], args[2], args[3], args[4], options); + + } + } + + static string ExecuteOptions(string engine, string key, string user, string oldpass, string newpassbase, Dictionary options) + { + Engine eng = Engine.NONE; + string newpass; + switch (engine) + { + case "fb": + eng = Engine.FACEBOOK; + break; + case "smf": + eng = Engine.SMF; + break; + case "win": + eng = Engine.WINDOWS; + break; + case "twitter": + eng = Engine.TWITTER; + break; + } + + + TOTP t = new TOTP(key); + using (AccountManagementEngine aeng = new AccountManagementEngine()) + { + foreach (KeyValuePair opt in options) + { + aeng.AddData(opt.Key, opt.Value); + } + newpass = newpassbase + t.now().ToString("D6"); + aeng.ChangePassword(eng, user, oldpass, newpass); + } + return newpass; + } + + static Dictionary parseOpts(string arg) + { + Dictionary ret = new Dictionary(); + string[] sections = arg.Split('&'); + string[] pieces; + foreach(string s in sections) + { + pieces = s.Split('='); + ret[pieces[0]] = pieces[1]; + } + return ret; + } + + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementConsole/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementConsole/Properties/AssemblyInfo.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AccountManagementConsole")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AccountManagementConsole")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3860ac52-6cfd-4dfa-b6a9-3ad3cc504701")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/AccountManagementEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/AccountManagementEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; +using System.Text.RegularExpressions; +using AccountManagement.Engines; + +namespace AccountManagement +{ + public enum Engine + { + FACEBOOK, + SMF, + TWITTER, + WINDOWS, + NONE + } + public class AccountManagementEngine : IDisposable + { + public Dictionary options = new Dictionary(); + + public void AddData(string key, string val) + { + this.options[key] = val; + } + public bool ChangePassword(Engine engine, string username, string oldpass, string newpass) + { + bool retval = true; + IEngine eng = null; + switch (engine) + { + case Engine.FACEBOOK: + eng = new FacebookEngine(); + break; + case Engine.TWITTER: + eng = new TwitterEngine(); + break; + case Engine.SMF: + // Options: + // Required: + // URL + eng = new SMFEngine(options); + break; + case Engine.WINDOWS: + // Options: + // Required: + // location { local | domain } + // if location == domain + // domain -> domain of AD + // ads -> path of AD ie dc=microsoft,dc=com + eng = new WindowsEngine(options); + break; + } + if (eng != null) + eng.ChangePassword(username, oldpass, newpass); + return retval; + } + + public void Dispose() + { + + } + } + +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/AccountManagementEngine.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/AccountManagementEngine.csproj Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,93 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {89ED6745-E9F4-42A3-8795-D1C213956084} + Library + Properties + AccountManagement + AccountManagementEngine + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + Component + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/AccountManagementEngine.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/AccountManagementEngine.sln Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountManagementEngine", "AccountManagementEngine.csproj", "{89ED6745-E9F4-42A3-8795-D1C213956084}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {89ED6745-E9F4-42A3-8795-D1C213956084}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89ED6745-E9F4-42A3-8795-D1C213956084}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89ED6745-E9F4-42A3-8795-D1C213956084}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89ED6745-E9F4-42A3-8795-D1C213956084}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/CookieAwareWebClient.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/CookieAwareWebClient.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; + +namespace AccountManagement +{ + //copied from http://rockycode.com/blog/creating-cookie-aware-webclient/ + internal class CookieAwareWebClient : WebClient + { + public CookieContainer CookieContainer { get; set; } + public Uri Uri { get; set; } + + public CookieAwareWebClient() + : this(new CookieContainer()) + { + } + + public CookieAwareWebClient(CookieContainer cookies) + { + this.CookieContainer = cookies; + } + + protected override WebRequest GetWebRequest(Uri address) + { + WebRequest request = base.GetWebRequest(address); + if (request is HttpWebRequest) + { + (request as HttpWebRequest).CookieContainer = this.CookieContainer; + } + HttpWebRequest httpRequest = (HttpWebRequest)request; + httpRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; + return httpRequest; + } + + protected override WebResponse GetWebResponse(WebRequest request) + { + WebResponse response = base.GetWebResponse(request); + String setCookieHeader = response.Headers[HttpResponseHeader.SetCookie]; + + if (setCookieHeader != null) + { + this.CookieContainer.SetCookies(response.ResponseUri, setCookieHeader); + } + return response; + } + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Engines/FacebookEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Engines/FacebookEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; + +namespace AccountManagement.Engines +{ + internal class FacebookEngine : IEngine, IDisposable + { + private WebEngine web; + public bool ChangePassword(string username, string oldpass, string newpass) + { + web = new WebEngine("Nokia 7110/1.0"); + this.Login(username, oldpass); + this.ChangePass(oldpass, newpass); + return true; + } + + private void Login(string username, string password) + { + Dictionary postdatadct = new Dictionary(); + postdatadct.Add("{{username}}", username); + postdatadct.Add("{{password}}", password); + string[] scriptarr = Regex.Split(Properties.Resources.facebook_login, Environment.NewLine); + this.web.PostData(scriptarr[0], scriptarr.Skip(1).ToArray(), postdatadct); + } + + private void ChangePass(string oldpass, string newpass) + { + Dictionary postdatadct = new Dictionary(); + postdatadct.Add("{{oldpassword}}", oldpass); + postdatadct.Add("{{newpassword}}", newpass); + + string passpage = this.web.DownloadString("https://m.facebook.com/settings/account/?password&refid=70"); + Regex r = new Regex(@"""hidden"" name=""fb_dtsg"" value=""(.*)"" autocomplete=""off"" />"); + Match m = r.Match(passpage); + List scriptarr = Regex.Split(Properties.Resources.facebook_passgate, Environment.NewLine).ToList(); + scriptarr.Add("fb_dtsg=" + m.Groups[1].ToString()); + this.web.PostData(scriptarr[0], scriptarr.Skip(1).ToArray(), postdatadct); + } + + public void Dispose() + { + + } + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Engines/SMFEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Engines/SMFEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; + +namespace AccountManagement.Engines +{ + class SMFEngine : IDisposable, IEngine + { + private WebEngine web; + private Dictionary options; + public SMFEngine(Dictionary options) + { + this.web = new WebEngine(); + this.options = options; + } + public bool ChangePassword(string username, string oldpass, string newpass) + { + this.Login(username, oldpass); + this.ChangePass(oldpass, newpass); + return true; + } + + private void Login(string username, string password) + { + Dictionary postdatadct = new Dictionary(); + postdatadct.Add("{{username}}", username); + postdatadct.Add("{{password}}", password); + postdatadct.Add("{{url}}", this.options["url"]); + string[] scriptarr = Regex.Split(Properties.Resources.smf_login, Environment.NewLine); + this.web.PostData(scriptarr[0], scriptarr.Skip(1).ToArray(), postdatadct); + } + + private void ChangePass(string oldpass, string newpass) + { + Dictionary postdatadct = new Dictionary(); + postdatadct.Add("{{oldpassword}}", oldpass); + postdatadct.Add("{{newpassword}}", newpass); + postdatadct.Add("{{url}}", this.options["url"]); + string[] scriptarr = Regex.Split(Properties.Resources.smf_passgate, Environment.NewLine); + this.web.PostData(scriptarr[0], scriptarr.Skip(1).ToArray(), postdatadct); + } + + public void Dispose() + { + + } + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Engines/TwitterEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Engines/TwitterEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; + +namespace AccountManagement.Engines +{ + class TwitterEngine : IEngine, IDisposable + { + private WebEngine web; + public TwitterEngine() + { + + } + public void Dispose() + { + + } + + public bool ChangePassword(string username, string oldpass, string newpass) + { + web = new WebEngine("Nokia 7110/1.0"); + this.Login(username, oldpass); + this.ChangePass(oldpass, newpass); + return true; + } + + private void Login(string username, string password) + { + string page = this.web.DownloadString("https://mobile.twitter.com/session/new"); + Regex r = new Regex("input name=\"authenticity_token\" type=\"hidden\" value=\"(.*)\" />"); + Match m = r.Match(page); + Dictionary postdatadct = new Dictionary(); + postdatadct.Add("{{username}}", username); + postdatadct.Add("{{password}}", password); + postdatadct.Add("{{token}}", m.Groups[1].ToString()); + string[] scriptarr = Regex.Split(Properties.Resources.twitter_login, Environment.NewLine); + string ret = this.web.PostData(scriptarr[0], scriptarr.Skip(1).ToArray(), postdatadct); + //Console.WriteLine(ret); + } + + private void ChangePass(string oldpass, string newpass) + { + String page = this.web.DownloadString("https://mobile.twitter.com/settings/password"); + Regex r = new Regex("input name=\"authenticity_token\" type=\"hidden\" value=\"(.*)\" />"); + Match m = r.Match(page); + Dictionary postdatadct = new Dictionary(); + postdatadct.Add("{{oldpassword}}", oldpass); + postdatadct.Add("{{newpassword}}", newpass); + postdatadct.Add("{{token}}", m.Groups[1].ToString()); + List scriptarr = Regex.Split(Properties.Resources.twitter_passgate, Environment.NewLine).ToList(); + string ret = this.web.PostData(scriptarr[0], scriptarr.Skip(1).ToArray(), postdatadct); + } + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Engines/WindowsEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Engines/WindowsEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.DirectoryServices.AccountManagement; + +namespace AccountManagement.Engines +{ + class WindowsEngine : IDisposable, IEngine + { + private Dictionary options; + public WindowsEngine(Dictionary options) + { + this.options = options; + } + + // Adapted from http://www.snippetdirectory.com/csharp/changing-password-of-a-local-or-domain-user/ + public bool ChangePassword(string username, string oldpass, string newpass) + { + PrincipalContext insPrincipalContext = null; + if (this.options.Keys.Contains("location") && this.options["location"] == "local") + { + insPrincipalContext = new PrincipalContext(ContextType.Machine);//Connecting to local computer. + } + else if (this.options.Keys.Contains("location") && this.options["location"] == "domain") + { + insPrincipalContext = new PrincipalContext(ContextType.Domain, this.options["domain"], this.options["ads"]);//Connecting to Active Directory + } + UserPrincipal insUserPrincipal = new UserPrincipal(insPrincipalContext); + insUserPrincipal.Name = username; + PrincipalSearcher insPrincipalSearcher = new PrincipalSearcher(); + insUserPrincipal = insPrincipalSearcher.FindOne() as UserPrincipal; + insUserPrincipal.SetPassword(newpass); + insUserPrincipal.Save(); + insUserPrincipal.Dispose(); + return true; + } + + public void Dispose() + { + + } + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/IEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/IEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AccountManagement +{ + internal interface IEngine + { + bool ChangePassword(string username, string oldpass, string newpass); + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Properties/AssemblyInfo.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AccountManagementEngine")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AccountManagementEngine")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8a14255b-6392-45b9-ab71-c8864453b8ce")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Properties/Resources.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Properties/Resources.Designer.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,147 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17929 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AccountManagement.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AccountManagement.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to https://m.facebook.com/login.php?refsrc=http%3A%2F%2Fm.facebook.com%2Findex.php&refid=8 + ///email={{username}} + ///pass={{password}} + ///lsd=AVrMdhYE + ///charset_test=€,´,€,´,水,Д,Є + ///version=1 + ///ajax=1 + ///width=1920 + ///pxr=1 + ///gps=1 + ///m_ts=1358832742 + ///li=ZiT-UIWK8L6q0qNMGoz6tT7I + ///signup_layout=layout|lower_subdued_button||s_btn|special||l_btn|confirm||signupinstr||logininstr + ///laststage=first + ///login=Log In. + /// + internal static string facebook_login { + get { + return ResourceManager.GetString("facebook_login", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://m.facebook.com/login.php?refsrc=https%3A%2F%2Fm.facebook.com%2Fsettings%2Faccount%2F&refid=70 + ///old_password={{oldpassword}} + ///new_password={{newpassword}} + ///confirm_password={{newpassword}} + ///change_password= + ///save=Change Password + ///charset_test=€,´,€,´,水,Д,Є. + /// + internal static string facebook_passgate { + get { + return ResourceManager.GetString("facebook_passgate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{url}}/login2/ + ///user={{username}} + ///passwrd={{password}}. + /// + internal static string smf_login { + get { + return ResourceManager.GetString("smf_login", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{url}}/profile/?area=account;u=1;save + ///passwrd1={{newpassword}} + ///passwrd2={{newpassword}} + ///oldpasswrd={{oldpassword}}. + /// + internal static string smf_passgate { + get { + return ResourceManager.GetString("smf_passgate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://mobile.twitter.com/session + ///username={{username}} + ///password={{password}}. + /// + internal static string twitter_login { + get { + return ResourceManager.GetString("twitter_login", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://mobile.twitter.com/settings/password + ///settings[current_password]={{oldpassword}} + ///settings[password]={{newpassword}} + ///settings[password_confirmation]={{newpassword}}. + /// + internal static string twitter_passgate { + get { + return ResourceManager.GetString("twitter_passgate", resourceCulture); + } + } + } +} diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Properties/Resources.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Properties/Resources.resx Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\resources\facebook_login.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + + ..\resources\facebook_passgate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + + ..\Resources\smf_login.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\smf_passgate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\resources\twitter_login.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\twitter_passgate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Resources/facebook_login.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Resources/facebook_login.txt Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,15 @@ +https://m.facebook.com/login.php?refsrc=http%3A%2F%2Fm.facebook.com%2Findex.php&refid=8 +email={{username}} +pass={{password}} +lsd=AVrMdhYE +charset_test=€,´,€,´,水,Д,Є +version=1 +ajax=1 +width=1920 +pxr=1 +gps=1 +m_ts=1358832742 +li=ZiT-UIWK8L6q0qNMGoz6tT7I +signup_layout=layout|lower_subdued_button||s_btn|special||l_btn|confirm||signupinstr||logininstr +laststage=first +login=Log In \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Resources/facebook_passgate.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Resources/facebook_passgate.txt Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,7 @@ +https://m.facebook.com/login.php?refsrc=https%3A%2F%2Fm.facebook.com%2Fsettings%2Faccount%2F&refid=70 +old_password={{oldpassword}} +new_password={{newpassword}} +confirm_password={{newpassword}} +change_password= +save=Change Password +charset_test=€,´,€,´,水,Д,Є \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Resources/smf_login.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Resources/smf_login.txt Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,3 @@ +{{url}}/login2/ +user={{username}} +passwrd={{password}} \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Resources/smf_passgate.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Resources/smf_passgate.txt Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,4 @@ +{{url}}/profile/?area=account;u=1;save +passwrd1={{newpassword}} +passwrd2={{newpassword}} +oldpasswrd={{oldpassword}} \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Resources/twitter_login.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Resources/twitter_login.txt Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,5 @@ +https://mobile.twitter.com/session +username={{username}} +password={{password}} +authenticity_token={{token}} +commit=Sign in \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/Resources/twitter_passgate.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/Resources/twitter_passgate.txt Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,6 @@ +https://mobile.twitter.com/settings/password +settings[current_password]={{oldpassword}} +settings[password]={{newpassword}} +settings[password_confirmation]={{newpassword}} +authenticity_token={{token}} +commit=Save \ No newline at end of file diff -r 0000000000000000000000000000000000000000 -r 1bbff175f8dd58bee66dbf493e80fdcf8dbf2bf1 AccountManagementEngine/WebEngine.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AccountManagementEngine/WebEngine.cs Sat Jan 26 16:36:42 2013 -0600 @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using AccountManagement.Engines; + +namespace AccountManagement +{ + internal class WebEngine : IDisposable + { + private CookieAwareWebClient cli; + private string useragent = ""; + + public void AddHeader(string header, string val) + { + this.cli.Headers.Add(header, val); + } + public WebEngine() + { + this.cli = new CookieAwareWebClient(); + + } + + public WebEngine(string ua) + { + this.useragent = ua; + this.cli = new CookieAwareWebClient(); + + } + + private void SetHeaders() + { + this.cli.Headers.Add("user-agent", this.useragent); + } + public string DownloadString(string url) + { + this.SetHeaders(); + return this.cli.DownloadString(url); + } + + public string PostData(string url, string[] postarr, Dictionary replace) + { + + return this.post(url, BuildPostData(postarr, replace)); + } + + public string PostData(string url, string[] postarr) + { + return this.post(url, String.Join("&", postarr)); + } + + private string post(string url, string postdata) + { + this.SetHeaders(); + this.cli.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); + return this.cli.UploadString(url, "POST", postdata); + } + + private string BuildPostData(string[] postdata, Dictionary replace) + { + string ret; + + ret = String.Join("&", postdata); + + foreach (KeyValuePair entry in replace) + { + ret = ret.Replace(entry.Key, entry.Value); + } + + return ret; + } + + + public void Dispose() + { + + } + } +}