Showing
3 changed files
with
98 additions
and
25 deletions
Vulnerablity_DB/VulnCrawler/AWS.cs
0 → 100644
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.IO; | ||
4 | +using System.Linq; | ||
5 | +using System.Text; | ||
6 | +using System.Threading.Tasks; | ||
7 | +using System.Xml; | ||
8 | +using System.Xml.Serialization; | ||
9 | + | ||
10 | +namespace VulnCrawler | ||
11 | +{ | ||
12 | + public static class AWS | ||
13 | + { | ||
14 | + [XmlRoot("MySqlAccountInfo")] | ||
15 | + public class Account | ||
16 | + { | ||
17 | + public static string FilePath => @"D:\Account.xml"; | ||
18 | + [XmlAttribute("EndPoint")] | ||
19 | + public string Endpoint { get; set; } | ||
20 | + [XmlAttribute("ID")] | ||
21 | + public string Id { get; set; } | ||
22 | + [XmlAttribute("PW")] | ||
23 | + public string Pw { get; set; } | ||
24 | + | ||
25 | + } | ||
26 | + | ||
27 | + private static Account account; | ||
28 | + | ||
29 | + static AWS() { | ||
30 | + // account = LoadAccount(); | ||
31 | + account = new Account() { | ||
32 | + Endpoint = "aaa", | ||
33 | + Id = "bbb", | ||
34 | + Pw = "1231", | ||
35 | + | ||
36 | + }; | ||
37 | + Console.WriteLine(account.Endpoint); | ||
38 | + } | ||
39 | + | ||
40 | + private static Account LoadAccount() { | ||
41 | + | ||
42 | + if (!File.Exists(Account.FilePath)) { | ||
43 | + return null; | ||
44 | + } | ||
45 | + Account acc = null; | ||
46 | + // Deserialization | ||
47 | + using (var reader = new StreamReader(Account.FilePath)) { | ||
48 | + XmlSerializer xs = new XmlSerializer(typeof(Account)); | ||
49 | + acc = (Account)xs.Deserialize(reader); | ||
50 | + | ||
51 | + | ||
52 | + } | ||
53 | + | ||
54 | + return acc; | ||
55 | + } | ||
56 | + | ||
57 | + public static void SaveAccount() { | ||
58 | + | ||
59 | + | ||
60 | + //File.SetAttributes(Account.FilePath, FileAttributes.Normal); | ||
61 | + | ||
62 | + // Serialization | ||
63 | + using (StreamWriter wr = new StreamWriter(Account.FilePath)) { | ||
64 | + XmlSerializer xs = new XmlSerializer(typeof(Account)); | ||
65 | + xs.Serialize(wr, account); | ||
66 | + } | ||
67 | + | ||
68 | + } | ||
69 | + | ||
70 | + } | ||
71 | + | ||
72 | + | ||
73 | +} |
... | @@ -15,36 +15,35 @@ namespace VulnCrawler | ... | @@ -15,36 +15,35 @@ namespace VulnCrawler |
15 | { | 15 | { |
16 | static void Main(string[] args) { | 16 | static void Main(string[] args) { |
17 | 17 | ||
18 | - string accountInfo = File.ReadAllText(@"c:\account.txt"); | 18 | + AWS.SaveAccount(); |
19 | - string id = accountInfo.Split(',')[0]; | 19 | + |
20 | - string pw = accountInfo.Split(',')[1]; | 20 | + |
21 | - | 21 | + //MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder { |
22 | - MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder { | 22 | + // Server = "", |
23 | - Server = "", | 23 | + // UserID = id, |
24 | - UserID = id, | 24 | + // Password = pw, |
25 | - Password = pw, | 25 | + // Database = "vuln", |
26 | - Database = "vuln", | 26 | + // Port = 3306 |
27 | - Port = 3306 | 27 | + //}; |
28 | - }; | 28 | + |
29 | - | 29 | + //string strConn = builder.ToString(); |
30 | - string strConn = builder.ToString(); | 30 | + //builder = null; |
31 | - builder = null; | 31 | + //MySqlConnection conn = new MySqlConnection(strConn); |
32 | - MySqlConnection conn = new MySqlConnection(strConn); | ||
33 | 32 | ||
34 | - try { | 33 | + //try { |
35 | 34 | ||
36 | - String sql = "INSERT INTO members (id, pwd, name) " + | 35 | + // String sql = "INSERT INTO members (id, pwd, name) " + |
37 | - "VALUES ('gon', '111', '김삿갓')"; | 36 | + // "VALUES ('gon', '111', '김삿갓')"; |
38 | 37 | ||
39 | - MySqlCommand cmd = new MySqlCommand(sql, conn); | 38 | + // MySqlCommand cmd = new MySqlCommand(sql, conn); |
40 | 39 | ||
41 | - conn.Open(); | 40 | + // conn.Open(); |
42 | 41 | ||
43 | - cmd.ExecuteNonQuery(); | 42 | + // cmd.ExecuteNonQuery(); |
44 | - conn.Close(); | 43 | + // conn.Close(); |
45 | - } catch (Exception e) { | 44 | + //} catch (Exception e) { |
46 | - Console.WriteLine(e.ToString()); | 45 | + // Console.WriteLine(e.ToString()); |
47 | - } | 46 | + //} |
48 | 47 | ||
49 | // Run(); | 48 | // Run(); |
50 | 49 | ... | ... |
... | @@ -53,6 +53,7 @@ | ... | @@ -53,6 +53,7 @@ |
53 | <Reference Include="System.Xml" /> | 53 | <Reference Include="System.Xml" /> |
54 | </ItemGroup> | 54 | </ItemGroup> |
55 | <ItemGroup> | 55 | <ItemGroup> |
56 | + <Compile Include="AWS.cs" /> | ||
56 | <Compile Include="Program.cs" /> | 57 | <Compile Include="Program.cs" /> |
57 | <Compile Include="Properties\AssemblyInfo.cs" /> | 58 | <Compile Include="Properties\AssemblyInfo.cs" /> |
58 | <Compile Include="VulnPython.cs" /> | 59 | <Compile Include="VulnPython.cs" /> | ... | ... |
-
Please register or login to post a comment