Minor improvments on eachf and show_ip

This commit is contained in:
Lord Of Nougate 2022-05-07 13:08:52 +02:00
parent 26919d0d5a
commit 368956107b
2 changed files with 16 additions and 10 deletions

22
eachf
View File

@ -3,8 +3,8 @@ import sys, os
if sys.argv[1] in ["--help", "-h"]:
print("\nWelcome to the cli helper for foreach loops.")
print("\nUsage:\neachf [path] [filter] [command1] [command2]")
print("\nDescription:\nIn between the two command-arguments, the filename will be inserted.\n")
print("\nUsage:\neachf [path] [filter] [command1] [command2] [command3] [test]")
print("\nDescription:\nIn between the command-arguments, the filename will be inserted.\n")
exit()
files = os.listdir(sys.argv[1])
@ -17,11 +17,17 @@ for file in files:
filtered_files.append(file)
for f in filtered_files:
if len(sys.argv) == 4:
c = sys.argv[3] + " " + f
else:
c = sys.argv[3] + " " + f + " " + sys.argv[4]
c = sys.argv[3] + f
if len(sys.argv) >= 5:
c = c + sys.argv[4]
if len(sys.argv) >= 6:
c = c + f + sys.argv[5]
commands.append(c)
for command in commands:
os.system(command)
if sys.argv[-1] in ["test", "-t", "--test"]:
for command in commands:
print(command)
else:
for command in commands:
os.system(command)

View File

@ -1,2 +1,2 @@
ip_value=$(curl -s https://dnsleak.com/ | grep "You are connecting from an IPv4 address" -A 2 | grep "text" | awk '{ print $3}')
echo $ip_value | sed -e 's/value="//g' | sed -e 's/"//g'
ip_value=$(curl -s https://api.ipify.org/)
echo $ip_value