Adds httpie wrappers for ntlm auth
This commit is contained in:
parent
9f78ea20ce
commit
445c0a3d18
2 changed files with 60 additions and 0 deletions
30
bin/.bin/corp_http
Executable file
30
bin/.bin/corp_http
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
USERNAME="${CORPUSER}"
|
||||||
|
PASS="${CORPPASS}"
|
||||||
|
|
||||||
|
PASSCOMMAND="${CORPPASSCOMMAND}"
|
||||||
|
|
||||||
|
get_username(){
|
||||||
|
if [ -z "$USERNAME" ]; then
|
||||||
|
read -p "Corp Username: " USERNAME < /dev/tty
|
||||||
|
fi
|
||||||
|
echo $USERNAME
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
get_password(){
|
||||||
|
if [ -z "$PASS" ]; then
|
||||||
|
if [ -n "$CORPPASSCOMMAND" ]; then
|
||||||
|
PASS=$(eval $PASSCOMMAND)
|
||||||
|
else
|
||||||
|
read -p "Corp Password: " -s PASS < /dev/tty
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $PASS
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http --auth-type=ntlm --auth="$(get_username):$(get_password)" "$@"
|
30
bin/.bin/corp_https
Executable file
30
bin/.bin/corp_https
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
USERNAME="${CORPUSER}"
|
||||||
|
PASS="${CORPPASS}"
|
||||||
|
|
||||||
|
PASSCOMMAND="${CORPPASSCOMMAND}"
|
||||||
|
|
||||||
|
get_username(){
|
||||||
|
if [ -z "$USERNAME" ]; then
|
||||||
|
read -p "Corp Username: " USERNAME < /dev/tty
|
||||||
|
fi
|
||||||
|
echo $USERNAME
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
get_password(){
|
||||||
|
if [ -z "$PASS" ]; then
|
||||||
|
if [ -n "$CORPPASSCOMMAND" ]; then
|
||||||
|
PASS=$(eval $PASSCOMMAND)
|
||||||
|
else
|
||||||
|
read -p "Corp Password: " -s PASS < /dev/tty
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $PASS
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
https --auth-type=ntlm --auth="$(get_username):$(get_password)" "$@"
|
Loading…
Add table
Add a link
Reference in a new issue