Created
November 27, 2022 13:16
-
-
Save Ketchup901/1b782f7c8778820dbd48028e1b9bf51e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sets the addtime field used by Flood to a torrent inside rtorrent. | |
# First argument is the infohash of the torrent to be modified. | |
INFO_HASH="$1" | |
# | |
TIMESTAMP=$(date +%s) | |
# Hostname and port where rtorrent is listening (network.scgi.open_port) | |
HOST="localhost" | |
PORT=5000 | |
read -rd "\0" XMLRPC <<XMLRPC | |
<?xml version='1.0' encoding="iso-8859-1" ?> | |
<methodCall> | |
<methodName>d.custom.set</methodName> | |
<params> | |
<param> | |
<value> | |
<string>${INFO_HASH}</string> | |
</value> | |
</param> | |
<param> | |
<value> | |
<string>addtime</string> | |
</value> | |
</param> | |
<param> | |
<value> | |
<string>${TIMESTAMP}</string> | |
</value> | |
</param> | |
</params> | |
</methodCall> | |
XMLRPC | |
NULL="<00>"; | |
HEADERS="CONTENT_LENGTH${NULL}$(echo -n "$XMLRPC" | wc -c)${NULL}SCGI${NULL}1${NULL}REQUEST_METHOD${NULL}POST${NULL}REQUEST_URI${NULL}/RPC2${NULL}"; | |
REQUEST="$(echo -n "${HEADERS}" | sed 's:<00>:\x00:g' | wc -c):${HEADERS},${XMLRPC}"; | |
echo -n "$REQUEST" | sed 's:<00>:\x00:g' | nc "$HOST" "$PORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment