forked from rohitcoderCdefense/vulnCodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CWE-295.cs
30 lines (29 loc) · 1.1 KB
/
CWE-295.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Net;
using System.IO;
using System.Text;
using System.Security.Cryptography.X509Certificates;
namespace Test
{
class Program
{
static void Main(string[] args)
{
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.google.com");
request.Method = "GET";
request.ContentType = "application/json";
request.Accept = "application/json";
request.Headers.Add("Authorization", "Basic YWRtaW46YWRtaW4=");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
reader.Close();
dataStream.Close();
response.Close();
}
}
}