README 🥚

# Install (はじめに)
- 「JAYA」を「ダウンロード」
- 「JAYA」を「ドキュメント」に「配置」
> sudo chmod -v 0755 jaya*
> sudo cp -v jaya* /usr/local/sbin/
- この処理を行わないと「JAYA」は動作しません。

# Jayachk (オプション)
> cd ~/ドキュメント && sh -x jayachk
- シェルの構文チェックや差分をチェックします。

# Jayakit (オプション)
> sudo jayakit
- 既知の脆弱性やルートキットの検査を行います。

# Jayauns (モジュール)
> jayauns firefox
- ルート権限が絶対に使えない、隔離された環境の構築。

# Jayamac (最初に一度だけ実行)
> sudo jayamac
- リース履歴を消去し、MACアドレスをランダム化します。

# Jayanta (最初に一度だけ実行)
> sudo jayanta debian-tor privoxy
- コアシステム。TOR透過プロキシとRAWプロキシの構築。
- ホストから出る全ての通信がTorを経由するようになります。

# Jayaraw (アプリケーション起動の際)
> sudo L='ja_JP.UTF-8' jayaraw env HOME='/tmp/.jaraw' jayauns sh -c 'mkdir -p /tmp/.jaraw; firefox'
> sudo L='ja_JP.UTF-8' jayaraw jayauns firefox
- RAW強制空間。(DNSもWebRTCも全てを許可する。)
- 隔離空間を作りその空間内から出る通信は、生IPで通信を行います。

# Jayator (アプリケーション起動の際)
> sudo L='ja_JP.UTF-8' jayator env HOME='/tmp/.jator' jayauns sh -c 'mkdir -p /tmp/.jator; firefox'
> sudo L='ja_JP.UTF-8' jayator jayauns firefox
- TOR強制空間。(IPリークは論理的に不可能です。)
- 隔離空間を作りその空間内から出る通信は、カーネルレベルで匿名化されます。

# Jayavpn (Jayaraw起動後にJayaraw内でのみ有効)
> sudo cp -v vpn.conf /etc/wireguard/vpn.conf
> sudo jayaraw true; sudo jayavpn
- VPN簡易空間。(匿名化目的で利用しないでください。)
- Jayarawが作る名前空間内でWireGuardを使ったVPN環境を構築します。
- 結果として、Jayaraw空間内で実行したアプリケーションは、VPN経由になります。

# Jayatvd, Jayatwd, Jayaytd (TVer, Twitch, YouTube CLI+TUIクライアント)
- 機能 CTRL | Jayatvd: S シリーズ | Jayaytd: F フル, C カット, V ビデオ, S ストリーム, <> ページング

CONFIG 🐣

1
2
3
4
5
6
7
8
9
# yt-dlp config

nvim /home/void/.config/yt-dlp/config

-S 'res:480'
--js-runtimes node
--remote-components ejs:github
-f 'bv+ba[language=ja]/bestvideo+bestaudio/best'
--extractor-args 'youtube:player_client=web_embedded'

JAYACHK 🪶

#!/bin/sh

# PROJECT: Jayachk
# UPDATES: 2026-07-01 19:08:51 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
type shellcheck || exit 1; cd "$HOME/ドキュメント" || exit 2

for f in jaya*; do
  [ -f "$f" ] || exit 3
  shellcheck "$f" || exit 4
  diff -u "/usr/local/sbin/$f" "$f"; case $? in 0|1) ;; *) exit 5 ;; esac
done

JAYAKIT 🪽

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayakit
# UPDATES: 2026-06-15 19:58:45 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; export TMPDIR='/var/tmp'
[ "$(id -u)" -eq 0 ] || exit 1; type trivy rkhunter chkrootkit || exit 2; trivy rootfs / --scanners vuln
rkhunter --update; rkhunter --sk --check; chkrootkit 2>/dev/null | grep --color='always' -E 'Warning|INFECTED'

JAYAMAC 🦉

