Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #!/bin/bash
  2. #If used on WSL mind the line endings, only use LF (unix-style)
  3. echo "RemoteInstall for NXThemeInstaller by exelix"
  4. echo "Tested on Installer 2.0.1, may break for future versions (hopefully not)"
  5. IPADDR=$1
  6. FILENAME=$2
  7.  
  8. if [ -z "$FILENAME" ] || [ -z "$IPADDR" ]
  9. then
  10. echo "Usage $0 [IpAddress] [fileName]"
  11. echo "only nxtheme and szs files are supported"
  12. exit
  13. fi
  14.  
  15. if [ ! -f "$FILENAME" ]; then
  16. echo "$FILENAME not found!"
  17. exit
  18. fi
  19.  
  20. FILESIZE=$(stat -c%s "$FILENAME")
  21. echo "Size of $FILENAME = $FILESIZE bytes."
  22.  
  23. printf "theme\x0\x0\x0" > __tmp__theme
  24. #TODO: detect endianness and write proper size
  25. printf "0: %.8x" $FILESIZE | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >>__tmp__theme
  26. # for Big Endian: printf "0: %.8x" $FILESIZE | xxd -r -g0 >>__tmp__theme
  27. cat $FILENAME >> __tmp__theme
  28.  
  29. echo "Response from $IPADDR: "
  30. cat __tmp__theme | nc $IPADDR 5000
  31.  
  32. rm __tmp__theme
  33. echo "."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement