Skip to content

Instantly share code, notes, and snippets.

View kyouheicf's full-sized avatar
🍊

kyouheicf

🍊
  • 00:17 (UTC +09:00)
View GitHub Profile
// 権限を付与するために一度だけ実行する。
function test_Google_Chatに通知() {
notify('テストです。');
}
//Misc
function getRows_(item, type) {
if (type === 'GRID') return item.asGridItem().getRows();
if (type === 'CHECKBOX_GRID') return item.asCheckboxGridItem().getRows();
throw 'invalid type: ' + type;
export EMAIL='YOUR_EMAIL'
export APIKEY='YOUR_APIKEY'
export ZONE_ID='YOUR_ACCOUNT_ID'
curl -sX GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/intel/dns?ipv4=43.153.133.9&start=2024-07-23&end=2024-07-26&per_page=200" \
-H "X-Auth-Email: $EMAIL" \
-H "X-Auth-Key: $APIKEY" \
-H "Content-Type: application/json" | jq -r .result.reverse_records > reverse_records.json
for i in {0..$(cat reverse_records.json | jq 'length')}
<array>
<dict>
<key>organization</key>
<string>your-team-name</string>
<key>display_name</key>
<string>Global WARP</string>
<key>auto_connect</key>
<integer>0</integer>
<key>onboarding</key>
<false/>
@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/