#!/bin/sh

# PROJECT: Jayamac
# UPDATES: 2026-07-12 13:21:39 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
[ "$(id -u)" -eq 0 ] || exit 1; type macchanger || exit 2
rm -rfv -- /var/db/dhcp* /var/lib/dhcp* /var/lib/NetworkManager || exit 3

for f in /sys/class/net/*; do
  i="${f##*/}"
  [ "$i" != "lo" ] || continue
  [ -e "$f/device" ] || continue
  ip link set dev "$i" down || continue

  {
    ip addr flush dev "$i" &&
    ip neigh flush dev "$i"
  } || echo "fail: ip: $i" >&2

  macchanger -A "$i" || echo "fail: mac: $i" >&2
  ip link set dev "$i" up && echo "good: up: $i"
done

JAYANTA 🐦‍⬛

#!/bin/sh

# PROJECT: Jayanta
# UPDATES: 2026-06-18 20:08:38 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
TOR="${1:-tor}"; RAW="${2:-privoxy}"; NS="$(ip netns identify)"

[ "$(id -u)" -eq 0 ] || exit 1; type nft tor conntrack || exit 2
[ -z "$NS" ] || exit 3; ln -sfv /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 4
( id "$TOR" && id "$RAW" ) || { echo 'sudo sh jayanta [debian-]tor[anon] priv[tinypr]oxy'; exit 5; }
sysctl net.ipv4.ip_forward=0 net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 || exit 6

for t in nat filter; do nft add table ip $t; nft flush table ip $t; done
nft add chain ip nat output '{ type nat hook output priority dstnat; policy accept; }'
for c in input output forward; do nft add chain ip filter $c "{ type filter hook $c priority filter; policy drop; }"; done; conntrack -F expect; conntrack -F
nft add set ip nat reserved '{ type ipv4_addr; flags interval; elements = { 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 192.168.0.0/16, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 240.0.0.0/4 }; }'

nft add rule ip nat output udp dport 53 redirect to 9053
nft add rule ip nat output ip daddr 10.192.0.0/10 tcp dport '{ 80, 443 }' tcp flags syn / fin,syn,rst,ack redirect to 9040
nft add rule ip nat output skuid != "{ $TOR, $RAW }" oifname != "lo" ip daddr != @reserved tcp dport '{ 80, 443 }' tcp flags syn / fin,syn,rst,ack redirect to 9040

nft add rule ip filter input ct state established accept
nft add rule ip filter input iifname "lo" accept

nft add rule ip filter output ct state vmap '{ invalid : drop, established : accept }'
nft add rule ip filter output ct state new ip daddr 127.0.0.1 meta l4proto . th dport vmap '{ udp . 9053 : accept, tcp . 9040 : accept, tcp . 9050 : accept }'
nft add rule ip filter output ct state new tcp dport 443 tcp flags syn / fin,syn,rst,ack skuid "{ $TOR, $RAW }" accept
nft add rule ip filter output oifname "lo" ip daddr 127.0.0.1 accept; nft list ruleset

{
  echo "SafeSocks 1"
  echo "ReachableAddresses *:443"
  echo "User $TOR"
  echo "DataDirectory /var/lib/tor"
  echo "DNSPort 9053"
  echo "AutomapHostsOnResolve 1"
  echo "AutomapHostsSuffixes .onion"
  echo "VirtualAddrNetworkIPv4 10.192.0.0/10"
  echo "TransPort 9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort"
  echo "SocksPort 9050 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort"
} > /etc/tor/torrc; cat /etc/tor/torrc
{ sv restart tor || service tor restart || systemctl restart tor || rc-service tor restart; } >/dev/null 2>&1

JAYARAW 🕊️

#!/bin/sh

