-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
42 lines (34 loc) · 1.28 KB
/
Program.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
using System;
using System.Net;
using System.Runtime.InteropServices;
namespace HelloWorld
{
class Program
{
[DllImport("user32.dll")]
internal static extern bool OpenClipboard(IntPtr hWndNewOwner);
[DllImport("user32.dll")]
internal static extern bool CloseClipboard();
[DllImport("user32.dll")]
internal static extern bool SetClipboardData(uint uFormat, IntPtr data);
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
public static extern int MessageBox(IntPtr h, string m, string c, int type);
[STAThread]
static void Main(string[] args)
{
string password = downloadStringFromUrl("https://dinopass.com/password/strong");
OpenClipboard(IntPtr.Zero);
var ptr = Marshal.StringToHGlobalUni(password);
SetClipboardData(13, ptr);
CloseClipboard();
Marshal.FreeHGlobal(ptr);
MessageBox((IntPtr)0, password, "Password copied to clipboard", 0);
}
static string downloadStringFromUrl(string url)
{
WebClient client = new WebClient();
string htmlCode = client.DownloadString(url);
return htmlCode;
}
}
}