Compare commits
4 Commits
87b987daab
...
68b66d60ef
Author | SHA1 | Date | |
---|---|---|---|
68b66d60ef | |||
f53cdaf508 | |||
d77cca2699 | |||
1fa11b9f87 |
@ -47,6 +47,7 @@
|
|||||||
pup # html parser
|
pup # html parser
|
||||||
neofetch # Neo
|
neofetch # Neo
|
||||||
libarchive # bsdtar
|
libarchive # bsdtar
|
||||||
|
unrar # Extract rar archives
|
||||||
imagemagick # image tools
|
imagemagick # image tools
|
||||||
ffmpeg # video manupilation
|
ffmpeg # video manupilation
|
||||||
glow # markdown viewer
|
glow # markdown viewer
|
||||||
@ -73,6 +74,9 @@
|
|||||||
protonvpn-gui # Protonvpn
|
protonvpn-gui # Protonvpn
|
||||||
mumble # Mumble gui
|
mumble # Mumble gui
|
||||||
feishin # Jellyfin player
|
feishin # Jellyfin player
|
||||||
|
arx-libertatis # Arx fatalis cross platform engine port
|
||||||
|
devilutionx # Diablo 1 source port
|
||||||
|
antimicrox # Controller mapper
|
||||||
(nerdfonts.override { fonts = [ "CascadiaCode" ]; }) # Best font
|
(nerdfonts.override { fonts = [ "CascadiaCode" ]; }) # Best font
|
||||||
# (retroarch.override {
|
# (retroarch.override {
|
||||||
# cores = with libretro; [
|
# cores = with libretro; [
|
||||||
|
@ -7,8 +7,8 @@ rustPlatform.buildRustPackage rec {
|
|||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "imLinguin";
|
owner = "imLinguin";
|
||||||
repo = "comet";
|
repo = "comet";
|
||||||
rev = "95753236846cbd0980e679c4dbe73fb5908a6956";
|
rev = "684a6bd03a2b6d10e9bb7afaf293145d51f1acf4";
|
||||||
hash = "sha256-5PjBOd6RIvnd41PjiGZKl+nq9ZKBZHsXNjYdSsnsu+w=";
|
hash = "sha256-t/33ep4y/sJmyT7BuDNDjJdERA9XF+7buagzSMTV4ro=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,5 +30,8 @@ stdenv.mkDerivation {
|
|||||||
# Add dependencies to the runtime for my sync-backup script
|
# Add dependencies to the runtime for my sync-backup script
|
||||||
wrapProgram $out/bin/sync-backup \
|
wrapProgram $out/bin/sync-backup \
|
||||||
--prefix PATH : ${lib.makeBinPath [ rsync cryptsetup ]}
|
--prefix PATH : ${lib.makeBinPath [ rsync cryptsetup ]}
|
||||||
|
|
||||||
|
wrapProgram $out/bin/megadl \
|
||||||
|
--prefix PATH : ${lib.makeBinPath [ openssl ]}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
70
home-manager/modules/scripts/megadl
Executable file
70
home-manager/modules/scripts/megadl
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Shamelesly stolen from DemonKingSwarn from his discord message
|
||||||
|
# Original link is at http://0x0.st/Xokg.sh
|
||||||
|
|
||||||
|
URL=""
|
||||||
|
|
||||||
|
if [[ $1 =~ ^https?:\/\/mega(\.co)?\.nz ]]; then
|
||||||
|
URL="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! $URL ]]; then
|
||||||
|
echo "Usage: ${0##*/} url" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURL="curl -Y 1 -y 10"
|
||||||
|
|
||||||
|
missing=false
|
||||||
|
for cmd in openssl; do
|
||||||
|
if [[ ! $(command -v "$cmd" 2>&1) ]]; then
|
||||||
|
missing=true
|
||||||
|
echo "${0##*/}: $cmd: command not found" >&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if $missing; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $URL =~ .*/file/[^#]*#[^#]* ]]; then
|
||||||
|
id="${URL#*file/}"; id="${id%%#*}"
|
||||||
|
key="${URL##*file/}"; key="${key##*#}"
|
||||||
|
else
|
||||||
|
id="${URL#*!}"; id="${id%%!*}"
|
||||||
|
key="${URL##*!}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
raw_hex=$(echo "${key}=" | tr '\-_' '+/' | tr -d ',' | base64 -d -i 2>/dev/null | od -v -An -t x1 | tr -d '\n ')
|
||||||
|
hex=$(printf "%016x" \
|
||||||
|
$(( 0x${raw_hex:0:16} ^ 0x${raw_hex:32:16} )) \
|
||||||
|
$(( 0x${raw_hex:16:16} ^ 0x${raw_hex:48:16} ))
|
||||||
|
)
|
||||||
|
|
||||||
|
json=$($CURL -s -H 'Content-Type: application/json' -d '[{"a":"g", "g":"1", "p":"'"$id"'"}]' 'https://g.api.mega.co.nz/cs?id=&ak=') || exit 1; json="${json#"[{"}"; json="${json%"}]"}"
|
||||||
|
file_url="${json##*'"g":'}"; file_url="${file_url%%,*}"; file_url="${file_url//'"'/}"
|
||||||
|
|
||||||
|
json=$($CURL -s -H 'Content-Type: application/json' -d '[{"a":"g", "p":"'"$id"'"}]' 'https://g.api.mega.co.nz/cs?id=&ak=') || exit 1
|
||||||
|
at="${json##*'"at":'}"; at="${at%%,*}"; at="${at//'"'/}"
|
||||||
|
|
||||||
|
json=$(echo "${at}==" | tr '\-_' '+/' | tr -d ',' | openssl enc -a -A -d -aes-128-cbc -K "$hex" -iv "00000000000000000000000000000000" -nopad | tr -d '\0'); json="${json#"MEGA{"}"; json="${json%"}"}"
|
||||||
|
file_name="${json##*'"n":'}"
|
||||||
|
if [[ $file_name == *,* ]]; then
|
||||||
|
file_name="${file_name%%,*}"
|
||||||
|
fi
|
||||||
|
file_name="${file_name//'"'/}"
|
||||||
|
|
||||||
|
aria2c -x 15 -o "$file_name" "$file_url"
|
||||||
|
cat "$file_name" | openssl enc -d -aes-128-ctr -K "$hex" -iv "${raw_hex:32:16}0000000000000000" > "temp.new"
|
||||||
|
mv -f temp.new "$file_name"
|
||||||
|
|
||||||
|
echo "$file_url"
|
||||||
|
echo "$file_name"
|
||||||
|
echo "$hex"
|
||||||
|
echo "${raw_hex:32:16}0000000000000000"
|
||||||
|
sleep 5
|
||||||
|
echo "Downloading... (press Ctrl + C to Cancel)"
|
||||||
|
|
||||||
|
aria2c -x 16 -s 16 -o "$file_name" "$file_url"
|
||||||
|
cat "$file_name" | openssl enc -d -aes-128-ctr -K "$hex" -iv "${raw_hex:32:16}0000000000000000" > "temp.new"
|
||||||
|
mv -f temp.new "$file_name"
|
Loading…
Reference in New Issue
Block a user