# PROJECT: Jayaraw
# UPDATES: 2026-07-06 14:26:20 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; NS="$(ip netns identify)"
case "${SUDO_USER:-}" in ''|root) exit 1 ;; esac; type nft || exit 2
[ -z "$NS" ] || exit 3; ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 4
printf '\033[31m█\033[0m Leak IP [Yes/no]: '; read -r YN; case "$YN" in [Yy]*) ;; *) exit 5 ;; esac
sysctl -q net.ipv4.ip_forward=1 net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 || exit 6

ip netns list | grep -qw jaraw || ip netns add jaraw

ip -n jaraw link show raw-veth1 >/dev/null 2>&1 || {
  ip link add raw-veth0 type veth peer name raw-veth1
  ip link set raw-veth1 netns jaraw
}

ip addr replace 198.18.1.1/30 dev raw-veth0
ip link set raw-veth0 up

ip -n jaraw addr replace 198.18.1.2/30 dev raw-veth1
ip -n jaraw link set lo up; ip -n jaraw link set raw-veth1 up
ip -n jaraw route replace default via 198.18.1.1 dev raw-veth1

nft add table ip nat
nft add chain ip nat postrouting '{ type nat hook postrouting priority srcnat; policy accept; }'
nft flush chain ip nat postrouting
nft add rule ip nat postrouting ip saddr 198.18.1.0/30 masquerade

nft add table ip filter
nft add chain ip filter forward '{ type filter hook forward priority filter; policy drop; }'
nft flush chain ip filter forward
nft add rule ip filter forward ct state vmap '{ invalid : drop, established : accept }'
nft add rule ip filter forward ct state new iifname "raw-veth0" ip saddr 198.18.1.0/30 accept

for i in all default lo raw-veth1; do ip netns exec jaraw sysctl -q net.ipv6.conf.$i.disable_ipv6=1; done
exec ip netns exec jaraw sudo -u "$SUDO_USER" -i env "LANG=${L:-en_US.UTF-8}" "XDG_RUNTIME_DIR=/run/user/$(id -u "$SUDO_USER")" "${@:-bash}"

JAYATOR 🦅

#!/bin/sh

# PROJECT: Jayator
# UPDATES: 2026-07-06 14:26:24 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; NS="$(ip netns identify)"
case "${SUDO_USER:-}" in ''|root) exit 1 ;; esac; type nft tor || exit 2
[ -z "$NS" ] || exit 3; ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 4
printf '\033[32m█\033[0m Hide IP [Yes/no]: '; read -r YN; case "$YN" in ''|[Yy]*) ;; *) exit 5 ;; esac
sysctl -q net.ipv4.ip_forward=1 net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 || exit 6

ip netns list | grep -qw jator || ip netns add jator

ip -n jator link show tor-veth1 >/dev/null 2>&1 || {
  ip link add tor-veth0 type veth peer name tor-veth1
  ip link set tor-veth1 netns jator
}

ip addr replace 198.18.2.1/30 dev tor-veth0
ip link set tor-veth0 up

ip -n jator addr replace 198.18.2.2/30 dev tor-veth1
ip -n jator link set lo up; ip -n jator link set tor-veth1 up
ip -n jator route replace default via 198.18.2.1 dev tor-veth1

nft add table ip nat
nft add chain ip nat prerouting '{ type nat hook prerouting priority dstnat; policy accept; }'
nft flush chain ip nat prerouting
nft add rule ip nat prerouting iifname "tor-veth0" udp dport 53 dnat to 198.18.2.1:9053
nft add rule ip nat prerouting iifname "tor-veth0" tcp dport '{ 80, 443 }' tcp flags syn / fin,syn,rst,ack dnat to 198.18.2.1:9040

nft add table ip filter
for c in input forward; do nft add chain ip filter $c "{ type filter hook $c priority filter; policy drop; }"; done
nft flush chain ip filter input
nft add rule ip filter input ct state vmap '{ invalid : drop, established : accept }'
nft add rule ip filter input ct state new iifname "tor-veth0" meta l4proto . th dport vmap '{ udp . 9053 : accept, tcp . 9040 : accept, tcp . 9050 : accept }'
nft add rule ip filter input iifname "lo" accept

