-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathip-grabber.sh
More file actions
executable file
·48 lines (38 loc) · 2.17 KB
/
ip-grabber.sh
File metadata and controls
executable file
·48 lines (38 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Description: this script finds your ip and saves it to a log file.
# check if the ifconfig command exists
if [[ -n $(ifconfig) ]]
then
# store the IPv4 address using ifconfig
IP=$(ifconfig | egrep "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | head -n 1 | cut -b 14-24);
else
# store the IPv4 command using ip
#IP=$(ip -c addr | grep -w 'inet' | grep -v '127' | grep -E '(([0-9]{1,3}\.){3}[0-9])' | sed 's/inet//' | sed 's/ //' | cut -d '/' -f 1);
IP=$(ip -c addr | grep -w 'inet' | grep -v '127' | grep -o -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v '255');
fi
# display message
echo -e "\nYour IPv4 address is: $IP\n";
# output IPv4 address to ip.log
echo "$IP" > ./ip.log;
#############
# my banner #
#############
##########################################################
# source: http://patorjk.com/software/taag/ #
##########################################################
echo -e "\nScripted by: ";
echo -e "\n";
echo -e "\033[31;5m";
echo " ██▓ ██████▄▄▄█████▓▄▄▄ ▄████▄ ██ ▄█▒███████▒";
echo "▓██▒██ ▒▓ ██▒ ▓▒████▄ ▒██▀ ▀█ ██▄█▒▒ ▒ ▒ ▄▀░";
echo "▒██░ ▓██▄ ▒ ▓██░ ▒▒██ ▀█▄ ▒▓█ ▄▓███▄░░ ▒ ▄▀▒░ ";
echo "░██░ ▒ ██░ ▓██▓ ░░██▄▄▄▄██▒▓▓▄ ▄██▓██ █▄ ▄▀▒ ░";
echo "░██▒██████▒▒ ▒██▒ ░ ▓█ ▓██▒ ▓███▀ ▒██▒ █▒███████▒";
echo "░▓ ▒ ▒▓▒ ▒ ░ ▒ ░░ ▒▒ ▓▒█░ ░▒ ▒ ▒ ▒▒ ▓░▒▒ ▓░▒░▒";
echo " ▒ ░ ░▒ ░ ░ ░ ▒ ▒▒ ░ ░ ▒ ░ ░▒ ▒░░▒ ▒ ░ ▒";
echo " ▒ ░ ░ ░ ░ ░ ▒ ░ ░ ░░ ░░ ░ ░ ░ ░";
echo " ░ ░ ░ ░ ░ ░ ░ ░ ░ ";
echo " ░ ░ ";
echo -e "\033[25m";
echo -e "\n";
###########################################################