Posts

Showing posts from August 25, 2018

CURL request using .netrc file

Image
Clash Royale CLAN TAG #URR8PPP up vote 0 down vote favorite I am trying to write a script which is saving the credentials to a .netrc file and then it is reading from the file in order to pass them to a curl command and saves the returned cookie file for future use. I am interested if this is secure way to pass the username and password and if there is a man in the middle attack would they be able to sniff the credentials if the server which I am trying to reach is over HTTP. #!/bin/bash IP="192.168.0.1" user="Administrator" pass="Password1234" function credentials mkdir "$HOME"/.netrc rm "$HOME"/.netrc/credentials.txt touch "$HOME"/.netrc/credentials.txt echo "machine $IP"; echo "login $user"; echo "password $pass"; >> "$HOME"/.netrc/credentials.txt chmod 600 "$HOME"/.netrc/credentials.txt function cookie curl -v -c cookie.txt -n "$HOME"/.net

How to run sequentially two tasks on linux [closed]

Image
Clash Royale CLAN TAG #URR8PPP up vote 0 down vote favorite I'm using a keycloak server, when I run this command: standalone.sh This command launchs the server and I'm not able to stop it until I execute Ctrl-C command. I though about runing an instruction like this: standalone.sh && jboss-cli.sh -c --commands=shutdown or standalone.sh ; jboss-cli.sh -c --commands=shutdown Based on this question What are the shell's control and redirection operators? I found that ; Will run one command after another has finished, irrespective of the outcome of the first. And && Used to build AND lists, it allows you to run one command only if another exited successfully. But in my case the first task did not exit and still executing. Is there any solution to run another task which will stop the first? shell-script control-flow share | improve this question edited Mar 5 at 13:24 Kusalananda 103k 13 202 318 asked Mar 5 at 13:21 p