while IFS= read -r line; do grep -Fqx -- "$line" /etc/tor/torrc || echo "$line" >> /etc/tor/torrc
done <<'EOF'
DNSPort 198.18.2.1:9053
TransPort 198.18.2.1:9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
SocksPort 198.18.2.1:9050 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
EOF
{ sv restart tor || service tor restart || systemctl restart tor || rc-service tor restart; } >/dev/null 2>&1

for i in all default lo tor-veth1; do ip netns exec jator sysctl -q net.ipv6.conf.$i.disable_ipv6=1; done
exec ip netns exec jator sudo -u "$SUDO_USER" -i env "LANG=${L:-en_US.UTF-8}" "XDG_RUNTIME_DIR=/run/user/$(id -u "$SUDO_USER")" "${@:-bash}"

JAYAUNS 🐓

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayauns
# UPDATES: 2026-06-24 13:22:11 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
[ "$(id -u)" -ne 0 ] || exit 1; type unshare newuidmap || exit 2
exec unshare --uts --ipc --pid --fork --time --cgroup --kill-child --user --map-auto --map-current-user --mount --mount-proc --propagation private setpriv --no-new-privs "${@:-bash}"

JAYAVPN 🦤

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayavpn
# UPDATES: 2026-07-12 14:49:17 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
[ "$(id -u)" -eq 0 ] || exit 1; type wg-quick || exit 2; ip netns exec jaraw true 2>/dev/null || exit 3
[ ! -f /etc/wireguard/vpn.conf ] || ip netns exec jaraw wg show vpn 2>/dev/null || ip netns exec jaraw wg-quick up vpn || exit 4

JAYATVD 🦜

#!/bin/sh

# PROJECT: Jayatvd
# UPDATES: 2026-07-11 16:29:07 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; pipe="$(printf '\037')"; mode='search'; type jq fzf mpv curl chafa yt-dlp || exit 1; printf 'query: '; read -r query; [ -n "$query" ] || exit 2
KEYS="$(curl -s -X POST --data 'device_type=pc' -H 'user-agent: Mozilla/5.0' 'https://platform-api.tver.jp/v2/api/platform_users/browser/create')"; UID="$(printf '%s' "$KEYS" | jq -r '.result.platform_uid')"; TOKEN="$(printf '%s' "$KEYS" | jq -r '.result.platform_token')"; [ -n "$UID" ] && [ -n "$TOKEN" ] || exit 3

while :; do
  case "$mode" in
    series) ep="$(curl -sG "https://platform-api.tver.jp/service/api/v1/callSeriesEpisodes/$sid" -H 'user-agent: Mozilla/5.0' -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'x-tver-platform-type: web' --data-urlencode "platform_uid=$UID" --data-urlencode "platform_token=$TOKEN")" || exit 4 ;;
    search) ep="$(curl -sG 'https://platform-api.tver.jp/service/api/v2/callKeywordSearch' -H 'user-agent: Mozilla/5.0' -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'x-tver-platform-type: web' --data-urlencode "keyword=$query" --data-urlencode "platform_uid=$UID" --data-urlencode "platform_token=$TOKEN")" || exit 4 ;;
  esac

  epl="$(printf '%s' "$ep" | jq -r --arg pipe "$pipe" '.result.contents[] | (.contents[]? // .) | select(.type=="episode") | .content | [ .id, .title, .seriesID, .seriesTitle, .thumbnailPath, .broadcasterName ] | join($pipe)')"; [ -n "$epl" ] || exit 5
  fzf="$(printf '%s' "$epl" | fzf --with-nth=2 --layout='reverse' --delimiter="$pipe" --prompt="tv[$mode]> " --expect='esc,ctrl-s' --preview="echo {4} {6}; thumb={5}; curl -s https://image-cdn.tver.jp/w=400\${thumb} | chafa")" || { mode='search'; continue; }

  key="$(printf '%s' "$fzf" | head -n1)"
  row="$(printf '%s' "$fzf" | tail -n1)"
  eid="$(printf '%s' "$row" | cut -d"$pipe" -f1)"
  sid="$(printf '%s' "$row" | cut -d"$pipe" -f3)"

  case "$key" in
        '') mpv -- "https://tver.jp/episodes/$eid" ;;
       esc) [ "$mode" != "search" ] && mode='search' || exit 0 ;;
    ctrl-s) [ "$mode" != "series" ] && [ -n "$sid" ] && mode='series' ;;
  esac
