PHC-TheGlock
Forum Master
OK, Lets Start... Iksian ko nalang baka i tl;dr nyo eh.
Get all URL from String/File using Grep:
foo.html
Code:
<a href="https://example.com/foo?bar=foo">...</a>
Bash:
cat foo.html | grep -o "https://[^'\"<>]*"
Code:
https://example.com/foo?bar=foo
Get all IP's from String/File using Grep:
ips.txt
Code:
lol 1.1.1.1
2.2.2.2 lol
i am ip 1.2.3.4
Bash:
cat ips.txt | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
Code:
1.1.1.1
2.2.2.2
1.2.3.4
Get domain from URL String using AWK:
Bash:
echo "https://example.com/foo?bar=foo" | awk -F[/:] '{print $4}'
Code:
example.com
Get the IP of your Machine/VPS:
Method 1: From IFCONFIG (Sometimes You Get your Private IP Here)
Bash:
ifconfig | grep inet | awk 'NR==1 {print $2}'
Bash:
dig @resolver4.opendns.com myip.opendns.com +short
Bash:
dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6'
Code:
xxx.xxx.xxx.xxx (which is your ip)