Tag: programming

Gitlab

Setup HTTPS for Gitlab

Generate a new private key and a Certificate Signing Request openssl req -new -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.reqopenssl req -new -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.req Generate a certificate signing request (CSR) for an existing private key openssl req -new -key example.com.key -out example.com.reqopenssl req -new -key example.com.key -out example.com.req Edit Gitlab …

Rootkits

Windows Drivers

WDK- Windows Driver Kit Windows Driver Kit gives you the tools you need to develop, build, package, deploy, test, and debug drivers. You can run many basic certification tests in the integrated environment. The Windows Driver Kit (WDK) includes templates for several technologies and driver models, including Windows Driver Frameworks (WDF), Universal Serial Bus (USB), …

C

c – Output coloured text to a Windows terminal

GetStdHandle function retrieves a handle to the specified standard device (standard input, standard output, or standard error). GetConsoleScreenBufferInfo function retrieves information about the specified console screen buffer. SetConsoleTextAttribute function sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. This …

C#

The key LocalizedPerfCounter does not exist

When you are using .NET 2.0 or .NET 3.5 and you are trying to make a web request with WebRequest class you may see the following internal error if you have Common Language Runtime Exceptions enabled during debugging in Visual Studio: Exception thrown: ‘System.InvalidOperationException’ in System.dll Additional information: The key ‘LocalizedPerfCounter’ does not exist in …

C#

A full implementation of the VirusTotal 2.0 API

VirusTotal.NET – A full implementation of the VirusTotal 2.0 API. Here you will find project’s source code. Features Based on RestSharp (http://restsharp.org) to deserialize the VirusTotal JSON into objects Scan, rescan and get report of scanned files Scan websites and files Support for HTTP and HTTPS Support for checking if files have been scanned before …

C#

Get Windows Users with C# and WMI

class SystemUser { public enum AccountType { DUPLICATE_ACCOUNT = 256, NORMAL_ACCOUNT = 512, INTERDOMAIN_TRUST_ACCOUNT = 2048, WORKSTATION_TRUST_ACCOUNT = 4096, SERVER_TRUST_ACCOUNT = 8192 };   public AccountType Type { get; set; } public string Caption { get; set; } public string Description { get; set; } public bool Disabled { get; set; } public string Domain …

C#

Update NoIP Host with c#

More about NoIP dynamic dns update request click here. private void UpdateNoIPHost() { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create( string.Format("http://dynupdate.no-ip.com/nic/update?hostname={0}", "<NoIP Hostname>")); request.Method = "GET"; request.Proxy = null; request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64)"; request.Timeout = 10000; request.Headers.Add(HttpRequestHeader.Authorization, string.Format("Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "<NoIP username>", "<NoIP password>")))));   using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { } } …

C#

Check if user is Idle with C#

GetLastInputInfo function – Retrieves the time of the last input event. LASTINPUTINFO structure – Contains the time of the last input. public bool IsUserIdle() { uint idleTime = (uint)Environment.TickCount – GetLastInputEventTickCount(); idleTime = ((idleTime > 0) ? (idleTime / 1000) : 0); //user is idle for 5 min return (idleTime >= 5 * 60); } …