done

JAYATWD 🦚

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayatwd
# UPDATES: 2026-06-09 17:04:52 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; pipe="$(printf '\037')"
type fzf mpv yt-dlp || exit 1; printf 'id: '; read -r id; [ -n "$id" ] || exit 2
yt-dlp --no-warnings --skip-download --flat-playlist "https://twitch.tv/$id/videos" --print "%(title)s${pipe}%(url)s" | fzf --with-nth=1 --layout='reverse' --delimiter="$pipe" | cut -d"$pipe" -f2 | xargs -r mpv

JAYAYTD 🦩

#!/bin/sh

# PROJECT: Jayaytd
# UPDATES: 2026-07-11 16:29:13 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; type fzf mpv curl chafa yt-dlp || exit 1; line="${1:-20}"; pipe="$(printf '\037')"
printf 'query: '; read -r query; [ -n "$query" ] || exit 2; default="$query"; page=1; mode='search'; channel=''

while :; do
  case "$mode" in
    videos) src="$query/videos" ;;
    shorts) src="$query/shorts" ;;
    stream) src="$query/streams" ;;
    playls) src="$query/playlists" ;;
    search) src="ytsearch$((page * line)):$query" ;;
  esac

  ytd="$(yt-dlp --no-warnings --skip-download --flat-playlist --playlist-end "$((page * line))" --extractor-args 'youtube:lang=ja' --print "%(id)s${pipe}%(title)s${pipe}%(channel)s${pipe}%(channel_url)s${pipe}%(thumbnails.-1.url)s" "$src")" || { query="$default"; mode='search'; continue; }; [ -n "$ytd" ] || exit 3
  fzf="$(printf '%s' "$ytd" | fzf --with-nth=2 --layout='reverse' --delimiter="$pipe" --prompt="yt[$mode][$page]> " --expect='esc,left,right,ctrl-d,ctrl-v,ctrl-c,ctrl-s,ctrl-f' --preview="[ {3} != NA ] && echo {3}; thumb={5}; curl -s https://\${thumb#*//} | chafa")" || continue

  key="$(printf '%s' "$fzf" | head -n1)"
  row="$(printf '%s' "$fzf" | tail -n1)"
  ids="$(printf '%s' "$row" | cut -d"$pipe" -f1)"
  url="$(printf '%s' "$row" | cut -d"$pipe" -f4)"
  [ -n "$url" ] && [ "$url" != "NA" ] && channel="$url"

  case "$key" in
        '') case "$ids" in UC*) query="$channel"; mode='videos' ;; *) mpv -- "ytdl://$ids" ;; esac ;;
       esc) [ "$mode" != "search" ] && { query="$default"; mode='search'; } || exit 0 ;;
      left) [ "$page" -gt 1 ] && page="$((page - 1))" ;;
     right) page="$((page + 1))" ;;
    ctrl-d) yt-dlp -- "$ids" ;;
    ctrl-v) query="$channel"; mode='videos' ;;
    ctrl-c) query="$channel"; mode='shorts' ;;
    ctrl-s) query="$channel"; mode='stream' ;;
    ctrl-f) query="$channel"; mode='playls' ;;
  esac
done
Edit

Pub: 05 Dec 2024 05:11 UTC

Edit: 18 Jul 2026 01:32 UTC

Views: 10747

Auto Theme: Dark