Skip to content

Instantly share code, notes, and snippets.

View kyouheicf's full-sized avatar
🍊

kyouheicf

🍊
  • 19:24 (UTC +09:00)
View GitHub Profile
@kyouheicf
kyouheicf / tail-windows-firewall-defender-log.ps1
Created May 8, 2024 16:32 — forked from cameronkerrnz/tail-windows-firewall-defender-log.ps1
Tail and Filter Windows Firewall Log (like tail -f ... | awk)
Get-Content -Head 5 C:\Windows\System32\LogFiles\Filrewall\pfirewall.log
Get-Content -Wait -Tail 5 C:\Windows\System32\LogFiles\Filrewall\pfirewall.log | % {
do {
$a=$_.split(' ')
# DROP or ACCEPT (the only values AFAIK)
#
if ($a[2] -ne 'DROP') {continue}
graph LR
  b[<img src='https://cf-icons.pages.dev/internet-browser.svg' width='48' height='48'/><br>Browser] --> |GET html|p
  subgraph Cloudflare[<div style='text-align:center'><img src='https://cf-icons.pages.dev/logo-cloud.svg' width='100'/><br>Cloudflare]
    p[<img src='https://cf-icons.pages.dev/pages-logo.svg' width='48' height='48'/><br>Pages]
    cw --> |<img src='https://cf-icons.pages.dev/timer.svg' width='48' height='48'/><br>Cron Trigger|cw[<img src='https://cf-icons.pages.dev/edgeworker.svg' width='48' height='48'/><br>Cron Workers</div>]
    fw --> |"READ"|d["<img src='https://cf-icons.pages.dev/d1.svg' width='48' height='48'/><br>D1</br>(Table 'WaitPeople')"]
  end
  cw --> |"<img src='https://cf-icons.pages.dev/browser-rendering.svg' width='48' height='48'/><br>GET html</br>(Browser Rendering)"|q[<img src='https://cf-icons.pages.dev/applications.svg' width='48' height='48'/><br>www.qbhouse.co.jp]
  cw --> |"WRITE"|d
C:\Users\Administrator>nslookup github.com
Server: UnKnown
Address: ::1Non-authoritative answer:
Name: github.com
Address: 20.27.177.113
C:\Users\Administrator>netsh advfirewall firewall add rule name="Block Outbound to GitHub" dir=out action=block program= "C:\Program Files (x86)\cloudflared\cloudflared.exe" enable=yes remoteip=20.27.177.113
Ok.
C:\Users\Administrator>"C:\Program Files (x86)\cloudflared\cloudflared.exe" update --version 2024.2.0
# Set Private Application Name
export PRIVATE_APP_NAME='aa'
# Get current config json
http -A creds GET https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/apps \
| jq -r '.result[] | select (.name == "'$PRIVATE_APP_NAME'")' > private-app.json
# Set Private Application UUID
export PRIVATE_APP_UUID=$(cat private-app.json | jq -r .id)
# Get current config json
http -A creds GET https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/identity_providers \
| jq -r '[.result[] | select (.type == "azureAD")][0]' > azureAD.json
# Set identity UUID
export AZURE_AD_UUID=$(cat azureAD.json | jq -r .id)
# Set "prompt" config parameter option
jq 'del(.id, .uid, .version) | .config.prompt = "login"' azureAD.json > tmp && mv tmp azureAD.json
http -A creds POST \
https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/urlscanner/scan \
visibility=Unlisted \
url=https://www.cloudflare.com/
@kyouheicf
kyouheicf / run-multiple-replicas-on-the-same-windows-machine.bat
Last active March 12, 2024 01:30
run-multiple-replicas-on-the-same-windows-machine
rem set replica service name
set SC_NAME=Cloudflared2
echo %SC_NAME%
rem set tunnel token
set TUN_TOKEN=eyJxxx
echo %TUN_TOKEN%
rem copy binary to another folder
xcopy /e /h /c /i "C:\Program Files (x86)\cloudflared" "C:\Program Files (x86)\%SC_NAME%"
1. Inkscape --> some images are not rendered correctly
/Applications/Inkscape.app/Contents/MacOS/inkscape -b white -w 4096 -p *.svg --export-type=png
2. rsvg-convert --> works perfectly
rsvg-convert -w 4096 cf1-ref-arch-16.svg > cf1-ref-arch-16.png
3. ImageMagick --> not works well
convert -font ~/Library/Fonts/ipaexm.ttf cf1-ref-arch-16.svg cf1-ref-arch-16.png
export MACOS_BETA_RELEASE_URL='https://install.appcenter.ms/api/v0.1/apps/cloudflare/1.1.1.1-macos/distribution_groups/beta'
# export MACOS_STABLE_RELEASE_URL='https://install.appcenter.ms/api/v0.1/apps/cloudflare/1.1.1.1-macos-1/distribution_groups/release'
# export WINDOWS_BETA_RELEASE_URL='https://install.appcenter.ms/api/v0.1/apps/cloudflare/1.1.1.1-windows/distribution_groups/beta'
# export WINDOWS_STABLE_RELEASE_URL='https://install.appcenter.ms/api/v0.1/apps/cloudflare/1.1.1.1-windows-1/distribution_groups'
export TARGET_URL=${MACOS_BETA_RELEASE_URL}
# export TARGET_URL=${MACOS_STABLE_RELEASE_URL}
# export TARGET_URL=${WINDOWS_BETA_RELEASE_URL}
# export TARGET_URL=${WINDOWS_STABLE_RELEASE_URL}