Skip to content

Instantly share code, notes, and snippets.

@Suzhou65
Suzhou65 / CloudFlare_DDNS_3.md
Last active October 11, 2023 19:27
Get IPv4, IPv6 DNS record from CloudFlare API

Let's try to ask DNS record for CloudFlare API. and separate into string data.

The "id" of domain (inclouding subdomain) can be found in JSON data. in this example, it will be filled in "zone_record_ipv4_id" and "zone_record_ipv6_id".

import json
import requests

#API
auth_key = "API Token"
@Suzhou65
Suzhou65 / CloudFlare_DDNS_2.md
Last active July 24, 2024 13:35
Get DNS record from CloudFlare API

Let's try to ask DNS record for CloudFlare API.

Replace the "API Token" at auth_key by the API Token you get, the "Zone ID" can be found in Cloudflare Dashboard, logged in the Cloudflare Dashboard, check the Domain page, "Zone ID" information will appearance at API block, right hand side.

import json
import requests

cloudflare_api = "https://api.cloudflare.com/client/v4/"
zone_id = "278035ad7a9d983bc54a990b43ef7eb0"
@Suzhou65
Suzhou65 / CloudFlare_DDNS_1.md
Last active September 21, 2025 16:45
Verify API Token for CloudFlare API

First, logged in the Cloudflare Dashboard, and go to User Profile, choice API Tokens, generated API Token.

Then, once successfully generated, the token secret is only shown once. Make sure to copy the secret to a secure place. Replace the API Token at BearerAuth.

import json
import requests

cloudflare_verify = "https://api.cloudflare.com/client/v4/user/tokens/verify"
BearerAuth = "API Token"
@Suzhou65
Suzhou65 / ProfitTrailer_SSL_2.md
Created October 31, 2020 15:52
ProfitTrailer Install SSL Certificate

Move to the folder Install ProfitTrailer

cd ~
cd /var/opt/profittrailer

Editing ProfitTrailer configuration

sudo vim application.properties
@Suzhou65
Suzhou65 / ProfitTrailer_SSL_1.md
Last active October 31, 2020 15:28
ProfitTrailer Install SSL Certificate

Move to the folder storage file

cd ~
sudo mv /home/user/download_ssl

Create a PKCS12 from Certificates and Private Key files

sudo openssl pkcs12 -export -in Certificates.crt -inkey Private.key -out PKCS12.p12 -CAfile CA.crt -caname root -name tomcat
@Suzhou65
Suzhou65 / arp_monitor_2.md
Created September 21, 2020 12:42
NETGEAR R6400V2

NETGEAR board info

nvram show | grep board 
boardrev=0x1601
pci/2/1/boardflags=0x30000000
size: 43288 bytes (87784 left)
boardtype=0x0646
@Suzhou65
Suzhou65 / arp_monitor_1.md
Created September 21, 2020 12:35
ARP test
arp -i br0
? (10.0.1.10) aa:51:f2:42:1e:0f [ether] on br0
? (10.0.1.4)  fa:dc:46:d0:54:13 [ether] on br0
? (10.0.1.13) 62:90:11:e2:af:c6 [ether] on br0
? (10.0.1.17) 12:41:58:30:89:62 [ether] on br0
? (10.0.1.15) 7a:35:86:48:1a:74 [ether] on br0
? (10.0.1.6) 4a:2f:a6:c8:d9:21 [ether] on br0
@Suzhou65
Suzhou65 / monitor_7.md
Last active September 21, 2020 09:15
Raspberry Pi Automatically Report
import re
import os
import sys
import subprocess
from subprocess import PIPE
from subprocess import Popen

p1 = Popen(["ps", "-x"], stdout=PIPE)
p2 = Popen(["grep", "HentaiAtHome"], stdin=p1.stdout, stdout=PIPE)
@Suzhou65
Suzhou65 / monitor_6.md
Created September 21, 2020 08:57
Raspberry Pi Automatically Report
pi@raspberrypi:~/python $ python test.py
Sjava
Sgrep
@Suzhou65
Suzhou65 / monitor_6.md
Last active September 26, 2020 03:56
Raspberry Pi Automatically Report
import re
import os
import sys
import socket
import smtplib
import datetime
import subprocess
from subprocess import PIPE
from subprocess import Popen