Skip to content

Instantly share code, notes, and snippets.

View sashithacj's full-sized avatar

Sashitha Chamara sashithacj

View GitHub Profile
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@sashithacj
sashithacj / hellobot.php
Created March 31, 2021 09:38 — forked from ingria/hellobot.php
Simple PHP Telegram Bot
<?php
// @see https://core.telegram.org/bots/samples/hellobot
define('BOT_TOKEN', '12345678:replace-me-with-real-token');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
function apiRequestWebhook($method, $parameters) {
if (!is_string($method)) {
error_log("Method name must be a string\n");
return false;
@sashithacj
sashithacj / mailkit_example.cs
Created March 27, 2021 14:01 — forked from wattanar/mailkit_example.cs
C# Send Email With MailKit
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
var message = new MimeMessage();
var bodyBuilder = new BodyBuilder();
// from
@sashithacj
sashithacj / NativeControl.cs
Created March 21, 2021 00:46 — forked from NaxAlpha/NativeControl.cs
Windows GUI Hacking with C#
using System;
using System.Runtime.InteropServices;
using System.Text;
public class NativeControl {
public readonly IntPtr Handle;
public string Text {
get {
@sashithacj
sashithacj / ProcessExtensions.cs
Created March 21, 2021 00:45 — forked from NaxAlpha/ProcessExtensions.cs
Remote Process Hacking with C# - Part 2
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
public static class ProcessExtensions {
private static IntPtr kernel32;
private static IntPtr loadlibrary;
@sashithacj
sashithacj / inject.c
Created March 21, 2021 00:43 — forked from NaxAlpha/inject.c
Win32 dll injection with WriteProcessMemory and opcode patching.
#include
#include
// Source:
// http://www.emoticode.net/embed/c-plus-plus/win32-dll-injection-with-writeprocessmemory-and-opcode-patching.html
// No original Copy of page available
/***************************************************************************************************/
// Function:
// Inject
@sashithacj
sashithacj / HookFx.cs
Created March 21, 2021 00:35 — forked from NaxAlpha/HookFx.cs
Windows API Hook with C#
using System;
using System.Runtime.InteropServices;
public class FxHook:IDisposable {
const int nBytes = 5;
IntPtr addr;
Protection old;
byte[] src = new byte[5];
Serial Keys:
FU512-2DG1H-M85QZ-U7Z5T-PY8ZD
CU3MA-2LG1N-48EGQ-9GNGZ-QG0UD
GV7N2-DQZ00-4897Y-27ZNX-NV0TD
YZ718-4REEQ-08DHQ-JNYQC-ZQRD0
GZ3N0-6CX0L-H80UP-FPM59-NKAD4
YY31H-6EYEJ-480VZ-VXXZC-QF2E0
ZG51K-25FE1-H81ZP-95XGT-WV2C0
VG30H-2AX11-H88FQ-CQXGZ-M6AY4
@sashithacj
sashithacj / CompileInMemory.cs
Created October 24, 2019 20:50 — forked from TheKevinWang/CompileInMemory.cs
Compile and run C# code in memory to avoid anti-virus. Taken from a C# ransomware sample: https://www.bleepingcomputer.com/news/security/new-c-ransomware-compiles-itself-at-runtime/ However, this will still execute csc.exe and drop a dll to %temp% https://twitter.com/Laughing_Mantis/status/991018563296157696
using System;
using System.Collections.Generic;
using System.Text;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
using System.IO;
using System.Reflection;
namespace InMemoryCompiler
{
class Program
@sashithacj
sashithacj / GradleConfig.cs
Created October 1, 2019 19:30 — forked from zcyemi/GradleConfig.cs
Single file C# gradle file parser
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Text;
using System;
using Newtonsoft.Json;
namespace CIS
{
public class GradleConfig