Skip to content

Instantly share code, notes, and snippets.

View yusufozturk's full-sized avatar
🎯
Focusing

Yusuf Ozturk yusufozturk

🎯
Focusing
View GitHub Profile
@yusufozturk
yusufozturk / Get-EtwTraceProvider.ps1
Created July 15, 2022 11:23 — forked from guitarrapc/Get-EtwTraceProvider.ps1
ETW (Event Tracing for Windows) Providers and their GUIDs for Windows 10 x64
#Requires -RunAsAdministrator
#Requires -Version 5.0
# requires Windows 10
Get-EtwTraceProvider | Select-Object SessionName, Guid | sort SessionName
# as Markdown
<#
#Requires -RunAsAdministrator
$result = Get-EtwTraceProvider | sort SessionName
$result | %{"|Name|GUID|";"|----|----|";}{"|$($_.SessionName)|$($_.Guid)|"}
#>
@yusufozturk
yusufozturk / log-forwarding-with-etw.ps1
Created July 13, 2022 21:47 — forked from ajpc500/log-forwarding-with-etw.ps1
Quick-and-dirty PowerShell script to install Sysmon (SwiftOnSecurity config), SilkService and Winlogbeat, and forward logs to HELK based on IP set in environment variable "HELK_IP" (see Line 224).
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
if (!(Test-Path "C:\Tools")) {
New-Item -Path "C:\" -Name "Tools" -ItemType "directory"
}
# SYSMON
# Download Sysmon
$SysmonDirectory = "C:\Tools\Sysmon\"
@yusufozturk
yusufozturk / snippet.js
Created April 20, 2021 23:46 — forked from vmwarecode/snippet.js
Showing Web Console of a VM via vSphere HTML Console SDK
<html>
<head lang="en">
<meta charset="UTF-8">
<title>VM Web Console</title>
<!-- common js/css lib -->
<link href="css/wmks-all.css" rel="stylesheet" type="text/css" />
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="lib/jquery-1.8.3.min.js"></script>
<script src="lib/jquery-ui-1.8.16.min.js"></script>
@yusufozturk
yusufozturk / main.go
Created July 25, 2020 04:22 — forked from fentas/main.go
♻ Endless running goroutine. Restart process if it fails. Manage multiple processes.
package main
import (
"log"
// replace right path
"[...]/utils"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
@yusufozturk
yusufozturk / add CA cert on CentOS Debian Ubuntu.md
Created April 13, 2020 09:09 — forked from kekru/add CA cert on CentOS Debian Ubuntu.md
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org
@yusufozturk
yusufozturk / DatabaseCall.cs
Created November 20, 2017 14:19 — forked from benhysell/DatabaseCall.cs
c# Redis Caching Objects with StackExchange.Redis using Json
//extension method make a database call by providing a function pointer to Task<T> and passing in a method parameter
public static async Task<T> DatabaseCall<T>(this IDatabase cache, string key, Func<string, Task<T>> databaseCall, string methodParameter, TimeSpan timeSpan, bool invalidate, bool useCache)
{
T returnValue;
var cachedItem = default(T);
try
{
cachedItem = await cache.GetAsync<T>(key);
}
catch (RedisConnectionException ex)
HttpContext.Current = new HttpContext(
new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter()));
NameValueCollection headers = HttpContext.Current.Request.Headers;
Type t = headers.GetType();
const BindingFlags nonPublicInstanceMethod = BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance;
t.InvokeMember("MakeReadWrite", nonPublicInstanceMethod, null, headers, null);
t.InvokeMember("InvalidateCachedArrays", nonPublicInstanceMethod, null, headers, null);