Skip to content

Instantly share code, notes, and snippets.

View m2kar's full-sized avatar

M2kar m2kar

View GitHub Profile
@m2kar
m2kar / smartdns.conf
Created December 8, 2024 13:29
SmartDNS Configuration
# 权衡DNS劫持和速度的方案,使用了国内外的doh+dot作为上游
bind [::]:53
bind-tcp [::]:53
# china
#默认组
server-https https://223.6.6.6/dns-query
@m2kar
m2kar / pac.js
Created December 7, 2024 16:14
safari pac file debug
// 在macOS Safari中调试代理pac文件的方法
// 思路:把调试信息转换为域名,并使用Wireshark抓包
// Wireshark规则: (dns) && (dns.qry.name contains "test-pac.local")
function sanitizeAndConvertToDomain(input) {
// 去除非法字符,只保留字母、数字、点和连字符
const sanitized = input.replace(/[^a-zA-Z0-9.-]/g, '');
// 确保字符串以域名格式返回
const parts = sanitized.split('.');
const domain = parts.filter(part => part.length > 0).join('.');
@m2kar
m2kar / poc_prompt
Created November 23, 2024 10:09
PoC/EXP分类的Prompt
prompt_poc = """
<|im_start|> system
You are an advanced vulnerability mining tool, which is specially used to extract key knowledge from vulnerability analysis text.
<|im_end|>
<|im_start|> user
Task: Your task is to analyze the vulnerability analysis text provided and determine whether there is partial or complete code of PoC or EXP in the text, including executable script code, constructed input function, network request, and shell code.
1. Determine whether the code segment aligns with the characteristics of a Vulnerability Proof of Concept (PoC) or a Vulnerability Exploitation (Exp) example.
2. Provide a confidence score from 1 to 5 (where 5 signifies high confidence) on your determination.
<|im_end|>
@m2kar
m2kar / https.sh
Last active September 19, 2024 03:18
One-Liner HttpServer Return Command Exec Result
#!/bin/bash
# PROT=18080
# CMD="uptime"
while true; do response=$($CMD); length=$(echo -n "$response" | wc -c); echo -e "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: ${#response}\r\n\r\n$response" | nc -l -p $PORT; done
@m2kar
m2kar / github-issue-editor-full-screen.js
Last active May 26, 2023 10:45
GitHub Issues Editor Full Screen
// ==UserScript==
// @name GitHub Issues Editor Full Screen
// @namespace https://greasyfork.org/en/scripts/467156-github-issues-editor-full-screen/code
// @version 0.1
// @description Add a full screen button in the right-top of the github issue editor.
// @match https://github.com/*/issues/*
// @grant none
// @author m2kar (m2kar.cn#gmail.com)
// @origin-url https://gist.github.com/m2kar/a9beddbd946dada991e87ed366b9b24e
// @license MIT
@m2kar
m2kar / WindowsTerminalContextMenu.reg
Last active June 5, 2020 02:55
Windows Terminal Configure
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="D:\\Git\\git-bash.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command]
@="\"C:\\Users\\iMakar\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe\" -p GitBash -d \"%V\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\Debian]
@m2kar
m2kar / gitlab_python.py
Created April 1, 2020 13:25
gitlab python
import gitlab
gl=gitlab.Gitlab(gitlab_url,gitlab_token)
project=gl.projects.get(149)
issue=project.issues.get(1)
note=issue.notes.create(data={"body":"text"})
@m2kar
m2kar / logging.py
Created March 5, 2020 05:46
log配置
import logging
import const
#DEBUG级别的错误,输出到 const.LOGFILE
logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', # 输出格式
                    datefmt='%a, %d %b %Y %H:%M:%S',
                    filename=const.LOGFILE,
                    filemode='a')
@m2kar
m2kar / tmux-cheatsheet.markdown
Created December 23, 2019 01:13 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@m2kar
m2kar / profiles.json
Last active December 20, 2019 16:46
Windows Terminal: Add Git Bash
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles": [
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",