Skip to content

Instantly share code, notes, and snippets.

View pythonwood's full-sized avatar

pythonwood pythonwood

View GitHub Profile
@rodja
rodja / chat_app.py
Created May 8, 2023 03:36
Coding a Multi-User Chat App With NiceGUI
from uuid import uuid4
from nicegui import ui
messages = []
@ui.refreshable
def chat_messages(own_id):
for user_id, avatar, text in messages:
ui.chat_message(avatar=avatar, text=text, sent=user_id==own_id)
@simonemainardi
simonemainardi / disassemble-and-modify-a-binary-to-change-a-function.md
Last active January 18, 2024 18:05
Disassemble and Modify an Binary To Change a Function

Disassemble and Modify an Binary To Change a Function

In this gist I show how to disassemble and modify a Linux executable binary to change the body of a function. This will allow you to control how a binary behaves, even when you don't have access to the source code and you can't recompile it.

In my case, I was asked to try and bypass the protection mechanism implemented. The protection mechanism implemented was meant to only allow a binary to be run in presence of a valid license.

So basically my activity involved:

  • Finding the function which performs the protection check
  • Disassembling the binary
@ALiangLiang
ALiangLiang / vpn.ps1
Last active May 1, 2024 10:12
Create and connect VPN with powershell script
# Author: ALiangLiang <me@aliangliang.top>
# Replace VPN_NAME, ADDRESS and ACCOUNT first!!
# Ref: https://docs.microsoft.com/en-us/powershell/module/vpnclient/add-vpnconnection?view=win10-ps
$VPN_NAME = 'VPN'
$ADDRESS = 'vpn.example.com'
$ACCOUNT = 'user1'
function Connect {
@islishude
islishude / k8s-install.md
Last active July 20, 2024 14:39
k8s-国内源安装

MOVE TO HERE

注意以下命令,需要切换到 root 后运行

安装 docker

首先确定已经安装完成 docker,如果没有安装可以使用以下脚本快速安装并配置:

@rewida17
rewida17 / termux
Last active April 10, 2024 06:24
Run termux env via eg adb shell
#!/system/xbin/bash
#Based on https://github.com/termux/termux-app/issues/77
export PREFIX='/data/data/com.termux/files/usr'
export HOME='/data/data/com.termux/files/home'
export LD_LIBRARY_PATH='/data/data/com.termux/files/usr/lib'
export PATH="/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:$PATH"
export LANG='en_US.UTF-8'
export SHELL='/data/data/com.termux/files/usr/bin/bash'
export BIN='/data/data/com.termux/files/usr/bin'
export TERM=vt220
@karlvr
karlvr / 00README.md
Last active November 26, 2023 14:21
Roadwarrior configuration for macOS 10.12, iOS 10 and Windows 10 using strongSwan and user certificates

strongSwan setup for Road Warriors on macOS 10.12, iOS 10 and Windows 10

This setup is for remote users to connect into an office/home LAN using a VPN (ipsec). This is based on (but not the same as) the strongSwan documentation and this guide: https://raymii.org/s/tutorials/IPSEC_vpn_with_Ubuntu_16.04.html

I used strongSwan 5.5.1.

apt-get install -y strongswan strongswan-pki
@BretFisher
BretFisher / docker-for-mac.md
Last active July 9, 2024 11:29
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@GaryLee
GaryLee / hook-openpyxl.py
Created November 30, 2015 06:44
Fix ".constants.json" not found issue when using Pyinstaller to pack openpyxl.
# When you're encountering following error.
# > IOError: [Errno 2] No such file or directory: 'C:\\Users\\username\\AppData\\Local\\Temp\\_MEI502322\\openpyxl\\.constants.json'
#
# This solution tested under Python 2.7.10 and Pyinstaller 3.0.
#
# Put this file to your script folder.
# Add this hook to your distribution by
# > pyinstaller --onefile --additional-hooks-dir=. yourscript.py
#
from PyInstaller.utils.hooks import collect_data_files
@gotnix
gotnix / qemu_bridge-nat.txt
Created August 5, 2015 05:47
qemu 的网络桥接和NAT
chaos 的 qemu 技巧 (一) 网络桥接
http://ycool.com/post/sgeq9sf
原始的linux网络桥接 brctl 是很不错的技术,可以将虚拟机的网络和物理网络完好的桥接起来,
但是这个方法在服务器上应该是好的,然而,在桌面环境中,却会遇到一个大问题:
桥接设备如br0 不能跟network manager之类良好兼容,而且桌面机更多时候会跑wifi,这个brctl就更苦了。
所以,经过详细研究,现整理出一套用parprouted + vdeswitch + dhcp-helper +qemu的解决方案。
本方案中,出了 vde_tunctl , parprouted , dhcp-helper几个命令必须有root权限,其他任何步骤不需要root权限,
而且,在虚拟机里面也不会看到发到host machine的数据,基本上来说,安全模型还是比较清晰的。
@phryneas
phryneas / shellscan.sh
Last active January 14, 2016 11:00
quick web shell scan
#!/usr/bin/zsh
#improvements are greatly welcome:
terms=( )
terms=( $terms "exec" )
terms=( $terms "eval" )
terms=( $terms "passthru" )
terms=( $terms "shell_exec" )
terms=( $terms "system" )
terms=( $terms "pcntl_exec" )