//connect public static void Connect(AWS.Account account, string dbName) { MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder() { Server = account.Endpoint, UserID = account.Id, Password = account.Pw, Database = dbName, Port = 3306, }; string strConn = builder.ToString(); builder = null; Conn = new MySqlConnection(strConn); Conn.Open(); Account = account; DbName = dbName; }
static void Main(string[] args) { #region MySql 연결 //SecureString s_key = GetConsoleSecurePassword(); //Console.Clear(); //string key = SecureStringToString(s_key) //AWS.SaveAccount(); //AES aes = new AES(); /* AWS 계정 정보 파일 읽음 */ string txt = File.ReadAllText(@"Account.xml"); // string xml = aes.AESDecrypt128(txt, key); string xml = txt; AWS.LoadAccount(xml); AWS.Account account = AWS.account; /* AWS 정보 출력 */ Console.WriteLine($"Endpoint: {account.Endpoint}, ID: {account.Id}"); try { /* DB 접속 시도 */ VulnRDS.Connect(account, "vuln"); } catch (Exception e) { Console.WriteLine($"접속 에러 :: {e.ToString()}"); } /* AWS 연결 여부 확인 */ if (VulnRDS.Conn.State == System.Data.ConnectionState.Open) { Console.WriteLine("접속 성공"); } else { Console.WriteLine("연결 실패"); return; } #endregion Run(); }