add company 2FA in utool.py and remove old rokae files
This commit is contained in:
@ -24,7 +24,7 @@ def utool(option):
|
||||
# -a
|
||||
def list_local_using_port():
|
||||
exit_on_wrong_number()
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/ipports.sh port')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/ipports.sh port')
|
||||
|
||||
# -b
|
||||
def github_two_factor():
|
||||
@ -34,7 +34,7 @@ def utool(option):
|
||||
# -c
|
||||
def get_external_ip():
|
||||
exit_on_wrong_number()
|
||||
os.system("/usr/bin/python3 /opt/scripts/roll_api/get_self_ip.py")
|
||||
os.system("/usr/bin/python3 /opt/git/scripts/roll_api/get_self_ip.py")
|
||||
|
||||
# -d
|
||||
def get_ip_location():
|
||||
@ -44,7 +44,7 @@ def utool(option):
|
||||
ipv4 = re.match(r"^((([01]?\d\d?)|(2[0-4]\d)|(25[0-5]))\.){3}(([01]?\d\d?)|(2[0-4]\d)|(25[0-5]))$", checked_ip)
|
||||
if ipv4:
|
||||
os.environ['checked_ip'] = checked_ip
|
||||
os.system('/usr/bin/python3 /opt/scripts/roll_api/get_ip.py $checked_ip')
|
||||
os.system('/usr/bin/python3 /opt/git/scripts/roll_api/get_ip.py $checked_ip')
|
||||
else:
|
||||
print(f"{c_br}Plz enter correct IP...{c_e}")
|
||||
exit(ord(option.strip('-')))
|
||||
@ -69,12 +69,12 @@ def utool(option):
|
||||
def number2date():
|
||||
exit_on_wrong_number(2)
|
||||
os.environ['param'] = sys.argv[2]
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/number2d.sh $param')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/number2d.sh $param')
|
||||
|
||||
# -g
|
||||
def date2number():
|
||||
if len(sys.argv) < 3:
|
||||
print(f"{c_br}-k选项:将输入的时间转换成十进制和十六进制,需要一个字符串格式的时间作为输入,退出...{c_e}\n")
|
||||
print(f"{c_br}-g选项:将输入的时间转换成十进制和十六进制,需要一个字符串格式的时间作为输入,退出...{c_e}\n")
|
||||
exit(ord(option.strip('-')))
|
||||
|
||||
param=''
|
||||
@ -82,7 +82,7 @@ def utool(option):
|
||||
param += item + ' '
|
||||
|
||||
os.environ['param'] = param
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/date2n.sh $param')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/date2n.sh $param')
|
||||
|
||||
# -h
|
||||
def usage():
|
||||
@ -92,19 +92,32 @@ def utool(option):
|
||||
# -i
|
||||
def ps_top_20():
|
||||
exit_on_wrong_number()
|
||||
os.system("/usr/bin/bash /opt/scripts/utool/ps_top_20.sh")
|
||||
os.system("/usr/bin/bash /opt/git/scripts/utool/ps_top_20.sh")
|
||||
|
||||
# -j
|
||||
def docker_pid():
|
||||
exit_on_wrong_number(2)
|
||||
os.environ['param'] = sys.argv[2]
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/pid_in_docker.sh $param')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/pid_in_docker.sh $param')
|
||||
|
||||
# -k
|
||||
def company_two_factor():
|
||||
exit_on_wrong_number()
|
||||
# method 1
|
||||
# os.system("/usr/bin/echo -n 'ujjpsx7q'")
|
||||
# os.system("/usr/bin/oathtool -b --totp '22IH2VYKEQYOWVFCCHY5KTU4CYTJ7Z3O'")
|
||||
# method 2
|
||||
pin = 'ujjpsx7q'
|
||||
totp = os.popen("/usr/bin/oathtool -b --totp '22IH2VYKEQYOWVFCCHY5KTU4CYTJ7Z3O'").read()
|
||||
res = pin + totp
|
||||
print(res, end='')
|
||||
return res
|
||||
|
||||
# -p
|
||||
def gen_passwd():
|
||||
exit_on_wrong_number(2)
|
||||
os.environ['length'] = sys.argv[2]
|
||||
os.system('/usr/bin/bash /opt/scripts/utool/genpw.sh length')
|
||||
os.system('/usr/bin/bash /opt/git/scripts/utool/genpw.sh length')
|
||||
|
||||
def exit_on_wrong_number(number=1):
|
||||
if len(sys.argv) != (number+1):
|
||||
@ -134,7 +147,7 @@ def utool(option):
|
||||
'-v': ['Reserved', None],
|
||||
'-j': ['*find a docker subprocess, if true then print info', docker_pid],
|
||||
'-w': ['Reserved', None],
|
||||
'-k': ['Reserved', None],
|
||||
'-k': [' generate two-factor key of GITHUB', company_two_factor],
|
||||
'-x': ['Reserved', None],
|
||||
'-l': ['Reserved', None],
|
||||
'-y': ['Reserved', None],
|
||||
|
Reference in New Issue
Block a user