init
commit
bcef4c193b
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define database connection variables
|
||||
db_host="192.168.0.114"
|
||||
db_user="u2"
|
||||
db_pass="pass"
|
||||
db_name="u2_md5"
|
||||
db_table="md5_numbers"
|
||||
|
||||
# Function to calculate MD5 hash
|
||||
calculate_md5() {
|
||||
echo -n "$1" | md5sum | awk '{print $1}'
|
||||
}
|
||||
|
||||
# Function to insert values into the database
|
||||
insert_into_database() {
|
||||
local number=$1
|
||||
local md5=$(calculate_md5 "$number")
|
||||
mysql -h "$db_host" -u "$db_user" -p"$db_pass" "$db_name" -e "INSERT INTO $db_table (value, md5) VALUES ($number, '$md5');"
|
||||
}
|
||||
|
||||
# Loop from 1 to 10000000 and insert values into the database
|
||||
for (( i=13337; i<=10000000; i++ )); do
|
||||
insert_into_database "$i"
|
||||
# echo "Inserted value $i into database."
|
||||
done
|
||||
|
||||
echo "All values inserted into database."
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define database connection variables
|
||||
db_host="your_db_host"
|
||||
db_user="your_db_user"
|
||||
db_pass="your_db_password"
|
||||
db_name="your_db_name"
|
||||
db_table="your_db_table"
|
||||
|
||||
# Define path to dictionary file
|
||||
dictionary_file="path_to_your_dictionary_file"
|
||||
|
||||
# Check if dictionary file exists
|
||||
if [ ! -f "$dictionary_file" ]; then
|
||||
echo "Dictionary file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to insert word into the database
|
||||
insert_into_database() {
|
||||
local word="$1"
|
||||
mysql -h "$db_host" -u "$db_user" -p"$db_pass" "$db_name" -e "INSERT INTO $db_table (word) VALUES ('$word');"
|
||||
}
|
||||
|
||||
# Loop through each word in the dictionary and insert it into the database
|
||||
while read -r word; do
|
||||
insert_into_database "$word"
|
||||
echo "Inserted word $word into database."
|
||||
done < "$dictionary_file"
|
||||
|
||||
echo "All words inserted into database."
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define database connection variables
|
||||
db_host="your_db_host"
|
||||
db_user="your_db_user"
|
||||
db_pass="your_db_password"
|
||||
db_name="your_db_name"
|
||||
db_table="your_db_table"
|
||||
|
||||
# Define path to dictionary file
|
||||
dictionary_file="path_to_your_dictionary_file"
|
||||
|
||||
# Check if dictionary file exists
|
||||
if [ ! -f "$dictionary_file" ]; then
|
||||
echo "Dictionary file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to insert combination into the database
|
||||
insert_into_database() {
|
||||
local combined_word="$1"
|
||||
mysql -h "$db_host" -u "$db_user" -p"$db_pass" "$db_name" -e "INSERT INTO $db_table (combined_word) VALUES ('$combined_word');"
|
||||
}
|
||||
|
||||
# Loop through each word in the dictionary
|
||||
while read -r word1; do
|
||||
while read -r word2; do
|
||||
# Concatenate the two words
|
||||
combined_word="$word1$word2"
|
||||
|
||||
# Insert the combined word into the database
|
||||
insert_into_database "$combined_word"
|
||||
echo "Inserted combination $combined_word into database."
|
||||
done < "$dictionary_file"
|
||||
done < "$dictionary_file"
|
||||
|
||||
echo "All combinations inserted into database."
|
||||
|
Loading…
Reference in New Issue