/go/dbls: dbls from the Command Line

/go/dbls scans the data of one MySQL/MariaDB database (not its table structure) and finds every value that looks like a file name or a hash. It can: It looks for two kinds of text: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Print every file name and hash found in the database "mydb"
/go/dbls mydb

# Save the same list into the table "files" inside "mydb"
/go/dbls mydb files

Arguments

Position Argument Required Notes
1 <database> Yes The database to scan. Must already exist.
2 <table> No Table to store the results in. Created in <database> if it doesn’t exist.

Use plain names (letters, numbers, underscores). The names are placed into SQL statements without quoting, so a name with a hyphen or other special character can fail.

Examples

# Quick look at what files a CMS database refers to
/go/dbls wp_shop | less

# Build a file inventory table, then check it
/go/dbls wp_shop inventory
mariadb -e "SELECT COUNT(*) FROM wp_shop.inventory"

# Save the file names to a text file
/go/dbls wp_shop > /tmp/wp_shop-files.txt

Output

Print mode (one argument)

The output is two sorted, de-duplicated lists, one after the other:

  1. File names
  2. 32-character hashes

There is no heading or separator between them. The example below is illustrative.

backup.sql
cover.jpg
index.php
logo.png
notes.txt
5d41402abc4b2a76b9719d911017c592
d41d8cd98f00b204e9800998ecf8427e

Save mode (two arguments)

Nothing is printed. The results are inserted into <database>.<table>, which has this structure:

Column Type Default Notes
ID INT AUTO_INCREMENT — Primary key.
File CHAR(255) Empty Unique. Holds the file name or hash.
Download INT 0 Counter for your own use.
TimeStamp INT UNIX_TIMESTAMP() When the row was inserted.

The table uses InnoDB with utf8mb4_unicode_ci.

Because File is unique and the insert uses IGNORE, running the command again only adds new values. Existing rows, including their Download counts, are left alone.

See the full reference at /go/dbls and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *