R
R
Roman2019-10-23 09:15:04
bash
Roman, 2019-10-23 09:15:04

Is it possible to register in a bash script interactive input of a login-password for GitHub and a MySQL command call?

I need to automate
1. Dump a table from MySQL to a file (ex.

mysql> SELECT * FROM passwd INTO OUTFILE '/tmp/passwd.txt'
)
2. Make a commit of this file in Git
3. Make a git push to GitHub
Is it possible to do this with Bash? (I had very little to do with Bash, I only wrote small scripts for cron to make a queue of commands)
And GitHub also asks for a login / password - can it be entered interactively using Bash?
I know that it is possible to authorize on GitHub through SSH keys - but this is some kind of headache in general)))
Thank you.
upd .: I apparently wrote the question somehow wrong (judging by the answers) ... in general, the main question is here:
GitHub asks for a username/password - can it be entered interactively with Bash?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
fara_ib, 2019-10-23
@procode

Taken from www.tech-notes.net/use-expect-in-bash
the script takes a username and password as arguments, then connects with them to the server 192.168.1.10 and executes cat /etc/issue
#!/usr/bin there /expect
log_file expect_log
set login [lindex $argv 0]
set pw [lindex $argv 1]
spawn ssh [email protected]
expect "[email protected]\'s password:"
send "$pw\r"
expect "[email protected]"
send "cat /etc/issue\r" You
can execute it like this:
expect -f script.exp user password
The second option is to run everything directly in bash:
expect -c 'spawn ssh [email protected]; expect `Password:` {send - `password\r`};

F
FanatPHP, 2019-10-23
@FanatPHP

Everything is possible.
But if you are already going to break someone or at least pentest, then work hard yourself, and do not be a gasket between your task and the toaster.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question