Skip to content

Instantly share code, notes, and snippets.

View KnightChaser's full-sized avatar
🏳️
Yearning for freedom

Garam Lee KnightChaser

🏳️
Yearning for freedom
View GitHub Profile
@KnightChaser
KnightChaser / ChromeDriverWebsiteAutoRefresh.py
Created March 25, 2025 06:07
A Python3 code utilizing chrome driver to automatically send refresh(F5) to the target website as much as specified.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from tqdm import tqdm
import time
# Configuration
num = 1234 # How many times?
url = "www.example.com" # To where?
@KnightChaser
KnightChaser / kprobe_inet_csk_accept_event_generator.py
Created March 21, 2025 05:13
The following Python program generates a TCP socket accept event(IPv4) which can be captured by tracing kprobe/inet_csk_accept and kretprobe/inet_csk_accept.
import socket
import threading
import time
# Simple TCP server that listens and accepts a connection.
def server():
srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
srv.bind(("127.0.0.1", 12345))
srv.listen(5)
@KnightChaser
KnightChaser / clang4SpaceForTab
Created February 20, 2025 07:00
Setting 1 tab = 4 spaces for C/C++ development with Neovim.
BasedOnStyle: LLVM
IndentWidth: 4
# If you want your vim/neovim or other editor follows "1 tab = 4 spaces" for C/C++ development,
# Save this as `.clang-format` in root of your project directory. And reload the editor again. Tada.
# In my case, `clangd` installed on Mason@Neovim initially set "1 tab = 2 spaces". So I wanted to change it.
@KnightChaser
KnightChaser / mySimpleVimrc.vim
Created March 23, 2024 12:03
My simple ~/.vimrc configuration file for fast startup
" Ordinary settings
set title
set autoindent
set cursorcolumn
set cursorline
set number
set ruler

GitHub Search Syntax for Finding API Keys/Secrets/Tokens

As a security professional, it is important to conduct a thorough reconnaissance. With the increasing use of APIs nowadays, it has become paramount to keep access tokens and other API-related secrets secure in order to prevent leaks. However, despite technological advances, human error remains a factor, and many developers still unknowingly hardcode their API secrets into source code and commit them to public repositories. GitHub, being a widely popular platform for public code repositories, may inadvertently host such leaked secrets. To help identify these vulnerabilities, I have created a comprehensive search list using powerful search syntax that enables the search of thousands of leaked keys and secrets in a single search.

Search Syntax:

(path:*.{File_extension1} OR path:*.{File_extension-N}) AND ({Keyname1} OR {Keyname-N}) AND (({Signature/pattern1} OR {Signature/pattern-N}) AND ({PlatformTag1} OR {PlatformTag-N}))

Examples:

**1.

@KnightChaser
KnightChaser / ReversePolishNotationImplementation.cpp
Created May 30, 2023 11:43
A C++ implementation for calculation with reverse polish notation(postfix notation).
#include <iostream>
#include <vector>
#include <string>
#include <stack>
using namespace std;
// redefine operator << to print the vector like just strings
template <typename S>
ostream& operator<<(ostream& os,
const vector<S>& vector)
@KnightChaser
KnightChaser / espanso_base_yml_for_me.yml
Created March 7, 2023 13:58
My personal base.yml file of espanso to supercharge my laptop usage experience. Optimized only for me.
# espanso match file
# For a complete introduction, visit the official docs at: https://espanso.org/docs/
# You can use this file to define the base matches (aka snippets)
# that will be available in every application when using espanso.
# Matches are substitution rules: when you type the "trigger" string
# it gets replaced by the "replace" string.
matches:
@KnightChaser
KnightChaser / ActivateWindowsBitlocker.bat
Created January 15, 2023 12:08
You don't need to restart your device to lock the unlocked Bitlocker-enabled drives again.
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
@KnightChaser
KnightChaser / get_naver_finance_info_lite.py
Created November 26, 2022 13:05
(Unofficial method) Get some finance information for Naver finance website with avoid excessive request frequency and allowing 1-minute delay
import requests
import time
import random
import os
import ast
import pickle
class CustomUserAgentString:
user_agent_string_list = [