Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMousa committed Jan 5, 2024
1 parent ff7a18a commit 7ba5f68
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 0x08-networking_basics_2/0-change_your_home_IP
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# changes the following domain resolve ips
# localhost from 127.0.0.1 to 127.0.0.2
# facebook.com from 157.240.11.35 to 8.8.8.8

cp /etc/hosts ~/hosts.new
echo "127.0.0.2 localhost" > ~/hosts.new
echo "8.8.8.8 facebook.com" >> ~/hosts.new
cp -f ~/hosts.new /etc/hosts
8 changes: 8 additions & 0 deletions 0x08-networking_basics_2/1-show_attached_IPs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Displays all acive IPv4 addresses on the machine.

# a different way using ifconfig but now ip is a new command and ifconfig can be missing in some os
#ifconfig | grep -Eo "inet (addr:)?([0-9]*\.){3}[0-9]*" | awk '{print $2}'

ip -4 -o addr show | awk '{print $4}' | cut -d "/" -f 1

4 changes: 4 additions & 0 deletions 0x08-networking_basics_2/100-port_listening_on_localhost
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# a script that listens on poer 98 on localhost

nc -l localhost 98
1 change: 1 addition & 0 deletions 0x08-networking_basics_2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x08. Networking basics #1

0 comments on commit 7ba5f68

Please sign in to comment.