Skip to content

Instantly share code, notes, and snippets.

@ergoz
ergoz / youtube_formats.md
Created July 22, 2024 12:53 — forked from MartinEesmaa/youtube_formats.md
Youtube Format IDs

Note: This is all almost full YouTube ID informations. Original owner goes to AgentOak, modified version by Martin Eesmaa.

See the credits and also special thanks in below.

Last updated: July 2024

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

blocklist="/etc/powerdns/blocklist.lua"
adservers=newDS()
if io.open(blocklist, 'r') then
adservers:add(dofile(blocklist))
end
function preresolve(dq)
if(not adservers:check(dq.qname) or (dq.qtype ~= pdns.A and dq.qtype ~= pdns.AAAA)) then
return false
adservers=newDS()
adservers:add(dofile("blocklist.lua"))
-- optionally: adservers:add(dofile("trackers.lua"))
filterset=newCAS()
filterset:add(dofile("filtercustomers.lua"))
function preresolve(dq)
if(not adservers:check(dq.qname) or (dq.qtype ~= pdns.A and dq.qtype ~= pdns.AAAA)) then
return false
# sqlite3 /etc/powerdns/powerdns.sqlite3 < /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql
# pdnsutil create-zone example.com ns1.example.com
Creating empty zone 'example.com.'
Also adding one NS record
# pdnsutil add-record example.com ns1 A 192.168.1.2
New rrset:
ns1.example.com. IN A 3600 192.168.1.2
# pdnsutil list-zone example.com
example.com. 3600 IN NS ns1.example.com.
example.com. 3600 IN SOA ns1.example.com hostmaster.example.com 1 10800 3600 604800 3600

CVE-2015-7547 mitigation script

In response to CVE-2015-7547, we are developing this Lua script which should protect your users, at a slight risk of disrupting specific queries which naturally deliver very large responses.

Run the script below by setting: lua-dns-script=stop-cve-2015-7547.lua - or use rec_control reload-lua-script stop-cve-2015-7547.lua at runtime.

Please continue to check this page for updates.

function postresolve ( remoteip, domain, qtype, records, origrcode )
malwareips=newNMG()
malwareips:addMasks(dofile("blacklist.ip"))
function postresolve(dq)
-- print("postresolve called for ",dq.qname:toString())
local records = dq:getRecords()
local changed = false
for k,v in pairs(records) do
if v.type == pdns.A or v.type == pdns.AAAA
then
googleset = newDS()
-- https://www.google.com/supported_domains
-- (echo 'return{' ; for a in $(curl https://www.google.com/supported_domains | sed s/^\\.//) ; do echo \"$a\",; done ; echo '}') > googledomains.lua
googleset:add(dofile("googledomains.lua"))
function handleSafeSearch(dq)
if(googleset:check(dq.qname)) then
@ergoz
ergoz / lua.md
Created July 18, 2024 17:53 — forked from ahupowerdns/lua.md
The LUA record type for Lua-powered DNS records

LUA Record Type for Lua-powered DNS records for standards based fail-over and geographical load balancing

GitHub branch -> https://github.com/ahupowerdns/pdns/tree/luarec

Recently, many zone owners could not migrate away from Dyn since they were benefiting from non-standardised DNS-based failover and geographical loadbalancing features. What you see below is an attempt to get standards based but flexible equivalents of these currently proprietary features. Here is a zone:

$TTL 60
lua.br. IN      SOA     a.lua.br. nstld.verisign-grs.com. (
        2016032300      ; Serial
        14400           ; Refresh
$ORIGIN .
v6.powerdns.org 3600 IN NS lua-ns-v6.powerdns.org.
v6.powerdns.org 3600 IN SOA lua-ns-v6.powerdns.org hostmaster.v6.powerdns.org 1 10800 3600 604800 3600
whoami-ecs.v6.powerdns.org 60 IN LUA TXT "'ip: '..who:toString()..', netmask: '..(ecswho and ecswho:toString() or 'no ECS')"
whoami-port.v6.powerdns.org 60 IN LUA TXT "who:toStringWithPort()"
whoami.v6.powerdns.org 60 IN LUA AAAA "who:toString()"
whoami.v6.powerdns.org 60 IN LUA TXT "who:toString()"
;;;;;;;;;;;;;;