Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update passwords & backup docker containers #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions blue-team/linux/docker_backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# backup docker containers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a #!/bin/bash or #!/bin/sh or #!/usr/bin/env bash or some other interpreter


# write container ids to text file
echo docker ps -aq > container_ids.txt

i = 0
while read id; do
docker commit -p "$id" "docker-backup$i"
name = "container$i"
docker save -o ~/$name.tar "docker-backup$i"
# save tar file to termbin
((i=i+1))
done < container_ids.txt
7 changes: 7 additions & 0 deletions blue-team/linux/update_passwords.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
# change password for users
grep "/home" /etc/passwd | awk -F: '{print $1}' > users.txt
while read user; do
echo "$user@123" | passwd --stdin "$user"
Copy link
Member

@AnthonyH45 AnthonyH45 Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should read in the appended password, as if we edit the file, we might accidentally leave it if we forget to delete the script

Another note (thanks @advilm ) we should use ${user} rather than just $user as this is better practice

done < users.txt